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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eslint/eslint | lib/rules/yoda.js | getFlippedString | function getFlippedString(node) {
const operatorToken = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
const textBeforeOperator = sourceCode.getText().slice(sourceCode.getTokenBefore(operatorToken).range[1], operatorToken.range[0]);
const textAfterOperator = sourceCode.getText().slice(operatorToken.range[1], sourceCode.getTokenAfter(operatorToken).range[0]);
const leftText = sourceCode.getText().slice(node.range[0], sourceCode.getTokenBefore(operatorToken).range[1]);
const rightText = sourceCode.getText().slice(sourceCode.getTokenAfter(operatorToken).range[0], node.range[1]);
return rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
} | javascript | function getFlippedString(node) {
const operatorToken = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
const textBeforeOperator = sourceCode.getText().slice(sourceCode.getTokenBefore(operatorToken).range[1], operatorToken.range[0]);
const textAfterOperator = sourceCode.getText().slice(operatorToken.range[1], sourceCode.getTokenAfter(operatorToken).range[0]);
const leftText = sourceCode.getText().slice(node.range[0], sourceCode.getTokenBefore(operatorToken).range[1]);
const rightText = sourceCode.getText().slice(sourceCode.getTokenAfter(operatorToken).range[0], node.range[1]);
return rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
} | [
"function",
"getFlippedString",
"(",
"node",
")",
"{",
"const",
"operatorToken",
"=",
"sourceCode",
".",
"getFirstTokenBetween",
"(",
"node",
".",
"left",
",",
"node",
".",
"right",
",",
"token",
"=>",
"token",
".",
"value",
"===",
"node",
".",
"operator",
... | Returns a string representation of a BinaryExpression node with its sides/operator flipped around.
@param {ASTNode} node The BinaryExpression node
@returns {string} A string representation of the node with the sides and operator flipped | [
"Returns",
"a",
"string",
"representation",
"of",
"a",
"BinaryExpression",
"node",
"with",
"its",
"sides",
"/",
"operator",
"flipped",
"around",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/yoda.js#L276-L284 | train | Get flipped string | [
30522,
3853,
2131,
10258,
11514,
5669,
3367,
4892,
1006,
13045,
1007,
1063,
9530,
3367,
6872,
18715,
2368,
1027,
3120,
16044,
1012,
2131,
8873,
12096,
18715,
2368,
20915,
28394,
2078,
1006,
13045,
1012,
2187,
1010,
13045,
1012,
2157,
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... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(fn, mOptions) {
// Functionality taken from lodash open source library and adapted as needed
mOptions = Object.assign({
wait: 0,
maxWait: null,
leading: false,
asyncLeading: false,
trailing: true,
requestAnimationFrame: false
}, mOptions);
var iLastInvocationTime = null;
var iTimerId = null;
var oCancelablePromise = null;
var bMaxWait = mOptions.maxWait != null;
mOptions.wait = Math.max(0, mOptions.wait);
mOptions.maxWait = bMaxWait ? Math.max(mOptions.maxWait, mOptions.wait) : mOptions.maxWait;
/**
* Calls the method. Only calls the method if an arguments object is provided.
*
* @param {any} [vContext] The context of the call.
* @param {Object} [vArguments] The arguments object.
* @param {boolean} [bAsync=false] Whether the method should be called in a promise.
* @param {boolean} [bFinal=false] Whether this is the final invocation before cancellation.
*/
function invoke(vContext, vArguments, bAsync, bFinal) {
iLastInvocationTime = bFinal === true ? null : Date.now();
if (vArguments == null) {
return;
}
if (bAsync === true) {
var oPromise = Promise.resolve().then(function() {
if (!oPromise.canceled) {
fn.apply(vContext, vArguments);
}
oCancelablePromise = null;
});
oPromise.cancel = function() {
oPromise.canceled = true;
};
oCancelablePromise = oPromise;
} else {
fn.apply(vContext, vArguments);
}
}
/**
* Calls the method debounced. Multiple calls within a certain time will be reduced to one call.
*
* @param {any} [vContext] The context of the call.
* @param {Object} [vArguments] The arguments object.
*/
function invokeDebounced(vContext, vArguments) {
cancelTimer();
/**
* Executes a trailing invocation if it is enabled in the options.
*
* @param {boolean} [bFinal=true] Whether this is the final invocation.
*/
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
if (mOptions.requestAnimationFrame) {
iTimerId = window.requestAnimationFrame(function() {
_invoke();
});
} else {
var iNow = Date.now();
var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
var iRemainingWaitTime = Math.max(0, bMaxWait ?
Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
mOptions.wait);
var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;
iTimerId = setTimeout(function() {
if (bMaxWaitInvocation) {
var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
if (iTimerOvertime > iCancelWaitTime) {
// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
_invoke();
} else {
// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
// the debounced method is called again during this time.
iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
_invoke(false);
}
} else {
_invoke();
}
}, iRemainingWaitTime);
}
}
function cancelTimer() {
if (mOptions.requestAnimationFrame) {
window.cancelAnimationFrame(iTimerId);
} else {
clearTimeout(iTimerId);
}
iTimerId = null;
}
function cancelPromise() {
if (oCancelablePromise) {
oCancelablePromise.cancel();
oCancelablePromise = null;
}
}
function cancel() {
cancelTimer();
cancelPromise();
iLastInvocationTime = null;
}
function pending() {
return iTimerId != null;
}
var debounced = function() {
if (!pending() && !mOptions.leading) {
invoke(); // Fake a leading invocation. Required for maxWait invocations.
}
if (pending() || !mOptions.leading) {
invokeDebounced(this, arguments);
} else if (mOptions.asyncLeading) {
invoke(this, arguments, true);
invokeDebounced();
} else { // mOptions.leading
invokeDebounced(); // Schedule delayed invocation before leading invocation. Function execution might take some time.
invoke(this, arguments);
}
};
debounced.cancel = cancel;
debounced.pending = pending;
return debounced;
} | javascript | function(fn, mOptions) {
// Functionality taken from lodash open source library and adapted as needed
mOptions = Object.assign({
wait: 0,
maxWait: null,
leading: false,
asyncLeading: false,
trailing: true,
requestAnimationFrame: false
}, mOptions);
var iLastInvocationTime = null;
var iTimerId = null;
var oCancelablePromise = null;
var bMaxWait = mOptions.maxWait != null;
mOptions.wait = Math.max(0, mOptions.wait);
mOptions.maxWait = bMaxWait ? Math.max(mOptions.maxWait, mOptions.wait) : mOptions.maxWait;
/**
* Calls the method. Only calls the method if an arguments object is provided.
*
* @param {any} [vContext] The context of the call.
* @param {Object} [vArguments] The arguments object.
* @param {boolean} [bAsync=false] Whether the method should be called in a promise.
* @param {boolean} [bFinal=false] Whether this is the final invocation before cancellation.
*/
function invoke(vContext, vArguments, bAsync, bFinal) {
iLastInvocationTime = bFinal === true ? null : Date.now();
if (vArguments == null) {
return;
}
if (bAsync === true) {
var oPromise = Promise.resolve().then(function() {
if (!oPromise.canceled) {
fn.apply(vContext, vArguments);
}
oCancelablePromise = null;
});
oPromise.cancel = function() {
oPromise.canceled = true;
};
oCancelablePromise = oPromise;
} else {
fn.apply(vContext, vArguments);
}
}
/**
* Calls the method debounced. Multiple calls within a certain time will be reduced to one call.
*
* @param {any} [vContext] The context of the call.
* @param {Object} [vArguments] The arguments object.
*/
function invokeDebounced(vContext, vArguments) {
cancelTimer();
/**
* Executes a trailing invocation if it is enabled in the options.
*
* @param {boolean} [bFinal=true] Whether this is the final invocation.
*/
function _invoke(bFinal) {
bFinal = bFinal !== false;
if (bFinal) {
cancel();
}
if (mOptions.trailing) {
invoke(vContext, vArguments, null, bFinal);
}
}
if (mOptions.requestAnimationFrame) {
iTimerId = window.requestAnimationFrame(function() {
_invoke();
});
} else {
var iNow = Date.now();
var iTimeSinceLastInvocation = iLastInvocationTime == null ? 0 : iNow - iLastInvocationTime;
var iRemainingWaitTime = Math.max(0, bMaxWait ?
Math.min(mOptions.maxWait - iTimeSinceLastInvocation, mOptions.wait) :
mOptions.wait);
var bMaxWaitInvocation = iRemainingWaitTime < mOptions.wait;
iTimerId = setTimeout(function() {
if (bMaxWaitInvocation) {
var iTimerOvertime = Math.max(0, (Date.now() - iNow) - iRemainingWaitTime);
var iCancelWaitTime = mOptions.wait - iRemainingWaitTime;
if (iTimerOvertime > iCancelWaitTime) {
// The timer took longer, maybe because of a long-running synchronous execution. No need to wait more.
_invoke();
} else {
// Because there is some time left, the timer is restarted for cleanup. This is necessary for correct scheduling if
// the debounced method is called again during this time.
iTimerId = setTimeout(cancel, iCancelWaitTime - iTimerOvertime);
_invoke(false);
}
} else {
_invoke();
}
}, iRemainingWaitTime);
}
}
function cancelTimer() {
if (mOptions.requestAnimationFrame) {
window.cancelAnimationFrame(iTimerId);
} else {
clearTimeout(iTimerId);
}
iTimerId = null;
}
function cancelPromise() {
if (oCancelablePromise) {
oCancelablePromise.cancel();
oCancelablePromise = null;
}
}
function cancel() {
cancelTimer();
cancelPromise();
iLastInvocationTime = null;
}
function pending() {
return iTimerId != null;
}
var debounced = function() {
if (!pending() && !mOptions.leading) {
invoke(); // Fake a leading invocation. Required for maxWait invocations.
}
if (pending() || !mOptions.leading) {
invokeDebounced(this, arguments);
} else if (mOptions.asyncLeading) {
invoke(this, arguments, true);
invokeDebounced();
} else { // mOptions.leading
invokeDebounced(); // Schedule delayed invocation before leading invocation. Function execution might take some time.
invoke(this, arguments);
}
};
debounced.cancel = cancel;
debounced.pending = pending;
return debounced;
} | [
"function",
"(",
"fn",
",",
"mOptions",
")",
"{",
"// Functionality taken from lodash open source library and adapted as needed",
"mOptions",
"=",
"Object",
".",
"assign",
"(",
"{",
"wait",
":",
"0",
",",
"maxWait",
":",
"null",
",",
"leading",
":",
"false",
",",
... | Invokes a method if a certain time has passed since the last call, regardless of how many times it was called.
@param {Function} fn The method to debounce.
@param {Object} [mOptions] The options that influence when the debounced method will be invoked.
@param {int} [mOptions.wait=0] The amount of milliseconds since the last call to wait before actually invoking the method. Has no
effect, if <code>mOptions.requestAnimationFrame</code> is set to <code>true</code>.
@param {int | null} [mOptions.maxWait=null] The maximum amount of milliseconds to wait for an invocation. Has no effect, if
<code>mOptions.requestAnimationFrame</code> is set to <code>true</code>.
@param {boolean} [mOptions.leading=false] Whether the method should be invoked on the first call.
@param {boolean} [mOptions.asyncLeading=false] Whether the leading invocation should be asynchronous.
@param {boolean} [mOptions.trailing=true] Whether the method should be invoked after a certain time has passed. If
<code>mOptions.leading</code> is set to <code>true</code>, the method needs to be called more
than once for an invocation at the end of the waiting time.
@param {boolean} [mOptions.requestAnimationFrame=false] Whether <code>requestAnimationFrame</code> should be used to debounce the
method. If set to <code>true</code>, <code>mOptions.wait</code> and
<code>mOptions.maxWait</code> have no effect.
@returns {Function} Returns the debounced method. | [
"Invokes",
"a",
"method",
"if",
"a",
"certain",
"time",
"has",
"passed",
"since",
"the",
"last",
"call",
"regardless",
"of",
"how",
"many",
"times",
"it",
"was",
"called",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1271-L1422 | train | A function that calls the method with the given arguments. | [
30522,
3853,
1006,
1042,
2078,
1010,
9587,
16790,
2015,
1007,
1063,
1013,
1013,
15380,
2579,
2013,
8840,
8883,
2232,
2330,
3120,
3075,
1998,
5967,
2004,
2734,
9587,
16790,
2015,
1027,
4874,
1012,
23911,
1006,
1063,
3524,
1024,
1014,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/func-name-matching.js | isPropertyCall | function isPropertyCall(objName, funcName, node) {
if (!node) {
return false;
}
return node.type === "CallExpression" &&
node.callee.object.name === objName &&
node.callee.property.name === funcName;
} | javascript | function isPropertyCall(objName, funcName, node) {
if (!node) {
return false;
}
return node.type === "CallExpression" &&
node.callee.object.name === objName &&
node.callee.property.name === funcName;
} | [
"function",
"isPropertyCall",
"(",
"objName",
",",
"funcName",
",",
"node",
")",
"{",
"if",
"(",
"!",
"node",
")",
"{",
"return",
"false",
";",
"}",
"return",
"node",
".",
"type",
"===",
"\"CallExpression\"",
"&&",
"node",
".",
"callee",
".",
"object",
... | Check whether node is a certain CallExpression.
@param {string} objName object name
@param {string} funcName function name
@param {ASTNode} node The node to check
@returns {boolean} `true` if node matches CallExpression | [
"Check",
"whether",
"node",
"is",
"a",
"certain",
"CallExpression",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/func-name-matching.js#L116-L123 | train | returns true if node is a CallExpression | [
30522,
3853,
2003,
21572,
4842,
3723,
9289,
2140,
1006,
27885,
22895,
14074,
1010,
4569,
2278,
18442,
1010,
13045,
1007,
1063,
2065,
1006,
999,
13045,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
2655... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/components/range/lib/mouse.js | up | function up (e) {
obj.onmouseup && obj.onmouseup(e)
event.unbind(document, 'mousemove', move)
event.unbind(document, 'mouseup', up)
self.emit('up', e)
} | javascript | function up (e) {
obj.onmouseup && obj.onmouseup(e)
event.unbind(document, 'mousemove', move)
event.unbind(document, 'mouseup', up)
self.emit('up', e)
} | [
"function",
"up",
"(",
"e",
")",
"{",
"obj",
".",
"onmouseup",
"&&",
"obj",
".",
"onmouseup",
"(",
"e",
")",
"event",
".",
"unbind",
"(",
"document",
",",
"'mousemove'",
",",
"move",
")",
"event",
".",
"unbind",
"(",
"document",
",",
"'mouseup'",
","... | up | [
"up"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/range/lib/mouse.js#L46-L51 | train | mouseup event handler | [
30522,
3853,
2039,
1006,
1041,
1007,
1063,
27885,
3501,
1012,
2006,
27711,
13765,
2361,
1004,
1004,
27885,
3501,
1012,
2006,
27711,
13765,
2361,
1006,
1041,
1007,
2724,
1012,
4895,
8428,
2094,
1006,
6254,
1010,
1005,
8000,
5302,
3726,
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... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | Observer | function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
} | javascript | function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
} | [
"function",
"Observer",
"(",
"value",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"dep",
"=",
"new",
"Dep",
"(",
")",
";",
"this",
".",
"vmCount",
"=",
"0",
";",
"def",
"(",
"value",
",",
"'__ob__'",
",",
"this",
")",
";",
"... | Observer class that are attached to each observed
object. Once attached, the observer converts target
object's property keys into getter/setters that
collect dependencies and dispatches updates. | [
"Observer",
"class",
"that",
"are",
"attached",
"to",
"each",
"observed",
"object",
".",
"Once",
"attached",
"the",
"observer",
"converts",
"target",
"object",
"s",
"property",
"keys",
"into",
"getter",
"/",
"setters",
"that",
"collect",
"dependencies",
"and",
... | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L953-L967 | train | observe value | [
30522,
3853,
9718,
1006,
3643,
1007,
1063,
2023,
1012,
3643,
1027,
3643,
1025,
2023,
1012,
2139,
2361,
1027,
2047,
2139,
2361,
1006,
1007,
1025,
2023,
1012,
1058,
12458,
21723,
1027,
1014,
1025,
13366,
1006,
3643,
1010,
1005,
1035,
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... |
openlayers/openlayers | examples/raster.js | summarize | function summarize(value, counts) {
const min = counts.min;
const max = counts.max;
const num = counts.values.length;
if (value < min) {
// do nothing
} else if (value >= max) {
counts.values[num - 1] += 1;
} else {
const index = Math.floor((value - min) / counts.delta);
counts.values[index] += 1;
}
} | javascript | function summarize(value, counts) {
const min = counts.min;
const max = counts.max;
const num = counts.values.length;
if (value < min) {
// do nothing
} else if (value >= max) {
counts.values[num - 1] += 1;
} else {
const index = Math.floor((value - min) / counts.delta);
counts.values[index] += 1;
}
} | [
"function",
"summarize",
"(",
"value",
",",
"counts",
")",
"{",
"const",
"min",
"=",
"counts",
".",
"min",
";",
"const",
"max",
"=",
"counts",
".",
"max",
";",
"const",
"num",
"=",
"counts",
".",
"values",
".",
"length",
";",
"if",
"(",
"value",
"<... | Summarize values for a histogram.
@param {numver} value A VGI value.
@param {Object} counts An object for keeping track of VGI counts. | [
"Summarize",
"values",
"for",
"a",
"histogram",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/raster.js#L31-L43 | train | summarize the value | [
30522,
3853,
7680,
7849,
4697,
1006,
3643,
1010,
9294,
1007,
1063,
9530,
3367,
8117,
1027,
9294,
1012,
8117,
1025,
9530,
3367,
4098,
1027,
9294,
1012,
4098,
1025,
9530,
3367,
16371,
2213,
1027,
9294,
1012,
5300,
1012,
3091,
1025,
2065,
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... |
PrismJS/prism | scripts/utopia.js | function() {
var options;
if(_.type(arguments[0]) === 'string') {
if(_.type(arguments[1]) === 'object') {
// Utopia.element.create('div', { ... });
options = arguments[1];
options.tag = arguments[0];
}
else {
// Utopia.element.create('div', ...);
options = {
tag: arguments[0]
};
// Utopia.element.create('div', [contents]);
if(_.type(arguments[1]) === 'array') {
options.contents = arguments[1];
}
// Utopia.element.create('div', 'Text contents');
else if(_.type(arguments[1]) === 'string' || _.type(arguments[1]) === 'number') {
options.contents = ['' + arguments[1]];
}
}
}
else {
options = arguments[0];
}
var namespace = options.namespace || '', element;
if(namespace) {
element = document.createElementNS(namespace, options.tag);
}
else {
element = document.createElement(options.tag);
}
if (options.className || options.id) {
options.properties = options.properties || {};
options.properties.className = options.className;
options.properties.id = options.id;
}
// Set properties, attributes and contents
_.element.set(element, options);
// Place the element in the DOM (inside, before or after an existing element)
// This could be a selector
if(options.before) {
var before = $(options.before);
if (before && before.parentNode) {
before.parentNode.insertBefore(element, before);
}
}
if (options.after && element.parentNode === null) {
var after = $(options.after);
if (after && after.parentNode) {
after.parentNode.insertBefore(element, after.nextSibling)
}
}
if (options.inside && element.parentNode === null) {
$(options.inside).appendChild(element);
}
return element;
} | javascript | function() {
var options;
if(_.type(arguments[0]) === 'string') {
if(_.type(arguments[1]) === 'object') {
// Utopia.element.create('div', { ... });
options = arguments[1];
options.tag = arguments[0];
}
else {
// Utopia.element.create('div', ...);
options = {
tag: arguments[0]
};
// Utopia.element.create('div', [contents]);
if(_.type(arguments[1]) === 'array') {
options.contents = arguments[1];
}
// Utopia.element.create('div', 'Text contents');
else if(_.type(arguments[1]) === 'string' || _.type(arguments[1]) === 'number') {
options.contents = ['' + arguments[1]];
}
}
}
else {
options = arguments[0];
}
var namespace = options.namespace || '', element;
if(namespace) {
element = document.createElementNS(namespace, options.tag);
}
else {
element = document.createElement(options.tag);
}
if (options.className || options.id) {
options.properties = options.properties || {};
options.properties.className = options.className;
options.properties.id = options.id;
}
// Set properties, attributes and contents
_.element.set(element, options);
// Place the element in the DOM (inside, before or after an existing element)
// This could be a selector
if(options.before) {
var before = $(options.before);
if (before && before.parentNode) {
before.parentNode.insertBefore(element, before);
}
}
if (options.after && element.parentNode === null) {
var after = $(options.after);
if (after && after.parentNode) {
after.parentNode.insertBefore(element, after.nextSibling)
}
}
if (options.inside && element.parentNode === null) {
$(options.inside).appendChild(element);
}
return element;
} | [
"function",
"(",
")",
"{",
"var",
"options",
";",
"if",
"(",
"_",
".",
"type",
"(",
"arguments",
"[",
"0",
"]",
")",
"===",
"'string'",
")",
"{",
"if",
"(",
"_",
".",
"type",
"(",
"arguments",
"[",
"1",
"]",
")",
"===",
"'object'",
")",
"{",
... | Creates a new DOM element
@param options {Object} A set of key/value pairs for attributes, properties, contents, placement in the DOM etc
@return The new DOM element | [
"Creates",
"a",
"new",
"DOM",
"element"
] | acceb3b56f0e8362a7ef274dbd85b17611df2ec4 | https://github.com/PrismJS/prism/blob/acceb3b56f0e8362a7ef274dbd85b17611df2ec4/scripts/utopia.js#L150-L220 | train | Create an element | [
30522,
3853,
1006,
1007,
1063,
13075,
7047,
1025,
2065,
1006,
1035,
1012,
2828,
1006,
9918,
1031,
1014,
1033,
1007,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2065,
1006,
1035,
1012,
2828,
1006,
9918,
1031,
1015,
1033,
1007,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/func-names.js | getConfigForNode | function getConfigForNode(node) {
if (
node.generator &&
context.options.length > 1 &&
context.options[1].generators
) {
return context.options[1].generators;
}
return context.options[0] || "always";
} | javascript | function getConfigForNode(node) {
if (
node.generator &&
context.options.length > 1 &&
context.options[1].generators
) {
return context.options[1].generators;
}
return context.options[0] || "always";
} | [
"function",
"getConfigForNode",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"generator",
"&&",
"context",
".",
"options",
".",
"length",
">",
"1",
"&&",
"context",
".",
"options",
"[",
"1",
"]",
".",
"generators",
")",
"{",
"return",
"context",
".",... | Returns the config option for the given node.
@param {ASTNode} node - A node to get the config for.
@returns {string} The config option. | [
"Returns",
"the",
"config",
"option",
"for",
"the",
"given",
"node",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/func-names.js#L77-L87 | train | Get config for node | [
30522,
3853,
2131,
8663,
8873,
25708,
26295,
3207,
1006,
13045,
1007,
1063,
2065,
1006,
13045,
1012,
13103,
1004,
1004,
6123,
1012,
7047,
1012,
3091,
1028,
1015,
1004,
1004,
6123,
1012,
7047,
1031,
1015,
1033,
1012,
16937,
1007,
1063,
2709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/no-else-return.js | displayReport | function displayReport(node) {
context.report({
node,
messageId: "unexpected",
fix: fixer => {
const sourceCode = context.getSourceCode();
const startToken = sourceCode.getFirstToken(node);
const elseToken = sourceCode.getTokenBefore(startToken);
const source = sourceCode.getText(node);
const lastIfToken = sourceCode.getTokenBefore(elseToken);
let fixedSource, firstTokenOfElseBlock;
if (startToken.type === "Punctuator" && startToken.value === "{") {
firstTokenOfElseBlock = sourceCode.getTokenAfter(startToken);
} else {
firstTokenOfElseBlock = startToken;
}
/*
* If the if block does not have curly braces and does not end in a semicolon
* and the else block starts with (, [, /, +, ` or -, then it is not
* safe to remove the else keyword, because ASI will not add a semicolon
* after the if block
*/
const ifBlockMaybeUnsafe = node.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";";
const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value);
if (ifBlockMaybeUnsafe && elseBlockUnsafe) {
return null;
}
const endToken = sourceCode.getLastToken(node);
const lastTokenOfElseBlock = sourceCode.getTokenBefore(endToken);
if (lastTokenOfElseBlock.value !== ";") {
const nextToken = sourceCode.getTokenAfter(endToken);
const nextTokenUnsafe = nextToken && /^[([/+`-]/u.test(nextToken.value);
const nextTokenOnSameLine = nextToken && nextToken.loc.start.line === lastTokenOfElseBlock.loc.start.line;
/*
* If the else block contents does not end in a semicolon,
* and the else block starts with (, [, /, +, ` or -, then it is not
* safe to remove the else block, because ASI will not add a semicolon
* after the remaining else block contents
*/
if (nextTokenUnsafe || (nextTokenOnSameLine && nextToken.value !== "}")) {
return null;
}
}
if (startToken.type === "Punctuator" && startToken.value === "{") {
fixedSource = source.slice(1, -1);
} else {
fixedSource = source;
}
/*
* Extend the replacement range to include the entire
* function to avoid conflicting with no-useless-return.
* https://github.com/eslint/eslint/issues/8026
*/
return new FixTracker(fixer, sourceCode)
.retainEnclosingFunction(node)
.replaceTextRange([elseToken.range[0], node.range[1]], fixedSource);
}
});
} | javascript | function displayReport(node) {
context.report({
node,
messageId: "unexpected",
fix: fixer => {
const sourceCode = context.getSourceCode();
const startToken = sourceCode.getFirstToken(node);
const elseToken = sourceCode.getTokenBefore(startToken);
const source = sourceCode.getText(node);
const lastIfToken = sourceCode.getTokenBefore(elseToken);
let fixedSource, firstTokenOfElseBlock;
if (startToken.type === "Punctuator" && startToken.value === "{") {
firstTokenOfElseBlock = sourceCode.getTokenAfter(startToken);
} else {
firstTokenOfElseBlock = startToken;
}
/*
* If the if block does not have curly braces and does not end in a semicolon
* and the else block starts with (, [, /, +, ` or -, then it is not
* safe to remove the else keyword, because ASI will not add a semicolon
* after the if block
*/
const ifBlockMaybeUnsafe = node.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";";
const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value);
if (ifBlockMaybeUnsafe && elseBlockUnsafe) {
return null;
}
const endToken = sourceCode.getLastToken(node);
const lastTokenOfElseBlock = sourceCode.getTokenBefore(endToken);
if (lastTokenOfElseBlock.value !== ";") {
const nextToken = sourceCode.getTokenAfter(endToken);
const nextTokenUnsafe = nextToken && /^[([/+`-]/u.test(nextToken.value);
const nextTokenOnSameLine = nextToken && nextToken.loc.start.line === lastTokenOfElseBlock.loc.start.line;
/*
* If the else block contents does not end in a semicolon,
* and the else block starts with (, [, /, +, ` or -, then it is not
* safe to remove the else block, because ASI will not add a semicolon
* after the remaining else block contents
*/
if (nextTokenUnsafe || (nextTokenOnSameLine && nextToken.value !== "}")) {
return null;
}
}
if (startToken.type === "Punctuator" && startToken.value === "{") {
fixedSource = source.slice(1, -1);
} else {
fixedSource = source;
}
/*
* Extend the replacement range to include the entire
* function to avoid conflicting with no-useless-return.
* https://github.com/eslint/eslint/issues/8026
*/
return new FixTracker(fixer, sourceCode)
.retainEnclosingFunction(node)
.replaceTextRange([elseToken.range[0], node.range[1]], fixedSource);
}
});
} | [
"function",
"displayReport",
"(",
"node",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
",",
"messageId",
":",
"\"unexpected\"",
",",
"fix",
":",
"fixer",
"=>",
"{",
"const",
"sourceCode",
"=",
"context",
".",
"getSourceCode",
"(",
")",
";",
"con... | -------------------------------------------------------------------------- Helpers --------------------------------------------------------------------------
Display the context report if rule is violated
@param {Node} node The 'else' node
@returns {void} | [
"--------------------------------------------------------------------------",
"Helpers",
"--------------------------------------------------------------------------",
"Display",
"the",
"context",
"report",
"if",
"rule",
"is",
"violated"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-else-return.js#L60-L127 | train | Reports a given node if it has an else block. | [
30522,
3853,
4653,
2890,
6442,
1006,
13045,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1010,
4471,
3593,
1024,
1000,
9223,
1000,
1010,
8081,
1024,
8081,
2121,
1027,
1028,
1063,
9530,
3367,
3120,
16044,
1027,
6123,
1012,
4152,
8162,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/templating/render.js | renderTemplate | function renderTemplate(engine, filePath, content, context) {
context = context || {};
// Mutable objects to contains all blocks requiring post-processing
var blocks = {};
// Create nunjucks environment
var env = engine.toNunjucks(blocks);
// Replace shortcuts from plugin's blocks
content = replaceShortcuts(engine.getBlocks(), filePath, content);
return timing.measure(
'template.render',
Promise.nfcall(
env.renderString.bind(env),
content,
context,
{
path: filePath
}
)
.then(function(content) {
return TemplateOutput.create(content, blocks);
})
);
} | javascript | function renderTemplate(engine, filePath, content, context) {
context = context || {};
// Mutable objects to contains all blocks requiring post-processing
var blocks = {};
// Create nunjucks environment
var env = engine.toNunjucks(blocks);
// Replace shortcuts from plugin's blocks
content = replaceShortcuts(engine.getBlocks(), filePath, content);
return timing.measure(
'template.render',
Promise.nfcall(
env.renderString.bind(env),
content,
context,
{
path: filePath
}
)
.then(function(content) {
return TemplateOutput.create(content, blocks);
})
);
} | [
"function",
"renderTemplate",
"(",
"engine",
",",
"filePath",
",",
"content",
",",
"context",
")",
"{",
"context",
"=",
"context",
"||",
"{",
"}",
";",
"// Mutable objects to contains all blocks requiring post-processing",
"var",
"blocks",
"=",
"{",
"}",
";",
"// ... | Render a template
@param {TemplateEngine} engine
@param {String} filePath: absolute path for the loader
@param {String} content
@param {Object} context (optional)
@return {Promise<TemplateOutput>} | [
"Render",
"a",
"template"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/templating/render.js#L15-L42 | train | Render a template | [
30522,
3853,
17552,
18532,
15725,
1006,
3194,
1010,
5371,
15069,
1010,
4180,
1010,
6123,
1007,
1063,
6123,
1027,
6123,
1064,
1064,
1063,
1065,
1025,
1013,
1013,
14163,
10880,
5200,
2000,
3397,
2035,
5991,
9034,
2695,
1011,
6364,
13075,
5991... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/LiveDevelopment.js | _waitForInterstitialPageLoad | function _waitForInterstitialPageLoad() {
var deferred = $.Deferred(),
keepPolling = true,
timer = window.setTimeout(function () {
keepPolling = false;
deferred.reject();
}, 10000); // 10 seconds
/*
* Asynchronously check to see if the interstitial page has
* finished loading; if not, check again until timing out.
*/
function pollInterstitialPage() {
if (keepPolling && Inspector.connected()) {
Inspector.Runtime.evaluate("window.isBracketsLiveDevelopmentInterstitialPageLoaded", function (response) {
var result = response.result;
if (result.type === "boolean" && result.value) {
window.clearTimeout(timer);
deferred.resolve();
} else {
window.setTimeout(pollInterstitialPage, 100);
}
});
} else {
deferred.reject();
}
}
pollInterstitialPage();
return deferred.promise();
} | javascript | function _waitForInterstitialPageLoad() {
var deferred = $.Deferred(),
keepPolling = true,
timer = window.setTimeout(function () {
keepPolling = false;
deferred.reject();
}, 10000); // 10 seconds
/*
* Asynchronously check to see if the interstitial page has
* finished loading; if not, check again until timing out.
*/
function pollInterstitialPage() {
if (keepPolling && Inspector.connected()) {
Inspector.Runtime.evaluate("window.isBracketsLiveDevelopmentInterstitialPageLoaded", function (response) {
var result = response.result;
if (result.type === "boolean" && result.value) {
window.clearTimeout(timer);
deferred.resolve();
} else {
window.setTimeout(pollInterstitialPage, 100);
}
});
} else {
deferred.reject();
}
}
pollInterstitialPage();
return deferred.promise();
} | [
"function",
"_waitForInterstitialPageLoad",
"(",
")",
"{",
"var",
"deferred",
"=",
"$",
".",
"Deferred",
"(",
")",
",",
"keepPolling",
"=",
"true",
",",
"timer",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"keepPolling",
"=",
"false",... | @private
Create a promise that resolves when the interstitial page has
finished loading.
@return {jQuery.Promise} Resolves once page is loaded | [
"@private",
"Create",
"a",
"promise",
"that",
"resolves",
"when",
"the",
"interstitial",
"page",
"has",
"finished",
"loading",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevelopment.js#L1019-L1050 | train | Wait until the interstitial page has finished loading | [
30522,
3853,
1035,
3524,
29278,
18447,
2545,
3775,
20925,
13704,
11066,
1006,
1007,
1063,
13075,
13366,
28849,
2094,
1027,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
2562,
18155,
2989,
1027,
2995,
1010,
25309,
1027,
3332,
1012,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(oColumn) {
var oTable = oColumn.getParent();
if (!oTable || !oTable.getEnableColumnReordering()) {
// Column reordering is not active at all
return false;
}
var iCurrentIndex = oTable.indexOfColumn(oColumn);
if (iCurrentIndex < oTable.getComputedFixedColumnCount() || iCurrentIndex < oTable._iFirstReorderableIndex) {
// No movement of fixed columns or e.g. the first column in the TreeTable
return false;
}
if (TableColumnUtils.hasHeaderSpan(oColumn)
|| TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()).length != 0) {
// No movement if the column is spanned by an other column or itself defines a span
return false;
}
return true;
} | javascript | function(oColumn) {
var oTable = oColumn.getParent();
if (!oTable || !oTable.getEnableColumnReordering()) {
// Column reordering is not active at all
return false;
}
var iCurrentIndex = oTable.indexOfColumn(oColumn);
if (iCurrentIndex < oTable.getComputedFixedColumnCount() || iCurrentIndex < oTable._iFirstReorderableIndex) {
// No movement of fixed columns or e.g. the first column in the TreeTable
return false;
}
if (TableColumnUtils.hasHeaderSpan(oColumn)
|| TableColumnUtils.getParentSpannedColumns(oTable, oColumn.getId()).length != 0) {
// No movement if the column is spanned by an other column or itself defines a span
return false;
}
return true;
} | [
"function",
"(",
"oColumn",
")",
"{",
"var",
"oTable",
"=",
"oColumn",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"oTable",
"||",
"!",
"oTable",
".",
"getEnableColumnReordering",
"(",
")",
")",
"{",
"// Column reordering is not active at all",
"return",
... | Returns true if the column can be moved to another position.
@param {sap.ui.table.Column} oColumn Column of the table.
@returns {boolean} Whether the column can be moved to another position. | [
"Returns",
"true",
"if",
"the",
"column",
"can",
"be",
"moved",
"to",
"another",
"position",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableColumnUtils.js#L386-L406 | train | Returns true if the column can be moved to the right position | [
30522,
3853,
1006,
1051,
25778,
2819,
2078,
1007,
1063,
13075,
27178,
3085,
1027,
1051,
25778,
2819,
2078,
1012,
2131,
19362,
4765,
1006,
1007,
1025,
2065,
1006,
999,
27178,
3085,
1064,
1064,
999,
27178,
3085,
1012,
2131,
8189,
3468,
25778,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/extensions/table/mergedTableCreator.js | _findIndex | function _findIndex(arr, onFind) {
let foundIndex = -1;
util.forEach(arr, (item, index) => {
let nextFind = true;
if (onFind(item, index)) {
foundIndex = index;
nextFind = false;
}
return nextFind;
});
return foundIndex;
} | javascript | function _findIndex(arr, onFind) {
let foundIndex = -1;
util.forEach(arr, (item, index) => {
let nextFind = true;
if (onFind(item, index)) {
foundIndex = index;
nextFind = false;
}
return nextFind;
});
return foundIndex;
} | [
"function",
"_findIndex",
"(",
"arr",
",",
"onFind",
")",
"{",
"let",
"foundIndex",
"=",
"-",
"1",
";",
"util",
".",
"forEach",
"(",
"arr",
",",
"(",
"item",
",",
"index",
")",
"=>",
"{",
"let",
"nextFind",
"=",
"true",
";",
"if",
"(",
"onFind",
... | Find index by onFind function.
@param {Array} arr - target array
@param {function} onFind - find function
@returns {number}
@private | [
"Find",
"index",
"by",
"onFind",
"function",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableCreator.js#L80-L94 | train | Find index of an item in an array | [
30522,
3853,
1035,
2424,
22254,
10288,
1006,
12098,
2099,
1010,
2006,
16294,
2094,
1007,
1063,
2292,
2179,
22254,
10288,
1027,
1011,
1015,
1025,
21183,
30524,
1027,
6270,
1025,
1065,
2709,
2279,
16294,
2094,
1025,
1065,
1007,
1025,
2709,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | gulp/util.js | themeBuildStream | function themeBuildStream() {
// Make a copy so that we don't modify the actual config that is used by other functions
var paths = config.themeBaseFiles.slice(0);
config.componentPaths.forEach(component => paths.push(path.join(component, '*-theme.scss')));
paths.push(config.themeCore);
return gulp.src(paths)
.pipe(concat('default-theme.scss'))
.pipe(utils.hoistScssVariables())
.pipe(sass())
.pipe(dedupeCss())
// The PostCSS orderedValues plugin modifies the theme color expressions.
.pipe(minifyCss({orderedValues: false}))
.pipe(utils.cssToNgConstant('material.core', '$MD_THEME_CSS'));
} | javascript | function themeBuildStream() {
// Make a copy so that we don't modify the actual config that is used by other functions
var paths = config.themeBaseFiles.slice(0);
config.componentPaths.forEach(component => paths.push(path.join(component, '*-theme.scss')));
paths.push(config.themeCore);
return gulp.src(paths)
.pipe(concat('default-theme.scss'))
.pipe(utils.hoistScssVariables())
.pipe(sass())
.pipe(dedupeCss())
// The PostCSS orderedValues plugin modifies the theme color expressions.
.pipe(minifyCss({orderedValues: false}))
.pipe(utils.cssToNgConstant('material.core', '$MD_THEME_CSS'));
} | [
"function",
"themeBuildStream",
"(",
")",
"{",
"// Make a copy so that we don't modify the actual config that is used by other functions",
"var",
"paths",
"=",
"config",
".",
"themeBaseFiles",
".",
"slice",
"(",
"0",
")",
";",
"config",
".",
"componentPaths",
".",
"forEac... | builds the theming related css and provides it as a JS const for angular | [
"builds",
"the",
"theming",
"related",
"css",
"and",
"provides",
"it",
"as",
"a",
"JS",
"const",
"for",
"angular"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L235-L249 | train | Build the theme files | [
30522,
3853,
4323,
8569,
4014,
5104,
25379,
1006,
1007,
1063,
1013,
1013,
2191,
1037,
6100,
2061,
2008,
2057,
2123,
1005,
1056,
19933,
1996,
5025,
9530,
8873,
2290,
2008,
2003,
2109,
2011,
2060,
4972,
13075,
10425,
1027,
9530,
8873,
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... |
aframevr/aframe | src/utils/device.js | isTablet | function isTablet (mockUserAgent) {
var userAgent = mockUserAgent || window.navigator.userAgent;
return /ipad|Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(userAgent);
} | javascript | function isTablet (mockUserAgent) {
var userAgent = mockUserAgent || window.navigator.userAgent;
return /ipad|Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(userAgent);
} | [
"function",
"isTablet",
"(",
"mockUserAgent",
")",
"{",
"var",
"userAgent",
"=",
"mockUserAgent",
"||",
"window",
".",
"navigator",
".",
"userAgent",
";",
"return",
"/",
"ipad|Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle",
"/",
"i",
".",
"test",
"(",
"userAgent"... | Detect tablet devices.
@param {string} mockUserAgent - Allow passing a mock user agent for testing. | [
"Detect",
"tablet",
"devices",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/device.js#L76-L79 | train | Check if the user agent is tablet | [
30522,
3853,
21541,
3085,
2102,
1006,
12934,
20330,
4270,
3372,
1007,
1063,
13075,
5310,
4270,
3372,
1027,
12934,
20330,
4270,
3372,
1064,
1064,
3332,
1012,
20532,
1012,
5310,
4270,
3372,
1025,
2709,
1013,
25249,
1064,
26041,
1006,
1021,
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... |
laurent22/joplin | ReactNativeClient/lib/import-enex-md-gen.js | function(lines) {
while (lines.length) {
if (!lines[0].trim()) {
lines.splice(0, 1);
} else {
break;
}
}
while (lines.length) {
if (!lines[lines.length - 1].trim()) {
lines.pop();
} else {
break;
}
}
return lines;
} | javascript | function(lines) {
while (lines.length) {
if (!lines[0].trim()) {
lines.splice(0, 1);
} else {
break;
}
}
while (lines.length) {
if (!lines[lines.length - 1].trim()) {
lines.pop();
} else {
break;
}
}
return lines;
} | [
"function",
"(",
"lines",
")",
"{",
"while",
"(",
"lines",
".",
"length",
")",
"{",
"if",
"(",
"!",
"lines",
"[",
"0",
"]",
".",
"trim",
"(",
")",
")",
"{",
"lines",
".",
"splice",
"(",
"0",
",",
"1",
")",
";",
"}",
"else",
"{",
"break",
";... | After importing HTML, the resulting Markdown often has empty lines at the beginning and end due to block start/end or elements that were ignored, etc. If these white spaces were intended it's not really possible to detect it, so simply trim them all so that the result is more deterministic and can be easily unit tested. | [
"After",
"importing",
"HTML",
"the",
"resulting",
"Markdown",
"often",
"has",
"empty",
"lines",
"at",
"the",
"beginning",
"and",
"end",
"due",
"to",
"block",
"start",
"/",
"end",
"or",
"elements",
"that",
"were",
"ignored",
"etc",
".",
"If",
"these",
"whit... | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/ReactNativeClient/lib/import-enex-md-gen.js#L979-L997 | train | Remove empty lines | [
30522,
3853,
1006,
3210,
1007,
1063,
2096,
1006,
3210,
1012,
3091,
1007,
1063,
2065,
1006,
999,
3210,
1031,
1014,
1033,
1012,
12241,
1006,
1007,
1007,
1063,
3210,
1012,
11867,
13231,
1006,
1014,
1010,
1015,
1007,
1025,
1065,
2842,
1063,
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... | |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(pref, down, move, up, cancel) {
_dragStartEvent = pref + down;
_dragMoveEvent = pref + move;
_dragEndEvent = pref + up;
if(cancel) {
_dragCancelEvent = pref + cancel;
} else {
_dragCancelEvent = '';
}
} | javascript | function(pref, down, move, up, cancel) {
_dragStartEvent = pref + down;
_dragMoveEvent = pref + move;
_dragEndEvent = pref + up;
if(cancel) {
_dragCancelEvent = pref + cancel;
} else {
_dragCancelEvent = '';
}
} | [
"function",
"(",
"pref",
",",
"down",
",",
"move",
",",
"up",
",",
"cancel",
")",
"{",
"_dragStartEvent",
"=",
"pref",
"+",
"down",
";",
"_dragMoveEvent",
"=",
"pref",
"+",
"move",
";",
"_dragEndEvent",
"=",
"pref",
"+",
"up",
";",
"if",
"(",
"cancel... | helper function that builds touch/pointer/mouse events | [
"helper",
"function",
"that",
"builds",
"touch",
"/",
"pointer",
"/",
"mouse",
"events"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L1091-L1100 | train | Set the event handlers for the drag operation | [
30522,
3853,
1006,
3653,
2546,
1010,
2091,
1010,
2693,
1010,
2039,
1010,
17542,
1007,
1063,
1035,
8011,
14117,
2618,
15338,
1027,
3653,
2546,
1009,
2091,
1025,
1035,
8011,
5302,
3726,
18697,
3372,
1027,
3653,
2546,
1009,
2693,
1025,
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... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | isNonTextPartiallySelected | function isNonTextPartiallySelected(node, range) {
return (node.nodeType != 3) &&
(isOrIsAncestorOf(node, range.startContainer) || isOrIsAncestorOf(node, range.endContainer));
} | javascript | function isNonTextPartiallySelected(node, range) {
return (node.nodeType != 3) &&
(isOrIsAncestorOf(node, range.startContainer) || isOrIsAncestorOf(node, range.endContainer));
} | [
"function",
"isNonTextPartiallySelected",
"(",
"node",
",",
"range",
")",
"{",
"return",
"(",
"node",
".",
"nodeType",
"!=",
"3",
")",
"&&",
"(",
"isOrIsAncestorOf",
"(",
"node",
",",
"range",
".",
"startContainer",
")",
"||",
"isOrIsAncestorOf",
"(",
"node"... | /*---------------------------------------------------------------------------------------------------------------- Utility functions | [
"/",
"*",
"----------------------------------------------------------------------------------------------------------------",
"Utility",
"functions"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L1006-L1009 | train | Returns true if node is not text partially selected | [
30522,
3853,
3475,
28040,
18413,
19362,
20925,
2135,
11246,
22471,
2098,
1006,
13045,
1010,
2846,
1007,
1063,
2709,
1006,
13045,
1012,
13045,
13874,
999,
1027,
1017,
1007,
1004,
1004,
1006,
11163,
6935,
26755,
4263,
11253,
1006,
13045,
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... |
GitbookIO/gitbook | lib/modifiers/summary/indexLevels.js | indexLevels | function indexLevels(summary) {
var parts = summary.getParts();
parts = parts.map(indexPartLevels);
return summary.set('parts', parts);
} | javascript | function indexLevels(summary) {
var parts = summary.getParts();
parts = parts.map(indexPartLevels);
return summary.set('parts', parts);
} | [
"function",
"indexLevels",
"(",
"summary",
")",
"{",
"var",
"parts",
"=",
"summary",
".",
"getParts",
"(",
")",
";",
"parts",
"=",
"parts",
".",
"map",
"(",
"indexPartLevels",
")",
";",
"return",
"summary",
".",
"set",
"(",
"'parts'",
",",
"parts",
")"... | Index all levels in the summary
@param {Summary}
@return {Summary} | [
"Index",
"all",
"levels",
"in",
"the",
"summary"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/summary/indexLevels.js#L9-L14 | train | index the levels of the given summary | [
30522,
3853,
5950,
20414,
9050,
1006,
12654,
1007,
1063,
13075,
3033,
1027,
12654,
1012,
2131,
26950,
1006,
1007,
1025,
3033,
1027,
3033,
1012,
4949,
1006,
5950,
19362,
9286,
15985,
2015,
1007,
1025,
2709,
12654,
1012,
2275,
1006,
1005,
303... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(bIncludeText, bIncludeAttributes) {
this._oValueSetResult.text = {
text : false,
attributes : false
};
if (bIncludeText == true) {
this._oValueSetResult.text = true;
}
if (bIncludeAttributes == true) {
this._oValueSetResult.attributes = true;
}
} | javascript | function(bIncludeText, bIncludeAttributes) {
this._oValueSetResult.text = {
text : false,
attributes : false
};
if (bIncludeText == true) {
this._oValueSetResult.text = true;
}
if (bIncludeAttributes == true) {
this._oValueSetResult.attributes = true;
}
} | [
"function",
"(",
"bIncludeText",
",",
"bIncludeAttributes",
")",
"{",
"this",
".",
"_oValueSetResult",
".",
"text",
"=",
"{",
"text",
":",
"false",
",",
"attributes",
":",
"false",
"}",
";",
"if",
"(",
"bIncludeText",
"==",
"true",
")",
"{",
"this",
".",... | Specify which components of the dimension shall be included in the value
set.
@param {boolean} bIncludeText
Indicator whether or not to include the dimension text (if
available) in the value set.
@param {boolean} bIncludeAttributes
Indicator whether or not to include all dimension attributes
(if available) in the value set.
@public
@function
@name sap.ui.model.analytics.odata4analytics.includeDimensionTextAttributes | [
"Specify",
"which",
"components",
"of",
"the",
"dimension",
"shall",
"be",
"included",
"in",
"the",
"value",
"set",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L5238-L5249 | train | Sets the value set to the text and attributes | [
30522,
3853,
1006,
8026,
20464,
12672,
18209,
1010,
8026,
20464,
12672,
19321,
3089,
8569,
4570,
1007,
1063,
2023,
1012,
1035,
9242,
15808,
3388,
6072,
11314,
1012,
3793,
1027,
1063,
3793,
1024,
6270,
1010,
12332,
1024,
6270,
1065,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | GifRecorder | function GifRecorder(mediaStream) {
if (typeof GIFEncoder === 'undefined') {
throw 'Please link: https://cdn.webrtc-experiment.com/gif-recorder.js';
}
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
var imageWidth = this.videoWidth || 320;
var imageHeight = this.videoHeight || 240;
canvas.width = video.width = imageWidth;
canvas.height = video.height = imageHeight;
// external library to record as GIF images
gifEncoder = new GIFEncoder();
// void setRepeat(int iter)
// Sets the number of times the set of GIF frames should be played.
// Default is 1; 0 means play indefinitely.
gifEncoder.setRepeat(0);
// void setFrameRate(Number fps)
// Sets frame rate in frames per second.
// Equivalent to setDelay(1000/fps).
// Using "setDelay" instead of "setFrameRate"
gifEncoder.setDelay(this.frameRate || this.speed || 200);
// void setQuality(int quality)
// Sets quality of color quantization (conversion of images to the
// maximum 256 colors allowed by the GIF specification).
// Lower values (minimum = 1) produce better colors,
// but slow processing significantly. 10 is the default,
// and produces good color mapping at reasonable speeds.
// Values greater than 20 do not yield significant improvements in speed.
gifEncoder.setQuality(this.quality || 1);
// Boolean start()
// This writes the GIF Header and returns false if it fails.
gifEncoder.start();
startTime = Date.now();
function drawVideoFrame(time) {
if (isPaused) {
setTimeout(drawVideoFrame, 500, time);
return;
}
lastAnimationFrame = requestAnimationFrame(drawVideoFrame);
if (typeof lastFrameTime === undefined) {
lastFrameTime = time;
}
// ~10 fps
if (time - lastFrameTime < 90) {
return;
}
if (video.paused) {
video.play(); // Android
}
context.drawImage(video, 0, 0, imageWidth, imageHeight);
gifEncoder.addFrame(context);
// console.log('Recording...' + Math.round((Date.now() - startTime) / 1000) + 's');
// console.log("fps: ", 1000 / (time - lastFrameTime));
lastFrameTime = time;
}
lastAnimationFrame = requestAnimationFrame(drawVideoFrame);
timeout = setTimeout(doneRecording, timeSlice);
};
function doneRecording() {
endTime = Date.now();
var gifBlob = new Blob([new Uint8Array(gifEncoder.stream().bin)], {
type: 'image/gif'
});
self.ondataavailable(gifBlob);
// todo: find a way to clear old recorded blobs
gifEncoder.stream().bin = [];
}
this.stop = function() {
if (lastAnimationFrame) {
cancelAnimationFrame(lastAnimationFrame);
clearTimeout(timeout);
doneRecording();
this.onstop();
}
};
this.onstop = function() {};
var isPaused = false;
this.pause = function() {
isPaused = true;
};
this.resume = function() {
isPaused = false;
};
this.ondataavailable = function() {};
this.onstop = function() {};
// Reference to itself
var self = this;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var video = document.createElement('video');
video.muted = true;
video.autoplay = true;
video.src = URL.createObjectURL(mediaStream);
video.play();
var lastAnimationFrame = null;
var startTime, endTime, lastFrameTime;
var gifEncoder;
var timeout;
} | javascript | function GifRecorder(mediaStream) {
if (typeof GIFEncoder === 'undefined') {
throw 'Please link: https://cdn.webrtc-experiment.com/gif-recorder.js';
}
// void start(optional long timeSlice)
// timestamp to fire "ondataavailable"
this.start = function(timeSlice) {
timeSlice = timeSlice || 1000;
var imageWidth = this.videoWidth || 320;
var imageHeight = this.videoHeight || 240;
canvas.width = video.width = imageWidth;
canvas.height = video.height = imageHeight;
// external library to record as GIF images
gifEncoder = new GIFEncoder();
// void setRepeat(int iter)
// Sets the number of times the set of GIF frames should be played.
// Default is 1; 0 means play indefinitely.
gifEncoder.setRepeat(0);
// void setFrameRate(Number fps)
// Sets frame rate in frames per second.
// Equivalent to setDelay(1000/fps).
// Using "setDelay" instead of "setFrameRate"
gifEncoder.setDelay(this.frameRate || this.speed || 200);
// void setQuality(int quality)
// Sets quality of color quantization (conversion of images to the
// maximum 256 colors allowed by the GIF specification).
// Lower values (minimum = 1) produce better colors,
// but slow processing significantly. 10 is the default,
// and produces good color mapping at reasonable speeds.
// Values greater than 20 do not yield significant improvements in speed.
gifEncoder.setQuality(this.quality || 1);
// Boolean start()
// This writes the GIF Header and returns false if it fails.
gifEncoder.start();
startTime = Date.now();
function drawVideoFrame(time) {
if (isPaused) {
setTimeout(drawVideoFrame, 500, time);
return;
}
lastAnimationFrame = requestAnimationFrame(drawVideoFrame);
if (typeof lastFrameTime === undefined) {
lastFrameTime = time;
}
// ~10 fps
if (time - lastFrameTime < 90) {
return;
}
if (video.paused) {
video.play(); // Android
}
context.drawImage(video, 0, 0, imageWidth, imageHeight);
gifEncoder.addFrame(context);
// console.log('Recording...' + Math.round((Date.now() - startTime) / 1000) + 's');
// console.log("fps: ", 1000 / (time - lastFrameTime));
lastFrameTime = time;
}
lastAnimationFrame = requestAnimationFrame(drawVideoFrame);
timeout = setTimeout(doneRecording, timeSlice);
};
function doneRecording() {
endTime = Date.now();
var gifBlob = new Blob([new Uint8Array(gifEncoder.stream().bin)], {
type: 'image/gif'
});
self.ondataavailable(gifBlob);
// todo: find a way to clear old recorded blobs
gifEncoder.stream().bin = [];
}
this.stop = function() {
if (lastAnimationFrame) {
cancelAnimationFrame(lastAnimationFrame);
clearTimeout(timeout);
doneRecording();
this.onstop();
}
};
this.onstop = function() {};
var isPaused = false;
this.pause = function() {
isPaused = true;
};
this.resume = function() {
isPaused = false;
};
this.ondataavailable = function() {};
this.onstop = function() {};
// Reference to itself
var self = this;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var video = document.createElement('video');
video.muted = true;
video.autoplay = true;
video.src = URL.createObjectURL(mediaStream);
video.play();
var lastAnimationFrame = null;
var startTime, endTime, lastFrameTime;
var gifEncoder;
var timeout;
} | [
"function",
"GifRecorder",
"(",
"mediaStream",
")",
"{",
"if",
"(",
"typeof",
"GIFEncoder",
"===",
"'undefined'",
")",
"{",
"throw",
"'Please link: https://cdn.webrtc-experiment.com/gif-recorder.js'",
";",
"}",
"// void start(optional long timeSlice)",
"// timestamp to fire \"o... | -------------- GifRecorder.js | [
"--------------",
"GifRecorder",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L2066-L2200 | train | Gif recorder. | [
30522,
3853,
21025,
19699,
8586,
8551,
2121,
1006,
2865,
21422,
1007,
1063,
2065,
1006,
2828,
11253,
21025,
18940,
16044,
2099,
1027,
1027,
1027,
1005,
6151,
28344,
1005,
1007,
1063,
5466,
1005,
3531,
4957,
1024,
16770,
1024,
1013,
1013,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
storybooks/storybook | examples/official-storybook/config.js | importAll | function importAll(context) {
const storyStore = window.__STORYBOOK_CLIENT_API__._storyStore; // eslint-disable-line no-undef, no-underscore-dangle
context.keys().forEach(filename => {
const fileExports = context(filename);
// A old-style story file
if (!fileExports.default) {
return;
}
const { default: component, ...examples } = fileExports;
let componentOptions = component;
if (component.prototype && component.prototype.isReactComponent) {
componentOptions = { component };
}
const kindName = componentOptions.title || componentOptions.component.displayName;
if (previousExports[filename]) {
if (previousExports[filename] === fileExports) {
return;
}
// Otherwise clear this kind
storyStore.removeStoryKind(kindName);
storyStore.incrementRevision();
}
// We pass true here to avoid the warning about HMR. It's cool clientApi, we got this
const kind = storiesOf(kindName, true);
(componentOptions.decorators || []).forEach(decorator => {
kind.addDecorator(decorator);
});
if (componentOptions.parameters) {
kind.addParameters(componentOptions.parameters);
}
Object.keys(examples).forEach(key => {
const example = examples[key];
const { title = key, parameters } = example;
kind.add(title, example, parameters);
});
previousExports[filename] = fileExports;
});
} | javascript | function importAll(context) {
const storyStore = window.__STORYBOOK_CLIENT_API__._storyStore; // eslint-disable-line no-undef, no-underscore-dangle
context.keys().forEach(filename => {
const fileExports = context(filename);
// A old-style story file
if (!fileExports.default) {
return;
}
const { default: component, ...examples } = fileExports;
let componentOptions = component;
if (component.prototype && component.prototype.isReactComponent) {
componentOptions = { component };
}
const kindName = componentOptions.title || componentOptions.component.displayName;
if (previousExports[filename]) {
if (previousExports[filename] === fileExports) {
return;
}
// Otherwise clear this kind
storyStore.removeStoryKind(kindName);
storyStore.incrementRevision();
}
// We pass true here to avoid the warning about HMR. It's cool clientApi, we got this
const kind = storiesOf(kindName, true);
(componentOptions.decorators || []).forEach(decorator => {
kind.addDecorator(decorator);
});
if (componentOptions.parameters) {
kind.addParameters(componentOptions.parameters);
}
Object.keys(examples).forEach(key => {
const example = examples[key];
const { title = key, parameters } = example;
kind.add(title, example, parameters);
});
previousExports[filename] = fileExports;
});
} | [
"function",
"importAll",
"(",
"context",
")",
"{",
"const",
"storyStore",
"=",
"window",
".",
"__STORYBOOK_CLIENT_API__",
".",
"_storyStore",
";",
"// eslint-disable-line no-undef, no-underscore-dangle",
"context",
".",
"keys",
"(",
")",
".",
"forEach",
"(",
"filename... | The simplest version of examples would just export this function for users to use | [
"The",
"simplest",
"version",
"of",
"examples",
"would",
"just",
"export",
"this",
"function",
"for",
"users",
"to",
"use"
] | 9bff9271b7e163fb12b9ee0cf697c56f9d727b7b | https://github.com/storybooks/storybook/blob/9bff9271b7e163fb12b9ee0cf697c56f9d727b7b/examples/official-storybook/config.js#L72-L118 | train | Import all files from a context | [
30522,
3853,
12324,
8095,
1006,
6123,
1007,
1063,
9530,
3367,
2466,
23809,
2063,
1027,
3332,
1012,
1035,
1035,
2466,
8654,
1035,
7396,
1035,
17928,
1035,
1035,
1012,
1035,
2466,
23809,
2063,
1025,
1013,
1013,
9686,
4115,
2102,
1011,
4487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | dist/js/materialize.js | destroy | function destroy() {
this._resetDropdownStyles();
this._removeEventHandlers();
Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1);
this.el.M_Dropdown = undefined;
} | javascript | function destroy() {
this._resetDropdownStyles();
this._removeEventHandlers();
Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1);
this.el.M_Dropdown = undefined;
} | [
"function",
"destroy",
"(",
")",
"{",
"this",
".",
"_resetDropdownStyles",
"(",
")",
";",
"this",
".",
"_removeEventHandlers",
"(",
")",
";",
"Dropdown",
".",
"_dropdowns",
".",
"splice",
"(",
"Dropdown",
".",
"_dropdowns",
".",
"indexOf",
"(",
"this",
")"... | Teardown component | [
"Teardown",
"component"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L2317-L2322 | train | Destroys the Dropdown instance | [
30522,
3853,
6033,
1006,
1007,
1063,
2023,
1012,
1035,
25141,
25711,
7698,
21756,
4244,
1006,
1007,
1025,
2023,
1012,
1035,
6366,
18697,
3372,
11774,
12910,
1006,
1007,
1025,
4530,
7698,
1012,
1035,
4530,
7698,
2015,
1012,
11867,
13231,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.f/src/sap/f/cards/BindingResolver.js | process | function process(vValue, oModel, sPath, iCurrentLevel, iMaxLevel) {
var bReachedMaxLevel = iCurrentLevel === iMaxLevel;
if (bReachedMaxLevel) {
Log.warning("BindingResolver maximum level processing reached. Please check for circular dependencies.");
}
if (!vValue || bReachedMaxLevel) {
return vValue;
}
if (Array.isArray(vValue)) {
vValue.forEach(function (vItem, iIndex, aArray) {
if (typeof vItem === "object") {
process(vItem, oModel, sPath, iCurrentLevel + 1, iMaxLevel);
} else if (typeof vItem === "string") {
aArray[iIndex] = resolveBinding(vItem, oModel, sPath);
}
}, this);
return vValue;
} else if (typeof vValue === "object") {
for (var sProp in vValue) {
if (typeof vValue[sProp] === "object") {
process(vValue[sProp], oModel, sPath, iCurrentLevel + 1, iMaxLevel);
} else if (typeof vValue[sProp] === "string") {
vValue[sProp] = resolveBinding(vValue[sProp], oModel, sPath);
}
}
return vValue;
} else if (typeof vValue === "string") {
return resolveBinding(vValue, oModel, sPath);
} else {
return vValue;
}
} | javascript | function process(vValue, oModel, sPath, iCurrentLevel, iMaxLevel) {
var bReachedMaxLevel = iCurrentLevel === iMaxLevel;
if (bReachedMaxLevel) {
Log.warning("BindingResolver maximum level processing reached. Please check for circular dependencies.");
}
if (!vValue || bReachedMaxLevel) {
return vValue;
}
if (Array.isArray(vValue)) {
vValue.forEach(function (vItem, iIndex, aArray) {
if (typeof vItem === "object") {
process(vItem, oModel, sPath, iCurrentLevel + 1, iMaxLevel);
} else if (typeof vItem === "string") {
aArray[iIndex] = resolveBinding(vItem, oModel, sPath);
}
}, this);
return vValue;
} else if (typeof vValue === "object") {
for (var sProp in vValue) {
if (typeof vValue[sProp] === "object") {
process(vValue[sProp], oModel, sPath, iCurrentLevel + 1, iMaxLevel);
} else if (typeof vValue[sProp] === "string") {
vValue[sProp] = resolveBinding(vValue[sProp], oModel, sPath);
}
}
return vValue;
} else if (typeof vValue === "string") {
return resolveBinding(vValue, oModel, sPath);
} else {
return vValue;
}
} | [
"function",
"process",
"(",
"vValue",
",",
"oModel",
",",
"sPath",
",",
"iCurrentLevel",
",",
"iMaxLevel",
")",
"{",
"var",
"bReachedMaxLevel",
"=",
"iCurrentLevel",
"===",
"iMaxLevel",
";",
"if",
"(",
"bReachedMaxLevel",
")",
"{",
"Log",
".",
"warning",
"("... | Traverses an object and resolves all binding syntaxes.
@param {*} vValue The value to resolve.
@param {sap.ui.model.Model} oModel The model.
@param {string} [sPath] The path to take.
@param {number} iCurrentLevel The current level of recursion.
@param {number} iMaxLevel The maximum level of recursion.
@private
@returns {*} The resolved value. | [
"Traverses",
"an",
"object",
"and",
"resolves",
"all",
"binding",
"syntaxes",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/BindingResolver.js#L44-L77 | train | This function is called by the binding resolver to process the value. | [
30522,
3853,
2832,
1006,
1058,
10175,
5657,
1010,
18168,
10244,
2140,
1010,
14690,
2232,
1010,
24582,
29264,
20414,
2884,
1010,
10047,
8528,
20414,
2884,
1007,
1063,
13075,
25769,
17848,
20414,
2884,
1027,
24582,
29264,
20414,
2884,
1027,
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... |
aws/aws-sdk-js | lib/discover_endpoint.js | discoverEndpoint | function discoverEndpoint(request, done) {
var service = request.service || {};
if (hasCustomEndpoint(service) || request.isPresigned()) return done();
if (!isEndpointDiscoveryApplicable(request)) return done();
request.httpRequest.appendToUserAgent('endpoint-discovery');
var operations = service.api.operations || {};
var operationModel = operations[request.operation];
var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';
switch (isEndpointDiscoveryRequired) {
case 'OPTIONAL':
optionalDiscoverEndpoint(request);
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
done();
break;
case 'REQUIRED':
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
requiredDiscoverEndpoint(request, done);
break;
case 'NULL':
default:
done();
break;
}
} | javascript | function discoverEndpoint(request, done) {
var service = request.service || {};
if (hasCustomEndpoint(service) || request.isPresigned()) return done();
if (!isEndpointDiscoveryApplicable(request)) return done();
request.httpRequest.appendToUserAgent('endpoint-discovery');
var operations = service.api.operations || {};
var operationModel = operations[request.operation];
var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';
switch (isEndpointDiscoveryRequired) {
case 'OPTIONAL':
optionalDiscoverEndpoint(request);
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
done();
break;
case 'REQUIRED':
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
requiredDiscoverEndpoint(request, done);
break;
case 'NULL':
default:
done();
break;
}
} | [
"function",
"discoverEndpoint",
"(",
"request",
",",
"done",
")",
"{",
"var",
"service",
"=",
"request",
".",
"service",
"||",
"{",
"}",
";",
"if",
"(",
"hasCustomEndpoint",
"(",
"service",
")",
"||",
"request",
".",
"isPresigned",
"(",
")",
")",
"return... | attach endpoint discovery logic to request object
@param [object] request
@api private | [
"attach",
"endpoint",
"discovery",
"logic",
"to",
"request",
"object"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L324-L350 | train | Discover an endpoint | [
30522,
3853,
7523,
10497,
8400,
1006,
5227,
1010,
2589,
1007,
1063,
13075,
2326,
1027,
5227,
1012,
2326,
1064,
1064,
1063,
1065,
1025,
2065,
1006,
2038,
7874,
20389,
10497,
8400,
1006,
2326,
1007,
1064,
1064,
5227,
1012,
2003,
28994,
23773,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/sidenav/sidenav.js | toggleOpen | function toggleOpen(isOpen) {
if (scope.isOpen === isOpen) {
return $q.when(true);
} else {
if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();
return $q(function(resolve) {
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = isOpen;
$mdUtil.nextTick(function() {
// When the current `updateIsOpen()` animation finishes
promise.then(function(result) {
if (!scope.isOpen && triggeringElement && triggeringInteractionType === 'keyboard') {
// reset focus to originating element (if available) upon close
triggeringElement.focus();
triggeringElement = null;
}
resolve(result);
});
});
});
}
} | javascript | function toggleOpen(isOpen) {
if (scope.isOpen === isOpen) {
return $q.when(true);
} else {
if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();
return $q(function(resolve) {
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = isOpen;
$mdUtil.nextTick(function() {
// When the current `updateIsOpen()` animation finishes
promise.then(function(result) {
if (!scope.isOpen && triggeringElement && triggeringInteractionType === 'keyboard') {
// reset focus to originating element (if available) upon close
triggeringElement.focus();
triggeringElement = null;
}
resolve(result);
});
});
});
}
} | [
"function",
"toggleOpen",
"(",
"isOpen",
")",
"{",
"if",
"(",
"scope",
".",
"isOpen",
"===",
"isOpen",
")",
"{",
"return",
"$q",
".",
"when",
"(",
"true",
")",
";",
"}",
"else",
"{",
"if",
"(",
"scope",
".",
"isOpen",
"&&",
"sidenavCtrl",
".",
"onC... | Toggle the sideNav view and publish a promise to be resolved when
the view animation finishes.
@param {boolean} isOpen true to open the sidenav, false to close it
@returns {*} promise to be resolved when the view animation finishes | [
"Toggle",
"the",
"sideNav",
"view",
"and",
"publish",
"a",
"promise",
"to",
"be",
"resolved",
"when",
"the",
"view",
"animation",
"finishes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L474-L499 | train | Toggle the isOpen property of the sidenavCtrl | [
30522,
3853,
2000,
24679,
26915,
1006,
11163,
11837,
1007,
1063,
2065,
1006,
9531,
1012,
11163,
11837,
1027,
1027,
1027,
11163,
11837,
1007,
1063,
2709,
1002,
1053,
1012,
2043,
1006,
2995,
1007,
1025,
1065,
2842,
1063,
2065,
1006,
9531,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/ExtensionManager.js | updateFromDownload | function updateFromDownload(installationResult) {
if (installationResult.keepFile === undefined) {
installationResult.keepFile = false;
}
var installationStatus = installationResult.installationStatus;
if (installationStatus === Package.InstallationStatuses.ALREADY_INSTALLED ||
installationStatus === Package.InstallationStatuses.NEEDS_UPDATE ||
installationStatus === Package.InstallationStatuses.SAME_VERSION ||
installationStatus === Package.InstallationStatuses.OLDER_VERSION) {
var id = installationResult.name;
delete _idsToRemove[id];
_idsToUpdate[id] = installationResult;
exports.trigger("statusChange", id);
}
} | javascript | function updateFromDownload(installationResult) {
if (installationResult.keepFile === undefined) {
installationResult.keepFile = false;
}
var installationStatus = installationResult.installationStatus;
if (installationStatus === Package.InstallationStatuses.ALREADY_INSTALLED ||
installationStatus === Package.InstallationStatuses.NEEDS_UPDATE ||
installationStatus === Package.InstallationStatuses.SAME_VERSION ||
installationStatus === Package.InstallationStatuses.OLDER_VERSION) {
var id = installationResult.name;
delete _idsToRemove[id];
_idsToUpdate[id] = installationResult;
exports.trigger("statusChange", id);
}
} | [
"function",
"updateFromDownload",
"(",
"installationResult",
")",
"{",
"if",
"(",
"installationResult",
".",
"keepFile",
"===",
"undefined",
")",
"{",
"installationResult",
".",
"keepFile",
"=",
"false",
";",
"}",
"var",
"installationStatus",
"=",
"installationResul... | If a downloaded package appears to be an update, mark the extension for update.
If an extension was previously marked for removal, marking for update will
turn off the removal mark.
@param {Object} installationResult info about the install provided by the Package.download function | [
"If",
"a",
"downloaded",
"package",
"appears",
"to",
"be",
"an",
"update",
"mark",
"the",
"extension",
"for",
"update",
".",
"If",
"an",
"extension",
"was",
"previously",
"marked",
"for",
"removal",
"marking",
"for",
"update",
"will",
"turn",
"off",
"the",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L583-L598 | train | Update the installation status from download | [
30522,
3853,
10651,
19699,
5358,
7698,
11066,
1006,
8272,
6072,
11314,
1007,
1063,
2065,
1006,
8272,
6072,
11314,
1012,
2562,
8873,
2571,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
8272,
6072,
11314,
1012,
2562,
8873,
2571,
1027,
6270,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/linter.js | getDirectiveComments | function getDirectiveComments(filename, ast, ruleMapper) {
const configuredRules = {};
const enabledGlobals = {};
const exportedVariables = {};
const problems = [];
const disableDirectives = [];
ast.comments.filter(token => token.type !== "Shebang").forEach(comment => {
const trimmedCommentText = comment.value.trim();
const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/u.exec(trimmedCommentText);
if (!match) {
return;
}
const directiveValue = trimmedCommentText.slice(match.index + match[1].length);
if (/^eslint-disable-(next-)?line$/u.test(match[1])) {
if (comment.loc.start.line === comment.loc.end.line) {
const directiveType = match[1].slice("eslint-".length);
disableDirectives.push(...createDisableDirectives(directiveType, comment.loc.start, directiveValue));
} else {
problems.push({
ruleId: null,
severity: 2,
message: `${match[1]} comment should not span multiple lines.`,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
}
} else if (comment.type === "Block") {
switch (match[1]) {
case "exported":
Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment));
break;
case "globals":
case "global":
for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) {
let normalizedValue;
try {
normalizedValue = ConfigOps.normalizeConfigGlobal(value);
} catch (err) {
problems.push({
ruleId: null,
severity: 2,
message: err.message,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
continue;
}
if (enabledGlobals[id]) {
enabledGlobals[id].comments.push(comment);
enabledGlobals[id].value = normalizedValue;
} else {
enabledGlobals[id] = {
comments: [comment],
value: normalizedValue
};
}
}
break;
case "eslint-disable":
disableDirectives.push(...createDisableDirectives("disable", comment.loc.start, directiveValue));
break;
case "eslint-enable":
disableDirectives.push(...createDisableDirectives("enable", comment.loc.start, directiveValue));
break;
case "eslint": {
const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);
if (parseResult.success) {
Object.keys(parseResult.config).forEach(name => {
const ruleValue = parseResult.config[name];
try {
validator.validateRuleOptions(ruleMapper(name), name, ruleValue);
} catch (err) {
problems.push({
ruleId: name,
severity: 2,
message: err.message,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
}
configuredRules[name] = ruleValue;
});
} else {
problems.push(parseResult.error);
}
break;
}
// no default
}
}
});
return {
configuredRules,
enabledGlobals,
exportedVariables,
problems,
disableDirectives
};
} | javascript | function getDirectiveComments(filename, ast, ruleMapper) {
const configuredRules = {};
const enabledGlobals = {};
const exportedVariables = {};
const problems = [];
const disableDirectives = [];
ast.comments.filter(token => token.type !== "Shebang").forEach(comment => {
const trimmedCommentText = comment.value.trim();
const match = /^(eslint(-\w+){0,3}|exported|globals?)(\s|$)/u.exec(trimmedCommentText);
if (!match) {
return;
}
const directiveValue = trimmedCommentText.slice(match.index + match[1].length);
if (/^eslint-disable-(next-)?line$/u.test(match[1])) {
if (comment.loc.start.line === comment.loc.end.line) {
const directiveType = match[1].slice("eslint-".length);
disableDirectives.push(...createDisableDirectives(directiveType, comment.loc.start, directiveValue));
} else {
problems.push({
ruleId: null,
severity: 2,
message: `${match[1]} comment should not span multiple lines.`,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
}
} else if (comment.type === "Block") {
switch (match[1]) {
case "exported":
Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment));
break;
case "globals":
case "global":
for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) {
let normalizedValue;
try {
normalizedValue = ConfigOps.normalizeConfigGlobal(value);
} catch (err) {
problems.push({
ruleId: null,
severity: 2,
message: err.message,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
continue;
}
if (enabledGlobals[id]) {
enabledGlobals[id].comments.push(comment);
enabledGlobals[id].value = normalizedValue;
} else {
enabledGlobals[id] = {
comments: [comment],
value: normalizedValue
};
}
}
break;
case "eslint-disable":
disableDirectives.push(...createDisableDirectives("disable", comment.loc.start, directiveValue));
break;
case "eslint-enable":
disableDirectives.push(...createDisableDirectives("enable", comment.loc.start, directiveValue));
break;
case "eslint": {
const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);
if (parseResult.success) {
Object.keys(parseResult.config).forEach(name => {
const ruleValue = parseResult.config[name];
try {
validator.validateRuleOptions(ruleMapper(name), name, ruleValue);
} catch (err) {
problems.push({
ruleId: name,
severity: 2,
message: err.message,
line: comment.loc.start.line,
column: comment.loc.start.column + 1,
endLine: comment.loc.end.line,
endColumn: comment.loc.end.column + 1,
nodeType: null
});
}
configuredRules[name] = ruleValue;
});
} else {
problems.push(parseResult.error);
}
break;
}
// no default
}
}
});
return {
configuredRules,
enabledGlobals,
exportedVariables,
problems,
disableDirectives
};
} | [
"function",
"getDirectiveComments",
"(",
"filename",
",",
"ast",
",",
"ruleMapper",
")",
"{",
"const",
"configuredRules",
"=",
"{",
"}",
";",
"const",
"enabledGlobals",
"=",
"{",
"}",
";",
"const",
"exportedVariables",
"=",
"{",
"}",
";",
"const",
"problems"... | Parses comments in file to extract file-specific config of rules, globals
and environments and merges them with global config; also code blocks
where reporting is disabled or enabled and merges them with reporting config.
@param {string} filename The file being checked.
@param {ASTNode} ast The top node of the AST.
@param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules
@returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: Problem[], disableDirectives: DisableDirective[]}}
A collection of the directive comments that were found, along with any problems that occurred when parsing | [
"Parses",
"comments",
"in",
"file",
"to",
"extract",
"file",
"-",
"specific",
"config",
"of",
"rules",
"globals",
"and",
"environments",
"and",
"merges",
"them",
"with",
"global",
"config",
";",
"also",
"code",
"blocks",
"where",
"reporting",
"is",
"disabled",... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L165-L288 | train | Get all directives from the given file | [
30522,
3853,
2131,
4305,
2890,
15277,
9006,
8163,
1006,
5371,
18442,
1010,
2004,
2102,
1010,
3627,
2863,
18620,
1007,
1063,
9530,
3367,
26928,
6820,
4244,
1027,
1063,
1065,
1025,
9530,
3367,
9124,
23296,
16429,
9777,
1027,
1063,
1065,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/CodeFolding/main.js | deinit | function deinit() {
_isInitialized = false;
KeyBindingManager.removeBinding(collapseKey);
KeyBindingManager.removeBinding(expandKey);
KeyBindingManager.removeBinding(collapseAllKey);
KeyBindingManager.removeBinding(expandAllKey);
KeyBindingManager.removeBinding(collapseAllKeyMac);
KeyBindingManager.removeBinding(expandAllKeyMac);
//remove menus
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuDivider(codeFoldingMenuDivider.id);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(COLLAPSE);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(EXPAND);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(COLLAPSE_ALL);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(EXPAND_ALL);
EditorManager.off(".CodeFolding");
DocumentManager.off(".CodeFolding");
ProjectManager.off(".CodeFolding");
// Remove gutter & revert collapsed sections in all currently open editors
Editor.forEveryEditor(function (editor) {
CodeMirror.commands.unfoldAll(editor._codeMirror);
});
removeGutters();
} | javascript | function deinit() {
_isInitialized = false;
KeyBindingManager.removeBinding(collapseKey);
KeyBindingManager.removeBinding(expandKey);
KeyBindingManager.removeBinding(collapseAllKey);
KeyBindingManager.removeBinding(expandAllKey);
KeyBindingManager.removeBinding(collapseAllKeyMac);
KeyBindingManager.removeBinding(expandAllKeyMac);
//remove menus
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuDivider(codeFoldingMenuDivider.id);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(COLLAPSE);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(EXPAND);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(COLLAPSE_ALL);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).removeMenuItem(EXPAND_ALL);
EditorManager.off(".CodeFolding");
DocumentManager.off(".CodeFolding");
ProjectManager.off(".CodeFolding");
// Remove gutter & revert collapsed sections in all currently open editors
Editor.forEveryEditor(function (editor) {
CodeMirror.commands.unfoldAll(editor._codeMirror);
});
removeGutters();
} | [
"function",
"deinit",
"(",
")",
"{",
"_isInitialized",
"=",
"false",
";",
"KeyBindingManager",
".",
"removeBinding",
"(",
"collapseKey",
")",
";",
"KeyBindingManager",
".",
"removeBinding",
"(",
"expandKey",
")",
";",
"KeyBindingManager",
".",
"removeBinding",
"("... | Remove code-folding functionality | [
"Remove",
"code",
"-",
"folding",
"functionality"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/main.js#L358-L384 | train | Deinitialize the code folding | [
30522,
3853,
14866,
3490,
2102,
1006,
1007,
1063,
1035,
2003,
5498,
20925,
3550,
1027,
6270,
1025,
3145,
8428,
4667,
24805,
4590,
1012,
6366,
8428,
4667,
1006,
7859,
14839,
1007,
1025,
3145,
8428,
4667,
24805,
4590,
1012,
6366,
8428,
4667,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base/ManagedObjectModel.js | _traverseToLastManagedObject | function _traverseToLastManagedObject(aNodeStack) {
//Determine last managed object via node stack of getProperty
var sMember, i = aNodeStack.length - 1, aParts = [];
while (!(aNodeStack[i].node instanceof ManagedObject)) {
if (sMember) {
aParts.splice(0, 0, sMember);
}
sMember = aNodeStack[i].path;
i--;
}
return [aNodeStack[i].node, aNodeStack[i + 1], aParts, sMember];
} | javascript | function _traverseToLastManagedObject(aNodeStack) {
//Determine last managed object via node stack of getProperty
var sMember, i = aNodeStack.length - 1, aParts = [];
while (!(aNodeStack[i].node instanceof ManagedObject)) {
if (sMember) {
aParts.splice(0, 0, sMember);
}
sMember = aNodeStack[i].path;
i--;
}
return [aNodeStack[i].node, aNodeStack[i + 1], aParts, sMember];
} | [
"function",
"_traverseToLastManagedObject",
"(",
"aNodeStack",
")",
"{",
"//Determine last managed object via node stack of getProperty",
"var",
"sMember",
",",
"i",
"=",
"aNodeStack",
".",
"length",
"-",
"1",
",",
"aParts",
"=",
"[",
"]",
";",
"while",
"(",
"!",
... | Traverse in the recorded node stack of an object retrievel to tha last used
managed object in oder to be able to get the value/binding to use this
for further retrietment
@param aNodeStack
@returns {array} an array containing:
<ul>
<li>the last managed object</li>
<li>a map with the value of the last direct child and its path</li>
<li>an array of the remaining parts in the traversal</li>
<li>a string that represents the reimaining path from the last managed object to the value</li>
</ul> | [
"Traverse",
"in",
"the",
"recorded",
"node",
"stack",
"of",
"an",
"object",
"retrievel",
"to",
"tha",
"last",
"used",
"managed",
"object",
"in",
"oder",
"to",
"be",
"able",
"to",
"get",
"the",
"value",
"/",
"binding",
"to",
"use",
"this",
"for",
"further... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L77-L89 | train | Traverse the node stack to the last managed object | [
30522,
3853,
1035,
20811,
3406,
8523,
22942,
18655,
16429,
20614,
1006,
2019,
19847,
2696,
3600,
1007,
1063,
1013,
1013,
5646,
2197,
3266,
4874,
3081,
13045,
9991,
1997,
2131,
21572,
4842,
3723,
13075,
15488,
6633,
5677,
1010,
1045,
1027,
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... |
adobe/brackets | src/JSUtils/ScopeManager.js | getJumptoDef | function getJumptoDef(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_JUMPTODEF_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_JUMPTODEF_MSG);
} | javascript | function getJumptoDef(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_JUMPTODEF_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_JUMPTODEF_MSG);
} | [
"function",
"getJumptoDef",
"(",
"fileInfo",
",",
"offset",
")",
"{",
"postMessage",
"(",
"{",
"type",
":",
"MessageIds",
".",
"TERN_JUMPTODEF_MSG",
",",
"fileInfo",
":",
"fileInfo",
",",
"offset",
":",
"offset",
"}",
")",
";",
"return",
"addPendingRequest",
... | Get a Promise for the definition from TernJS, for the file & offset passed in.
@param {{type: string, name: string, offsetLines: number, text: string}} fileInfo
- type of update, name of file, and the text of the update.
For "full" updates, the whole text of the file is present. For "part" updates,
the changed portion of the text. For "empty" updates, the file has not been modified
and the text is empty.
@param {{line: number, ch: number}} offset - the offset in the file the hints should be calculate at
@return {jQuery.Promise} - a promise that will resolve to definition when
it is done | [
"Get",
"a",
"Promise",
"for",
"the",
"definition",
"from",
"TernJS",
"for",
"the",
"file",
"&",
"offset",
"passed",
"in",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L345-L353 | train | Get the jumpto definition | [
30522,
3853,
2131,
9103,
27718,
10244,
2546,
1006,
5371,
2378,
14876,
1010,
16396,
1007,
1063,
2695,
7834,
3736,
3351,
1006,
1063,
2828,
1024,
4471,
9821,
1012,
28774,
2078,
1035,
5376,
3406,
3207,
2546,
1035,
5796,
2290,
1010,
5371,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
semantic-release/semantic-release | lib/git.js | fetch | async function fetch(repositoryUrl, execaOpts) {
try {
await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], execaOpts);
} catch (error) {
await execa('git', ['fetch', '--tags', repositoryUrl], execaOpts);
}
} | javascript | async function fetch(repositoryUrl, execaOpts) {
try {
await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], execaOpts);
} catch (error) {
await execa('git', ['fetch', '--tags', repositoryUrl], execaOpts);
}
} | [
"async",
"function",
"fetch",
"(",
"repositoryUrl",
",",
"execaOpts",
")",
"{",
"try",
"{",
"await",
"execa",
"(",
"'git'",
",",
"[",
"'fetch'",
",",
"'--unshallow'",
",",
"'--tags'",
",",
"repositoryUrl",
"]",
",",
"execaOpts",
")",
";",
"}",
"catch",
"... | Unshallow the git repository if necessary and fetch all the tags.
@param {String} repositoryUrl The remote repository URL.
@param {Object} [execaOpts] Options to pass to `execa`. | [
"Unshallow",
"the",
"git",
"repository",
"if",
"necessary",
"and",
"fetch",
"all",
"the",
"tags",
"."
] | edf382f88838ed543c0b76cb6c914cca1fc1ddd1 | https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L63-L69 | train | Fetch the tags from the specified repository | [
30522,
2004,
6038,
2278,
3853,
18584,
1006,
22409,
3126,
2140,
1010,
4654,
19281,
7361,
3215,
1007,
1063,
3046,
1063,
26751,
4654,
19281,
1006,
1005,
21025,
2102,
1005,
1010,
1031,
1005,
18584,
1005,
1010,
1005,
1011,
1011,
4895,
7377,
7174... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/Time.js | toDate | function toDate(oTime) {
if (!isTime(oTime)) {
throw new FormatException("Illegal sap.ui.model.odata.type.Time value: "
+ toString(oTime));
}
return new Date(oTime.ms);
} | javascript | function toDate(oTime) {
if (!isTime(oTime)) {
throw new FormatException("Illegal sap.ui.model.odata.type.Time value: "
+ toString(oTime));
}
return new Date(oTime.ms);
} | [
"function",
"toDate",
"(",
"oTime",
")",
"{",
"if",
"(",
"!",
"isTime",
"(",
"oTime",
")",
")",
"{",
"throw",
"new",
"FormatException",
"(",
"\"Illegal sap.ui.model.odata.type.Time value: \"",
"+",
"toString",
"(",
"oTime",
")",
")",
";",
"}",
"return",
"new... | Converts the given time object to a Date.
@param {object} oTime
the <code>Time</code> object
@returns {Date}
a Date with hour, minute, second and milliseconds set according to the time object.
@throws FormatException if the time object's format does not match | [
"Converts",
"the",
"given",
"time",
"object",
"to",
"a",
"Date",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/Time.js#L100-L106 | train | Converts a time object to a Date | [
30522,
3853,
28681,
3686,
1006,
27178,
14428,
1007,
1063,
2065,
1006,
999,
21541,
14428,
1006,
27178,
14428,
1007,
1007,
1063,
5466,
2047,
4289,
10288,
24422,
1006,
1000,
6206,
20066,
1012,
21318,
1012,
2944,
1012,
1051,
2850,
2696,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js | function(strVal) {
strVal = strVal.toLowerCase().trim();
if (strVal) {
if (this.isTransparent(strVal)) {
this.value = {
h: 0,
s: 0,
b: 0,
a: 0
};
return true;
} else {
var parsedColor = this.parse(strVal);
if (parsedColor) {
this.value = this.value = {
h: parsedColor.h,
s: parsedColor.s,
b: parsedColor.b,
a: parsedColor.a
};
if (!this.origFormat) {
this.origFormat = parsedColor.format;
}
} else if (this.fallbackValue) {
// if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed
this.value = this.fallbackValue;
}
}
}
return false;
} | javascript | function(strVal) {
strVal = strVal.toLowerCase().trim();
if (strVal) {
if (this.isTransparent(strVal)) {
this.value = {
h: 0,
s: 0,
b: 0,
a: 0
};
return true;
} else {
var parsedColor = this.parse(strVal);
if (parsedColor) {
this.value = this.value = {
h: parsedColor.h,
s: parsedColor.s,
b: parsedColor.b,
a: parsedColor.a
};
if (!this.origFormat) {
this.origFormat = parsedColor.format;
}
} else if (this.fallbackValue) {
// if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed
this.value = this.fallbackValue;
}
}
}
return false;
} | [
"function",
"(",
"strVal",
")",
"{",
"strVal",
"=",
"strVal",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"strVal",
")",
"{",
"if",
"(",
"this",
".",
"isTransparent",
"(",
"strVal",
")",
")",
"{",
"this",
".",
"value",
"=... | parse a string to HSB
@protected
@param {String} strVal
@returns {boolean} Returns true if it could be parsed, false otherwise | [
"parse",
"a",
"string",
"to",
"HSB"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js#L273-L303 | train | parse the value | [
30522,
3853,
1006,
2358,
26585,
1007,
1063,
2358,
26585,
1027,
2358,
26585,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1012,
12241,
1006,
1007,
1025,
2065,
1006,
2358,
26585,
1007,
1063,
2065,
1006,
2023,
1012,
21541,
5521,
27694,
4765,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableAccExtension.js | function(oExtension) {
var oTable = oExtension.getTable();
var oInfo = TableUtils.getFocusedItemInfo(oTable);
return oInfo.cellInRow - (TableUtils.hasRowHeader(oTable) ? 1 : 0);
} | javascript | function(oExtension) {
var oTable = oExtension.getTable();
var oInfo = TableUtils.getFocusedItemInfo(oTable);
return oInfo.cellInRow - (TableUtils.hasRowHeader(oTable) ? 1 : 0);
} | [
"function",
"(",
"oExtension",
")",
"{",
"var",
"oTable",
"=",
"oExtension",
".",
"getTable",
"(",
")",
";",
"var",
"oInfo",
"=",
"TableUtils",
".",
"getFocusedItemInfo",
"(",
"oTable",
")",
";",
"return",
"oInfo",
".",
"cellInRow",
"-",
"(",
"TableUtils",... | /*
Returns the index of the column (in the array of visible columns (see Table._getVisibleColumns())) of the current focused cell
In case the focused cell is a row action the given index equals the length of the visible columns.
This function must not be used if the focus is on a row header.
@returns {int} | [
"/",
"*",
"Returns",
"the",
"index",
"of",
"the",
"column",
"(",
"in",
"the",
"array",
"of",
"visible",
"columns",
"(",
"see",
"Table",
".",
"_getVisibleColumns",
"()",
"))",
"of",
"the",
"current",
"focused",
"cell",
"In",
"case",
"the",
"focused",
"cel... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L130-L134 | train | Returns the number of cells in the row of the focused item. | [
30522,
3853,
1006,
1051,
10288,
29048,
1007,
1063,
13075,
27178,
3085,
1027,
1051,
10288,
29048,
1012,
2131,
10880,
1006,
1007,
1025,
13075,
1051,
2378,
14876,
1027,
2795,
21823,
4877,
1012,
2131,
14876,
7874,
2098,
4221,
10020,
14876,
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... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | findLCA | function findLCA(node1, node2, layoutInfo) {
// Find their common ancester, starting from the root graph
var res = findLCA_aux(node1, node2, 0, layoutInfo);
if (2 > res.count) {
// If aux function couldn't find the common ancester,
// then it is the root graph
return 0;
} else {
return res.graph;
}
} | javascript | function findLCA(node1, node2, layoutInfo) {
// Find their common ancester, starting from the root graph
var res = findLCA_aux(node1, node2, 0, layoutInfo);
if (2 > res.count) {
// If aux function couldn't find the common ancester,
// then it is the root graph
return 0;
} else {
return res.graph;
}
} | [
"function",
"findLCA",
"(",
"node1",
",",
"node2",
",",
"layoutInfo",
")",
"{",
"// Find their common ancester, starting from the root graph",
"var",
"res",
"=",
"findLCA_aux",
"(",
"node1",
",",
"node2",
",",
"0",
",",
"layoutInfo",
")",
";",
"if",
"(",
"2",
... | @brief : This function finds the index of the lowest common
graph ancestor between 2 nodes in the subtree
(from the graph hierarchy induced tree) whose
root is graphIx
@arg node1: node1's ID
@arg node2: node2's ID
@arg layoutInfo: layoutInfo object | [
"@brief",
":",
"This",
"function",
"finds",
"the",
"index",
"of",
"the",
"lowest",
"common",
"graph",
"ancestor",
"between",
"2",
"nodes",
"in",
"the",
"subtree",
"(",
"from",
"the",
"graph",
"hierarchy",
"induced",
"tree",
")",
"whose",
"root",
"is",
"gra... | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L19856-L19867 | train | Find the common ancester of two nodes | [
30522,
3853,
2424,
15472,
2050,
1006,
13045,
2487,
1010,
13045,
2475,
1010,
9621,
2378,
14876,
1007,
1063,
1013,
1013,
2424,
2037,
2691,
2019,
9623,
3334,
1010,
3225,
2013,
1996,
7117,
10629,
13075,
24501,
1027,
2424,
15472,
2050,
1035,
195... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SearchResultsView.js | SearchResultsView | function SearchResultsView(model, panelID, panelName, type) {
var panelHtml = Mustache.render(searchPanelTemplate, {panelID: panelID});
this._panel = WorkspaceManager.createBottomPanel(panelName, $(panelHtml), 100);
this._$summary = this._panel.$panel.find(".title");
this._$table = this._panel.$panel.find(".table-container");
this._model = model;
this._searchResultsType = type;
} | javascript | function SearchResultsView(model, panelID, panelName, type) {
var panelHtml = Mustache.render(searchPanelTemplate, {panelID: panelID});
this._panel = WorkspaceManager.createBottomPanel(panelName, $(panelHtml), 100);
this._$summary = this._panel.$panel.find(".title");
this._$table = this._panel.$panel.find(".table-container");
this._model = model;
this._searchResultsType = type;
} | [
"function",
"SearchResultsView",
"(",
"model",
",",
"panelID",
",",
"panelName",
",",
"type",
")",
"{",
"var",
"panelHtml",
"=",
"Mustache",
".",
"render",
"(",
"searchPanelTemplate",
",",
"{",
"panelID",
":",
"panelID",
"}",
")",
";",
"this",
".",
"_panel... | @constructor
Handles the search results panel.
Dispatches the following events:
replaceBatch - when the "Replace" button is clicked.
close - when the panel is closed.
@param {SearchModel} model The model that this view is showing.
@param {string} panelID The CSS ID to use for the panel.
@param {string} panelName The name to use for the panel, as passed to WorkspaceManager.createBottomPanel().
@param {string} type type to identify if it is reference search or string match serach | [
"@constructor",
"Handles",
"the",
"search",
"results",
"panel",
".",
"Dispatches",
"the",
"following",
"events",
":",
"replaceBatch",
"-",
"when",
"the",
"Replace",
"button",
"is",
"clicked",
".",
"close",
"-",
"when",
"the",
"panel",
"is",
"closed",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/SearchResultsView.js#L77-L85 | train | Search results view | [
30522,
3853,
3945,
6072,
11314,
2015,
8584,
1006,
2944,
1010,
5997,
3593,
1010,
5997,
18442,
1010,
2828,
1007,
1063,
13075,
5997,
11039,
19968,
1027,
28786,
1012,
17552,
1006,
3945,
9739,
20042,
6633,
15725,
1010,
1063,
5997,
3593,
1024,
59... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
swimlane/ngx-datatable | release/utils/tree.js | groupRowsByParents | function groupRowsByParents(rows, from, to) {
if (from && to) {
var nodeById = {};
var l = rows.length;
var node = null;
nodeById[0] = new TreeNode(); // that's the root node
var uniqIDs = rows.reduce(function (arr, item) {
var toValue = to(item);
if (arr.indexOf(toValue) === -1) {
arr.push(toValue);
}
return arr;
}, []);
for (var i = 0; i < l; i++) { // make TreeNode objects for each item
nodeById[to(rows[i])] = new TreeNode(rows[i]);
}
for (var i = 0; i < l; i++) { // link all TreeNode objects
node = nodeById[to(rows[i])];
var parent_1 = 0;
var fromValue = from(node.row);
if (!!fromValue && (uniqIDs.indexOf(fromValue) > -1)) {
parent_1 = fromValue;
}
node.parent = nodeById[parent_1];
node.row['level'] = node.parent.row['level'] + 1;
node.parent.children.push(node);
}
var resolvedRows_1 = [];
nodeById[0].flatten(function () {
resolvedRows_1 = resolvedRows_1.concat([this.row]);
}, true);
return resolvedRows_1;
}
else {
return rows;
}
} | javascript | function groupRowsByParents(rows, from, to) {
if (from && to) {
var nodeById = {};
var l = rows.length;
var node = null;
nodeById[0] = new TreeNode(); // that's the root node
var uniqIDs = rows.reduce(function (arr, item) {
var toValue = to(item);
if (arr.indexOf(toValue) === -1) {
arr.push(toValue);
}
return arr;
}, []);
for (var i = 0; i < l; i++) { // make TreeNode objects for each item
nodeById[to(rows[i])] = new TreeNode(rows[i]);
}
for (var i = 0; i < l; i++) { // link all TreeNode objects
node = nodeById[to(rows[i])];
var parent_1 = 0;
var fromValue = from(node.row);
if (!!fromValue && (uniqIDs.indexOf(fromValue) > -1)) {
parent_1 = fromValue;
}
node.parent = nodeById[parent_1];
node.row['level'] = node.parent.row['level'] + 1;
node.parent.children.push(node);
}
var resolvedRows_1 = [];
nodeById[0].flatten(function () {
resolvedRows_1 = resolvedRows_1.concat([this.row]);
}, true);
return resolvedRows_1;
}
else {
return rows;
}
} | [
"function",
"groupRowsByParents",
"(",
"rows",
",",
"from",
",",
"to",
")",
"{",
"if",
"(",
"from",
"&&",
"to",
")",
"{",
"var",
"nodeById",
"=",
"{",
"}",
";",
"var",
"l",
"=",
"rows",
".",
"length",
";",
"var",
"node",
"=",
"null",
";",
"nodeBy... | This functions rearrange items by their parents
Also sets the level value to each of the items
Note: Expecting each item has a property called parentId
Note: This algorithm will fail if a list has two or more items with same ID
NOTE: This algorithm will fail if there is a deadlock of relationship
For example,
Input
id -> parent
1 -> 0
2 -> 0
3 -> 1
4 -> 1
5 -> 2
7 -> 8
6 -> 3
Output
id -> level
1 -> 0
--3 -> 1
----6 -> 2
--4 -> 1
2 -> 0
--5 -> 1
7 -> 8
@param rows | [
"This",
"functions",
"rearrange",
"items",
"by",
"their",
"parents",
"Also",
"sets",
"the",
"level",
"value",
"to",
"each",
"of",
"the",
"items"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/tree.js#L44-L80 | train | group rows by parents | [
30522,
3853,
2177,
10524,
14478,
19362,
11187,
1006,
10281,
1010,
2013,
1010,
2000,
1007,
1063,
2065,
1006,
2013,
1004,
1004,
2000,
1007,
1063,
13075,
13045,
3762,
3593,
1027,
1063,
1065,
1025,
13075,
1048,
1027,
10281,
1012,
3091,
1025,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(sel, range) {
var ranges = sel.getAllRanges();
sel.removeAllRanges();
for (var i = 0, len = ranges.length; i < len; ++i) {
if (!rangesEqual(range, ranges[i])) {
sel.addRange(ranges[i]);
}
}
if (!sel.rangeCount) {
updateEmptySelection(sel);
}
} | javascript | function(sel, range) {
var ranges = sel.getAllRanges();
sel.removeAllRanges();
for (var i = 0, len = ranges.length; i < len; ++i) {
if (!rangesEqual(range, ranges[i])) {
sel.addRange(ranges[i]);
}
}
if (!sel.rangeCount) {
updateEmptySelection(sel);
}
} | [
"function",
"(",
"sel",
",",
"range",
")",
"{",
"var",
"ranges",
"=",
"sel",
".",
"getAllRanges",
"(",
")",
";",
"sel",
".",
"removeAllRanges",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"ranges",
".",
"length",
";",
"i",
... | Removal of a single range | [
"Removal",
"of",
"a",
"single",
"range"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L3480-L3491 | train | update the selection | [
30522,
3853,
1006,
7367,
2140,
1010,
2846,
1007,
1063,
13075,
8483,
1027,
7367,
2140,
1012,
2131,
8095,
24388,
2229,
1006,
1007,
1025,
7367,
2140,
1012,
6366,
8095,
24388,
2229,
1006,
1007,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/command/Menus.js | ContextMenu | function ContextMenu(id) {
Menu.apply(this, arguments);
var $newMenu = $("<li class='dropdown context-menu' id='" + StringUtils.jQueryIdEscape(id) + "'></li>"),
$popUp = $("<ul class='dropdown-menu'></ul>"),
$toggle = $("<a href='#' class='dropdown-toggle' data-toggle='dropdown'></a>").hide();
// assemble the menu fragments
$newMenu.append($toggle).append($popUp);
// insert into DOM
$("#context-menu-bar > ul").append($newMenu);
var self = this;
PopUpManager.addPopUp($popUp,
function () {
self.close();
},
false);
// Listen to ContextMenu's beforeContextMenuOpen event to first close other popups
PopUpManager.listenToContextMenu(this);
} | javascript | function ContextMenu(id) {
Menu.apply(this, arguments);
var $newMenu = $("<li class='dropdown context-menu' id='" + StringUtils.jQueryIdEscape(id) + "'></li>"),
$popUp = $("<ul class='dropdown-menu'></ul>"),
$toggle = $("<a href='#' class='dropdown-toggle' data-toggle='dropdown'></a>").hide();
// assemble the menu fragments
$newMenu.append($toggle).append($popUp);
// insert into DOM
$("#context-menu-bar > ul").append($newMenu);
var self = this;
PopUpManager.addPopUp($popUp,
function () {
self.close();
},
false);
// Listen to ContextMenu's beforeContextMenuOpen event to first close other popups
PopUpManager.listenToContextMenu(this);
} | [
"function",
"ContextMenu",
"(",
"id",
")",
"{",
"Menu",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"$newMenu",
"=",
"$",
"(",
"\"<li class='dropdown context-menu' id='\"",
"+",
"StringUtils",
".",
"jQueryIdEscape",
"(",
"id",
")",
"+",
"\"... | Represents a context menu that can open at a specific location in the UI.
Clients should not create this object directly and should instead use registerContextMenu()
to create new ContextMenu objects.
Context menus in brackets may be HTML-based or native so clients should not reach into
the HTML and should instead manipulate ContextMenus through the API.
Events:
- beforeContextMenuOpen
- beforeContextMenuClose
@constructor
@extends {Menu} | [
"Represents",
"a",
"context",
"menu",
"that",
"can",
"open",
"at",
"a",
"specific",
"location",
"in",
"the",
"UI",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/Menus.js#L1170-L1192 | train | ContextMenu constructor. | [
30522,
3853,
6123,
3549,
2226,
1006,
8909,
1007,
1063,
12183,
1012,
6611,
1006,
2023,
1010,
9918,
1007,
1025,
13075,
1002,
2047,
3549,
2226,
1027,
1002,
1006,
1000,
1026,
5622,
2465,
1027,
1005,
4530,
7698,
6123,
1011,
12183,
1005,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js | function(aControls, aChangeTypes) {
if (!aControls || aControls.length === 0) {
return this._reject("At least one control ID has to be provided as a parameter");
}
var oAppComponent = aControls[0].appComponent || Utils.getAppComponentForControl(aControls[0]);
if (!oAppComponent) {
return this._reject("App Component could not be determined");
}
var aIdsOfPassedControls = aControls.map(function (oControl) {
return oControl.id || oControl.getId();
});
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
return oFlexController.getComponentChanges({currentLayer: "USER", includeCtrlVariants: true})
.then(function (aChanges) {
return aChanges
.filter(this._filterBySelectors.bind(this, oAppComponent, aIdsOfPassedControls))
.filter(this._filterByChangeType.bind(this, aChangeTypes))
.some(this._ifValidFileType);
}.bind(this));
} | javascript | function(aControls, aChangeTypes) {
if (!aControls || aControls.length === 0) {
return this._reject("At least one control ID has to be provided as a parameter");
}
var oAppComponent = aControls[0].appComponent || Utils.getAppComponentForControl(aControls[0]);
if (!oAppComponent) {
return this._reject("App Component could not be determined");
}
var aIdsOfPassedControls = aControls.map(function (oControl) {
return oControl.id || oControl.getId();
});
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
return oFlexController.getComponentChanges({currentLayer: "USER", includeCtrlVariants: true})
.then(function (aChanges) {
return aChanges
.filter(this._filterBySelectors.bind(this, oAppComponent, aIdsOfPassedControls))
.filter(this._filterByChangeType.bind(this, aChangeTypes))
.some(this._ifValidFileType);
}.bind(this));
} | [
"function",
"(",
"aControls",
",",
"aChangeTypes",
")",
"{",
"if",
"(",
"!",
"aControls",
"||",
"aControls",
".",
"length",
"===",
"0",
")",
"{",
"return",
"this",
".",
"_reject",
"(",
"\"At least one control ID has to be provided as a parameter\"",
")",
";",
"}... | Checks if personalization changes exists for control.
@param {sap.ui.core.Element[] | map[]} aControls - an array of instances of controls, a map with control IDs including a app component or a mixture for which personalization exists
@param {array} [aChangeTypes] - Types of changes that have existing personalization.
@param {sap.ui.core.Component} aControls.appComponent - Application component of the controls at runtime in case a map has been used
@param {string} aControls.id - ID of the control in case a map has been used to specify the control
@returns {Promise} Promise resolving with true if personalization changes exists, otherwise false.
@method sap.ui.fl.ControlPersonalizationAPI.isPersonalized
@public | [
"Checks",
"if",
"personalization",
"changes",
"exists",
"for",
"control",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L316-L339 | train | Returns a promise that resolves to a list of changes | [
30522,
3853,
1006,
9353,
12162,
13153,
2015,
1010,
9353,
18003,
27405,
10374,
1007,
1063,
2065,
1006,
999,
9353,
12162,
13153,
2015,
1064,
1064,
9353,
12162,
13153,
2015,
1012,
3091,
1027,
1027,
1027,
1014,
1007,
1063,
2709,
2023,
1012,
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... | |
eslint/eslint | lib/rules/prefer-object-spread.js | getEndWithSpaces | function getEndWithSpaces(token, sourceCode) {
const text = sourceCode.text;
let end = token.range[1];
// Detect spaces after the token.
while (ANY_SPACE.test(text[end] || "")) {
end += 1;
}
return end;
} | javascript | function getEndWithSpaces(token, sourceCode) {
const text = sourceCode.text;
let end = token.range[1];
// Detect spaces after the token.
while (ANY_SPACE.test(text[end] || "")) {
end += 1;
}
return end;
} | [
"function",
"getEndWithSpaces",
"(",
"token",
",",
"sourceCode",
")",
"{",
"const",
"text",
"=",
"sourceCode",
".",
"text",
";",
"let",
"end",
"=",
"token",
".",
"range",
"[",
"1",
"]",
";",
"// Detect spaces after the token.",
"while",
"(",
"ANY_SPACE",
"."... | Get the range of a given token and around whitespaces.
@param {Token} token The token to get range.
@param {SourceCode} sourceCode The source code object to get tokens.
@returns {number} The start of the range of the token and around whitespaces. | [
"Get",
"the",
"range",
"of",
"a",
"given",
"token",
"and",
"around",
"whitespaces",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-object-spread.js#L131-L141 | train | Get the end of the token | [
30522,
3853,
2131,
10497,
24415,
23058,
2015,
1006,
19204,
1010,
3120,
16044,
1007,
1063,
9530,
3367,
3793,
1027,
3120,
16044,
1012,
3793,
1025,
2292,
2203,
1027,
19204,
1012,
2846,
1031,
1015,
1033,
1025,
1013,
1013,
11487,
7258,
2044,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/encodeGlobal.js | function(name, blockData) {
var block = blocks.get(name) || defaultBlocks.get(name);
return Promise(block.applyBlock(blockData, result));
} | javascript | function(name, blockData) {
var block = blocks.get(name) || defaultBlocks.get(name);
return Promise(block.applyBlock(blockData, result));
} | [
"function",
"(",
"name",
",",
"blockData",
")",
"{",
"var",
"block",
"=",
"blocks",
".",
"get",
"(",
"name",
")",
"||",
"defaultBlocks",
".",
"get",
"(",
"name",
")",
";",
"return",
"Promise",
"(",
"block",
".",
"applyBlock",
"(",
"blockData",
",",
"... | Apply a templating block and returns its result
@param {String} name
@param {Object} blockData
@return {Promise|Object} | [
"Apply",
"a",
"templating",
"block",
"and",
"returns",
"its",
"result"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/api/encodeGlobal.js#L135-L138 | train | Apply a block to the database | [
30522,
3853,
1006,
2171,
1010,
3796,
2850,
2696,
1007,
1063,
13075,
3796,
1027,
5991,
1012,
2131,
1006,
2171,
1007,
1064,
1064,
12398,
23467,
2015,
1012,
2131,
1006,
2171,
1007,
1025,
2709,
4872,
1006,
3796,
1012,
6611,
23467,
1006,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CSSInlineEditor.js | _stylesheetListRenderer | function _stylesheetListRenderer(item) {
var html = "<span class='stylesheet-name'>" + _.escape(item.name);
if (item.subDirStr) {
html += "<span class='stylesheet-dir'> — " + _.escape(item.subDirStr) + "</span>";
}
html += "</span>";
return html;
} | javascript | function _stylesheetListRenderer(item) {
var html = "<span class='stylesheet-name'>" + _.escape(item.name);
if (item.subDirStr) {
html += "<span class='stylesheet-dir'> — " + _.escape(item.subDirStr) + "</span>";
}
html += "</span>";
return html;
} | [
"function",
"_stylesheetListRenderer",
"(",
"item",
")",
"{",
"var",
"html",
"=",
"\"<span class='stylesheet-name'>\"",
"+",
"_",
".",
"escape",
"(",
"item",
".",
"name",
")",
";",
"if",
"(",
"item",
".",
"subDirStr",
")",
"{",
"html",
"+=",
"\"<span class='... | Item renderer for stylesheet-picker dropdown | [
"Item",
"renderer",
"for",
"stylesheet",
"-",
"picker",
"dropdown"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/CSSInlineEditor.js#L146-L153 | train | Render a list of stylesheets | [
30522,
3853,
1035,
6782,
21030,
19646,
2923,
7389,
4063,
2121,
1006,
30524,
4019,
1006,
8875,
1012,
2171,
1007,
1025,
2065,
1006,
8875,
1012,
4942,
4305,
12096,
2099,
1007,
1063,
16129,
1009,
1027,
1000,
1026,
8487,
2465,
1027,
1005,
6782,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/max-len.js | ensureArrayAndPush | function ensureArrayAndPush(object, key, value) {
if (!Array.isArray(object[key])) {
object[key] = [];
}
object[key].push(value);
} | javascript | function ensureArrayAndPush(object, key, value) {
if (!Array.isArray(object[key])) {
object[key] = [];
}
object[key].push(value);
} | [
"function",
"ensureArrayAndPush",
"(",
"object",
",",
"key",
",",
"value",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"object",
"[",
"key",
"]",
")",
")",
"{",
"object",
"[",
"key",
"]",
"=",
"[",
"]",
";",
"}",
"object",
"[",
"key",... | Ensure that an array exists at [key] on `object`, and add `value` to it.
@param {Object} object the object to mutate
@param {string} key the object's key
@param {*} value the value to add
@returns {void}
@private | [
"Ensure",
"that",
"an",
"array",
"exists",
"at",
"[",
"key",
"]",
"on",
"object",
"and",
"add",
"value",
"to",
"it",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-len.js#L208-L213 | train | Ensure an array is present | [
30522,
3853,
5676,
2906,
29539,
4859,
12207,
2232,
1006,
4874,
1010,
3145,
1010,
3643,
1007,
1063,
2065,
1006,
999,
9140,
1012,
18061,
11335,
2100,
1006,
4874,
1031,
3145,
1033,
1007,
1007,
1063,
4874,
1031,
3145,
1033,
1027,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/core/propertyTypes.js | assetParse | function assetParse (value) {
var el;
var parsedUrl;
// If an element was provided (e.g. canvas or video), just return it.
if (typeof value !== 'string') { return value; }
// Wrapped `url()` in case of data URI.
parsedUrl = value.match(urlRegex);
if (parsedUrl) { return parsedUrl[1]; }
// ID.
if (value.charAt(0) === '#') {
el = document.getElementById(value.substring(1));
if (el) {
// Pass through media elements. If we have the elements, we don't have to call
// three.js loaders which would re-request the assets.
if (el.tagName === 'CANVAS' || el.tagName === 'VIDEO' || el.tagName === 'IMG') {
return el;
}
return el.getAttribute('src');
}
warn('"' + value + '" asset not found.');
return;
}
// Non-wrapped url().
return value;
} | javascript | function assetParse (value) {
var el;
var parsedUrl;
// If an element was provided (e.g. canvas or video), just return it.
if (typeof value !== 'string') { return value; }
// Wrapped `url()` in case of data URI.
parsedUrl = value.match(urlRegex);
if (parsedUrl) { return parsedUrl[1]; }
// ID.
if (value.charAt(0) === '#') {
el = document.getElementById(value.substring(1));
if (el) {
// Pass through media elements. If we have the elements, we don't have to call
// three.js loaders which would re-request the assets.
if (el.tagName === 'CANVAS' || el.tagName === 'VIDEO' || el.tagName === 'IMG') {
return el;
}
return el.getAttribute('src');
}
warn('"' + value + '" asset not found.');
return;
}
// Non-wrapped url().
return value;
} | [
"function",
"assetParse",
"(",
"value",
")",
"{",
"var",
"el",
";",
"var",
"parsedUrl",
";",
"// If an element was provided (e.g. canvas or video), just return it.",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
"value",
";",
"}",
"// Wrapped ... | For general assets.
@param {string} value - Can either be `url(<value>)`, an ID selector to an asset, or
just string.
@returns {string} Parsed value from `url(<value>)`, src from `<someasset src>`, or
just string. | [
"For",
"general",
"assets",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/propertyTypes.js#L73-L101 | train | Parse an asset value. | [
30522,
3853,
11412,
19362,
3366,
1006,
3643,
1007,
1063,
13075,
3449,
1025,
13075,
11968,
6924,
3126,
2140,
1025,
1013,
1013,
2065,
2019,
5783,
2001,
3024,
1006,
1041,
1012,
1043,
1012,
10683,
2030,
2678,
1007,
1010,
2074,
2709,
2009,
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/toolbars.js | locationBar_clear | function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
} | javascript | function locationBar_clear() {
this.focus({type: "shortcut"});
this._controller.keypress(this.urlbar, "VK_DELETE", {});
this._controller.waitForEval("subject.value == ''",
TIMEOUT, 100, this.urlbar.getNode());
} | [
"function",
"locationBar_clear",
"(",
")",
"{",
"this",
".",
"focus",
"(",
"{",
"type",
":",
"\"shortcut\"",
"}",
")",
";",
"this",
".",
"_controller",
".",
"keypress",
"(",
"this",
".",
"urlbar",
",",
"\"VK_DELETE\"",
",",
"{",
"}",
")",
";",
"this",
... | Clear the location bar | [
"Clear",
"the",
"location",
"bar"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/toolbars.js#L301-L306 | train | Clear the location bar | [
30522,
3853,
3295,
8237,
1035,
3154,
1006,
1007,
1063,
2023,
1012,
3579,
1006,
1063,
2828,
1024,
1000,
2460,
12690,
1000,
1065,
1007,
1025,
2023,
1012,
1035,
11486,
1012,
3145,
20110,
1006,
2023,
1012,
24471,
20850,
2906,
1010,
1000,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mxGeometry | function mxGeometry(x, y, width, height)
{
mxRectangle.call(this, x, y, width, height);
} | javascript | function mxGeometry(x, y, width, height)
{
mxRectangle.call(this, x, y, width, height);
} | [
"function",
"mxGeometry",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
"{",
"mxRectangle",
".",
"call",
"(",
"this",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
";",
"}"
] | Copyright (c) 2006-2015, JGraph Ltd
Copyright (c) 2006-2015, Gaudenz Alder
Class: mxGeometry
Extends <mxRectangle> to represent the geometry of a cell.
For vertices, the geometry consists of the x- and y-location, and the width
and height. For edges, the geometry consists of the optional terminal- and
control points. The terminal points are only required if an edge is
unconnected, and are stored in the sourcePoint> and <targetPoint>
variables, respectively.
Example:
If an edge is unconnected, that is, it has no source or target terminal,
then a geometry with terminal points for a new edge can be defined as
follows.
(code)
geometry.setTerminalPoint(new mxPoint(x1, y1), true);
geometry.points = [new mxPoint(x2, y2)];
geometry.setTerminalPoint(new mxPoint(x3, y3), false);
(end)
Control points are used regardless of the connected state of an edge and may
be ignored or interpreted differently depending on the edge's <mxEdgeStyle>.
To disable automatic reset of control points after a cell has been moved or
resized, the the <mxGraph.resizeEdgesOnMove> and
<mxGraph.resetEdgesOnResize> may be used.
Edge Labels:
Using the x- and y-coordinates of a cell's geometry, it is possible to
position the label on edges on a specific location on the actual edge shape
as it appears on the screen. The x-coordinate of an edge's geometry is used
to describe the distance from the center of the edge from -1 to 1 with 0
being the center of the edge and the default value. The y-coordinate of an
edge's geometry is used to describe the absolute, orthogonal distance in
pixels from that point. In addition, the <mxGeometry.offset> is used as an
absolute offset vector from the resulting point.
This coordinate system is applied if <relative> is true, otherwise the
offset defines the absolute vector from the edge's center point to the
label and the values for <x> and <y> are ignored.
The width and height parameter for edge geometries can be used to set the
label width and height (eg. for word wrapping).
Ports:
The term "port" refers to a relatively positioned, connectable child cell,
which is used to specify the connection between the parent and another cell
in the graph. Ports are typically modeled as vertices with relative
geometries.
Offsets:
The <offset> field is interpreted in 3 different ways, depending on the cell
and the geometry. For edges, the offset defines the absolute offset for the
edge label. For relative geometries, the offset defines the absolute offset
for the origin (top, left corner) of the vertex, otherwise the offset
defines the absolute offset for the label inside the vertex or group.
Constructor: mxGeometry
Constructs a new object to describe the size and location of a vertex or
the control points of an edge. | [
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"JGraph",
"Ltd",
"Copyright",
"(",
"c",
")",
"2006",
"-",
"2015",
"Gaudenz",
"Alder",
"Class",
":",
"mxGeometry"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L42863-L42866 | train | A geometry that can be used to draw a rectangle of the same size. | [
30522,
3853,
25630,
3351,
8462,
11129,
1006,
1060,
1010,
1061,
1010,
9381,
1010,
4578,
1007,
1063,
25630,
2890,
25572,
3070,
2571,
1012,
2655,
1006,
2023,
1010,
1060,
1010,
1061,
1010,
9381,
1010,
4578,
1007,
1025,
1065,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/material-design-lite | gulpfile.babel.js | mdlPublish | function mdlPublish(pubScope) {
let cacheTtl = null;
let src = null;
let dest = null;
if (pubScope === 'staging') {
// Set staging specific vars here.
cacheTtl = 0;
src = 'dist/*';
dest = bucketStaging;
} else if (pubScope === 'prod') {
// Set prod specific vars here.
cacheTtl = 60;
src = 'dist/*';
dest = bucketProd;
} else if (pubScope === 'promote') {
// Set promote (essentially prod) specific vars here.
cacheTtl = 60;
src = `${bucketStaging}/*`;
dest = bucketProd;
}
let infoMsg = `Publishing ${pubScope}/${pkg.version} to GCS (${dest})`;
if (src) {
infoMsg += ` from ${src}`;
}
console.log(infoMsg);
// Build gsutil commands:
// The gsutil -h option is used to set metadata headers.
// The gsutil -m option requests parallel copies.
// The gsutil -R option is used for recursive file copy.
const cacheControl = `-h "Cache-Control:public,max-age=${cacheTtl}"`;
const gsutilCacheCmd = `gsutil -m setmeta ${cacheControl} ${dest}/**`;
const gsutilCpCmd = `gsutil -m cp -r -z html,css,js,svg ${src} ${dest}`;
gulp.src('').pipe($.shell([gsutilCpCmd, gsutilCacheCmd]));
} | javascript | function mdlPublish(pubScope) {
let cacheTtl = null;
let src = null;
let dest = null;
if (pubScope === 'staging') {
// Set staging specific vars here.
cacheTtl = 0;
src = 'dist/*';
dest = bucketStaging;
} else if (pubScope === 'prod') {
// Set prod specific vars here.
cacheTtl = 60;
src = 'dist/*';
dest = bucketProd;
} else if (pubScope === 'promote') {
// Set promote (essentially prod) specific vars here.
cacheTtl = 60;
src = `${bucketStaging}/*`;
dest = bucketProd;
}
let infoMsg = `Publishing ${pubScope}/${pkg.version} to GCS (${dest})`;
if (src) {
infoMsg += ` from ${src}`;
}
console.log(infoMsg);
// Build gsutil commands:
// The gsutil -h option is used to set metadata headers.
// The gsutil -m option requests parallel copies.
// The gsutil -R option is used for recursive file copy.
const cacheControl = `-h "Cache-Control:public,max-age=${cacheTtl}"`;
const gsutilCacheCmd = `gsutil -m setmeta ${cacheControl} ${dest}/**`;
const gsutilCpCmd = `gsutil -m cp -r -z html,css,js,svg ${src} ${dest}`;
gulp.src('').pipe($.shell([gsutilCpCmd, gsutilCacheCmd]));
} | [
"function",
"mdlPublish",
"(",
"pubScope",
")",
"{",
"let",
"cacheTtl",
"=",
"null",
";",
"let",
"src",
"=",
"null",
";",
"let",
"dest",
"=",
"null",
";",
"if",
"(",
"pubScope",
"===",
"'staging'",
")",
"{",
"// Set staging specific vars here.",
"cacheTtl",
... | Function to publish staging or prod version from local tree,
or to promote staging to prod, per passed arg.
@param {string} pubScope the scope to publish to. | [
"Function",
"to",
"publish",
"staging",
"or",
"prod",
"version",
"from",
"local",
"tree",
"or",
"to",
"promote",
"staging",
"to",
"prod",
"per",
"passed",
"arg",
"."
] | 60f441a22ed98ed2c03f6179adf460d888bf459f | https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/gulpfile.babel.js#L634-L671 | train | Publishes the specified mdl project to GCS. | [
30522,
3853,
9108,
14277,
12083,
13602,
1006,
23598,
16186,
1007,
1063,
2292,
17053,
4779,
2140,
1027,
19701,
1025,
2292,
5034,
2278,
1027,
19701,
1025,
2292,
4078,
2102,
1027,
19701,
1025,
2065,
1006,
23598,
16186,
1027,
1027,
1027,
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... |
GitbookIO/gitbook | lib/plugins/sortDependencies.js | sortDependencies | function sortDependencies(plugins) {
var byTypes = plugins.groupBy(pluginType);
return byTypes.get(TYPE_PLUGIN, Immutable.List())
.concat(byTypes.get(TYPE_THEME, Immutable.List()));
} | javascript | function sortDependencies(plugins) {
var byTypes = plugins.groupBy(pluginType);
return byTypes.get(TYPE_PLUGIN, Immutable.List())
.concat(byTypes.get(TYPE_THEME, Immutable.List()));
} | [
"function",
"sortDependencies",
"(",
"plugins",
")",
"{",
"var",
"byTypes",
"=",
"plugins",
".",
"groupBy",
"(",
"pluginType",
")",
";",
"return",
"byTypes",
".",
"get",
"(",
"TYPE_PLUGIN",
",",
"Immutable",
".",
"List",
"(",
")",
")",
".",
"concat",
"("... | Sort the list of dependencies to match list in book.json
The themes should always be loaded after the plugins
@param {List<PluginDependency>} deps
@return {List<PluginDependency>} | [
"Sort",
"the",
"list",
"of",
"dependencies",
"to",
"match",
"list",
"in",
"book",
".",
"json",
"The",
"themes",
"should",
"always",
"be",
"loaded",
"after",
"the",
"plugins"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/sortDependencies.js#L27-L32 | train | Sort dependencies by pluginType and theme | [
30522,
3853,
4066,
3207,
11837,
4181,
9243,
1006,
13354,
7076,
1007,
1063,
13075,
2011,
13874,
2015,
1027,
13354,
7076,
1012,
2177,
3762,
1006,
13354,
18447,
18863,
1007,
1025,
2709,
2011,
13874,
2015,
1012,
2131,
1006,
2828,
1035,
13354,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (sFetch, bThrow) {
return function () {
var oSyncPromise = this[sFetch].apply(this, arguments);
if (oSyncPromise.isFulfilled()) {
return oSyncPromise.getResult();
} else if (bThrow) {
if (oSyncPromise.isRejected()) {
oSyncPromise.caught();
throw oSyncPromise.getResult();
} else {
throw new Error("Result pending");
}
}
};
} | javascript | function (sFetch, bThrow) {
return function () {
var oSyncPromise = this[sFetch].apply(this, arguments);
if (oSyncPromise.isFulfilled()) {
return oSyncPromise.getResult();
} else if (bThrow) {
if (oSyncPromise.isRejected()) {
oSyncPromise.caught();
throw oSyncPromise.getResult();
} else {
throw new Error("Result pending");
}
}
};
} | [
"function",
"(",
"sFetch",
",",
"bThrow",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"oSyncPromise",
"=",
"this",
"[",
"sFetch",
"]",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"oSyncPromise",
".",
"isFulfilled",
"(",
... | Returns a "get*" method corresponding to the given "fetch*" method.
@param {string} sFetch
A "fetch*" method's name
@param {boolean} [bThrow=false]
Whether the "get*" method throws if the promise is not (yet) fulfilled instead of just
returning <code>undefined</code> (Note:
{@link sap.ui.model.odata.v4.ODataMetaModel#getObject} intentionally never throws
because it is used for data binding)
@returns {function}
A "get*" method returning the "fetch*" method's result or
<code>undefined</code> in case the promise is not (yet) fulfilled | [
"Returns",
"a",
"get",
"*",
"method",
"corresponding",
"to",
"the",
"given",
"fetch",
"*",
"method",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L286-L301 | train | Returns a function that will be called when the promise is resolved or rejected. | [
30522,
3853,
1006,
16420,
3388,
2818,
1010,
18411,
8093,
5004,
1007,
1063,
30524,
5562,
1012,
2131,
6072,
11314,
1006,
1007,
1025,
1065,
2842,
2065,
1006,
18411,
8093,
5004,
1007,
1063,
2065,
1006,
9808,
6038,
21906,
21716,
5562,
1012,
2003... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-else-return.js | checkIfWithoutElse | function checkIfWithoutElse(node) {
const parent = node.parent;
/*
* Fixing this would require splitting one statement into two, so no error should
* be reported if this node is in a position where only one statement is allowed.
*/
if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) {
return;
}
const consequents = [];
let alternate;
for (let currentNode = node; currentNode.type === "IfStatement"; currentNode = currentNode.alternate) {
if (!currentNode.alternate) {
return;
}
consequents.push(currentNode.consequent);
alternate = currentNode.alternate;
}
if (consequents.every(alwaysReturns)) {
displayReport(alternate);
}
} | javascript | function checkIfWithoutElse(node) {
const parent = node.parent;
/*
* Fixing this would require splitting one statement into two, so no error should
* be reported if this node is in a position where only one statement is allowed.
*/
if (!astUtils.STATEMENT_LIST_PARENTS.has(parent.type)) {
return;
}
const consequents = [];
let alternate;
for (let currentNode = node; currentNode.type === "IfStatement"; currentNode = currentNode.alternate) {
if (!currentNode.alternate) {
return;
}
consequents.push(currentNode.consequent);
alternate = currentNode.alternate;
}
if (consequents.every(alwaysReturns)) {
displayReport(alternate);
}
} | [
"function",
"checkIfWithoutElse",
"(",
"node",
")",
"{",
"const",
"parent",
"=",
"node",
".",
"parent",
";",
"/*\n * Fixing this would require splitting one statement into two, so no error should\n * be reported if this node is in a position where only one statement... | Check the if statement, but don't catch else-if blocks.
@returns {void}
@param {Node} node The node for the if statement to check
@private | [
"Check",
"the",
"if",
"statement",
"but",
"don",
"t",
"catch",
"else",
"-",
"if",
"blocks",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-else-return.js#L220-L245 | train | Check if node is not a if statement | [
30522,
3853,
4638,
10128,
24415,
5833,
9050,
2063,
1006,
13045,
1007,
1063,
9530,
3367,
6687,
1027,
13045,
1012,
6687,
1025,
1013,
1008,
1008,
15887,
2023,
2052,
5478,
14541,
2028,
4861,
2046,
2048,
1010,
2061,
2053,
7561,
2323,
1008,
2022,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js | function () {
var oVersion = sap.ui.getCore().getConfiguration().getVersion();
if (oVersion && oVersion.compareTo(this._MIN_UI5VERSION_SUPPORT_ASSISTANT) >= 0) {
return true;
}
return false;
} | javascript | function () {
var oVersion = sap.ui.getCore().getConfiguration().getVersion();
if (oVersion && oVersion.compareTo(this._MIN_UI5VERSION_SUPPORT_ASSISTANT) >= 0) {
return true;
}
return false;
} | [
"function",
"(",
")",
"{",
"var",
"oVersion",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"getVersion",
"(",
")",
";",
"if",
"(",
"oVersion",
"&&",
"oVersion",
".",
"compareTo",
"(",
"this",
".",
"_MIN_UI5... | Checks if current version of UI5 is equal or higher than minimum UI5 version
that Support Assistant is available at.
@returns {boolean}
@private | [
"Checks",
"if",
"current",
"version",
"of",
"UI5",
"is",
"equal",
"or",
"higher",
"than",
"minimum",
"UI5",
"version",
"that",
"Support",
"Assistant",
"is",
"available",
"at",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L703-L709 | train | Returns true if the current version of UI5 is higher than the minimum UI5 version | [
30522,
3853,
1006,
1007,
1063,
13075,
15849,
3258,
1027,
20066,
1012,
21318,
1012,
2131,
17345,
1006,
1007,
1012,
2131,
8663,
8873,
27390,
3370,
1006,
1007,
1012,
2131,
27774,
1006,
1007,
1025,
2065,
1006,
15849,
3258,
1004,
1004,
15849,
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... | |
nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | removeColByCell | function removeColByCell($cell) {
const index = $cell.index();
$cell.parents('table').find('tr').each((n, tr) => {
$(tr).children().eq(index).remove();
});
} | javascript | function removeColByCell($cell) {
const index = $cell.index();
$cell.parents('table').find('tr').each((n, tr) => {
$(tr).children().eq(index).remove();
});
} | [
"function",
"removeColByCell",
"(",
"$cell",
")",
"{",
"const",
"index",
"=",
"$cell",
".",
"index",
"(",
")",
";",
"$cell",
".",
"parents",
"(",
"'table'",
")",
".",
"find",
"(",
"'tr'",
")",
".",
"each",
"(",
"(",
"n",
",",
"tr",
")",
"=>",
"{"... | Remove column by given cell
@param {jQuery} $cell - jQuery wrapped table cell | [
"Remove",
"column",
"by",
"given",
"cell"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L98-L104 | train | Remove a cell from the table | [
30522,
3853,
6366,
25778,
3762,
29109,
2140,
1006,
1002,
3526,
1007,
1063,
9530,
3367,
5950,
1027,
1002,
3526,
1012,
5950,
1006,
1007,
1025,
1002,
3526,
1012,
3008,
1006,
1005,
2795,
1005,
1007,
1012,
2424,
1006,
1005,
19817,
1005,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pagekit/vue-resource | dist/vue-resource.esm.js | header | function header (request) {
var headers = assign({}, Http.headers.common,
!request.crossOrigin ? Http.headers.custom : {},
Http.headers[toLower(request.method)]
);
each(headers, function (value, name) {
if (!request.headers.has(name)) {
request.headers.set(name, value);
}
});
} | javascript | function header (request) {
var headers = assign({}, Http.headers.common,
!request.crossOrigin ? Http.headers.custom : {},
Http.headers[toLower(request.method)]
);
each(headers, function (value, name) {
if (!request.headers.has(name)) {
request.headers.set(name, value);
}
});
} | [
"function",
"header",
"(",
"request",
")",
"{",
"var",
"headers",
"=",
"assign",
"(",
"{",
"}",
",",
"Http",
".",
"headers",
".",
"common",
",",
"!",
"request",
".",
"crossOrigin",
"?",
"Http",
".",
"headers",
".",
"custom",
":",
"{",
"}",
",",
"Ht... | Header Interceptor. | [
"Header",
"Interceptor",
"."
] | fe268fa1d6053ede5f34aef9a11e1a424a70446c | https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L999-L1012 | train | Add the request header | [
30522,
3853,
20346,
1006,
5227,
1007,
1063,
13075,
20346,
2015,
1027,
23911,
1006,
1063,
1065,
1010,
8299,
1012,
20346,
2015,
1012,
2691,
1010,
999,
5227,
1012,
2892,
10050,
11528,
1029,
8299,
1012,
20346,
2015,
1012,
7661,
1024,
1063,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (mChangeListeners, sPath, oValue, bRemoved) {
Object.keys(oValue).forEach(function (sProperty) {
var sPropertyPath = _Helper.buildPath(sPath, sProperty),
vValue = oValue[sProperty];
if (vValue && typeof vValue === "object") {
_Helper.fireChanges(mChangeListeners, sPropertyPath, vValue, bRemoved);
} else {
_Helper.fireChange(mChangeListeners, sPropertyPath,
bRemoved ? undefined : vValue);
}
});
_Helper.fireChange(mChangeListeners, sPath, bRemoved ? undefined : oValue);
} | javascript | function (mChangeListeners, sPath, oValue, bRemoved) {
Object.keys(oValue).forEach(function (sProperty) {
var sPropertyPath = _Helper.buildPath(sPath, sProperty),
vValue = oValue[sProperty];
if (vValue && typeof vValue === "object") {
_Helper.fireChanges(mChangeListeners, sPropertyPath, vValue, bRemoved);
} else {
_Helper.fireChange(mChangeListeners, sPropertyPath,
bRemoved ? undefined : vValue);
}
});
_Helper.fireChange(mChangeListeners, sPath, bRemoved ? undefined : oValue);
} | [
"function",
"(",
"mChangeListeners",
",",
"sPath",
",",
"oValue",
",",
"bRemoved",
")",
"{",
"Object",
".",
"keys",
"(",
"oValue",
")",
".",
"forEach",
"(",
"function",
"(",
"sProperty",
")",
"{",
"var",
"sPropertyPath",
"=",
"_Helper",
".",
"buildPath",
... | Iterates recursively over all properties of the given value and fires change events
to all listeners. Also fires a change event for the object itself, for example in case of
an advertised action.
@param {object} mChangeListeners A map of change listeners by path
@param {string} sPath The path of the current value
@param {object} oValue The value
@param {boolean} bRemoved If true the value is assumed to have been removed and the
change event reports undefined as the new value | [
"Iterates",
"recursively",
"over",
"all",
"properties",
"of",
"the",
"given",
"value",
"and",
"fires",
"change",
"events",
"to",
"all",
"listeners",
".",
"Also",
"fires",
"a",
"change",
"event",
"for",
"the",
"object",
"itself",
"for",
"example",
"in",
"case... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L417-L431 | train | Fires changes to the listeners | [
30522,
3853,
1006,
11338,
18003,
29282,
6528,
2545,
1010,
14690,
2232,
1010,
9242,
5657,
1010,
7987,
6633,
21818,
2094,
1007,
1063,
4874,
1012,
6309,
1006,
9242,
5657,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
11867,
18981,
15010,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/transform-apijson-for-sdk.js | function (description, deprecatedText, deprecatedSince) {
if (!description && !deprecatedText && !deprecatedSince) {
return "";
}
var result = description || "";
if (deprecatedSince || deprecatedText) {
// Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low
result += "<span class=\"sapUiDeprecated\"><br>";
result += this.formatDeprecated(deprecatedSince, deprecatedText);
result += "</span>";
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | javascript | function (description, deprecatedText, deprecatedSince) {
if (!description && !deprecatedText && !deprecatedSince) {
return "";
}
var result = description || "";
if (deprecatedSince || deprecatedText) {
// Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low
result += "<span class=\"sapUiDeprecated\"><br>";
result += this.formatDeprecated(deprecatedSince, deprecatedText);
result += "</span>";
}
result = this._preProcessLinksInTextBlock(result);
return result;
} | [
"function",
"(",
"description",
",",
"deprecatedText",
",",
"deprecatedSince",
")",
"{",
"if",
"(",
"!",
"description",
"&&",
"!",
"deprecatedText",
"&&",
"!",
"deprecatedSince",
")",
"{",
"return",
"\"\"",
";",
"}",
"var",
"result",
"=",
"description",
"||"... | Formats the description of the property
@param description - the description of the property
@param deprecatedText - the text explaining this property is deprecated
@param deprecatedSince - the version when this property was deprecated
@returns string - the formatted description | [
"Formats",
"the",
"description",
"of",
"the",
"property"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1643-L1661 | train | Returns a string with the description of the documentation | [
30522,
3853,
1006,
6412,
1010,
2139,
28139,
12921,
18209,
1010,
2139,
28139,
12921,
11493,
3401,
1007,
1063,
2065,
1006,
999,
6412,
1004,
1004,
999,
2139,
28139,
12921,
18209,
1004,
1004,
999,
2139,
28139,
12921,
11493,
3401,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hello-mui/js/mui.js | function(x, y) {
if(x === y) {
return '';
}
if(abs(x) >= abs(y)) {
return x > 0 ? 'left' : 'right';
}
return y > 0 ? 'up' : 'down';
} | javascript | function(x, y) {
if(x === y) {
return '';
}
if(abs(x) >= abs(y)) {
return x > 0 ? 'left' : 'right';
}
return y > 0 ? 'up' : 'down';
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"x",
"===",
"y",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"abs",
"(",
"x",
")",
">=",
"abs",
"(",
"y",
")",
")",
"{",
"return",
"x",
">",
"0",
"?",
"'left'",
":",
"'right'",
";",
... | direction
@param {Object} x
@param {Object} y | [
"direction"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.js#L1220-L1228 | train | Returns the direction of the given point | [
30522,
3853,
1006,
1060,
1010,
1061,
1007,
1063,
2065,
1006,
1060,
1027,
1027,
1027,
1061,
1007,
1063,
2709,
1005,
1005,
1025,
1065,
2065,
1006,
14689,
1006,
30524,
1005,
1025,
1065,
2709,
1061,
1028,
1014,
1029,
1005,
2039,
1005,
1024,
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... | |
vuejs/vue-devtools | src/backend/index.js | processFirebaseBindings | function processFirebaseBindings (instance) {
var refs = instance.$firebaseRefs
if (refs) {
return Object.keys(refs).map(key => {
return {
type: 'firebase bindings',
key,
value: instance[key]
}
})
} else {
return []
}
} | javascript | function processFirebaseBindings (instance) {
var refs = instance.$firebaseRefs
if (refs) {
return Object.keys(refs).map(key => {
return {
type: 'firebase bindings',
key,
value: instance[key]
}
})
} else {
return []
}
} | [
"function",
"processFirebaseBindings",
"(",
"instance",
")",
"{",
"var",
"refs",
"=",
"instance",
".",
"$firebaseRefs",
"if",
"(",
"refs",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"refs",
")",
".",
"map",
"(",
"key",
"=>",
"{",
"return",
"{",
"t... | Process Firebase bindings.
@param {Vue} instance
@return {Array} | [
"Process",
"Firebase",
"bindings",
"."
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L842-L855 | train | Process firebase bindings | [
30522,
3853,
2832,
10273,
15058,
8428,
4667,
2015,
1006,
6013,
1007,
1063,
13075,
25416,
2015,
1027,
6013,
1012,
1002,
2543,
15058,
2890,
10343,
2065,
1006,
25416,
2015,
1007,
1063,
2709,
4874,
1012,
6309,
1006,
25416,
2015,
1007,
1012,
494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/3/bower_components/html5shiv/dist/html5shiv-printshiv.js | addStyleSheet | function addStyleSheet(ownerDocument, cssText) {
var p = ownerDocument.createElement('p'),
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
p.innerHTML = 'x<style>' + cssText + '</style>';
return parent.insertBefore(p.lastChild, parent.firstChild);
} | javascript | function addStyleSheet(ownerDocument, cssText) {
var p = ownerDocument.createElement('p'),
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
p.innerHTML = 'x<style>' + cssText + '</style>';
return parent.insertBefore(p.lastChild, parent.firstChild);
} | [
"function",
"addStyleSheet",
"(",
"ownerDocument",
",",
"cssText",
")",
"{",
"var",
"p",
"=",
"ownerDocument",
".",
"createElement",
"(",
"'p'",
")",
",",
"parent",
"=",
"ownerDocument",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
"||",
... | /*--------------------------------------------------------------------------
Creates a style sheet with the given CSS text and adds it to the document.
@private
@param {Document} ownerDocument The document.
@param {String} cssText The CSS text.
@returns {StyleSheet} The style element. | [
"/",
"*",
"--------------------------------------------------------------------------",
"Creates",
"a",
"style",
"sheet",
"with",
"the",
"given",
"CSS",
"text",
"and",
"adds",
"it",
"to",
"the",
"document",
"."
] | a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd | https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js#L67-L73 | train | Adds a style sheet to the page | [
30522,
3853,
9909,
27983,
4095,
15558,
1006,
3954,
3527,
24894,
4765,
1010,
20116,
13473,
18413,
1007,
1063,
13075,
1052,
1027,
3954,
3527,
24894,
4765,
1012,
3443,
12260,
3672,
1006,
1005,
1052,
1005,
1007,
1010,
6687,
1027,
3954,
3527,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ODataListBinding.js | replaceLambdaVariables | function replaceLambdaVariables(sPath, mLambdaVariableToPath) {
var aSegments = sPath.split("/");
aSegments[0] = mLambdaVariableToPath[aSegments[0]];
return aSegments[0] ? aSegments.join("/") : sPath;
} | javascript | function replaceLambdaVariables(sPath, mLambdaVariableToPath) {
var aSegments = sPath.split("/");
aSegments[0] = mLambdaVariableToPath[aSegments[0]];
return aSegments[0] ? aSegments.join("/") : sPath;
} | [
"function",
"replaceLambdaVariables",
"(",
"sPath",
",",
"mLambdaVariableToPath",
")",
"{",
"var",
"aSegments",
"=",
"sPath",
".",
"split",
"(",
"\"/\"",
")",
";",
"aSegments",
"[",
"0",
"]",
"=",
"mLambdaVariableToPath",
"[",
"aSegments",
"[",
"0",
"]",
"]"... | Replaces an optional lambda variable in the first segment of the given path by the
correct path.
@param {string} sPath The path with an optional lambda variable at the beginning
@param {object} mLambdaVariableToPath The map from lambda variable to full path
@returns {string} The path with replaced lambda variable | [
"Replaces",
"an",
"optional",
"lambda",
"variable",
"in",
"the",
"first",
"segment",
"of",
"the",
"given",
"path",
"by",
"the",
"correct",
"path",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataListBinding.js#L968-L973 | train | Replaces the given path with the corresponding value in the given map. | [
30522,
3853,
5672,
10278,
2497,
29045,
10980,
13510,
1006,
14690,
2232,
1010,
18619,
14905,
29045,
10980,
3468,
14399,
8988,
1007,
1063,
13075,
2004,
13910,
8163,
1027,
14690,
2232,
1012,
3975,
1006,
1000,
1013,
1000,
1007,
1025,
2004,
13910,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/dom/jquery/Selectors.js | getValue | function getValue(oTarget, sProperty) {
var descriptor = Object.getOwnPropertyDescriptor(oTarget, sProperty);
return descriptor && descriptor.value;
} | javascript | function getValue(oTarget, sProperty) {
var descriptor = Object.getOwnPropertyDescriptor(oTarget, sProperty);
return descriptor && descriptor.value;
} | [
"function",
"getValue",
"(",
"oTarget",
",",
"sProperty",
")",
"{",
"var",
"descriptor",
"=",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"oTarget",
",",
"sProperty",
")",
";",
"return",
"descriptor",
"&&",
"descriptor",
".",
"value",
";",
"}"
] | This module provides the following jQuery selectors:
<ul>
<li>:focusable/li>
<li>:sapFocusable</li>
<li>:sapTabbable</li>
</ul>
@namespace
@name module:sap/ui/dom/jquery/Selectors
@public
@since 1.58
Using "Object.getOwnPropertyDescriptor" to not trigger the "getter" - see jquery.sap.stubs | [
"This",
"module",
"provides",
"the",
"following",
"jQuery",
"selectors",
":",
"<ul",
">",
"<li",
">",
":",
"focusable",
"/",
"li",
">",
"<li",
">",
":",
"sapFocusable<",
"/",
"li",
">",
"<li",
">",
":",
"sapTabbable<",
"/",
"li",
">",
"<",
"/",
"ul",... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/jquery/Selectors.js#L25-L28 | train | Gets the value of a property | [
30522,
3853,
2131,
10175,
5657,
1006,
27178,
2906,
18150,
1010,
11867,
18981,
15010,
1007,
1063,
13075,
4078,
23235,
2953,
1027,
4874,
1012,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
27178,
2906,
18150,
1010,
11867,
18981,
1501... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config/config-initializer.js | processAnswers | function processAnswers(answers) {
let config = {
rules: {},
env: {},
parserOptions: {},
extends: []
};
// set the latest ECMAScript version
config.parserOptions.ecmaVersion = DEFAULT_ECMA_VERSION;
config.env.es6 = true;
config.globals = {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
};
// set the module type
if (answers.moduleType === "esm") {
config.parserOptions.sourceType = "module";
} else if (answers.moduleType === "commonjs") {
config.env.commonjs = true;
}
// add in browser and node environments if necessary
answers.env.forEach(env => {
config.env[env] = true;
});
// add in library information
if (answers.framework === "react") {
config.parserOptions.ecmaFeatures = {
jsx: true
};
config.plugins = ["react"];
} else if (answers.framework === "vue") {
config.plugins = ["vue"];
config.extends.push("plugin:vue/essential");
}
// setup rules based on problems/style enforcement preferences
if (answers.purpose === "problems") {
config.extends.unshift("eslint:recommended");
} else if (answers.purpose === "style") {
if (answers.source === "prompt") {
config.extends.unshift("eslint:recommended");
config.rules.indent = ["error", answers.indent];
config.rules.quotes = ["error", answers.quotes];
config.rules["linebreak-style"] = ["error", answers.linebreak];
config.rules.semi = ["error", answers.semi ? "always" : "never"];
} else if (answers.source === "auto") {
config = configureRules(answers, config);
config = autoconfig.extendFromRecommended(config);
}
}
// normalize extends
if (config.extends.length === 0) {
delete config.extends;
} else if (config.extends.length === 1) {
config.extends = config.extends[0];
}
ConfigOps.normalizeToStrings(config);
return config;
} | javascript | function processAnswers(answers) {
let config = {
rules: {},
env: {},
parserOptions: {},
extends: []
};
// set the latest ECMAScript version
config.parserOptions.ecmaVersion = DEFAULT_ECMA_VERSION;
config.env.es6 = true;
config.globals = {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
};
// set the module type
if (answers.moduleType === "esm") {
config.parserOptions.sourceType = "module";
} else if (answers.moduleType === "commonjs") {
config.env.commonjs = true;
}
// add in browser and node environments if necessary
answers.env.forEach(env => {
config.env[env] = true;
});
// add in library information
if (answers.framework === "react") {
config.parserOptions.ecmaFeatures = {
jsx: true
};
config.plugins = ["react"];
} else if (answers.framework === "vue") {
config.plugins = ["vue"];
config.extends.push("plugin:vue/essential");
}
// setup rules based on problems/style enforcement preferences
if (answers.purpose === "problems") {
config.extends.unshift("eslint:recommended");
} else if (answers.purpose === "style") {
if (answers.source === "prompt") {
config.extends.unshift("eslint:recommended");
config.rules.indent = ["error", answers.indent];
config.rules.quotes = ["error", answers.quotes];
config.rules["linebreak-style"] = ["error", answers.linebreak];
config.rules.semi = ["error", answers.semi ? "always" : "never"];
} else if (answers.source === "auto") {
config = configureRules(answers, config);
config = autoconfig.extendFromRecommended(config);
}
}
// normalize extends
if (config.extends.length === 0) {
delete config.extends;
} else if (config.extends.length === 1) {
config.extends = config.extends[0];
}
ConfigOps.normalizeToStrings(config);
return config;
} | [
"function",
"processAnswers",
"(",
"answers",
")",
"{",
"let",
"config",
"=",
"{",
"rules",
":",
"{",
"}",
",",
"env",
":",
"{",
"}",
",",
"parserOptions",
":",
"{",
"}",
",",
"extends",
":",
"[",
"]",
"}",
";",
"// set the latest ECMAScript version",
... | process user's answers and create config object
@param {Object} answers answers received from inquirer
@returns {Object} config object | [
"process",
"user",
"s",
"answers",
"and",
"create",
"config",
"object"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-initializer.js#L245-L309 | train | Process the answers of the process | [
30522,
3853,
2832,
6962,
13777,
2015,
1006,
6998,
1007,
1063,
2292,
9530,
8873,
2290,
1027,
1063,
3513,
1024,
1063,
1065,
1010,
4372,
2615,
1024,
1063,
1065,
1010,
11968,
8043,
7361,
9285,
1024,
1063,
1065,
1010,
8908,
1024,
1031,
1033,
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... |
GeekyAnts/vue-native-core | src/platforms/weex/framework.js | callFunction | function callFunction (globalObjects, body) {
const globalKeys = []
const globalValues = []
for (const key in globalObjects) {
globalKeys.push(key)
globalValues.push(globalObjects[key])
}
globalKeys.push(body)
const result = new Function(...globalKeys)
return result(...globalValues)
} | javascript | function callFunction (globalObjects, body) {
const globalKeys = []
const globalValues = []
for (const key in globalObjects) {
globalKeys.push(key)
globalValues.push(globalObjects[key])
}
globalKeys.push(body)
const result = new Function(...globalKeys)
return result(...globalValues)
} | [
"function",
"callFunction",
"(",
"globalObjects",
",",
"body",
")",
"{",
"const",
"globalKeys",
"=",
"[",
"]",
"const",
"globalValues",
"=",
"[",
"]",
"for",
"(",
"const",
"key",
"in",
"globalObjects",
")",
"{",
"globalKeys",
".",
"push",
"(",
"key",
")"... | Call a new function body with some global objects.
@param {object} globalObjects
@param {string} code
@return {any} | [
"Call",
"a",
"new",
"function",
"body",
"with",
"some",
"global",
"objects",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/weex/framework.js#L357-L368 | train | Call a function | [
30522,
3853,
2655,
11263,
27989,
1006,
3795,
16429,
20614,
2015,
1010,
2303,
1007,
1063,
9530,
3367,
3795,
14839,
2015,
1027,
1031,
1033,
9530,
3367,
3795,
10175,
15808,
1027,
1031,
1033,
2005,
1006,
9530,
3367,
3145,
1999,
3795,
16429,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/StringMatch.js | _wholeStringSearch | function _wholeStringSearch(queryLower, compareLower, originalQuery, originalStr, specials, lastSegmentSpecialsIndex) {
var lastSegmentStart = specials[lastSegmentSpecialsIndex];
var result;
var matchList;
result = _lastSegmentSearch(queryLower, compareLower, originalQuery, originalStr, specials, lastSegmentSpecialsIndex, lastSegmentStart);
if (result) {
matchList = result.matchList;
// Do we have more query characters that did not fit?
if (result.remainder) {
// Scan with the remainder only through the beginning of the last segment
var remainderMatchList = _generateMatchList(result.remainder,
compareLower.substring(0, lastSegmentStart),
result.originalRemainder,
originalStr.substring(0, lastSegmentStart),
specials.slice(0, lastSegmentSpecialsIndex), 0);
if (remainderMatchList) {
// add the new matched ranges to the beginning of the set of ranges we had
matchList.unshift.apply(matchList, remainderMatchList);
} else {
// no match
return null;
}
}
} else {
// No match in the last segment, so we start over searching the whole
// string
matchList = _generateMatchList(queryLower, compareLower, originalQuery, originalStr, specials, 0);
}
return matchList;
} | javascript | function _wholeStringSearch(queryLower, compareLower, originalQuery, originalStr, specials, lastSegmentSpecialsIndex) {
var lastSegmentStart = specials[lastSegmentSpecialsIndex];
var result;
var matchList;
result = _lastSegmentSearch(queryLower, compareLower, originalQuery, originalStr, specials, lastSegmentSpecialsIndex, lastSegmentStart);
if (result) {
matchList = result.matchList;
// Do we have more query characters that did not fit?
if (result.remainder) {
// Scan with the remainder only through the beginning of the last segment
var remainderMatchList = _generateMatchList(result.remainder,
compareLower.substring(0, lastSegmentStart),
result.originalRemainder,
originalStr.substring(0, lastSegmentStart),
specials.slice(0, lastSegmentSpecialsIndex), 0);
if (remainderMatchList) {
// add the new matched ranges to the beginning of the set of ranges we had
matchList.unshift.apply(matchList, remainderMatchList);
} else {
// no match
return null;
}
}
} else {
// No match in the last segment, so we start over searching the whole
// string
matchList = _generateMatchList(queryLower, compareLower, originalQuery, originalStr, specials, 0);
}
return matchList;
} | [
"function",
"_wholeStringSearch",
"(",
"queryLower",
",",
"compareLower",
",",
"originalQuery",
",",
"originalStr",
",",
"specials",
",",
"lastSegmentSpecialsIndex",
")",
"{",
"var",
"lastSegmentStart",
"=",
"specials",
"[",
"lastSegmentSpecialsIndex",
"]",
";",
"var"... | /*
Implements the top-level search algorithm. Search the last segment first,
then search the rest of the string with the remainder.
The parameters and return value are the same as for getMatchRanges.
@param {string} queryLower the search string (will be searched lower case)
@param {string} compareLower the lower-cased string to search
@param {string} originalQuery the "non-normalized" query string (used to detect case match priority)
@param {string} originalStr the "non-normalized" string to compare with (used to detect case match priority)
@param {Array} specials list of special indexes in str (from findSpecialCharacters)
@param {int} lastSegmentSpecialsIndex index into specials array to start scanning with
@return {Array.<SpecialMatch|NormalMatch>} matched indexes or null if no matches possible | [
"/",
"*",
"Implements",
"the",
"top",
"-",
"level",
"search",
"algorithm",
".",
"Search",
"the",
"last",
"segment",
"first",
"then",
"search",
"the",
"rest",
"of",
"the",
"string",
"with",
"the",
"remainder",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/StringMatch.js#L463-L497 | train | Search the whole string in the string | [
30522,
3853,
1035,
2878,
3367,
4892,
17310,
11140,
1006,
23032,
27663,
2099,
1010,
12826,
27663,
2099,
1010,
2434,
4226,
2854,
1010,
23728,
16344,
1010,
19247,
1010,
16180,
13910,
8163,
5051,
13247,
11493,
3207,
2595,
1007,
1063,
13075,
16180... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/code-prettify | js-modules/run_prettify.js | contentLoaded | function contentLoaded(callback) {
var addEventListener = doc['addEventListener'];
var done = false, top = true,
add = addEventListener ? 'addEventListener' : 'attachEvent',
rem = addEventListener ? 'removeEventListener' : 'detachEvent',
pre = addEventListener ? '' : 'on',
init = function(e) {
if (e.type == 'readystatechange' && doc.readyState != 'complete') {
return;
}
(e.type == 'load' ? win : doc)[rem](pre + e.type, init, false);
if (!done && (done = true)) { callback.call(win, e.type || e); }
},
poll = function() {
try {
root.doScroll('left');
} catch(e) {
win.setTimeout(poll, 50);
return;
}
init('poll');
};
if (doc.readyState == 'complete') {
callback.call(win, 'lazy');
} else {
if (doc.createEventObject && root.doScroll) {
try { top = !win.frameElement; } catch(e) { }
if (top) { poll(); }
}
doc[add](pre + 'DOMContentLoaded', init, false);
doc[add](pre + 'readystatechange', init, false);
win[add](pre + 'load', init, false);
}
} | javascript | function contentLoaded(callback) {
var addEventListener = doc['addEventListener'];
var done = false, top = true,
add = addEventListener ? 'addEventListener' : 'attachEvent',
rem = addEventListener ? 'removeEventListener' : 'detachEvent',
pre = addEventListener ? '' : 'on',
init = function(e) {
if (e.type == 'readystatechange' && doc.readyState != 'complete') {
return;
}
(e.type == 'load' ? win : doc)[rem](pre + e.type, init, false);
if (!done && (done = true)) { callback.call(win, e.type || e); }
},
poll = function() {
try {
root.doScroll('left');
} catch(e) {
win.setTimeout(poll, 50);
return;
}
init('poll');
};
if (doc.readyState == 'complete') {
callback.call(win, 'lazy');
} else {
if (doc.createEventObject && root.doScroll) {
try { top = !win.frameElement; } catch(e) { }
if (top) { poll(); }
}
doc[add](pre + 'DOMContentLoaded', init, false);
doc[add](pre + 'readystatechange', init, false);
win[add](pre + 'load', init, false);
}
} | [
"function",
"contentLoaded",
"(",
"callback",
")",
"{",
"var",
"addEventListener",
"=",
"doc",
"[",
"'addEventListener'",
"]",
";",
"var",
"done",
"=",
"false",
",",
"top",
"=",
"true",
",",
"add",
"=",
"addEventListener",
"?",
"'addEventListener'",
":",
"'a... | From http://javascript.nwbox.com/ContentLoaded/contentloaded.js Author: Diego Perini (diego.perini at gmail.com) Summary: cross-browser wrapper for DOMContentLoaded Updated: 20101020 License: MIT Version: 1.2 | [
"From",
"http",
":",
"//",
"javascript",
".",
"nwbox",
".",
"com",
"/",
"ContentLoaded",
"/",
"contentloaded",
".",
"js",
"Author",
":",
"Diego",
"Perini",
"(",
"diego",
".",
"perini",
"at",
"gmail",
".",
"com",
")",
"Summary",
":",
"cross",
"-",
"brow... | e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc | https://github.com/google/code-prettify/blob/e14ed1c3c40f78fca2a11af4cb0fa251f6f997fc/js-modules/run_prettify.js#L82-L118 | train | contentLoaded - callback | [
30522,
3853,
4180,
17468,
1006,
2655,
5963,
1007,
1063,
13075,
5587,
18697,
3372,
9863,
24454,
1027,
9986,
1031,
1005,
5587,
18697,
3372,
9863,
24454,
1005,
1033,
1025,
13075,
2589,
1027,
6270,
1010,
2327,
1027,
2995,
1010,
5587,
1027,
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... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js | function(oNodeList) {
var aNodeValues = [];
var xPath = AnnotationParser._oXPath;
for (var i = 0; i < oNodeList.length; ++i) {
var oNode = xPath.nextNode(oNodeList, i);
var vNodeValue = AnnotationParser.getPropertyValues(oNode);
var sType = oNode.getAttribute("Type");
if (sType) {
vNodeValue["RecordType"] = AnnotationParser.replaceWithAlias(sType);
}
aNodeValues.push(vNodeValue);
}
return aNodeValues;
} | javascript | function(oNodeList) {
var aNodeValues = [];
var xPath = AnnotationParser._oXPath;
for (var i = 0; i < oNodeList.length; ++i) {
var oNode = xPath.nextNode(oNodeList, i);
var vNodeValue = AnnotationParser.getPropertyValues(oNode);
var sType = oNode.getAttribute("Type");
if (sType) {
vNodeValue["RecordType"] = AnnotationParser.replaceWithAlias(sType);
}
aNodeValues.push(vNodeValue);
}
return aNodeValues;
} | [
"function",
"(",
"oNodeList",
")",
"{",
"var",
"aNodeValues",
"=",
"[",
"]",
";",
"var",
"xPath",
"=",
"AnnotationParser",
".",
"_oXPath",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"oNodeList",
".",
"length",
";",
"++",
"i",
")",
"{",
... | /*
Returns a property value object for the given nodes
@param {XPathResult} oNodeList - As many nodes as should be checked for Record values
@return {object|object[]} The extracted values
@static
@private | [
"/",
"*",
"Returns",
"a",
"property",
"value",
"object",
"for",
"the",
"given",
"nodes"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L856-L873 | train | Returns the values of all the nodes in the given NodeList | [
30522,
3853,
1006,
21058,
9247,
2923,
1007,
1063,
13075,
2019,
10244,
10175,
15808,
1027,
1031,
1033,
1025,
13075,
26726,
8988,
1027,
5754,
17287,
3508,
19362,
8043,
1012,
1035,
23060,
15069,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/no-var.js | canFix | function canFix(node) {
const variables = context.getDeclaredVariables(node);
const scopeNode = getScopeNode(node);
if (node.parent.type === "SwitchCase" ||
node.declarations.some(hasSelfReferenceInTDZ) ||
variables.some(isGlobal) ||
variables.some(isRedeclared) ||
variables.some(isUsedFromOutsideOf(scopeNode))
) {
return false;
}
if (astUtils.isInLoop(node)) {
if (variables.some(isReferencedInClosure)) {
return false;
}
if (!isLoopAssignee(node) && !isDeclarationInitialized(node)) {
return false;
}
}
if (
!isLoopAssignee(node) &&
!(node.parent.type === "ForStatement" && node.parent.init === node) &&
!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)
) {
// If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed.
return false;
}
return true;
} | javascript | function canFix(node) {
const variables = context.getDeclaredVariables(node);
const scopeNode = getScopeNode(node);
if (node.parent.type === "SwitchCase" ||
node.declarations.some(hasSelfReferenceInTDZ) ||
variables.some(isGlobal) ||
variables.some(isRedeclared) ||
variables.some(isUsedFromOutsideOf(scopeNode))
) {
return false;
}
if (astUtils.isInLoop(node)) {
if (variables.some(isReferencedInClosure)) {
return false;
}
if (!isLoopAssignee(node) && !isDeclarationInitialized(node)) {
return false;
}
}
if (
!isLoopAssignee(node) &&
!(node.parent.type === "ForStatement" && node.parent.init === node) &&
!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)
) {
// If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed.
return false;
}
return true;
} | [
"function",
"canFix",
"(",
"node",
")",
"{",
"const",
"variables",
"=",
"context",
".",
"getDeclaredVariables",
"(",
"node",
")",
";",
"const",
"scopeNode",
"=",
"getScopeNode",
"(",
"node",
")",
";",
"if",
"(",
"node",
".",
"parent",
".",
"type",
"===",... | Checks whether it can fix a given variable declaration or not.
It cannot fix if the following cases:
- A variable is a global variable.
- A variable is declared on a SwitchCase node.
- A variable is redeclared.
- A variable is used from outside the scope.
- A variable is used from a closure within a loop.
- A variable might be used before it is assigned within a loop.
- A variable might be used in TDZ.
- A variable is declared in statement position (e.g. a single-line `IfStatement`)
## A variable is declared on a SwitchCase node.
If this rule modifies 'var' declarations on a SwitchCase node, it
would generate the warnings of 'no-case-declarations' rule. And the
'eslint:recommended' preset includes 'no-case-declarations' rule, so
this rule doesn't modify those declarations.
## A variable is redeclared.
The language spec disallows redeclarations of `let` declarations.
Those variables would cause syntax errors.
## A variable is used from outside the scope.
The language spec disallows accesses from outside of the scope for
`let` declarations. Those variables would cause reference errors.
## A variable is used from a closure within a loop.
A `var` declaration within a loop shares the same variable instance
across all loop iterations, while a `let` declaration creates a new
instance for each iteration. This means if a variable in a loop is
referenced by any closure, changing it from `var` to `let` would
change the behavior in a way that is generally unsafe.
## A variable might be used before it is assigned within a loop.
Within a loop, a `let` declaration without an initializer will be
initialized to null, while a `var` declaration will retain its value
from the previous iteration, so it is only safe to change `var` to
`let` if we can statically determine that the variable is always
assigned a value before its first access in the loop body. To keep
the implementation simple, we only convert `var` to `let` within
loops when the variable is a loop assignee or the declaration has an
initializer.
@param {ASTNode} node - A variable declaration node to check.
@returns {boolean} `true` if it can fix the node. | [
"Checks",
"whether",
"it",
"can",
"fix",
"a",
"given",
"variable",
"declaration",
"or",
"not",
".",
"It",
"cannot",
"fix",
"if",
"the",
"following",
"cases",
":"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L266-L299 | train | Check if the node can be fixed | [
30522,
3853,
2064,
8873,
2595,
1006,
13045,
1007,
1063,
9530,
3367,
10857,
1027,
6123,
1012,
2131,
3207,
20464,
12069,
2094,
10755,
19210,
2015,
1006,
13045,
1007,
1025,
9530,
3367,
9531,
3630,
3207,
1027,
4152,
16186,
3630,
3207,
1006,
130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js | function(sControllerName, vObject) {
var oResultConfig;
findConfig(CONFIG_CONTROLLER_REPLACEMENTS, vObject, function(oConfig) {
oResultConfig = oConfig[sControllerName];
return !!oResultConfig;
});
return oResultConfig;
} | javascript | function(sControllerName, vObject) {
var oResultConfig;
findConfig(CONFIG_CONTROLLER_REPLACEMENTS, vObject, function(oConfig) {
oResultConfig = oConfig[sControllerName];
return !!oResultConfig;
});
return oResultConfig;
} | [
"function",
"(",
"sControllerName",
",",
"vObject",
")",
"{",
"var",
"oResultConfig",
";",
"findConfig",
"(",
"CONFIG_CONTROLLER_REPLACEMENTS",
",",
"vObject",
",",
"function",
"(",
"oConfig",
")",
"{",
"oResultConfig",
"=",
"oConfig",
"[",
"sControllerName",
"]",... | returns the configuration of the controller replacement for the given
controller name
@private | [
"returns",
"the",
"configuration",
"of",
"the",
"controller",
"replacement",
"for",
"the",
"given",
"controller",
"name"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L199-L206 | train | Returns the configuration for the controller replacement | [
30522,
3853,
1006,
8040,
12162,
26611,
18442,
1010,
30524,
8873,
2290,
1025,
2424,
8663,
8873,
2290,
1006,
9530,
8873,
2290,
1035,
11486,
1035,
23936,
1010,
29536,
2497,
20614,
1010,
3853,
1006,
1051,
8663,
8873,
2290,
1007,
1063,
10848,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js | function () {
var that = this;
var oDialog = new Dialog({
title: "{i18n>confirmDeletionTitle}",
type: "Message",
content: new Text({text: "{i18n>questionFileDeletion}"}),
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Reject,
press: function () {
oDialog.close();
that._selectTransportAndDeleteFile();
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
} | javascript | function () {
var that = this;
var oDialog = new Dialog({
title: "{i18n>confirmDeletionTitle}",
type: "Message",
content: new Text({text: "{i18n>questionFileDeletion}"}),
beginButton: new Button({
text: "{i18n>confirm}",
type: ButtonType.Reject,
press: function () {
oDialog.close();
that._selectTransportAndDeleteFile();
}
}),
endButton: new Button({
text: "{i18n>cancel}",
press: function () {
oDialog.close();
}
}),
afterClose: function () {
oDialog.destroy();
}
});
this.getView().addDependent(oDialog);
oDialog.open();
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oDialog",
"=",
"new",
"Dialog",
"(",
"{",
"title",
":",
"\"{i18n>confirmDeletionTitle}\"",
",",
"type",
":",
"\"Message\"",
",",
"content",
":",
"new",
"Text",
"(",
"{",
"text",
":",
"... | Handles the deletion button;
The function displays a confirmation dialog. On confirmation, the deletion of the displayed content is triggered.
@public | [
"Handles",
"the",
"deletion",
"button",
";",
"The",
"function",
"displays",
"a",
"confirmation",
"dialog",
".",
"On",
"confirmation",
"the",
"deletion",
"of",
"the",
"displayed",
"content",
"is",
"triggered",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js#L161-L190 | train | Creates a dialog that will confirm deletion of a file | [
30522,
3853,
1006,
1007,
1063,
13075,
2008,
1027,
2023,
1025,
13075,
21045,
23067,
2290,
1027,
2047,
13764,
8649,
1006,
1063,
2516,
1024,
1000,
1063,
1045,
15136,
2078,
1028,
12210,
9247,
20624,
12162,
4183,
2571,
1065,
1000,
1010,
2828,
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... | |
zeit/pkg | prelude/bootstrap.js | findNativeAddonForExists | function findNativeAddonForExists (path) {
var foundPath = findNativeAddonSyncFreeFromRequire(path);
if (!foundPath) return false;
return ancestor.existsSync.call(fs, foundPath);
} | javascript | function findNativeAddonForExists (path) {
var foundPath = findNativeAddonSyncFreeFromRequire(path);
if (!foundPath) return false;
return ancestor.existsSync.call(fs, foundPath);
} | [
"function",
"findNativeAddonForExists",
"(",
"path",
")",
"{",
"var",
"foundPath",
"=",
"findNativeAddonSyncFreeFromRequire",
"(",
"path",
")",
";",
"if",
"(",
"!",
"foundPath",
")",
"return",
"false",
";",
"return",
"ancestor",
".",
"existsSync",
".",
"call",
... | /////////////////////////////////////////////////////////////// exists //////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// | [
"///////////////////////////////////////////////////////////////",
"exists",
"////////////////////////////////////////////////////////",
"///////////////////////////////////////////////////////////////"
] | 3775ab6decc2f8f013142e1282934c12fbd1881e | https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L1003-L1007 | train | Find a native add - on | [
30522,
3853,
2424,
19833,
3512,
4215,
5280,
29278,
10288,
5130,
1006,
4130,
1007,
1063,
13075,
2179,
15069,
1027,
2424,
19833,
3512,
4215,
5280,
6508,
12273,
23301,
19699,
5358,
2890,
15549,
2890,
1006,
4130,
1007,
1025,
2065,
1006,
999,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/file/FileUtils.js | getNativeBracketsDirectoryPath | function getNativeBracketsDirectoryPath() {
var pathname = decodeURI(window.location.pathname);
var directory = pathname.substr(0, pathname.lastIndexOf("/"));
return convertToNativePath(directory);
} | javascript | function getNativeBracketsDirectoryPath() {
var pathname = decodeURI(window.location.pathname);
var directory = pathname.substr(0, pathname.lastIndexOf("/"));
return convertToNativePath(directory);
} | [
"function",
"getNativeBracketsDirectoryPath",
"(",
")",
"{",
"var",
"pathname",
"=",
"decodeURI",
"(",
"window",
".",
"location",
".",
"pathname",
")",
";",
"var",
"directory",
"=",
"pathname",
".",
"substr",
"(",
"0",
",",
"pathname",
".",
"lastIndexOf",
"(... | Returns a native absolute path to the 'brackets' source directory.
Note that this only works when run in brackets/src/index.html, so it does
not work for unit tests (which is run from brackets/test/SpecRunner.html)
WARNING: unlike most paths in Brackets, this path EXCLUDES the trailing "/".
@return {string} | [
"Returns",
"a",
"native",
"absolute",
"path",
"to",
"the",
"brackets",
"source",
"directory",
".",
"Note",
"that",
"this",
"only",
"works",
"when",
"run",
"in",
"brackets",
"/",
"src",
"/",
"index",
".",
"html",
"so",
"it",
"does",
"not",
"work",
"for",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/file/FileUtils.js#L304-L308 | train | Get the native path to the brackets directory | [
30522,
3853,
2131,
19833,
3512,
10024,
30524,
3367,
2099,
1006,
1014,
1010,
4130,
18442,
1012,
2197,
22254,
10288,
11253,
1006,
1000,
1013,
1000,
1007,
1007,
1025,
2709,
10463,
2669,
8082,
15069,
1006,
14176,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
graphql/graphiql | src/components/GraphiQL.js | observableToPromise | function observableToPromise(observable) {
if (!isObservable(observable)) {
return observable;
}
return new Promise((resolve, reject) => {
const subscription = observable.subscribe(
v => {
resolve(v);
subscription.unsubscribe();
},
reject,
() => {
reject(new Error('no value resolved'));
},
);
});
} | javascript | function observableToPromise(observable) {
if (!isObservable(observable)) {
return observable;
}
return new Promise((resolve, reject) => {
const subscription = observable.subscribe(
v => {
resolve(v);
subscription.unsubscribe();
},
reject,
() => {
reject(new Error('no value resolved'));
},
);
});
} | [
"function",
"observableToPromise",
"(",
"observable",
")",
"{",
"if",
"(",
"!",
"isObservable",
"(",
"observable",
")",
")",
"{",
"return",
"observable",
";",
"}",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"... | Duck-type Observable.take(1).toPromise() | [
"Duck",
"-",
"type",
"Observable",
".",
"take",
"(",
"1",
")",
".",
"toPromise",
"()"
] | 5d0f31d6059edc5f816edba3962c3b57fdabd478 | https://github.com/graphql/graphiql/blob/5d0f31d6059edc5f816edba3962c3b57fdabd478/src/components/GraphiQL.js#L1066-L1082 | train | Returns a promise that resolves to the value of the given observable. | [
30522,
3853,
27885,
8043,
12423,
14399,
21716,
5562,
1006,
27885,
8043,
12423,
1007,
1063,
2065,
1006,
999,
11163,
5910,
2121,
12423,
1006,
27885,
8043,
12423,
1007,
1007,
1063,
2709,
27885,
8043,
12423,
1025,
1065,
2709,
2047,
4872,
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... |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | finiteLinesIntersect | function finiteLinesIntersect(x1, y1, x2, y2, x3, y3, x4, y4, infiniteLines) {
var dx13 = x1 - x3;
var dx21 = x2 - x1;
var dx43 = x4 - x3;
var dy13 = y1 - y3;
var dy21 = y2 - y1;
var dy43 = y4 - y3;
var ua_t = dx43 * dy13 - dy43 * dx13;
var ub_t = dx21 * dy13 - dy21 * dx13;
var u_b = dy43 * dx21 - dx43 * dy21;
if (u_b !== 0) {
var ua = ua_t / u_b;
var ub = ub_t / u_b;
var flptThreshold = 0.001;
var _min = 0 - flptThreshold;
var _max = 1 + flptThreshold;
if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) {
return [x1 + ua * dx21, y1 + ua * dy21];
} else {
if (!infiniteLines) {
return [];
} else {
return [x1 + ua * dx21, y1 + ua * dy21];
}
}
} else {
if (ua_t === 0 || ub_t === 0) {
// Parallel, coincident lines. Check if overlap
// Check endpoint of second line
if (midOfThree(x1, x2, x4) === x4) {
return [x4, y4];
} // Check start point of second line
if (midOfThree(x1, x2, x3) === x3) {
return [x3, y3];
} // Endpoint of first line
if (midOfThree(x3, x4, x2) === x2) {
return [x2, y2];
}
return [];
} else {
// Parallel, non-coincident
return [];
}
}
} | javascript | function finiteLinesIntersect(x1, y1, x2, y2, x3, y3, x4, y4, infiniteLines) {
var dx13 = x1 - x3;
var dx21 = x2 - x1;
var dx43 = x4 - x3;
var dy13 = y1 - y3;
var dy21 = y2 - y1;
var dy43 = y4 - y3;
var ua_t = dx43 * dy13 - dy43 * dx13;
var ub_t = dx21 * dy13 - dy21 * dx13;
var u_b = dy43 * dx21 - dx43 * dy21;
if (u_b !== 0) {
var ua = ua_t / u_b;
var ub = ub_t / u_b;
var flptThreshold = 0.001;
var _min = 0 - flptThreshold;
var _max = 1 + flptThreshold;
if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) {
return [x1 + ua * dx21, y1 + ua * dy21];
} else {
if (!infiniteLines) {
return [];
} else {
return [x1 + ua * dx21, y1 + ua * dy21];
}
}
} else {
if (ua_t === 0 || ub_t === 0) {
// Parallel, coincident lines. Check if overlap
// Check endpoint of second line
if (midOfThree(x1, x2, x4) === x4) {
return [x4, y4];
} // Check start point of second line
if (midOfThree(x1, x2, x3) === x3) {
return [x3, y3];
} // Endpoint of first line
if (midOfThree(x3, x4, x2) === x2) {
return [x2, y2];
}
return [];
} else {
// Parallel, non-coincident
return [];
}
}
} | [
"function",
"finiteLinesIntersect",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"x3",
",",
"y3",
",",
"x4",
",",
"y4",
",",
"infiniteLines",
")",
"{",
"var",
"dx13",
"=",
"x1",
"-",
"x3",
";",
"var",
"dx21",
"=",
"x2",
"-",
"x1",
";",
"var... | (x1,y1)=>(x2,y2) intersect with (x3,y3)=>(x4,y4) | [
"(",
"x1",
"y1",
")",
"=",
">",
"(",
"x2",
"y2",
")",
"intersect",
"with",
"(",
"x3",
"y3",
")",
"=",
">",
"(",
"x4",
"y4",
")"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L3001-L3054 | train | Determine if two finite lines intersect | [
30522,
3853,
10713,
12735,
18447,
2545,
22471,
1006,
1060,
2487,
1010,
1061,
2487,
1010,
1060,
2475,
1010,
1061,
2475,
1010,
1060,
2509,
1010,
1061,
2509,
1010,
1060,
2549,
1010,
1061,
2549,
1010,
10709,
12735,
1007,
1063,
13075,
1040,
2595... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onCopyLastUser | function onCopyLastUser() {
// If last user is null, NULL_USER error will be thrown.
auth.updateCurrentUser(lastUser).then(function() {
alertSuccess('Copied last user to Auth');
}, function(error) {
alertError('Error: ' + error.code);
});
} | javascript | function onCopyLastUser() {
// If last user is null, NULL_USER error will be thrown.
auth.updateCurrentUser(lastUser).then(function() {
alertSuccess('Copied last user to Auth');
}, function(error) {
alertError('Error: ' + error.code);
});
} | [
"function",
"onCopyLastUser",
"(",
")",
"{",
"// If last user is null, NULL_USER error will be thrown.",
"auth",
".",
"updateCurrentUser",
"(",
"lastUser",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"alertSuccess",
"(",
"'Copied last user to Auth'",
")",
";",
"... | Copy last user to auth. | [
"Copy",
"last",
"user",
"to",
"auth",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1289-L1296 | train | Copy last user to auth | [
30522,
3853,
2006,
3597,
7685,
8523,
5809,
2121,
1006,
1007,
1063,
1013,
1013,
2065,
2197,
5310,
2003,
19701,
1010,
19701,
1035,
5310,
7561,
2097,
2022,
6908,
1012,
8740,
2705,
1012,
10651,
10841,
14343,
3372,
20330,
1006,
2197,
20330,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js | function (sNamespace) {
if (!sNamespace) {
return "";
}
if (sNamespace[0] === "/") {
var sNamespaceWithoutLeadingSlash = sNamespace.substring(1, sNamespace.length);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutLeadingSlash);
}
if (sNamespace[sNamespace.length - 1] === "/") {
var sNamespaceWithoutTrailingSlash = sNamespace.substring(0, sNamespace.length - 1);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutTrailingSlash);
}
return sNamespace;
} | javascript | function (sNamespace) {
if (!sNamespace) {
return "";
}
if (sNamespace[0] === "/") {
var sNamespaceWithoutLeadingSlash = sNamespace.substring(1, sNamespace.length);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutLeadingSlash);
}
if (sNamespace[sNamespace.length - 1] === "/") {
var sNamespaceWithoutTrailingSlash = sNamespace.substring(0, sNamespace.length - 1);
return this.cleanLeadingAndTrailingSlashes(sNamespaceWithoutTrailingSlash);
}
return sNamespace;
} | [
"function",
"(",
"sNamespace",
")",
"{",
"if",
"(",
"!",
"sNamespace",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"sNamespace",
"[",
"0",
"]",
"===",
"\"/\"",
")",
"{",
"var",
"sNamespaceWithoutLeadingSlash",
"=",
"sNamespace",
".",
"substring",
"(... | Removes leading and trailing slashes from a string.
@param {String} sNamespace - input string
@returns {String} - string after removing leading and trailing slashes
@public | [
"Removes",
"leading",
"and",
"trailing",
"slashes",
"from",
"a",
"string",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js#L102-L115 | train | Returns the namespace of the given namespace | [
30522,
3853,
1006,
1055,
18442,
23058,
1007,
1063,
2065,
1006,
999,
1055,
18442,
23058,
1007,
1063,
2709,
1000,
1000,
1025,
1065,
2065,
1006,
1055,
18442,
23058,
1031,
1014,
1033,
1027,
1027,
1027,
1000,
1013,
1000,
1007,
1063,
13075,
1055,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/autocomplete/demoFloatingLabel/script.js | loadAll | function loadAll() {
var allStates = 'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware,\
Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana,\
Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana,\
Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina,\
North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina,\
South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia,\
Wisconsin, Wyoming';
return allStates.split(/, +/g).map(function (state) {
return {
value: state.toLowerCase(),
display: state
};
});
} | javascript | function loadAll() {
var allStates = 'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware,\
Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana,\
Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana,\
Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina,\
North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina,\
South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia,\
Wisconsin, Wyoming';
return allStates.split(/, +/g).map(function (state) {
return {
value: state.toLowerCase(),
display: state
};
});
} | [
"function",
"loadAll",
"(",
")",
"{",
"var",
"allStates",
"=",
"'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware,\\\n Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana,\\\n Maine, Maryland, Massachusetts, M... | Build `states` list of key/value pairs | [
"Build",
"states",
"list",
"of",
"key",
"/",
"value",
"pairs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/demoFloatingLabel/script.js#L34-L49 | train | Load all the states | [
30522,
3853,
7170,
8095,
1006,
1007,
1063,
13075,
2035,
9153,
4570,
1027,
1005,
6041,
1010,
7397,
1010,
5334,
1010,
6751,
1010,
2662,
1010,
5169,
1010,
6117,
1010,
8452,
1010,
1032,
3516,
1010,
4108,
1010,
7359,
1010,
9795,
1010,
4307,
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... |
google/closure-library | closure/goog/html/sanitizer/noclobber.js | setCssProperty | function setCssProperty(cssStyle, propName, sanitizedValue) {
genericMethodCall(
Methods.SET_PROPERTY, cssStyle,
cssStyle.setProperty ? 'setProperty' : 'setAttribute',
[propName, sanitizedValue]);
} | javascript | function setCssProperty(cssStyle, propName, sanitizedValue) {
genericMethodCall(
Methods.SET_PROPERTY, cssStyle,
cssStyle.setProperty ? 'setProperty' : 'setAttribute',
[propName, sanitizedValue]);
} | [
"function",
"setCssProperty",
"(",
"cssStyle",
",",
"propName",
",",
"sanitizedValue",
")",
"{",
"genericMethodCall",
"(",
"Methods",
".",
"SET_PROPERTY",
",",
"cssStyle",
",",
"cssStyle",
".",
"setProperty",
"?",
"'setProperty'",
":",
"'setAttribute'",
",",
"[",
... | Provides a cross-browser way to set a CSS value on a CSS declaration.
@param {!CSSStyleDeclaration} cssStyle A CSS style object.
@param {string} propName A property name.
@param {string} sanitizedValue Sanitized value of the property to be set
on the CSS style object.
@supported IE8 and newer. | [
"Provides",
"a",
"cross",
"-",
"browser",
"way",
"to",
"set",
"a",
"CSS",
"value",
"on",
"a",
"CSS",
"declaration",
"."
] | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L437-L442 | train | Sets a CSS property to a value | [
30522,
3853,
2275,
6169,
13102,
18981,
15010,
1006,
20116,
4757,
27983,
1010,
17678,
18442,
1010,
2624,
25090,
5422,
10175,
5657,
1007,
1063,
12391,
11368,
6806,
16409,
8095,
1006,
4725,
1012,
2275,
1035,
3200,
1010,
20116,
4757,
27983,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/ProjectManager.js | _documentSelectionFocusChange | function _documentSelectionFocusChange() {
var curFullPath = MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE);
if (curFullPath && _hasFileSelectionFocus()) {
actionCreator.setSelected(curFullPath, true);
} else {
actionCreator.setSelected(null);
}
_fileViewControllerChange();
} | javascript | function _documentSelectionFocusChange() {
var curFullPath = MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE);
if (curFullPath && _hasFileSelectionFocus()) {
actionCreator.setSelected(curFullPath, true);
} else {
actionCreator.setSelected(null);
}
_fileViewControllerChange();
} | [
"function",
"_documentSelectionFocusChange",
"(",
")",
"{",
"var",
"curFullPath",
"=",
"MainViewManager",
".",
"getCurrentlyViewedPath",
"(",
"MainViewManager",
".",
"ACTIVE_PANE",
")",
";",
"if",
"(",
"curFullPath",
"&&",
"_hasFileSelectionFocus",
"(",
")",
")",
"{... | @private
Handler for changes in document selection. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L468-L476 | train | Change the document selection focus | [
30522,
3853,
1035,
5491,
12260,
7542,
14876,
7874,
22305,
2063,
1006,
1007,
1063,
13075,
12731,
12881,
18083,
15069,
1027,
2364,
8584,
24805,
4590,
1012,
2131,
10841,
14343,
20630,
8584,
2098,
15069,
1006,
2364,
8584,
24805,
4590,
1012,
3161,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TableAccExtension.js | function($Cell) {
var oTable = this.getTable(),
sTableId = oTable.getId(),
bIsInGroupingRow = TableUtils.Grouping.isInGroupingRow($Cell),
bIsInSumRow = TableUtils.Grouping.isInSumRow($Cell),
oRow = oTable.getRows()[$Cell.attr("data-sap-ui-rowindex")],
aDefaultLabels = ExtensionHelper.getAriaAttributesFor(this, TableAccExtension.ELEMENTTYPES.ROWHEADER)["aria-labelledby"] || [],
aLabels = aDefaultLabels.concat([sTableId + "-rownumberofrows"]);
if (!bIsInSumRow && !bIsInGroupingRow) {
if (!$Cell.hasClass("sapUiTableRowHidden")) {
aLabels.push(oRow.getId() + "-rowselecttext");
if (TableUtils.hasRowHighlights(oTable)) {
aLabels.push(oRow.getId() + "-highlighttext");
}
}
}
if (bIsInGroupingRow) {
aLabels.push(sTableId + "-ariarowgrouplabel");
aLabels.push(sTableId + (oRow._bIsExpanded ? "-rowcollapsetext" : "-rowexpandtext"));
//aLabels.push(oRow.getId() + "-groupHeader"); //Not needed: Screenreader seems to announce this automatically
}
if (bIsInSumRow) {
var iLevel = $Cell.data("sap-ui-level");
if (iLevel == 0) {
aLabels.push(sTableId + "-ariagrandtotallabel");
} else if (iLevel > 0) {
aLabels.push(sTableId + "-ariagrouptotallabel");
//aLabels.push(oRow.getId() + "-groupHeader"); //Not needed: Screenreader seems to announce this automatically
}
}
ExtensionHelper.performCellModifications(this, $Cell, aDefaultLabels, null, aLabels, null, null);
} | javascript | function($Cell) {
var oTable = this.getTable(),
sTableId = oTable.getId(),
bIsInGroupingRow = TableUtils.Grouping.isInGroupingRow($Cell),
bIsInSumRow = TableUtils.Grouping.isInSumRow($Cell),
oRow = oTable.getRows()[$Cell.attr("data-sap-ui-rowindex")],
aDefaultLabels = ExtensionHelper.getAriaAttributesFor(this, TableAccExtension.ELEMENTTYPES.ROWHEADER)["aria-labelledby"] || [],
aLabels = aDefaultLabels.concat([sTableId + "-rownumberofrows"]);
if (!bIsInSumRow && !bIsInGroupingRow) {
if (!$Cell.hasClass("sapUiTableRowHidden")) {
aLabels.push(oRow.getId() + "-rowselecttext");
if (TableUtils.hasRowHighlights(oTable)) {
aLabels.push(oRow.getId() + "-highlighttext");
}
}
}
if (bIsInGroupingRow) {
aLabels.push(sTableId + "-ariarowgrouplabel");
aLabels.push(sTableId + (oRow._bIsExpanded ? "-rowcollapsetext" : "-rowexpandtext"));
//aLabels.push(oRow.getId() + "-groupHeader"); //Not needed: Screenreader seems to announce this automatically
}
if (bIsInSumRow) {
var iLevel = $Cell.data("sap-ui-level");
if (iLevel == 0) {
aLabels.push(sTableId + "-ariagrandtotallabel");
} else if (iLevel > 0) {
aLabels.push(sTableId + "-ariagrouptotallabel");
//aLabels.push(oRow.getId() + "-groupHeader"); //Not needed: Screenreader seems to announce this automatically
}
}
ExtensionHelper.performCellModifications(this, $Cell, aDefaultLabels, null, aLabels, null, null);
} | [
"function",
"(",
"$Cell",
")",
"{",
"var",
"oTable",
"=",
"this",
".",
"getTable",
"(",
")",
",",
"sTableId",
"=",
"oTable",
".",
"getId",
"(",
")",
",",
"bIsInGroupingRow",
"=",
"TableUtils",
".",
"Grouping",
".",
"isInGroupingRow",
"(",
"$Cell",
")",
... | /*
Modifies the labels and descriptions of a row header cell.
@see ExtensionHelper.performCellModifications | [
"/",
"*",
"Modifies",
"the",
"labels",
"and",
"descriptions",
"of",
"a",
"row",
"header",
"cell",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccExtension.js#L429-L465 | train | Adds the aria - labelledby attribute to the cells list | [
30522,
3853,
1006,
1002,
3526,
1007,
1063,
13075,
27178,
3085,
1027,
2023,
1012,
2131,
10880,
1006,
1007,
1010,
6540,
3593,
1027,
27178,
3085,
1012,
2131,
3593,
1006,
1007,
1010,
20377,
2075,
22107,
2075,
10524,
1027,
2795,
21823,
4877,
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... | |
aframevr/aframe | src/core/component.js | function (value) {
var parsedValue;
if (typeof value !== 'string') { return value; }
if (this.isSingleProperty) {
parsedValue = this.schema.parse(value);
/**
* To avoid bogus double parsings. Cached values will be parsed when building
* component data. For instance when parsing a src id to its url, we want to cache
* original string and not the parsed one (#monster -> models/monster.dae)
* so when building data we parse the expected value.
*/
if (typeof parsedValue === 'string') { parsedValue = value; }
} else {
// Parse using the style parser to avoid double parsing of individual properties.
utils.objectPool.clearObject(this.parsingAttrValue);
parsedValue = styleParser.parse(value, this.parsingAttrValue);
}
return parsedValue;
} | javascript | function (value) {
var parsedValue;
if (typeof value !== 'string') { return value; }
if (this.isSingleProperty) {
parsedValue = this.schema.parse(value);
/**
* To avoid bogus double parsings. Cached values will be parsed when building
* component data. For instance when parsing a src id to its url, we want to cache
* original string and not the parsed one (#monster -> models/monster.dae)
* so when building data we parse the expected value.
*/
if (typeof parsedValue === 'string') { parsedValue = value; }
} else {
// Parse using the style parser to avoid double parsing of individual properties.
utils.objectPool.clearObject(this.parsingAttrValue);
parsedValue = styleParser.parse(value, this.parsingAttrValue);
}
return parsedValue;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"parsedValue",
";",
"if",
"(",
"typeof",
"value",
"!==",
"'string'",
")",
"{",
"return",
"value",
";",
"}",
"if",
"(",
"this",
".",
"isSingleProperty",
")",
"{",
"parsedValue",
"=",
"this",
".",
"schema",
".",... | Given an HTML attribute value parses the string based on the component schema.
To avoid double parsings of strings into strings we store the original instead
of the parsed one
@param {string} value - HTML attribute value | [
"Given",
"an",
"HTML",
"attribute",
"value",
"parses",
"the",
"string",
"based",
"on",
"the",
"component",
"schema",
".",
"To",
"avoid",
"double",
"parsings",
"of",
"strings",
"into",
"strings",
"we",
"store",
"the",
"original",
"instead",
"of",
"the",
"pars... | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L236-L254 | train | Parses the given value. | [
30522,
3853,
1006,
3643,
1007,
1063,
13075,
11968,
6924,
10175,
5657,
1025,
2065,
1006,
2828,
11253,
3643,
999,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2709,
3643,
1025,
1065,
2065,
1006,
2023,
1012,
26354,
2075,
2571,
21572,
4842,
3723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.demokit/src/sap/ui/demokit/demoapps/model/libraryData.js | createDemoAppData | function createDemoAppData(oDemoAppMetadata, sLibUrl, sLibNamespace) {
// transform simple demo app link to a configuration object
var aLinks = [];
// transform link object to a bindable array of objects
if (jQuery.isPlainObject(oDemoAppMetadata.links)) {
aLinks = Object.keys(oDemoAppMetadata.links).map(function (sKey) {
return {
name: sKey,
ref: oDemoAppMetadata.links[sKey]
};
});
}
var oApp = {
lib : oDemoAppMetadata.namespace || sLibNamespace,
name : oDemoAppMetadata.text,
icon : oDemoAppMetadata.icon,
desc : oDemoAppMetadata.desc,
config : oDemoAppMetadata.config,
teaser : oDemoAppMetadata.teaser,
category : oDemoAppMetadata.category,
ref : (oDemoAppMetadata.resolve === "lib" ? sLibUrl : "") + oDemoAppMetadata.ref,
links : aLinks
};
return oApp;
} | javascript | function createDemoAppData(oDemoAppMetadata, sLibUrl, sLibNamespace) {
// transform simple demo app link to a configuration object
var aLinks = [];
// transform link object to a bindable array of objects
if (jQuery.isPlainObject(oDemoAppMetadata.links)) {
aLinks = Object.keys(oDemoAppMetadata.links).map(function (sKey) {
return {
name: sKey,
ref: oDemoAppMetadata.links[sKey]
};
});
}
var oApp = {
lib : oDemoAppMetadata.namespace || sLibNamespace,
name : oDemoAppMetadata.text,
icon : oDemoAppMetadata.icon,
desc : oDemoAppMetadata.desc,
config : oDemoAppMetadata.config,
teaser : oDemoAppMetadata.teaser,
category : oDemoAppMetadata.category,
ref : (oDemoAppMetadata.resolve === "lib" ? sLibUrl : "") + oDemoAppMetadata.ref,
links : aLinks
};
return oApp;
} | [
"function",
"createDemoAppData",
"(",
"oDemoAppMetadata",
",",
"sLibUrl",
",",
"sLibNamespace",
")",
"{",
"// transform simple demo app link to a configuration object",
"var",
"aLinks",
"=",
"[",
"]",
";",
"// transform link object to a bindable array of objects",
"if",
"(",
... | function to compute the app objects for a demo object | [
"function",
"to",
"compute",
"the",
"app",
"objects",
"for",
"a",
"demo",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/demoapps/model/libraryData.js#L12-L38 | train | Creates a data object for a demo app | [
30522,
3853,
2580,
6633,
10441,
9397,
2850,
2696,
1006,
24040,
5302,
29098,
11368,
8447,
2696,
1010,
22889,
12322,
3126,
2140,
1010,
22889,
12322,
18442,
23058,
1007,
1063,
1013,
1013,
10938,
3722,
9703,
10439,
4957,
2000,
1037,
9563,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(sMeasureName, bIncludeRawValue, bIncludeFormattedValue, bIncludeUnit) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aMeasName = [];
if (sMeasureName) {
if (this._oMeasures[sMeasureName] == undefined) {
throw sMeasureName + " is not part of the query result";
}
aMeasName.push(sMeasureName);
} else {
for ( var sName in this._oMeasures) {
aMeasName.push(sName);
}
}
for (var i = -1, sMeasName; (sMeasName = aMeasName[++i]) !== undefined;) {
if (bIncludeRawValue != null) {
this._oMeasures[sMeasName].value = bIncludeRawValue;
}
if (bIncludeFormattedValue != null) {
this._oMeasures[sMeasName].text = bIncludeFormattedValue;
}
if (bIncludeUnit != null) {
this._oMeasures[sMeasName].unit = bIncludeUnit;
}
}
} | javascript | function(sMeasureName, bIncludeRawValue, bIncludeFormattedValue, bIncludeUnit) {
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
var aMeasName = [];
if (sMeasureName) {
if (this._oMeasures[sMeasureName] == undefined) {
throw sMeasureName + " is not part of the query result";
}
aMeasName.push(sMeasureName);
} else {
for ( var sName in this._oMeasures) {
aMeasName.push(sName);
}
}
for (var i = -1, sMeasName; (sMeasName = aMeasName[++i]) !== undefined;) {
if (bIncludeRawValue != null) {
this._oMeasures[sMeasName].value = bIncludeRawValue;
}
if (bIncludeFormattedValue != null) {
this._oMeasures[sMeasName].text = bIncludeFormattedValue;
}
if (bIncludeUnit != null) {
this._oMeasures[sMeasName].unit = bIncludeUnit;
}
}
} | [
"function",
"(",
"sMeasureName",
",",
"bIncludeRawValue",
",",
"bIncludeFormattedValue",
",",
"bIncludeUnit",
")",
"{",
"this",
".",
"_oSelectedPropertyNames",
"=",
"null",
";",
"// reset previously compiled list of selected properties",
"var",
"aMeasName",
"=",
"[",
"]",... | Specify which measure components shall be included in the query result.
The settings get applied to the currently set measures.
@param {string} sMeasureName
Name of the measure for which the settings get applied.
Specify null to apply the settings to all currently set
measures.
@param {boolean} bIncludeRawValue
Indicator whether or not to include the raw value in the query
result. Pass null to keep current setting.
@param {boolean} bIncludeFormattedValue
Indicator whether or not to include the formatted value (if
available) in the query result. Pass null to keep current
setting.
@param {boolean} bIncludeUnit
Indicator whether or not to include the unit (if available) in
the query result. Pass null to keep current setting.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#includeMeasureRawFormattedValueUnit | [
"Specify",
"which",
"measure",
"components",
"shall",
"be",
"included",
"in",
"the",
"query",
"result",
".",
"The",
"settings",
"get",
"applied",
"to",
"the",
"currently",
"set",
"measures",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4411-L4436 | train | Sets the measure name to the given values | [
30522,
3853,
1006,
15488,
5243,
28632,
18442,
1010,
8026,
20464,
29190,
10376,
10175,
5657,
1010,
8026,
20464,
12672,
14192,
19321,
2098,
10175,
5657,
1010,
8026,
20464,
12672,
19496,
2102,
1007,
1063,
2023,
1012,
1035,
9808,
12260,
10985,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dialog/dialog.spec.js | function(element, transformAttr, expectedCss) {
var testDiv = angular.element('<div>');
testDiv.css(transformAttr, expectedCss);
expect(element.css(transformAttr)).toBe(testDiv.css(transformAttr));
} | javascript | function(element, transformAttr, expectedCss) {
var testDiv = angular.element('<div>');
testDiv.css(transformAttr, expectedCss);
expect(element.css(transformAttr)).toBe(testDiv.css(transformAttr));
} | [
"function",
"(",
"element",
",",
"transformAttr",
",",
"expectedCss",
")",
"{",
"var",
"testDiv",
"=",
"angular",
".",
"element",
"(",
"'<div>'",
")",
";",
"testDiv",
".",
"css",
"(",
"transformAttr",
",",
"expectedCss",
")",
";",
"expect",
"(",
"element",... | Verifies that an element has the expected CSS for its transform property.
Works by creating a new element, setting the expected CSS on that
element, and comparing to the element being tested. This convoluted
approach is needed because if jQuery is installed it can rewrite
'translate3d' values to equivalent 'matrix' values, for example turning
'translate3d(240px, 120px, 0px) scale(0.5, 0.5)' into
'matrix(0.5, 0, 0, 0.5, 240, 120)'. | [
"Verifies",
"that",
"an",
"element",
"has",
"the",
"expected",
"CSS",
"for",
"its",
"transform",
"property",
".",
"Works",
"by",
"creating",
"a",
"new",
"element",
"setting",
"the",
"expected",
"CSS",
"on",
"that",
"element",
"and",
"comparing",
"to",
"the",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.spec.js#L2071-L2075 | train | Tests that an element has a transform attribute | [
30522,
3853,
1006,
5783,
1010,
10938,
19321,
2099,
30524,
2015,
1006,
10938,
19321,
2099,
1007,
1007,
1012,
2000,
4783,
1006,
3231,
4305,
2615,
1012,
20116,
2015,
1006,
10938,
19321,
2099,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GeekyAnts/vue-native-core | dist/vue.runtime.common.js | locateNode | function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
} | javascript | function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
} | [
"function",
"locateNode",
"(",
"vnode",
")",
"{",
"return",
"vnode",
".",
"componentInstance",
"&&",
"(",
"!",
"vnode",
".",
"data",
"||",
"!",
"vnode",
".",
"data",
".",
"transition",
")",
"?",
"locateNode",
"(",
"vnode",
".",
"componentInstance",
".",
... | /* recursively search for possible transition defined inside the component root | [
"/",
"*",
"recursively",
"search",
"for",
"possible",
"transition",
"defined",
"inside",
"the",
"component",
"root"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L6185-L6189 | train | locate node in hierarchy | [
30522,
3853,
12453,
3630,
3207,
1006,
1058,
3630,
3207,
1007,
1063,
2709,
1058,
3630,
3207,
1012,
6922,
7076,
26897,
1004,
1004,
1006,
999,
1058,
3630,
3207,
1012,
2951,
1064,
1064,
999,
1058,
3630,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/object-curly-newline.js | normalizeOptions | function normalizeOptions(options) {
const isNodeSpecificOption = lodash.overSome([lodash.isPlainObject, lodash.isString]);
if (lodash.isPlainObject(options) && lodash.some(options, isNodeSpecificOption)) {
return {
ObjectExpression: normalizeOptionValue(options.ObjectExpression),
ObjectPattern: normalizeOptionValue(options.ObjectPattern),
ImportDeclaration: normalizeOptionValue(options.ImportDeclaration),
ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration)
};
}
const value = normalizeOptionValue(options);
return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value };
} | javascript | function normalizeOptions(options) {
const isNodeSpecificOption = lodash.overSome([lodash.isPlainObject, lodash.isString]);
if (lodash.isPlainObject(options) && lodash.some(options, isNodeSpecificOption)) {
return {
ObjectExpression: normalizeOptionValue(options.ObjectExpression),
ObjectPattern: normalizeOptionValue(options.ObjectPattern),
ImportDeclaration: normalizeOptionValue(options.ImportDeclaration),
ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration)
};
}
const value = normalizeOptionValue(options);
return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value };
} | [
"function",
"normalizeOptions",
"(",
"options",
")",
"{",
"const",
"isNodeSpecificOption",
"=",
"lodash",
".",
"overSome",
"(",
"[",
"lodash",
".",
"isPlainObject",
",",
"lodash",
".",
"isString",
"]",
")",
";",
"if",
"(",
"lodash",
".",
"isPlainObject",
"("... | Normalizes a given option value.
@param {string|Object|undefined} options - An option value to parse.
@returns {{
ObjectExpression: {multiline: boolean, minProperties: number, consistent: boolean},
ObjectPattern: {multiline: boolean, minProperties: number, consistent: boolean},
ImportDeclaration: {multiline: boolean, minProperties: number, consistent: boolean},
ExportNamedDeclaration : {multiline: boolean, minProperties: number, consistent: boolean}
}} Normalized option object. | [
"Normalizes",
"a",
"given",
"option",
"value",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/object-curly-newline.js#L84-L99 | train | Normalizes options | [
30522,
3853,
3671,
4697,
7361,
9285,
1006,
7047,
1007,
1063,
9530,
3367,
3475,
19847,
5051,
6895,
8873,
3597,
16790,
1027,
8840,
8883,
2232,
1012,
15849,
8462,
1006,
1031,
8840,
8883,
2232,
1012,
2003,
24759,
8113,
16429,
20614,
1010,
8840,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/search.js | engineManager_removeEngine | function engineManager_removeEngine(name) {
this.selectedEngine = name;
var button = this.getElement({type: "engine_button", subtype: "remove"});
this._controller.click(button);
this._controller.waitForEval("subject.manager.selectedEngine != subject.removedEngine", TIMEOUT, 100,
{manager: this, removedEngine: name});
} | javascript | function engineManager_removeEngine(name) {
this.selectedEngine = name;
var button = this.getElement({type: "engine_button", subtype: "remove"});
this._controller.click(button);
this._controller.waitForEval("subject.manager.selectedEngine != subject.removedEngine", TIMEOUT, 100,
{manager: this, removedEngine: name});
} | [
"function",
"engineManager_removeEngine",
"(",
"name",
")",
"{",
"this",
".",
"selectedEngine",
"=",
"name",
";",
"var",
"button",
"=",
"this",
".",
"getElement",
"(",
"{",
"type",
":",
"\"engine_button\"",
",",
"subtype",
":",
"\"remove\"",
"}",
")",
";",
... | Remove the engine with the given name
@param {string} name
Name of the engine to remove | [
"Remove",
"the",
"engine",
"with",
"the",
"given",
"name"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L345-L353 | train | Remove an engine | [
30522,
3853,
3194,
24805,
4590,
1035,
6366,
13159,
3170,
1006,
2171,
1007,
1063,
2023,
1012,
3479,
13159,
3170,
1027,
2171,
1025,
13075,
6462,
1027,
2023,
1012,
2131,
12260,
3672,
1006,
1063,
2828,
1024,
1000,
3194,
1035,
6462,
1000,
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... |
apache/incubator-echarts | src/model/OptionManager.js | OptionManager | function OptionManager(api) {
/**
* @private
* @type {module:echarts/ExtensionAPI}
*/
this._api = api;
/**
* @private
* @type {Array.<number>}
*/
this._timelineOptions = [];
/**
* @private
* @type {Array.<Object>}
*/
this._mediaList = [];
/**
* @private
* @type {Object}
*/
this._mediaDefault;
/**
* -1, means default.
* empty means no media.
* @private
* @type {Array.<number>}
*/
this._currentMediaIndices = [];
/**
* @private
* @type {Object}
*/
this._optionBackup;
/**
* @private
* @type {Object}
*/
this._newBaseOption;
} | javascript | function OptionManager(api) {
/**
* @private
* @type {module:echarts/ExtensionAPI}
*/
this._api = api;
/**
* @private
* @type {Array.<number>}
*/
this._timelineOptions = [];
/**
* @private
* @type {Array.<Object>}
*/
this._mediaList = [];
/**
* @private
* @type {Object}
*/
this._mediaDefault;
/**
* -1, means default.
* empty means no media.
* @private
* @type {Array.<number>}
*/
this._currentMediaIndices = [];
/**
* @private
* @type {Object}
*/
this._optionBackup;
/**
* @private
* @type {Object}
*/
this._newBaseOption;
} | [
"function",
"OptionManager",
"(",
"api",
")",
"{",
"/**\n * @private\n * @type {module:echarts/ExtensionAPI}\n */",
"this",
".",
"_api",
"=",
"api",
";",
"/**\n * @private\n * @type {Array.<number>}\n */",
"this",
".",
"_timelineOptions",
"=",
"[",
"]",
... | TERM EXPLANATIONS:
[option]:
An object that contains definitions of components. For example:
var option = {
title: {...},
legend: {...},
visualMap: {...},
series: [
{data: [...]},
{data: [...]},
...
]
};
[rawOption]:
An object input to echarts.setOption. 'rawOption' may be an
'option', or may be an object contains multi-options. For example:
var option = {
baseOption: {
title: {...},
legend: {...},
series: [
{data: [...]},
{data: [...]},
...
]
},
timeline: {...},
options: [
{title: {...}, series: {data: [...]}},
{title: {...}, series: {data: [...]}},
...
],
media: [
{
query: {maxWidth: 320},
option: {series: {x: 20}, visualMap: {show: false}}
},
{
query: {minWidth: 320, maxWidth: 720},
option: {series: {x: 500}, visualMap: {show: true}}
},
{
option: {series: {x: 1200}, visualMap: {show: true}}
}
]
};
@alias module:echarts/model/OptionManager
@param {module:echarts/ExtensionAPI} api | [
"TERM",
"EXPLANATIONS",
":"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/OptionManager.js#L93-L138 | train | The OptionManager constructor. | [
30522,
3853,
5724,
24805,
4590,
1006,
17928,
1007,
1063,
1013,
1008,
1008,
1008,
1030,
2797,
1008,
1030,
2828,
1063,
11336,
1024,
14925,
10686,
2015,
1013,
5331,
9331,
2072,
1065,
1008,
1013,
2023,
1012,
1035,
17928,
1027,
17928,
1025,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/chart.js/Chart.js | function(easingValue) {
var me = this;
var tooltip = me.tooltip;
var args = {
tooltip: tooltip,
easingValue: easingValue
};
if (core_plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {
return;
}
tooltip.draw();
core_plugins.notify(me, 'afterTooltipDraw', [args]);
} | javascript | function(easingValue) {
var me = this;
var tooltip = me.tooltip;
var args = {
tooltip: tooltip,
easingValue: easingValue
};
if (core_plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {
return;
}
tooltip.draw();
core_plugins.notify(me, 'afterTooltipDraw', [args]);
} | [
"function",
"(",
"easingValue",
")",
"{",
"var",
"me",
"=",
"this",
";",
"var",
"tooltip",
"=",
"me",
".",
"tooltip",
";",
"var",
"args",
"=",
"{",
"tooltip",
":",
"tooltip",
",",
"easingValue",
":",
"easingValue",
"}",
";",
"if",
"(",
"core_plugins",
... | Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw`
hook, in which case, plugins will not be called on `afterTooltipDraw`.
@private | [
"Draws",
"tooltip",
"unless",
"a",
"plugin",
"returns",
"false",
"to",
"the",
"beforeTooltipDraw",
"hook",
"in",
"which",
"case",
"plugins",
"will",
"not",
"be",
"called",
"on",
"afterTooltipDraw",
"."
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L8979-L8994 | train | draw tooltip with specified easing value | [
30522,
3853,
1006,
24070,
10175,
5657,
1007,
1063,
13075,
2033,
1027,
2023,
1025,
13075,
6994,
25101,
1027,
2033,
1012,
6994,
25101,
1025,
13075,
12098,
5620,
1027,
1063,
6994,
25101,
1024,
6994,
25101,
1010,
24070,
10175,
5657,
1024,
24070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_RkRec | function parse_RkRec(blob) {
var ixfe = blob.read_shift(2);
var RK = parse_RkNumber(blob);
return [ixfe, RK];
} | javascript | function parse_RkRec(blob) {
var ixfe = blob.read_shift(2);
var RK = parse_RkNumber(blob);
return [ixfe, RK];
} | [
"function",
"parse_RkRec",
"(",
"blob",
")",
"{",
"var",
"ixfe",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"var",
"RK",
"=",
"parse_RkNumber",
"(",
"blob",
")",
";",
"return",
"[",
"ixfe",
",",
"RK",
"]",
";",
"}"
] | /* [MS-XLS] 2.5.218 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"218"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5606-L5610 | train | Parse RkRec | [
30522,
3853,
11968,
3366,
1035,
1054,
21638,
8586,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
11814,
7959,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1016,
1007,
1025,
13075,
1054,
2243,
1027,
11968,
3366,
1035,
1054,
2243,
19172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | tooltips | function tooltips ( ) {
// Tooltips are added with options.tooltips in original order.
var tips = scope_Handles.map(addTooltip);
bindEvent('update', function(values, handleNumber, unencoded) {
if ( !tips[handleNumber] ) {
return;
}
var formattedValue = values[handleNumber];
if ( options.tooltips[handleNumber] !== true ) {
formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
}
tips[handleNumber].innerHTML = '<span>' + formattedValue + '</span>';
});
} | javascript | function tooltips ( ) {
// Tooltips are added with options.tooltips in original order.
var tips = scope_Handles.map(addTooltip);
bindEvent('update', function(values, handleNumber, unencoded) {
if ( !tips[handleNumber] ) {
return;
}
var formattedValue = values[handleNumber];
if ( options.tooltips[handleNumber] !== true ) {
formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
}
tips[handleNumber].innerHTML = '<span>' + formattedValue + '</span>';
});
} | [
"function",
"tooltips",
"(",
")",
"{",
"// Tooltips are added with options.tooltips in original order.",
"var",
"tips",
"=",
"scope_Handles",
".",
"map",
"(",
"addTooltip",
")",
";",
"bindEvent",
"(",
"'update'",
",",
"function",
"(",
"values",
",",
"handleNumber",
... | The tooltips option is a shorthand for using the 'update' event. | [
"The",
"tooltips",
"option",
"is",
"a",
"shorthand",
"for",
"using",
"the",
"update",
"event",
"."
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L991-L1010 | train | Add tooltip to the element | [
30522,
3853,
6994,
25101,
2015,
1006,
1007,
1063,
1013,
1013,
6994,
25101,
2015,
2024,
2794,
2007,
7047,
1012,
6994,
25101,
2015,
1999,
2434,
2344,
1012,
13075,
10247,
1027,
9531,
1035,
16024,
1012,
4949,
1006,
5587,
3406,
27914,
11514,
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... |
jaywcjlove/linux-command | template/js/index.js | function () {
var items = this.elm_result.children;
var isSel = false;
for (var i = 0; i < items.length; i++) {
if (items[i].className == 'ok') {
isSel = items[i];
break;
};
};
return isSel;
} | javascript | function () {
var items = this.elm_result.children;
var isSel = false;
for (var i = 0; i < items.length; i++) {
if (items[i].className == 'ok') {
isSel = items[i];
break;
};
};
return isSel;
} | [
"function",
"(",
")",
"{",
"var",
"items",
"=",
"this",
".",
"elm_result",
".",
"children",
";",
"var",
"isSel",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
... | 是否选中搜索结果 | [
"是否选中搜索结果"
] | 7d6c8c6b3468a0dd5311ee68934c9b8db64469f7 | https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/template/js/index.js#L147-L157 | train | Returns true if the result is ok | [
30522,
3853,
1006,
1007,
1063,
13075,
5167,
1027,
2023,
1012,
17709,
1035,
2765,
1012,
2336,
1025,
13075,
26354,
2884,
1027,
6270,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
5167,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jgraph/mxgraph | javascript/mxClient.js | function(node, graph, state, down, move, up, dblClick)
{
var getState = function(evt)
{
return (typeof(state) == 'function') ? state(evt) : state;
};
mxEvent.addGestureListeners(node, function (evt)
{
if (down != null)
{
down(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(evt, getState(evt)));
}
},
function (evt)
{
if (move != null)
{
move(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(evt, getState(evt)));
}
},
function (evt)
{
if (up != null)
{
up(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(evt, getState(evt)));
}
});
mxEvent.addListener(node, 'dblclick', function (evt)
{
if (dblClick != null)
{
dblClick(evt);
}
else if (!mxEvent.isConsumed(evt))
{
var tmp = getState(evt);
graph.dblClick(evt, (tmp != null) ? tmp.cell : null);
}
});
} | javascript | function(node, graph, state, down, move, up, dblClick)
{
var getState = function(evt)
{
return (typeof(state) == 'function') ? state(evt) : state;
};
mxEvent.addGestureListeners(node, function (evt)
{
if (down != null)
{
down(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_DOWN, new mxMouseEvent(evt, getState(evt)));
}
},
function (evt)
{
if (move != null)
{
move(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_MOVE, new mxMouseEvent(evt, getState(evt)));
}
},
function (evt)
{
if (up != null)
{
up(evt);
}
else if (!mxEvent.isConsumed(evt))
{
graph.fireMouseEvent(mxEvent.MOUSE_UP, new mxMouseEvent(evt, getState(evt)));
}
});
mxEvent.addListener(node, 'dblclick', function (evt)
{
if (dblClick != null)
{
dblClick(evt);
}
else if (!mxEvent.isConsumed(evt))
{
var tmp = getState(evt);
graph.dblClick(evt, (tmp != null) ? tmp.cell : null);
}
});
} | [
"function",
"(",
"node",
",",
"graph",
",",
"state",
",",
"down",
",",
"move",
",",
"up",
",",
"dblClick",
")",
"{",
"var",
"getState",
"=",
"function",
"(",
"evt",
")",
"{",
"return",
"(",
"typeof",
"(",
"state",
")",
"==",
"'function'",
")",
"?",... | Function: redirectMouseEvents
Redirects the mouse events from the given DOM node to the graph dispatch
loop using the event and given state as event arguments. State can
either be an instance of <mxCellState> or a function that returns an
<mxCellState>. The down, move, up and dblClick arguments are optional
functions that take the trigger event as arguments and replace the
default behaviour. | [
"Function",
":",
"redirectMouseEvents"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L9619-L9672 | train | This method is called by mxGraph when a node is clicked | [
30522,
3853,
1006,
13045,
1010,
10629,
1010,
2110,
1010,
2091,
1010,
2693,
1010,
2039,
1010,
16962,
15472,
25230,
1007,
1063,
13075,
4152,
12259,
1027,
3853,
1006,
23408,
2102,
1007,
1063,
2709,
1006,
2828,
11253,
1006,
2110,
1007,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
netlify/netlify-cms | packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js | escapeDelimiters | function escapeDelimiters(pattern, text) {
return text.replace(pattern, (match, start, end) => {
const hasEnd = typeof end === 'string';
const matchSliceEnd = hasEnd ? match.length - end.length : match.length;
const content = match.slice(start.length, matchSliceEnd);
return `${escape(start)}${content}${hasEnd ? escape(end) : ''}`;
});
} | javascript | function escapeDelimiters(pattern, text) {
return text.replace(pattern, (match, start, end) => {
const hasEnd = typeof end === 'string';
const matchSliceEnd = hasEnd ? match.length - end.length : match.length;
const content = match.slice(start.length, matchSliceEnd);
return `${escape(start)}${content}${hasEnd ? escape(end) : ''}`;
});
} | [
"function",
"escapeDelimiters",
"(",
"pattern",
",",
"text",
")",
"{",
"return",
"text",
".",
"replace",
"(",
"pattern",
",",
"(",
"match",
",",
"start",
",",
"end",
")",
"=>",
"{",
"const",
"hasEnd",
"=",
"typeof",
"end",
"===",
"'string'",
";",
"cons... | escapeDelimiters
Executes `String.replace` for a given pattern, but only on the first two
capture groups. Specifically intended for escaping opening (and optionally
closing) markdown entities without escaping the content in between. | [
"escapeDelimiters"
] | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/remarkEscapeMarkdownEntities.js#L201-L208 | train | Escape delimiters in text | [
30522,
3853,
6376,
20806,
23419,
2869,
1006,
5418,
1010,
3793,
1007,
1063,
2709,
3793,
1012,
5672,
1006,
5418,
1010,
1006,
2674,
1010,
2707,
1010,
2203,
1007,
1027,
1028,
1063,
9530,
3367,
2038,
10497,
1027,
2828,
11253,
2203,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jszip.js | function() {
var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
if (offset === -1) {
throw new Error("Corrupted zip : can't find end of central directory");
}
this.reader.setIndex(offset);
this.checkSignature(sig.CENTRAL_DIRECTORY_END);
this.readBlockEndOfCentral();
/* extract from the zip spec :
4) If one of the fields in the end of central directory
record is too small to hold required data, the field
should be set to -1 (0xFFFF or 0xFFFFFFFF) and the
ZIP64 format record should be created.
5) The end of central directory record and the
Zip64 end of central directory locator record must
reside on the same disk when splitting or spanning
an archive.
*/
if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
this.zip64 = true;
/*
Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from
the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents
all numbers as 64-bit double precision IEEE 754 floating point numbers.
So, we have 53bits for integers and bitwise operations treat everything as 32bits.
see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators
and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5
*/
// should look for a zip64 EOCD locator
offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
if (offset === -1) {
throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");
}
this.reader.setIndex(offset);
this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
this.readBlockZip64EndOfCentralLocator();
// now the zip64 EOCD record
this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);
this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
this.readBlockZip64EndOfCentral();
}
} | javascript | function() {
var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
if (offset === -1) {
throw new Error("Corrupted zip : can't find end of central directory");
}
this.reader.setIndex(offset);
this.checkSignature(sig.CENTRAL_DIRECTORY_END);
this.readBlockEndOfCentral();
/* extract from the zip spec :
4) If one of the fields in the end of central directory
record is too small to hold required data, the field
should be set to -1 (0xFFFF or 0xFFFFFFFF) and the
ZIP64 format record should be created.
5) The end of central directory record and the
Zip64 end of central directory locator record must
reside on the same disk when splitting or spanning
an archive.
*/
if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
this.zip64 = true;
/*
Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from
the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents
all numbers as 64-bit double precision IEEE 754 floating point numbers.
So, we have 53bits for integers and bitwise operations treat everything as 32bits.
see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators
and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5
*/
// should look for a zip64 EOCD locator
offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
if (offset === -1) {
throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");
}
this.reader.setIndex(offset);
this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);
this.readBlockZip64EndOfCentralLocator();
// now the zip64 EOCD record
this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);
this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);
this.readBlockZip64EndOfCentral();
}
} | [
"function",
"(",
")",
"{",
"var",
"offset",
"=",
"this",
".",
"reader",
".",
"lastIndexOfSignature",
"(",
"sig",
".",
"CENTRAL_DIRECTORY_END",
")",
";",
"if",
"(",
"offset",
"===",
"-",
"1",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Corrupted zip : can't ... | Read the end of central directory. | [
"Read",
"the",
"end",
"of",
"central",
"directory",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1809-L1855 | train | Extract the end of central directory | [
30522,
3853,
1006,
1007,
1063,
13075,
16396,
1027,
2023,
1012,
8068,
1012,
2197,
22254,
10288,
11253,
5332,
16989,
11244,
1006,
9033,
2290,
1012,
2430,
1035,
14176,
1035,
2203,
1007,
1025,
2065,
1006,
16396,
1027,
1027,
1027,
1011,
1015,
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/chart/sankey/sankeyLayout.js | computeNodeDepths | function computeNodeDepths(nodes, edges, height, width, nodeGap, iterations, orient) {
var nodesByBreadth = prepareNodesByBreadth(nodes, orient);
initializeNodeDepth(nodesByBreadth, edges, height, width, nodeGap, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
for (var alpha = 1; iterations > 0; iterations--) {
// 0.99 is a experience parameter, ensure that each iterations of
// changes as small as possible.
alpha *= 0.99;
relaxRightToLeft(nodesByBreadth, alpha, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
relaxLeftToRight(nodesByBreadth, alpha, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
}
} | javascript | function computeNodeDepths(nodes, edges, height, width, nodeGap, iterations, orient) {
var nodesByBreadth = prepareNodesByBreadth(nodes, orient);
initializeNodeDepth(nodesByBreadth, edges, height, width, nodeGap, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
for (var alpha = 1; iterations > 0; iterations--) {
// 0.99 is a experience parameter, ensure that each iterations of
// changes as small as possible.
alpha *= 0.99;
relaxRightToLeft(nodesByBreadth, alpha, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
relaxLeftToRight(nodesByBreadth, alpha, orient);
resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
}
} | [
"function",
"computeNodeDepths",
"(",
"nodes",
",",
"edges",
",",
"height",
",",
"width",
",",
"nodeGap",
",",
"iterations",
",",
"orient",
")",
"{",
"var",
"nodesByBreadth",
"=",
"prepareNodesByBreadth",
"(",
"nodes",
",",
"orient",
")",
";",
"initializeNodeD... | Using Gauss-Seidel iterations method to compute the node depth(y-position)
@param {module:echarts/data/Graph~Node} nodes node of sankey view
@param {module:echarts/data/Graph~Edge} edges edge of sankey view
@param {number} height the whole height of the area to draw the view
@param {number} nodeGap the vertical distance between two nodes
in the same column.
@param {number} iterations the number of iterations for the algorithm | [
"Using",
"Gauss",
"-",
"Seidel",
"iterations",
"method",
"to",
"compute",
"the",
"node",
"depth",
"(",
"y",
"-",
"position",
")"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sankey/sankeyLayout.js#L258-L273 | train | Compute the depth of the nodes in a cluster | [
30522,
3853,
24134,
3630,
5732,
23606,
7898,
1006,
14164,
1010,
7926,
1010,
4578,
1010,
9381,
1010,
13045,
3654,
2361,
1010,
27758,
2015,
1010,
16865,
1007,
1063,
13075,
14164,
3762,
27035,
2705,
1027,
7374,
3630,
6155,
3762,
27035,
2705,
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... |
openlayers/openlayers | src/ol/sphere.js | getAreaInternal | function getAreaInternal(coordinates, radius) {
let area = 0;
const len = coordinates.length;
let x1 = coordinates[len - 1][0];
let y1 = coordinates[len - 1][1];
for (let i = 0; i < len; i++) {
const x2 = coordinates[i][0];
const y2 = coordinates[i][1];
area += toRadians(x2 - x1) *
(2 + Math.sin(toRadians(y1)) +
Math.sin(toRadians(y2)));
x1 = x2;
y1 = y2;
}
return area * radius * radius / 2.0;
} | javascript | function getAreaInternal(coordinates, radius) {
let area = 0;
const len = coordinates.length;
let x1 = coordinates[len - 1][0];
let y1 = coordinates[len - 1][1];
for (let i = 0; i < len; i++) {
const x2 = coordinates[i][0];
const y2 = coordinates[i][1];
area += toRadians(x2 - x1) *
(2 + Math.sin(toRadians(y1)) +
Math.sin(toRadians(y2)));
x1 = x2;
y1 = y2;
}
return area * radius * radius / 2.0;
} | [
"function",
"getAreaInternal",
"(",
"coordinates",
",",
"radius",
")",
"{",
"let",
"area",
"=",
"0",
";",
"const",
"len",
"=",
"coordinates",
".",
"length",
";",
"let",
"x1",
"=",
"coordinates",
"[",
"len",
"-",
"1",
"]",
"[",
"0",
"]",
";",
"let",
... | Returns the spherical area for a list of coordinates.
[Reference](https://trs-new.jpl.nasa.gov/handle/2014/40409)
Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
Laboratory, Pasadena, CA, June 2007
@param {Array<import("./coordinate.js").Coordinate>} coordinates List of coordinates of a linear
ring. If the ring is oriented clockwise, the area will be positive,
otherwise it will be negative.
@param {number} radius The sphere radius.
@return {number} Area (in square meters). | [
"Returns",
"the",
"spherical",
"area",
"for",
"a",
"list",
"of",
"coordinates",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/sphere.js#L153-L168 | train | Get area of a polygon | [
30522,
3853,
2131,
12069,
22325,
11795,
2389,
1006,
12093,
1010,
12177,
1007,
1063,
2292,
2181,
1027,
1014,
1025,
9530,
3367,
18798,
1027,
12093,
1012,
3091,
1025,
2292,
1060,
2487,
1027,
12093,
1031,
18798,
1011,
1015,
1033,
1031,
1014,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 (elem)
{
if (elem === null) { return ; }
if (typeof(elem.sort) === "function") {
for (var i = 0; i < elem.length; i++) {
this._queueData(elem[i]);
}
} else if (typeof(elem.tree) === "function") {
this._queueData(elem.tree());
} else {
this._queueData(elem);
}
this._proto._send();
} | javascript | function (elem)
{
if (elem === null) { return ; }
if (typeof(elem.sort) === "function") {
for (var i = 0; i < elem.length; i++) {
this._queueData(elem[i]);
}
} else if (typeof(elem.tree) === "function") {
this._queueData(elem.tree());
} else {
this._queueData(elem);
}
this._proto._send();
} | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"elem",
"===",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"typeof",
"(",
"elem",
".",
"sort",
")",
"===",
"\"function\"",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elem",
"... | /* jshint unused:true Function: send
Send a stanza.
This function is called to push data onto the send queue to
go out over the wire. Whenever a request is sent to the BOSH
server, all pending data is sent and the queue is flushed.
Parameters:
(XMLElement |
[XMLElement] |
Strophe.Builder) elem - The stanza to send. | [
"/",
"*",
"jshint",
"unused",
":",
"true",
"Function",
":",
"send",
"Send",
"a",
"stanza",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L2414-L2428 | train | An array of data to send to the peer | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
2065,
1006,
3449,
6633,
1027,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
2828,
11253,
1006,
3449,
6633,
1012,
4066,
1007,
1027,
1027,
1027,
1000,
3853,
1000,
1007,
1063,
2005,
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.demokit/src/sap/ui/demokit/explored/view/entity.controller.js | function (sType) {
if (!sType) {
return null;
} else {
// remove core prefix
sType = sType.replace("sap.ui.core.", "");
// only take text after last dot
var index = sType.lastIndexOf(".");
return (index !== -1) ? sType.substr(index + 1) : sType;
}
} | javascript | function (sType) {
if (!sType) {
return null;
} else {
// remove core prefix
sType = sType.replace("sap.ui.core.", "");
// only take text after last dot
var index = sType.lastIndexOf(".");
return (index !== -1) ? sType.substr(index + 1) : sType;
}
} | [
"function",
"(",
"sType",
")",
"{",
"if",
"(",
"!",
"sType",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"// remove core prefix",
"sType",
"=",
"sType",
".",
"replace",
"(",
"\"sap.ui.core.\"",
",",
"\"\"",
")",
";",
"// only take text after last dot"... | Converts the type to a friendly readable text | [
"Converts",
"the",
"type",
"to",
"a",
"friendly",
"readable",
"text"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/view/entity.controller.js#L476-L486 | train | Returns the type of the object | [
30522,
3853,
1006,
2358,
18863,
1007,
1063,
2065,
1006,
999,
2358,
18863,
1007,
1063,
2709,
19701,
1025,
1065,
2842,
1063,
1013,
1013,
6366,
4563,
17576,
2358,
18863,
1027,
2358,
18863,
1012,
5672,
1006,
1000,
20066,
1012,
21318,
1012,
4563... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/JSUtils/ScopeManager.js | _setConfig | function _setConfig(configUpdate) {
config = brackets._configureJSCodeHints.config;
postMessage({
type: MessageIds.SET_CONFIG,
config: configUpdate
});
} | javascript | function _setConfig(configUpdate) {
config = brackets._configureJSCodeHints.config;
postMessage({
type: MessageIds.SET_CONFIG,
config: configUpdate
});
} | [
"function",
"_setConfig",
"(",
"configUpdate",
")",
"{",
"config",
"=",
"brackets",
".",
"_configureJSCodeHints",
".",
"config",
";",
"postMessage",
"(",
"{",
"type",
":",
"MessageIds",
".",
"SET_CONFIG",
",",
"config",
":",
"configUpdate",
"}",
")",
";",
"}... | @private
Update the configuration in the tern node domain. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1582-L1588 | train | Sets the config of the node | [
30522,
3853,
1035,
2275,
8663,
8873,
2290,
1006,
9530,
8873,
12193,
17299,
3686,
1007,
1063,
9530,
8873,
2290,
1027,
19719,
1012,
1035,
9530,
8873,
27390,
20518,
9363,
25383,
18447,
2015,
1012,
9530,
8873,
2290,
1025,
2695,
7834,
3736,
3351... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.