repo stringclasses 195 values | path stringlengths 4 99 | func_name stringlengths 0 41 | original_string stringlengths 72 56.1k | language stringclasses 1 value | code stringlengths 72 56.1k | code_tokens listlengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens listlengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SheetJS/js-xlsx | xlsx.js | make_sector_list | function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
var sl = sectors.length, sector_list = ([]);
var chkd = [], buf = [], buf_chain = [];
var modulus = ssz - 1, i=0, j=0, k=0, jj=0;
for(i=0; i < sl; ++i) {
buf = ([]);
k = (i + dir_start); if(k >= sl) k-=sl;
if(chkd[k]) continue;
buf_chain = [];
for(j=k; j>=0;) {
chkd[j] = true;
buf[buf.length] = j;
buf_chain.push(sectors[j]);
var addr = fat_addrs[Math.floor(j*4/ssz)];
jj = ((j*4) & modulus);
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
if(!sectors[addr]) break;
j = __readInt32LE(sectors[addr], jj);
}
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
}
return sector_list;
} | javascript | function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
var sl = sectors.length, sector_list = ([]);
var chkd = [], buf = [], buf_chain = [];
var modulus = ssz - 1, i=0, j=0, k=0, jj=0;
for(i=0; i < sl; ++i) {
buf = ([]);
k = (i + dir_start); if(k >= sl) k-=sl;
if(chkd[k]) continue;
buf_chain = [];
for(j=k; j>=0;) {
chkd[j] = true;
buf[buf.length] = j;
buf_chain.push(sectors[j]);
var addr = fat_addrs[Math.floor(j*4/ssz)];
jj = ((j*4) & modulus);
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
if(!sectors[addr]) break;
j = __readInt32LE(sectors[addr], jj);
}
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
}
return sector_list;
} | [
"function",
"make_sector_list",
"(",
"sectors",
",",
"dir_start",
",",
"fat_addrs",
",",
"ssz",
")",
"{",
"var",
"sl",
"=",
"sectors",
".",
"length",
",",
"sector_list",
"=",
"(",
"[",
"]",
")",
";",
"var",
"chkd",
"=",
"[",
"]",
",",
"buf",
"=",
"... | Chase down the sector linked lists | [
"Chase",
"down",
"the",
"sector",
"linked",
"lists"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L1571-L1593 | train | make_sector_list - make a sector list | [
30522,
3853,
2191,
1035,
4753,
1035,
2862,
1006,
11105,
1010,
16101,
1035,
2707,
1010,
6638,
1035,
5587,
2869,
1010,
7020,
2480,
1007,
1063,
13075,
22889,
1027,
11105,
1012,
3091,
1010,
4753,
1035,
2862,
1027,
1006,
1031,
1033,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/accessor-pairs.js | isPropertyDescriptor | function isPropertyDescriptor(node) {
// Object.defineProperty(obj, "foo", {set: ...})
if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") ||
isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty")
) {
return true;
}
/*
* Object.defineProperties(obj, {foo: {set: ...}})
* Object.create(proto, {foo: {set: ...}})
*/
const grandparent = node.parent.parent;
return grandparent.type === "ObjectExpression" && (
isArgumentOfMethodCall(grandparent, 1, "Object", "create") ||
isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties")
);
} | javascript | function isPropertyDescriptor(node) {
// Object.defineProperty(obj, "foo", {set: ...})
if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") ||
isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty")
) {
return true;
}
/*
* Object.defineProperties(obj, {foo: {set: ...}})
* Object.create(proto, {foo: {set: ...}})
*/
const grandparent = node.parent.parent;
return grandparent.type === "ObjectExpression" && (
isArgumentOfMethodCall(grandparent, 1, "Object", "create") ||
isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties")
);
} | [
"function",
"isPropertyDescriptor",
"(",
"node",
")",
"{",
"// Object.defineProperty(obj, \"foo\", {set: ...})",
"if",
"(",
"isArgumentOfMethodCall",
"(",
"node",
",",
"2",
",",
"\"Object\"",
",",
"\"defineProperty\"",
")",
"||",
"isArgumentOfMethodCall",
"(",
"node",
"... | Checks whether or not a given node is a property descriptor.
@param {ASTNode} node - A node to check.
@returns {boolean} `true` if the node is a property descriptor. | [
"Checks",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"a",
"property",
"descriptor",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/accessor-pairs.js#L48-L67 | train | Determines whether the node is a property descriptor | [
30522,
3853,
2003,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
13045,
1007,
1063,
1013,
1013,
4874,
1012,
9375,
21572,
4842,
3723,
1006,
27885,
3501,
1010,
1000,
29379,
1000,
1010,
1063,
2275,
1024,
1012,
1012,
1012,
1065,
1007,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wuchangming/spy-debugger | buildin_modules/weinre/web/demo/weinre-demo.js | intervalStuff | function intervalStuff() {
var message = "doing interval stuff at " + new Date()
// add a timeout
setTimeout(function() { console.log(message)}, 333)
// add a timeline marker
console.markTimeline(message)
// write to local- and sessionStorage
if (window.localStorage) {
var smessage = message + " (local)"
window.localStorage.setItem( "item-" + storageIndex, smessage)
}
if (window.sessionStorage) {
var smessage = message + " (session)"
window.sessionStorage.setItem("item-" + storageIndex, smessage)
}
storageIndex++
// write the message to the page
output(message)
// do an XHR
var xhr = new XMLHttpRequest()
// xhr.addEventListener("readystatechange", function() {logXhr(this)})
xhr.open("GET", "../target/target-script.js", true)
xhr.send()
} | javascript | function intervalStuff() {
var message = "doing interval stuff at " + new Date()
// add a timeout
setTimeout(function() { console.log(message)}, 333)
// add a timeline marker
console.markTimeline(message)
// write to local- and sessionStorage
if (window.localStorage) {
var smessage = message + " (local)"
window.localStorage.setItem( "item-" + storageIndex, smessage)
}
if (window.sessionStorage) {
var smessage = message + " (session)"
window.sessionStorage.setItem("item-" + storageIndex, smessage)
}
storageIndex++
// write the message to the page
output(message)
// do an XHR
var xhr = new XMLHttpRequest()
// xhr.addEventListener("readystatechange", function() {logXhr(this)})
xhr.open("GET", "../target/target-script.js", true)
xhr.send()
} | [
"function",
"intervalStuff",
"(",
")",
"{",
"var",
"message",
"=",
"\"doing interval stuff at \"",
"+",
"new",
"Date",
"(",
")",
"// add a timeout",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"message",
")",
"}",
",",
"333",
... | ------------------------------------------------------------------------------ | [
"------------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/demo/weinre-demo.js#L89-L119 | train | This function is called every time a new interval is created. | [
30522,
3853,
14025,
8525,
4246,
1006,
1007,
1063,
13075,
4471,
1027,
1000,
2725,
13483,
4933,
2012,
1000,
1009,
2047,
3058,
1006,
1007,
1013,
1013,
5587,
1037,
2051,
5833,
2275,
7292,
5833,
1006,
3853,
1006,
1007,
1063,
10122,
1012,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/Storage.js | function (el) {
if (el.__storage === this) {
return;
}
if (el instanceof Group) {
el.addChildrenToStorage(this);
}
this.addToStorage(el);
this._roots.push(el);
} | javascript | function (el) {
if (el.__storage === this) {
return;
}
if (el instanceof Group) {
el.addChildrenToStorage(this);
}
this.addToStorage(el);
this._roots.push(el);
} | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"el",
".",
"__storage",
"===",
"this",
")",
"{",
"return",
";",
"}",
"if",
"(",
"el",
"instanceof",
"Group",
")",
"{",
"el",
".",
"addChildrenToStorage",
"(",
"this",
")",
";",
"}",
"this",
".",
"addToSto... | 添加图形(Shape)或者组(Group)到根节点
@param {module:zrender/Element} el | [
"添加图形",
"(",
"Shape",
")",
"或者组",
"(",
"Group",
")",
"到根节点"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Storage.js#L159-L170 | train | Add an element to the cache | [
30522,
3853,
1006,
3449,
1007,
1063,
2065,
1006,
3449,
1012,
1035,
1035,
5527,
1027,
1027,
1027,
2023,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
3449,
6013,
11253,
2177,
1007,
1063,
3449,
1012,
5587,
19339,
22787,
14122,
6525,
3351,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/selenium-core/scripts/ui-element.js | UIElement | function UIElement(uiElementShorthand)
{
// a shorthand object might look like:
//
// {
// name: 'topic'
// , description: 'sidebar links to topic categories'
// , args: [
// {
// name: 'name'
// , description: 'the name of the topic'
// , defaultValues: topLevelTopics
// }
// ]
// , getLocator: function(args) {
// return this._listXPath +
// "/a[text()=" + args.name.quoteForXPath() + "]";
// }
// , getGenericLocator: function() {
// return this._listXPath + '/a';
// }
// // maintain testcases for getLocator()
// , testcase1: {
// // defaultValues used if args not specified
// args: { name: 'foo' }
// , xhtml: '<div id="topiclist">'
// + '<ul><li><a expected-result="1">foo</a></li></ul>'
// + '</div>'
// }
// // set a local element variable
// , _listXPath: "//div[@id='topiclist']/ul/li"
// }
//
// name cannot be null or an empty string. Enforce the same requirement for
// the description.
/**
* Recursively returns all permutations of argument-value pairs, given
* a list of argument definitions. Each argument definition will have
* a set of default values to use in generating said pairs. If an argument
* has no default values defined, it will not be included among the
* permutations.
*
* @param args a list of UIArguments
* @param inDocument the document object to pass to the getDefaultValues()
* method of each argument.
*
* @return a list of associative arrays containing key value pairs
*/
this.permuteArgs = function(args, inDocument) {
if (args.length == 0) {
return [];
}
var permutations = [];
var arg = args[0];
var remainingArgs = args.slice(1);
var subsequentPermutations = this.permuteArgs(remainingArgs,
inDocument);
var defaultValues = arg.getDefaultValues(inDocument);
// skip arguments for which no default values are defined. If the
// argument is a required one, then no permutations are possible.
if (defaultValues.length == 0) {
if (arg.required) {
return [];
}
else {
return subsequentPermutations;
}
}
for (var i = 0; i < defaultValues.length; ++i) {
var value = defaultValues[i];
var permutation;
if (subsequentPermutations.length == 0) {
permutation = {};
permutation[arg.name] = value + "";
permutations.push(permutation);
}
else {
for (var j = 0; j < subsequentPermutations.length; ++j) {
permutation = clone(subsequentPermutations[j]);
permutation[arg.name] = value + "";
permutations.push(permutation);
}
}
}
return permutations;
}
/**
* Returns a list of all testcases for this UIElement.
*/
this.getTestcases = function()
{
return this.testcases;
}
/**
* Run all unit tests, stopping at the first failure, if any. Return true
* if no failures encountered, false otherwise. See the following thread
* regarding use of getElementById() on XML documents created by parsing
* text via the DOMParser:
*
* http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/2b1b82b3c53a1282/
*/
this.test = function()
{
var parser = new DOMParser();
var testcases = this.getTestcases();
testcaseLoop: for (var i = 0; i < testcases.length; ++i) {
var testcase = testcases[i];
var xhtml = UI_GLOBAL.XHTML_DOCTYPE + '<html xmlns="'
+ UI_GLOBAL.XHTML_XMLNS + '">' + testcase.xhtml + '</html>';
var doc = parser.parseFromString(xhtml, "text/xml");
if (doc.firstChild.nodeName == 'parsererror') {
safe_alert('Error parsing XHTML in testcase "' + testcase.name
+ '" for UI element "' + this.name + '": ' + "\n"
+ doc.firstChild.firstChild.nodeValue);
}
// we're no longer using the default locators when testing, because
// args is now required
var locator = parse_locator(this.getLocator(testcase.args));
var results;
if (locator.type == 'xpath' || (locator.type == 'implicit' &&
locator.string.substring(0, 2) == '//')) {
// try using the javascript xpath engine to avoid namespace
// issues. The xpath does have to be lowercase however, it
// seems.
results = eval_xpath(locator.string, doc,
{ allowNativeXpath: false, returnOnFirstMatch: true });
}
else {
// piece the locator back together
locator = (locator.type == 'implicit')
? locator.string
: locator.type + '=' + locator.string;
results = eval_locator(locator, doc);
}
if (results.length && results[0].hasAttribute('expected-result')) {
continue testcaseLoop;
}
// testcase failed
if (is_IDE()) {
var msg = 'Testcase "' + testcase.name
+ '" failed for UI element "' + this.name + '":';
if (!results.length) {
msg += '\n"' + (locator.string || locator) + '" did not match any elements!';
}
else {
msg += '\n' + results[0] + ' was not the expected result!';
}
safe_alert(msg);
}
return false;
}
return true;
};
/**
* Creates a set of locators using permutations of default values for
* arguments used in the locator construction. The set is returned as an
* object mapping locators to key-value arguments objects containing the
* values passed to getLocator() to create the locator.
*
* @param opt_inDocument (optional) the document object of the "current"
* page when this method is invoked. Some arguments
* may have default value lists that are calculated
* based on the contents of the page.
*
* @return a list of locator strings
* @throws UIElementException
*/
this.getDefaultLocators = function(opt_inDocument) {
var defaultLocators = {};
if (this.args.length == 0) {
defaultLocators[this.getLocator({})] = {};
}
else {
var permutations = this.permuteArgs(this.args, opt_inDocument);
if (permutations.length != 0) {
for (var i = 0; i < permutations.length; ++i) {
var args = permutations[i];
var locator = this.getLocator(args);
if (!locator) {
throw new UIElementException('Error in UIElement(): '
+ 'no getLocator return value for element "' + name
+ '"');
}
defaultLocators[locator] = args;
}
}
else {
// try using no arguments. Parse the locator to make sure it's
// really good. If it doesn't work, fine.
try {
var locator = this.getLocator();
parse_locator(locator);
defaultLocators[locator] = {};
}
catch (e) {
safe_log('debug', e.message);
}
}
}
return defaultLocators;
};
/**
* Validate the structure of the shorthand notation this object is being
* initialized with. Throws an exception if there's a validation error.
*
* @param uiElementShorthand
*
* @throws UIElementException
*/
this.validate = function(uiElementShorthand)
{
var msg = "UIElement validation error:\n" + print_r(uiElementShorthand);
if (!uiElementShorthand.name) {
throw new UIElementException(msg + 'no name specified!');
}
if (!uiElementShorthand.description) {
throw new UIElementException(msg + 'no description specified!');
}
if (!uiElementShorthand.locator
&& !uiElementShorthand.getLocator
&& !uiElementShorthand.xpath
&& !uiElementShorthand.getXPath) {
throw new UIElementException(msg + 'no locator specified!');
}
};
this.init = function(uiElementShorthand)
{
this.validate(uiElementShorthand);
this.name = uiElementShorthand.name;
this.description = uiElementShorthand.description;
// construct a new getLocator() method based on the locator property,
// or use the provided function. We're deprecating the xpath property
// and getXPath() function, but still allow for them for backwards
// compatability.
if (uiElementShorthand.locator) {
this.getLocator = function(args) {
return uiElementShorthand.locator;
};
}
else if (uiElementShorthand.getLocator) {
this.getLocator = uiElementShorthand.getLocator;
}
else if (uiElementShorthand.xpath) {
this.getLocator = function(args) {
return uiElementShorthand.xpath;
};
}
else {
this.getLocator = uiElementShorthand.getXPath;
}
if (uiElementShorthand.genericLocator) {
this.getGenericLocator = function() {
return uiElementShorthand.genericLocator;
};
}
else if (uiElementShorthand.getGenericLocator) {
this.getGenericLocator = uiElementShorthand.getGenericLocator;
}
if (uiElementShorthand.getOffsetLocator) {
this.getOffsetLocator = uiElementShorthand.getOffsetLocator;
}
// get the testcases and local variables
this.testcases = [];
var localVars = {};
for (var attr in uiElementShorthand) {
if (attr.match(/^testcase/)) {
var testcase = uiElementShorthand[attr];
if (uiElementShorthand.args &&
uiElementShorthand.args.length && !testcase.args) {
safe_alert('No args defined in ' + attr + ' for UI element '
+ this.name + '! Skipping testcase.');
continue;
}
testcase.name = attr;
this.testcases.push(testcase);
}
else if (attr.match(/^_/)) {
this[attr] = uiElementShorthand[attr];
localVars[attr] = uiElementShorthand[attr];
}
}
// create the arguments
this.args = []
this.argsOrder = [];
if (uiElementShorthand.args) {
for (var i = 0; i < uiElementShorthand.args.length; ++i) {
var arg = new UIArgument(uiElementShorthand.args[i], localVars);
this.args.push(arg);
this.argsOrder.push(arg.name);
// if an exception is thrown when invoking getDefaultValues()
// with no parameters passed in, assume the method requires an
// inDocument parameter, and thus may only be invoked at run
// time. Mark the UI element object accordingly.
try {
arg.getDefaultValues();
}
catch (e) {
this.isDefaultLocatorConstructionDeferred = true;
}
}
}
if (!this.isDefaultLocatorConstructionDeferred) {
this.defaultLocators = this.getDefaultLocators();
}
};
this.init(uiElementShorthand);
} | javascript | function UIElement(uiElementShorthand)
{
// a shorthand object might look like:
//
// {
// name: 'topic'
// , description: 'sidebar links to topic categories'
// , args: [
// {
// name: 'name'
// , description: 'the name of the topic'
// , defaultValues: topLevelTopics
// }
// ]
// , getLocator: function(args) {
// return this._listXPath +
// "/a[text()=" + args.name.quoteForXPath() + "]";
// }
// , getGenericLocator: function() {
// return this._listXPath + '/a';
// }
// // maintain testcases for getLocator()
// , testcase1: {
// // defaultValues used if args not specified
// args: { name: 'foo' }
// , xhtml: '<div id="topiclist">'
// + '<ul><li><a expected-result="1">foo</a></li></ul>'
// + '</div>'
// }
// // set a local element variable
// , _listXPath: "//div[@id='topiclist']/ul/li"
// }
//
// name cannot be null or an empty string. Enforce the same requirement for
// the description.
/**
* Recursively returns all permutations of argument-value pairs, given
* a list of argument definitions. Each argument definition will have
* a set of default values to use in generating said pairs. If an argument
* has no default values defined, it will not be included among the
* permutations.
*
* @param args a list of UIArguments
* @param inDocument the document object to pass to the getDefaultValues()
* method of each argument.
*
* @return a list of associative arrays containing key value pairs
*/
this.permuteArgs = function(args, inDocument) {
if (args.length == 0) {
return [];
}
var permutations = [];
var arg = args[0];
var remainingArgs = args.slice(1);
var subsequentPermutations = this.permuteArgs(remainingArgs,
inDocument);
var defaultValues = arg.getDefaultValues(inDocument);
// skip arguments for which no default values are defined. If the
// argument is a required one, then no permutations are possible.
if (defaultValues.length == 0) {
if (arg.required) {
return [];
}
else {
return subsequentPermutations;
}
}
for (var i = 0; i < defaultValues.length; ++i) {
var value = defaultValues[i];
var permutation;
if (subsequentPermutations.length == 0) {
permutation = {};
permutation[arg.name] = value + "";
permutations.push(permutation);
}
else {
for (var j = 0; j < subsequentPermutations.length; ++j) {
permutation = clone(subsequentPermutations[j]);
permutation[arg.name] = value + "";
permutations.push(permutation);
}
}
}
return permutations;
}
/**
* Returns a list of all testcases for this UIElement.
*/
this.getTestcases = function()
{
return this.testcases;
}
/**
* Run all unit tests, stopping at the first failure, if any. Return true
* if no failures encountered, false otherwise. See the following thread
* regarding use of getElementById() on XML documents created by parsing
* text via the DOMParser:
*
* http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/2b1b82b3c53a1282/
*/
this.test = function()
{
var parser = new DOMParser();
var testcases = this.getTestcases();
testcaseLoop: for (var i = 0; i < testcases.length; ++i) {
var testcase = testcases[i];
var xhtml = UI_GLOBAL.XHTML_DOCTYPE + '<html xmlns="'
+ UI_GLOBAL.XHTML_XMLNS + '">' + testcase.xhtml + '</html>';
var doc = parser.parseFromString(xhtml, "text/xml");
if (doc.firstChild.nodeName == 'parsererror') {
safe_alert('Error parsing XHTML in testcase "' + testcase.name
+ '" for UI element "' + this.name + '": ' + "\n"
+ doc.firstChild.firstChild.nodeValue);
}
// we're no longer using the default locators when testing, because
// args is now required
var locator = parse_locator(this.getLocator(testcase.args));
var results;
if (locator.type == 'xpath' || (locator.type == 'implicit' &&
locator.string.substring(0, 2) == '//')) {
// try using the javascript xpath engine to avoid namespace
// issues. The xpath does have to be lowercase however, it
// seems.
results = eval_xpath(locator.string, doc,
{ allowNativeXpath: false, returnOnFirstMatch: true });
}
else {
// piece the locator back together
locator = (locator.type == 'implicit')
? locator.string
: locator.type + '=' + locator.string;
results = eval_locator(locator, doc);
}
if (results.length && results[0].hasAttribute('expected-result')) {
continue testcaseLoop;
}
// testcase failed
if (is_IDE()) {
var msg = 'Testcase "' + testcase.name
+ '" failed for UI element "' + this.name + '":';
if (!results.length) {
msg += '\n"' + (locator.string || locator) + '" did not match any elements!';
}
else {
msg += '\n' + results[0] + ' was not the expected result!';
}
safe_alert(msg);
}
return false;
}
return true;
};
/**
* Creates a set of locators using permutations of default values for
* arguments used in the locator construction. The set is returned as an
* object mapping locators to key-value arguments objects containing the
* values passed to getLocator() to create the locator.
*
* @param opt_inDocument (optional) the document object of the "current"
* page when this method is invoked. Some arguments
* may have default value lists that are calculated
* based on the contents of the page.
*
* @return a list of locator strings
* @throws UIElementException
*/
this.getDefaultLocators = function(opt_inDocument) {
var defaultLocators = {};
if (this.args.length == 0) {
defaultLocators[this.getLocator({})] = {};
}
else {
var permutations = this.permuteArgs(this.args, opt_inDocument);
if (permutations.length != 0) {
for (var i = 0; i < permutations.length; ++i) {
var args = permutations[i];
var locator = this.getLocator(args);
if (!locator) {
throw new UIElementException('Error in UIElement(): '
+ 'no getLocator return value for element "' + name
+ '"');
}
defaultLocators[locator] = args;
}
}
else {
// try using no arguments. Parse the locator to make sure it's
// really good. If it doesn't work, fine.
try {
var locator = this.getLocator();
parse_locator(locator);
defaultLocators[locator] = {};
}
catch (e) {
safe_log('debug', e.message);
}
}
}
return defaultLocators;
};
/**
* Validate the structure of the shorthand notation this object is being
* initialized with. Throws an exception if there's a validation error.
*
* @param uiElementShorthand
*
* @throws UIElementException
*/
this.validate = function(uiElementShorthand)
{
var msg = "UIElement validation error:\n" + print_r(uiElementShorthand);
if (!uiElementShorthand.name) {
throw new UIElementException(msg + 'no name specified!');
}
if (!uiElementShorthand.description) {
throw new UIElementException(msg + 'no description specified!');
}
if (!uiElementShorthand.locator
&& !uiElementShorthand.getLocator
&& !uiElementShorthand.xpath
&& !uiElementShorthand.getXPath) {
throw new UIElementException(msg + 'no locator specified!');
}
};
this.init = function(uiElementShorthand)
{
this.validate(uiElementShorthand);
this.name = uiElementShorthand.name;
this.description = uiElementShorthand.description;
// construct a new getLocator() method based on the locator property,
// or use the provided function. We're deprecating the xpath property
// and getXPath() function, but still allow for them for backwards
// compatability.
if (uiElementShorthand.locator) {
this.getLocator = function(args) {
return uiElementShorthand.locator;
};
}
else if (uiElementShorthand.getLocator) {
this.getLocator = uiElementShorthand.getLocator;
}
else if (uiElementShorthand.xpath) {
this.getLocator = function(args) {
return uiElementShorthand.xpath;
};
}
else {
this.getLocator = uiElementShorthand.getXPath;
}
if (uiElementShorthand.genericLocator) {
this.getGenericLocator = function() {
return uiElementShorthand.genericLocator;
};
}
else if (uiElementShorthand.getGenericLocator) {
this.getGenericLocator = uiElementShorthand.getGenericLocator;
}
if (uiElementShorthand.getOffsetLocator) {
this.getOffsetLocator = uiElementShorthand.getOffsetLocator;
}
// get the testcases and local variables
this.testcases = [];
var localVars = {};
for (var attr in uiElementShorthand) {
if (attr.match(/^testcase/)) {
var testcase = uiElementShorthand[attr];
if (uiElementShorthand.args &&
uiElementShorthand.args.length && !testcase.args) {
safe_alert('No args defined in ' + attr + ' for UI element '
+ this.name + '! Skipping testcase.');
continue;
}
testcase.name = attr;
this.testcases.push(testcase);
}
else if (attr.match(/^_/)) {
this[attr] = uiElementShorthand[attr];
localVars[attr] = uiElementShorthand[attr];
}
}
// create the arguments
this.args = []
this.argsOrder = [];
if (uiElementShorthand.args) {
for (var i = 0; i < uiElementShorthand.args.length; ++i) {
var arg = new UIArgument(uiElementShorthand.args[i], localVars);
this.args.push(arg);
this.argsOrder.push(arg.name);
// if an exception is thrown when invoking getDefaultValues()
// with no parameters passed in, assume the method requires an
// inDocument parameter, and thus may only be invoked at run
// time. Mark the UI element object accordingly.
try {
arg.getDefaultValues();
}
catch (e) {
this.isDefaultLocatorConstructionDeferred = true;
}
}
}
if (!this.isDefaultLocatorConstructionDeferred) {
this.defaultLocators = this.getDefaultLocators();
}
};
this.init(uiElementShorthand);
} | [
"function",
"UIElement",
"(",
"uiElementShorthand",
")",
"{",
"// a shorthand object might look like:",
"//",
"// {",
"// name: 'topic'",
"// , description: 'sidebar links to topic categories'",
"// , args: [",
"// {",
"// name: 'name'",
"// , ... | ***************************************************************************** UI-Element core
The UIElement object. This has been crafted along with UIMap to make
specifying UI elements using JSON as simple as possible. Object construction
will fail if 1) a proper name isn't provided, 2) a faulty args argument is
given, or 3) getLocator() returns undefined for a valid permutation of
default argument values. See ui-doc.html for the documentation on the
builder syntax.
@param uiElementShorthand an object whose contents conform to the
UI-Element builder syntax.
@return a new UIElement object
@throws UIElementException | [
"*****************************************************************************",
"UI",
"-",
"Element",
"core",
"The",
"UIElement",
"object",
".",
"This",
"has",
"been",
"crafted",
"along",
"with",
"UIMap",
"to",
"make",
"specifying",
"UI",
"elements",
"using",
"JSON",
"... | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/ui-element.js#L62-L405 | train | A UI element | [
30522,
3853,
21318,
12260,
3672,
1006,
21318,
12260,
8163,
27794,
11774,
1007,
1063,
1013,
1013,
1037,
2460,
11774,
4874,
2453,
2298,
2066,
1024,
1013,
1013,
1013,
1013,
1063,
1013,
1013,
2171,
1024,
1005,
8476,
1005,
1013,
1013,
1010,
6412... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_Hyperlink | function parse_Hyperlink(blob, length) {
var end = blob.l + length;
var sVer = blob.read_shift(4);
if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
var flags = blob.read_shift(2);
blob.l += 2;
var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime;
if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0020) guid = blob.read_shift(16);
if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
blob.l = end;
var target = targetFrameName||moniker||oleMoniker||"";
if(target && Loc) target+="#"+Loc;
if(!target) target = "#" + Loc;
var out = ({Target:target});
if(guid) out.guid = guid;
if(fileTime) out.time = fileTime;
if(displayName) out.Tooltip = displayName;
return out;
} | javascript | function parse_Hyperlink(blob, length) {
var end = blob.l + length;
var sVer = blob.read_shift(4);
if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
var flags = blob.read_shift(2);
blob.l += 2;
var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime;
if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
if(flags & 0x0020) guid = blob.read_shift(16);
if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
blob.l = end;
var target = targetFrameName||moniker||oleMoniker||"";
if(target && Loc) target+="#"+Loc;
if(!target) target = "#" + Loc;
var out = ({Target:target});
if(guid) out.guid = guid;
if(fileTime) out.time = fileTime;
if(displayName) out.Tooltip = displayName;
return out;
} | [
"function",
"parse_Hyperlink",
"(",
"blob",
",",
"length",
")",
"{",
"var",
"end",
"=",
"blob",
".",
"l",
"+",
"length",
";",
"var",
"sVer",
"=",
"blob",
".",
"read_shift",
"(",
"4",
")",
";",
"if",
"(",
"sVer",
"!==",
"2",
")",
"throw",
"new",
"... | /* [MS-OSHARED] 2.3.7.1 Hyperlink Object | [
"/",
"*",
"[",
"MS",
"-",
"OSHARED",
"]",
"2",
".",
"3",
".",
"7",
".",
"1",
"Hyperlink",
"Object"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5506-L5529 | train | Parse Hyperlink | [
30522,
3853,
11968,
3366,
1035,
23760,
13767,
1006,
1038,
4135,
2497,
1010,
3091,
1007,
1063,
13075,
2203,
1027,
1038,
4135,
2497,
1012,
1048,
1009,
3091,
1025,
13075,
17917,
2121,
1027,
1038,
4135,
2497,
1012,
3191,
1035,
5670,
1006,
1018,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zloirock/core-js | packages/core-js/modules/es.string.replace.js | replace | function replace(searchValue, replaceValue) {
var O = requireObjectCoercible(this);
var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
return replacer !== undefined
? replacer.call(searchValue, O, replaceValue)
: nativeReplace.call(String(O), searchValue, replaceValue);
} | javascript | function replace(searchValue, replaceValue) {
var O = requireObjectCoercible(this);
var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
return replacer !== undefined
? replacer.call(searchValue, O, replaceValue)
: nativeReplace.call(String(O), searchValue, replaceValue);
} | [
"function",
"replace",
"(",
"searchValue",
",",
"replaceValue",
")",
"{",
"var",
"O",
"=",
"requireObjectCoercible",
"(",
"this",
")",
";",
"var",
"replacer",
"=",
"searchValue",
"==",
"undefined",
"?",
"undefined",
":",
"searchValue",
"[",
"REPLACE",
"]",
"... | `String.prototype.replace` method https://tc39.github.io/ecma262/#sec-string.prototype.replace | [
"String",
".",
"prototype",
".",
"replace",
"method",
"https",
":",
"//",
"tc39",
".",
"github",
".",
"io",
"/",
"ecma262",
"/",
"#sec",
"-",
"string",
".",
"prototype",
".",
"replace"
] | fe7c8511a6d27d03a9b8e075b3351416aae95c58 | https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/es.string.replace.js#L28-L34 | train | Replace the value of the object with the value of the value of the value | [
30522,
3853,
5672,
1006,
3945,
10175,
5657,
1010,
5672,
10175,
5657,
1007,
1063,
13075,
1051,
1027,
5478,
16429,
20614,
16288,
11890,
7028,
1006,
2023,
1007,
1025,
13075,
5672,
2099,
1027,
3945,
10175,
5657,
1027,
1027,
6151,
28344,
1029,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-statements-per-line.js | reportFirstExtraStatementAndClear | function reportFirstExtraStatementAndClear() {
if (firstExtraStatement) {
context.report({
node: firstExtraStatement,
messageId: "exceed",
data: {
numberOfStatementsOnThisLine,
maxStatementsPerLine,
statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements"
}
});
}
firstExtraStatement = null;
} | javascript | function reportFirstExtraStatementAndClear() {
if (firstExtraStatement) {
context.report({
node: firstExtraStatement,
messageId: "exceed",
data: {
numberOfStatementsOnThisLine,
maxStatementsPerLine,
statements: numberOfStatementsOnThisLine === 1 ? "statement" : "statements"
}
});
}
firstExtraStatement = null;
} | [
"function",
"reportFirstExtraStatementAndClear",
"(",
")",
"{",
"if",
"(",
"firstExtraStatement",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
":",
"firstExtraStatement",
",",
"messageId",
":",
"\"exceed\"",
",",
"data",
":",
"{",
"numberOfStatementsOnThi... | Reports with the first extra statement, and clears it.
@returns {void} | [
"Reports",
"with",
"the",
"first",
"extra",
"statement",
"and",
"clears",
"it",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/max-statements-per-line.js#L67-L80 | train | report first extra statement | [
30522,
3853,
3189,
8873,
12096,
10288,
6494,
9153,
18532,
4765,
5685,
14321,
2906,
1006,
1007,
1063,
2065,
1006,
2034,
10288,
6494,
9153,
18532,
4765,
1007,
1063,
6123,
1012,
3189,
1006,
1063,
13045,
1024,
2034,
10288,
6494,
9153,
18532,
47... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | packages/material-ui/src/NoSsr/NoSsr.js | NoSsr | function NoSsr(props) {
const { children, defer = false, fallback = null } = props;
const [mountedState, setMountedState] = React.useState(false);
useEnhancedEffect(() => {
if (!defer) {
setMountedState(true);
}
}, [defer]);
React.useEffect(() => {
if (defer) {
setMountedState(true);
}
}, [defer]);
// We need the Fragment here to force react-docgen to recognise NoSsr as a component.
return <React.Fragment>{mountedState ? children : fallback}</React.Fragment>;
} | javascript | function NoSsr(props) {
const { children, defer = false, fallback = null } = props;
const [mountedState, setMountedState] = React.useState(false);
useEnhancedEffect(() => {
if (!defer) {
setMountedState(true);
}
}, [defer]);
React.useEffect(() => {
if (defer) {
setMountedState(true);
}
}, [defer]);
// We need the Fragment here to force react-docgen to recognise NoSsr as a component.
return <React.Fragment>{mountedState ? children : fallback}</React.Fragment>;
} | [
"function",
"NoSsr",
"(",
"props",
")",
"{",
"const",
"{",
"children",
",",
"defer",
"=",
"false",
",",
"fallback",
"=",
"null",
"}",
"=",
"props",
";",
"const",
"[",
"mountedState",
",",
"setMountedState",
"]",
"=",
"React",
".",
"useState",
"(",
"fal... | NoSsr purposely removes components from the subject of Server Side Rendering (SSR).
This component can be useful in a variety of situations:
- Escape hatch for broken dependencies not supporting SSR.
- Improve the time-to-first paint on the client by only rendering above the fold.
- Reduce the rendering time on the server.
- Under too heavy server load, you can turn on service degradation. | [
"NoSsr",
"purposely",
"removes",
"components",
"from",
"the",
"subject",
"of",
"Server",
"Side",
"Rendering",
"(",
"SSR",
")",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/NoSsr/NoSsr.js#L19-L37 | train | No SSR component. | [
30522,
3853,
16839,
21338,
1006,
24387,
1007,
1063,
9530,
3367,
1063,
2336,
1010,
13366,
2121,
1027,
6270,
1010,
2991,
5963,
1027,
19701,
1065,
1027,
24387,
1025,
9530,
3367,
1031,
5614,
9153,
2618,
1010,
2275,
27632,
9153,
2618,
1033,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/closure-library | closure/goog/html/sanitizer/noclobber.js | getCssPropertyValue | function getCssPropertyValue(cssStyle, propName) {
return genericMethodCall(
Methods.GET_PROPERTY_VALUE, cssStyle,
cssStyle.getPropertyValue ? 'getPropertyValue' : 'getAttribute',
[propName]) ||
'';
} | javascript | function getCssPropertyValue(cssStyle, propName) {
return genericMethodCall(
Methods.GET_PROPERTY_VALUE, cssStyle,
cssStyle.getPropertyValue ? 'getPropertyValue' : 'getAttribute',
[propName]) ||
'';
} | [
"function",
"getCssPropertyValue",
"(",
"cssStyle",
",",
"propName",
")",
"{",
"return",
"genericMethodCall",
"(",
"Methods",
".",
"GET_PROPERTY_VALUE",
",",
"cssStyle",
",",
"cssStyle",
".",
"getPropertyValue",
"?",
"'getPropertyValue'",
":",
"'getAttribute'",
",",
... | Provides a way cross-browser way to get a CSS value from a CSS declaration.
@param {!CSSStyleDeclaration} cssStyle A CSS style object.
@param {string} propName A property name.
@return {string} Value of the property as parsed by the browser.
@supported IE8 and newer. | [
"Provides",
"a",
"way",
"cross",
"-",
"browser",
"way",
"to",
"get",
"a",
"CSS",
"value",
"from",
"a",
"CSS",
"declaration",
"."
] | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L421-L427 | train | Get the value of a CSS property | [
30522,
3853,
2131,
6169,
13102,
18981,
15010,
10175,
5657,
1006,
20116,
4757,
27983,
1010,
17678,
18442,
1007,
1063,
2709,
12391,
11368,
6806,
16409,
8095,
1006,
4725,
1012,
2131,
1035,
3200,
1035,
3643,
1010,
20116,
4757,
27983,
1010,
20116,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | extension/bmap/BMapCoordSys.js | BMapCoordSys | function BMapCoordSys(bmap, api) {
this._bmap = bmap;
this.dimensions = ['lng', 'lat'];
this._mapOffset = [0, 0];
this._api = api;
this._projection = new BMap.MercatorProjection();
} | javascript | function BMapCoordSys(bmap, api) {
this._bmap = bmap;
this.dimensions = ['lng', 'lat'];
this._mapOffset = [0, 0];
this._api = api;
this._projection = new BMap.MercatorProjection();
} | [
"function",
"BMapCoordSys",
"(",
"bmap",
",",
"api",
")",
"{",
"this",
".",
"_bmap",
"=",
"bmap",
";",
"this",
".",
"dimensions",
"=",
"[",
"'lng'",
",",
"'lat'",
"]",
";",
"this",
".",
"_mapOffset",
"=",
"[",
"0",
",",
"0",
"]",
";",
"this",
"."... | /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
/* global BMap | [
"/",
"*",
"Licensed",
"to",
"the",
"Apache",
"Software",
"Foundation",
"(",
"ASF",
")",
"under",
"one",
"or",
"more",
"contributor",
"license",
"agreements",
".",
"See",
"the",
"NOTICE",
"file",
"distributed",
"with",
"this",
"work",
"for",
"additional",
"in... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/extension/bmap/BMapCoordSys.js#L47-L53 | train | A coord system for a bmap | [
30522,
3853,
1038,
2863,
15042,
16506,
5104,
7274,
1006,
1038,
2863,
2361,
1010,
17928,
1007,
1063,
2023,
1012,
1035,
1038,
2863,
2361,
1027,
1038,
2863,
2361,
1025,
2023,
1012,
9646,
1027,
1031,
1005,
1048,
3070,
1005,
1010,
1005,
2474,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Control.js | fnAppendBusyIndicator | function fnAppendBusyIndicator() {
// Only append if busy state is still set
if (!this.getBusy()) {
return;
}
var $this = this.$(this._sBusySection);
//If there is a pending delayed call to append the busy indicator, we can clear it now
if (this._busyIndicatorDelayedCallId) {
clearTimeout(this._busyIndicatorDelayedCallId);
delete this._busyIndicatorDelayedCallId;
}
// if no busy section/control jquery instance could be retrieved -> the control is not part of the dom anymore
// this might happen in certain scenarios when e.g. a dialog is closed faster than the busyIndicatorDelay
if (!$this || $this.length === 0) {
Log.warning("BusyIndicator could not be rendered. The outer control instance is not valid anymore.");
return;
}
if (this._sBlockSection === this._sBusySection) {
if (this._oBlockState) {
BusyIndicatorUtils.addHTML(this._oBlockState, this.getBusyIndicatorSize());
BlockLayerUtils.toggleAnimationStyle(this._oBlockState, true);
this._oBusyBlockState = this._oBlockState;
} else {
// BusyIndicator is the first blocking element created (and )
fnAddStandaloneBusyIndicator.call(this);
}
} else {
// Standalone busy indicator
fnAddStandaloneBusyIndicator.call(this);
}
} | javascript | function fnAppendBusyIndicator() {
// Only append if busy state is still set
if (!this.getBusy()) {
return;
}
var $this = this.$(this._sBusySection);
//If there is a pending delayed call to append the busy indicator, we can clear it now
if (this._busyIndicatorDelayedCallId) {
clearTimeout(this._busyIndicatorDelayedCallId);
delete this._busyIndicatorDelayedCallId;
}
// if no busy section/control jquery instance could be retrieved -> the control is not part of the dom anymore
// this might happen in certain scenarios when e.g. a dialog is closed faster than the busyIndicatorDelay
if (!$this || $this.length === 0) {
Log.warning("BusyIndicator could not be rendered. The outer control instance is not valid anymore.");
return;
}
if (this._sBlockSection === this._sBusySection) {
if (this._oBlockState) {
BusyIndicatorUtils.addHTML(this._oBlockState, this.getBusyIndicatorSize());
BlockLayerUtils.toggleAnimationStyle(this._oBlockState, true);
this._oBusyBlockState = this._oBlockState;
} else {
// BusyIndicator is the first blocking element created (and )
fnAddStandaloneBusyIndicator.call(this);
}
} else {
// Standalone busy indicator
fnAddStandaloneBusyIndicator.call(this);
}
} | [
"function",
"fnAppendBusyIndicator",
"(",
")",
"{",
"// Only append if busy state is still set",
"if",
"(",
"!",
"this",
".",
"getBusy",
"(",
")",
")",
"{",
"return",
";",
"}",
"var",
"$this",
"=",
"this",
".",
"$",
"(",
"this",
".",
"_sBusySection",
")",
... | Add busy indicator to DOM
@private | [
"Add",
"busy",
"indicator",
"to",
"DOM"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Control.js#L721-L759 | train | Append busy indicator to the DOM | [
30522,
3853,
1042,
2532,
21512,
4859,
8286,
25811,
14808,
8844,
1006,
1007,
1063,
1013,
1013,
2069,
10439,
10497,
2065,
5697,
2110,
2003,
2145,
2275,
2065,
1006,
999,
2023,
1012,
2131,
8286,
2100,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | src/directives/inview/inview.js | InView | function InView (el, callback, className) {
var _this = this
if (!(_this instanceof InView)) {
return new InView(el, callback)
}
_this.el = el
_this.callback = callback
function check (e) {
var params = {
windowScrollTop: getScrollTop(),
elementOffsetTop: _this.el.offsetTop,
inViewHeight: window.outerHeight,
elementOffsetTopInViewHeight: window.outerHeight - (getScrollTop() - (_this.el.offsetTop - window.outerHeight))
}
if (isInView(_this.el)) {
addClass(_this.el, className)
_this.callback.call(_this.el, true, params)
} else {
removeClass(_this.el, className)
_this.callback.call(_this.el, false, params)
}
}
var throttledCheck = throttle(check, 100)
check()
addEvent(window, 'scroll', throttledCheck)
} | javascript | function InView (el, callback, className) {
var _this = this
if (!(_this instanceof InView)) {
return new InView(el, callback)
}
_this.el = el
_this.callback = callback
function check (e) {
var params = {
windowScrollTop: getScrollTop(),
elementOffsetTop: _this.el.offsetTop,
inViewHeight: window.outerHeight,
elementOffsetTopInViewHeight: window.outerHeight - (getScrollTop() - (_this.el.offsetTop - window.outerHeight))
}
if (isInView(_this.el)) {
addClass(_this.el, className)
_this.callback.call(_this.el, true, params)
} else {
removeClass(_this.el, className)
_this.callback.call(_this.el, false, params)
}
}
var throttledCheck = throttle(check, 100)
check()
addEvent(window, 'scroll', throttledCheck)
} | [
"function",
"InView",
"(",
"el",
",",
"callback",
",",
"className",
")",
"{",
"var",
"_this",
"=",
"this",
"if",
"(",
"!",
"(",
"_this",
"instanceof",
"InView",
")",
")",
"{",
"return",
"new",
"InView",
"(",
"el",
",",
"callback",
")",
"}",
"_this",
... | @desc Create an InView instance.
@class
@func InView
@param {HTMLElement} element - element to detect when scrolled to view
@param {scrollCallback} scrollCallback - callback function fired on scroll event
@return {HTMLElement} - element
@example
var el = document.querySelector('.item')
var InView = InView(el, function(isInView, data) {
if (isInView) {
console.log('in view')
} else {
if (data.windowScrollTop - (data.elementOffsetTop - data.inViewHeight) > data.inViewHeight) {
console.log('not in view (scroll up)')
} else {
console.log('not in view (scroll down)')
}
}
}) | [
"@desc",
"Create",
"an",
"InView",
"instance",
"."
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/directives/inview/inview.js#L26-L54 | train | InView constructor. | [
30522,
3853,
1999,
8584,
1006,
3449,
1010,
2655,
5963,
1010,
2465,
18442,
1007,
1063,
13075,
1035,
2023,
1027,
2023,
2065,
1006,
999,
1006,
1035,
2023,
6013,
11253,
1999,
8584,
1007,
1007,
1063,
2709,
2047,
1999,
8584,
1006,
3449,
1010,
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/analytics/AnalyticalBinding.js | getAdditionalSelects | function getAdditionalSelects(oBinding) {
var oAnalyticalQueryRequest
= new odata4analytics.QueryResultRequest(oBinding.oAnalyticalQueryResult),
aComputedSelect,
sComputedSelect,
oDimension,
i,
j,
oMeasure,
n,
sPropertyName,
aSelect = oBinding.mParameters.select.split(","),
bError = trimAndCheckForDuplicates(aSelect, oBinding.sPath);
// prepare oAnalyticalQueryRequest to be able to call getURIQueryOptionValue("$select")
oAnalyticalQueryRequest.setAggregationLevel(oBinding.aMaxAggregationLevel);
oAnalyticalQueryRequest.setMeasures(oBinding.aMeasureName);
// update dimension's key, text and attributes as done in relevant _prepare... functions
Object.keys(oBinding.oDimensionDetailsSet).forEach(function (sDimensionKey) {
oDimension = oBinding.oDimensionDetailsSet[sDimensionKey];
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(sDimensionKey,
true, oDimension.textPropertyName !== undefined, oDimension.aAttributeName);
});
// update measure's raw value, formatted value and unit property as done in relevant
// _prepare... functions
Object.keys(oBinding.oMeasureDetailsSet).forEach(function (sMeasureKey) {
oMeasure = oBinding.oMeasureDetailsSet[sMeasureKey];
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(sMeasureKey,
oMeasure.rawValuePropertyName !== undefined,
oMeasure.formattedValuePropertyName !== undefined,
oMeasure.unitPropertyName !== undefined);
});
// at least all selected properties, computed by the binding, are contained in select
// binding parameter
sComputedSelect = oAnalyticalQueryRequest.getURIQueryOptionValue("$select");
if (sComputedSelect) {
aComputedSelect = sComputedSelect.split(",");
for (i = 0, n = aComputedSelect.length; i < n; i++) {
sPropertyName = aComputedSelect[i];
j = aSelect.indexOf(sPropertyName);
if (j < 0) {
oLogger.warning("Ignored the 'select' binding parameter, because"
+ " it does not contain the property '" + sPropertyName + "'",
oBinding.sPath);
bError = true;
} else {
aSelect.splice(j, 1);
}
}
}
// check additionally selected properties, no new dimensions and new measures or
// associated properties for new dimensions or measures are allowed
for (i = 0, n = aSelect.length; i < n; i++) {
sPropertyName = aSelect[i];
oDimension = oBinding.oAnalyticalQueryResult.findDimensionByPropertyName(sPropertyName);
if (oDimension && oBinding.oDimensionDetailsSet[oDimension.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oDimension);
bError = true;
}
oMeasure = oBinding.oAnalyticalQueryResult.findMeasureByPropertyName(sPropertyName);
if (oMeasure && oBinding.oMeasureDetailsSet[oMeasure.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oMeasure);
bError = true;
}
}
return bError ? [] : aSelect;
} | javascript | function getAdditionalSelects(oBinding) {
var oAnalyticalQueryRequest
= new odata4analytics.QueryResultRequest(oBinding.oAnalyticalQueryResult),
aComputedSelect,
sComputedSelect,
oDimension,
i,
j,
oMeasure,
n,
sPropertyName,
aSelect = oBinding.mParameters.select.split(","),
bError = trimAndCheckForDuplicates(aSelect, oBinding.sPath);
// prepare oAnalyticalQueryRequest to be able to call getURIQueryOptionValue("$select")
oAnalyticalQueryRequest.setAggregationLevel(oBinding.aMaxAggregationLevel);
oAnalyticalQueryRequest.setMeasures(oBinding.aMeasureName);
// update dimension's key, text and attributes as done in relevant _prepare... functions
Object.keys(oBinding.oDimensionDetailsSet).forEach(function (sDimensionKey) {
oDimension = oBinding.oDimensionDetailsSet[sDimensionKey];
oAnalyticalQueryRequest.includeDimensionKeyTextAttributes(sDimensionKey,
true, oDimension.textPropertyName !== undefined, oDimension.aAttributeName);
});
// update measure's raw value, formatted value and unit property as done in relevant
// _prepare... functions
Object.keys(oBinding.oMeasureDetailsSet).forEach(function (sMeasureKey) {
oMeasure = oBinding.oMeasureDetailsSet[sMeasureKey];
oAnalyticalQueryRequest.includeMeasureRawFormattedValueUnit(sMeasureKey,
oMeasure.rawValuePropertyName !== undefined,
oMeasure.formattedValuePropertyName !== undefined,
oMeasure.unitPropertyName !== undefined);
});
// at least all selected properties, computed by the binding, are contained in select
// binding parameter
sComputedSelect = oAnalyticalQueryRequest.getURIQueryOptionValue("$select");
if (sComputedSelect) {
aComputedSelect = sComputedSelect.split(",");
for (i = 0, n = aComputedSelect.length; i < n; i++) {
sPropertyName = aComputedSelect[i];
j = aSelect.indexOf(sPropertyName);
if (j < 0) {
oLogger.warning("Ignored the 'select' binding parameter, because"
+ " it does not contain the property '" + sPropertyName + "'",
oBinding.sPath);
bError = true;
} else {
aSelect.splice(j, 1);
}
}
}
// check additionally selected properties, no new dimensions and new measures or
// associated properties for new dimensions or measures are allowed
for (i = 0, n = aSelect.length; i < n; i++) {
sPropertyName = aSelect[i];
oDimension = oBinding.oAnalyticalQueryResult.findDimensionByPropertyName(sPropertyName);
if (oDimension && oBinding.oDimensionDetailsSet[oDimension.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oDimension);
bError = true;
}
oMeasure = oBinding.oAnalyticalQueryResult.findMeasureByPropertyName(sPropertyName);
if (oMeasure && oBinding.oMeasureDetailsSet[oMeasure.getName()] === undefined) {
logUnsupportedPropertyInSelect(oBinding.sPath, sPropertyName, oMeasure);
bError = true;
}
}
return bError ? [] : aSelect;
} | [
"function",
"getAdditionalSelects",
"(",
"oBinding",
")",
"{",
"var",
"oAnalyticalQueryRequest",
"=",
"new",
"odata4analytics",
".",
"QueryResultRequest",
"(",
"oBinding",
".",
"oAnalyticalQueryResult",
")",
",",
"aComputedSelect",
",",
"sComputedSelect",
",",
"oDimensi... | Checks whether the select binding parameter fits to the current analytical info and returns
an array of properties that need to be added to leaf requests. If the select binding
parameter does not fit to the current analytical info a warning is logged and the select
binding parameter is ignored.
Select binding parameter does not fit to the analytical info,
<ul>
<li>if an additional dimension is contained in the select binding parameter
<li>if an associated property (e.g. text property or attribute) of an additional dimension
is contained in the select binding parameter
<li>if an additional measure is contained in the select binding parameter
<li>if an associated property (e.g. text property) of an additional measure is contained in
the select binding parameter
<li>if a dimension or a measure of the current analytical info is not contained in the select
binding parameter
</ul>
@param {sap.ui.model.analytics.AnalyticalBinding} oBinding
The analytical binding instance
@returns {string[]} An array of additional properties that need to be selected or an empty
array if there are no additional select properties needed | [
"Checks",
"whether",
"the",
"select",
"binding",
"parameter",
"fits",
"to",
"the",
"current",
"analytical",
"info",
"and",
"returns",
"an",
"array",
"of",
"properties",
"that",
"need",
"to",
"be",
"added",
"to",
"leaf",
"requests",
".",
"If",
"the",
"select"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalBinding.js#L70-L144 | train | This function is called to add additional select parameters to the query request | [
30522,
3853,
2131,
4215,
27064,
11246,
22471,
2015,
1006,
27885,
22254,
2075,
1007,
1063,
13075,
1051,
27953,
21252,
2389,
4226,
2854,
2890,
15500,
1027,
2047,
1051,
2850,
2696,
2549,
27953,
21252,
2015,
1012,
23032,
6072,
11314,
2890,
15500,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.js | detachAndClean | function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $mdCompiler.
options.cleanupElement();
// Restores the focus to the origin element if the last interaction upon opening was a keyboard.
if (!options.$destroy && options.originInteraction === 'keyboard') {
options.origin.focus();
}
} | javascript | function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $mdCompiler.
options.cleanupElement();
// Restores the focus to the origin element if the last interaction upon opening was a keyboard.
if (!options.$destroy && options.originInteraction === 'keyboard') {
options.origin.focus();
}
} | [
"function",
"detachAndClean",
"(",
")",
"{",
"angular",
".",
"element",
"(",
"$document",
"[",
"0",
"]",
".",
"body",
")",
".",
"removeClass",
"(",
"'md-dialog-is-showing'",
")",
";",
"// Reverse the container stretch if using a content element.",
"if",
"(",
"option... | Detach the element | [
"Detach",
"the",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L835-L850 | train | Detaches the dialog element and cleans up the element | [
30522,
3853,
20010,
6776,
5685,
14321,
2319,
1006,
1007,
1063,
16108,
1012,
5783,
1006,
1002,
6254,
1031,
1014,
1033,
1012,
2303,
1007,
1012,
6366,
26266,
1006,
1005,
9108,
1011,
13764,
8649,
1011,
2003,
1011,
4760,
1005,
1007,
30524,
7047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
var interval = this.result.to - this.result.from;
if (this.old_min_interval === null) {
this.old_min_interval = this.options.min_interval;
}
this.options.min_interval = interval;
} | javascript | function () {
var interval = this.result.to - this.result.from;
if (this.old_min_interval === null) {
this.old_min_interval = this.options.min_interval;
}
this.options.min_interval = interval;
} | [
"function",
"(",
")",
"{",
"var",
"interval",
"=",
"this",
".",
"result",
".",
"to",
"-",
"this",
".",
"result",
".",
"from",
";",
"if",
"(",
"this",
".",
"old_min_interval",
"===",
"null",
")",
"{",
"this",
".",
"old_min_interval",
"=",
"this",
".",... | Then dragging interval, prevent interval collapsing
using min_interval option | [
"Then",
"dragging",
"interval",
"prevent",
"interval",
"collapsing",
"using",
"min_interval",
"option"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L974-L982 | train | set min interval | [
30522,
3853,
1006,
1007,
1063,
13075,
13483,
1027,
2023,
1012,
2765,
1012,
2000,
1011,
2023,
1012,
2765,
1012,
2013,
1025,
2065,
1006,
2023,
1012,
2214,
1035,
8117,
1035,
13483,
1027,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
2214,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/plugin.js | location | function location(doclet) {
var filename = (doclet.meta && doclet.meta.filename) || "unknown";
return " #" + ui5data(doclet).id + "@" + filename + (doclet.meta.lineno != null ? ":" + doclet.meta.lineno : "") + (doclet.synthetic ? "(synthetic)" : "");
} | javascript | function location(doclet) {
var filename = (doclet.meta && doclet.meta.filename) || "unknown";
return " #" + ui5data(doclet).id + "@" + filename + (doclet.meta.lineno != null ? ":" + doclet.meta.lineno : "") + (doclet.synthetic ? "(synthetic)" : "");
} | [
"function",
"location",
"(",
"doclet",
")",
"{",
"var",
"filename",
"=",
"(",
"doclet",
".",
"meta",
"&&",
"doclet",
".",
"meta",
".",
"filename",
")",
"||",
"\"unknown\"",
";",
"return",
"\" #\"",
"+",
"ui5data",
"(",
"doclet",
")",
".",
"id",
"+",
... | Creates a human readable location info for a given doclet.
@param {Doclet} doclet Doclet to get a location info for
@returns {string} A human readable location info | [
"Creates",
"a",
"human",
"readable",
"location",
"info",
"for",
"a",
"given",
"doclet",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/plugin.js#L1759-L1762 | train | Return the location of the file. | [
30522,
3853,
3295,
1006,
9986,
7485,
1007,
1063,
13075,
5371,
18442,
1027,
30524,
1025,
2709,
1000,
1001,
1000,
1009,
21318,
2629,
2850,
2696,
1006,
9986,
7485,
1007,
1012,
8909,
1009,
1000,
1030,
1000,
1009,
5371,
18442,
1009,
1006,
9986,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.m/src/sap/m/ViewSettingsDialog.js | getViewSettingsItemByKey | function getViewSettingsItemByKey(aViewSettingsItems, sKey) {
var i, oItem;
// convenience, also allow strings
// find item with this key
for (i = 0; i < aViewSettingsItems.length; i++) {
if (aViewSettingsItems[i].getKey() === sKey) {
oItem = aViewSettingsItems[i];
break;
}
}
return oItem;
} | javascript | function getViewSettingsItemByKey(aViewSettingsItems, sKey) {
var i, oItem;
// convenience, also allow strings
// find item with this key
for (i = 0; i < aViewSettingsItems.length; i++) {
if (aViewSettingsItems[i].getKey() === sKey) {
oItem = aViewSettingsItems[i];
break;
}
}
return oItem;
} | [
"function",
"getViewSettingsItemByKey",
"(",
"aViewSettingsItems",
",",
"sKey",
")",
"{",
"var",
"i",
",",
"oItem",
";",
"// convenience, also allow strings",
"// find item with this key",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aViewSettingsItems",
".",
"length"... | Gets an sap.m.ViewSettingsItem from a list of items by a given key.
@param {array} aViewSettingsItems The list of sap.m.ViewSettingsItem objects to be searched
@param {string} sKey The key of the searched item
@returns {*} The sap.m.ViewSettingsItem found in the list of items
@private | [
"Gets",
"an",
"sap",
".",
"m",
".",
"ViewSettingsItem",
"from",
"a",
"list",
"of",
"items",
"by",
"a",
"given",
"key",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/ViewSettingsDialog.js#L2942-L2955 | train | get a view settings item by key | [
30522,
3853,
2131,
8584,
21678,
8613,
4221,
14905,
15922,
3240,
1006,
20704,
2666,
9333,
18319,
3070,
28032,
6633,
2015,
1010,
15315,
3240,
1007,
1063,
13075,
1045,
1010,
1051,
4221,
2213,
1025,
1013,
1013,
15106,
1010,
2036,
3499,
7817,
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/material-design-lite | docs/_assets/customizer.js | init | function init() {
'use strict';
var wheel = document.querySelector('#wheel > svg');
var cdn = document.querySelector('.mdl-gen__cdn .mdl-gen__cdn-link');
var mc = new MaterialCustomizer(wheel, cdn);
// Workaround for IE.
var dl = document.querySelector('#download');
dl.addEventListener('click', function() {
if (window.navigator.msSaveBlob) {
window.navigator.msSaveBlob(this.blob, 'material.min.css');
}
}.bind(mc));
// Hook up GA event
dl.addEventListener('click', function() {
ga('send', {
hitType: 'event',
eventCategory: 'customizer',
eventAction: 'download',
eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
});
});
var clickCtr = 0;
cdn.addEventListener('click', function() {
var selection = window.getSelection();
selection.removeAllRanges();
var range = document.createRange();
if (clickCtr === 0) {
var link = cdn.querySelectorAll('.token.attr-value')[1];
range.setStart(link, 2);
range.setEnd(link, 3);
} else {
range.setStart(cdn, 1);
range.setEnd(cdn, 2);
}
selection.addRange(range);
clickCtr = (clickCtr + 1) % 2;
});
// Prevent browser's selection handling
cdn.addEventListener('mouseup', function(ev) {
ev.preventDefault();
});
cdn.addEventListener('mousedown', function(ev) {
ev.preventDefault();
});
document.addEventListener('mouseup', function() {
if (window.getSelection().toString().indexOf('.min.css') !== -1) {
ga('send', {
hitType: 'event',
eventCategory: 'customizer',
eventAction: 'copy',
eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
});
}
});
// Download template
var req = new XMLHttpRequest();
req.onload = function() {
mc.template = this.responseText;
mc.highlightField('Indigo');
mc.highlightField('Pink');
window.requestAnimationFrame(function() {
mc.updateCDN();
mc.updateStylesheet();
});
};
req.open('get', '../material.min.css.template', true);
req.send();
} | javascript | function init() {
'use strict';
var wheel = document.querySelector('#wheel > svg');
var cdn = document.querySelector('.mdl-gen__cdn .mdl-gen__cdn-link');
var mc = new MaterialCustomizer(wheel, cdn);
// Workaround for IE.
var dl = document.querySelector('#download');
dl.addEventListener('click', function() {
if (window.navigator.msSaveBlob) {
window.navigator.msSaveBlob(this.blob, 'material.min.css');
}
}.bind(mc));
// Hook up GA event
dl.addEventListener('click', function() {
ga('send', {
hitType: 'event',
eventCategory: 'customizer',
eventAction: 'download',
eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
});
});
var clickCtr = 0;
cdn.addEventListener('click', function() {
var selection = window.getSelection();
selection.removeAllRanges();
var range = document.createRange();
if (clickCtr === 0) {
var link = cdn.querySelectorAll('.token.attr-value')[1];
range.setStart(link, 2);
range.setEnd(link, 3);
} else {
range.setStart(cdn, 1);
range.setEnd(cdn, 2);
}
selection.addRange(range);
clickCtr = (clickCtr + 1) % 2;
});
// Prevent browser's selection handling
cdn.addEventListener('mouseup', function(ev) {
ev.preventDefault();
});
cdn.addEventListener('mousedown', function(ev) {
ev.preventDefault();
});
document.addEventListener('mouseup', function() {
if (window.getSelection().toString().indexOf('.min.css') !== -1) {
ga('send', {
hitType: 'event',
eventCategory: 'customizer',
eventAction: 'copy',
eventLabel: mc.getSelectedPrimary() + '-' + mc.getSelectedSecondary()
});
}
});
// Download template
var req = new XMLHttpRequest();
req.onload = function() {
mc.template = this.responseText;
mc.highlightField('Indigo');
mc.highlightField('Pink');
window.requestAnimationFrame(function() {
mc.updateCDN();
mc.updateStylesheet();
});
};
req.open('get', '../material.min.css.template', true);
req.send();
} | [
"function",
"init",
"(",
")",
"{",
"'use strict'",
";",
"var",
"wheel",
"=",
"document",
".",
"querySelector",
"(",
"'#wheel > svg'",
")",
";",
"var",
"cdn",
"=",
"document",
".",
"querySelector",
"(",
"'.mdl-gen__cdn .mdl-gen__cdn-link'",
")",
";",
"var",
"mc... | /*global MaterialCustomizer:true,Prism:true,ga:true /* exported init | [
"/",
"*",
"global",
"MaterialCustomizer",
":",
"true",
"Prism",
":",
"true",
"ga",
":",
"true",
"/",
"*",
"exported",
"init"
] | 60f441a22ed98ed2c03f6179adf460d888bf459f | https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/docs/_assets/customizer.js#L20-L96 | train | Initialize the customizer | [
30522,
3853,
1999,
4183,
1006,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
13075,
5217,
1027,
6254,
1012,
23032,
11246,
22471,
2953,
1006,
1005,
1001,
5217,
1028,
17917,
2290,
1005,
1007,
1025,
13075,
3729,
2078,
1027,
6254,
1012,
23032,
1124... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js | function () {
var tempRules = [],
rawLSData;
try {
rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY);
if (!rawLSData) {
return null;
}
tempRules = JSON.parse(decode(rawLSData));
tempRules = tempRules.map(function (tempRule) {
return RuleSerializer.deserialize(tempRule, true);
});
} catch (oError) {
// Swallow "Access Denied" exceptions in cross-origin scenarios.
}
return tempRules;
} | javascript | function () {
var tempRules = [],
rawLSData;
try {
rawLSData = localStorage.getItem(constants.LOCAL_STORAGE_TEMP_RULES_KEY);
if (!rawLSData) {
return null;
}
tempRules = JSON.parse(decode(rawLSData));
tempRules = tempRules.map(function (tempRule) {
return RuleSerializer.deserialize(tempRule, true);
});
} catch (oError) {
// Swallow "Access Denied" exceptions in cross-origin scenarios.
}
return tempRules;
} | [
"function",
"(",
")",
"{",
"var",
"tempRules",
"=",
"[",
"]",
",",
"rawLSData",
";",
"try",
"{",
"rawLSData",
"=",
"localStorage",
".",
"getItem",
"(",
"constants",
".",
"LOCAL_STORAGE_TEMP_RULES_KEY",
")",
";",
"if",
"(",
"!",
"rawLSData",
")",
"{",
"re... | Returns all previously created temporary rules.
@private
@name sap.ui.support.Storage.getRules
@method
@returns {object[]} An array containing all the temporary rules. | [
"Returns",
"all",
"previously",
"created",
"temporary",
"rules",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/Storage.js#L69-L90 | train | Returns the list of temp rules | [
30522,
3853,
1006,
1007,
1063,
13075,
8915,
8737,
6820,
4244,
1027,
1031,
1033,
1010,
6315,
4877,
2850,
2696,
1025,
3046,
1063,
6315,
4877,
2850,
2696,
1027,
10575,
4263,
4270,
1012,
2131,
4221,
2213,
1006,
5377,
2015,
1012,
2334,
1035,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
LLK/scratch-blocks | blocks_vertical/event.js | function() {
this.jsonInit({
"id": "event_whenflagclicked",
"message0": Blockly.Msg.EVENT_WHENFLAGCLICKED,
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "green-flag.svg",
"width": 24,
"height": 24,
"alt": "flag"
}
],
"category": Blockly.Categories.event,
"extensions": ["colours_event", "shape_hat"]
});
} | javascript | function() {
this.jsonInit({
"id": "event_whenflagclicked",
"message0": Blockly.Msg.EVENT_WHENFLAGCLICKED,
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "green-flag.svg",
"width": 24,
"height": 24,
"alt": "flag"
}
],
"category": Blockly.Categories.event,
"extensions": ["colours_event", "shape_hat"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"id\"",
":",
"\"event_whenflagclicked\"",
",",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"EVENT_WHENFLAGCLICKED",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_image\"",
",",
... | Block for when flag clicked.
@this Blockly.Block | [
"Block",
"for",
"when",
"flag",
"clicked",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/event.js#L78-L94 | train | Block for when flag clicked. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
8909,
1000,
1024,
1000,
2724,
1035,
2043,
10258,
8490,
20464,
6799,
2098,
1000,
1010,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
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... | |
thomaspark/bootswatch | docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js | createWrapper | function createWrapper(element) {
var node,
nodes = element.attributes,
index = nodes.length,
wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
// copy element attributes to the wrapper
while (index--) {
node = nodes[index];
node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
}
// copy element styles to the wrapper
wrapper.style.cssText = element.style.cssText;
return wrapper;
} | javascript | function createWrapper(element) {
var node,
nodes = element.attributes,
index = nodes.length,
wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
// copy element attributes to the wrapper
while (index--) {
node = nodes[index];
node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
}
// copy element styles to the wrapper
wrapper.style.cssText = element.style.cssText;
return wrapper;
} | [
"function",
"createWrapper",
"(",
"element",
")",
"{",
"var",
"node",
",",
"nodes",
"=",
"element",
".",
"attributes",
",",
"index",
"=",
"nodes",
".",
"length",
",",
"wrapper",
"=",
"element",
".",
"ownerDocument",
".",
"createElement",
"(",
"shivNamespace"... | Creates a printable wrapper for the given element.
@private
@param {Element} element The element.
@returns {Element} The wrapper. | [
"Creates",
"a",
"printable",
"wrapper",
"for",
"the",
"given",
"element",
"."
] | a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd | https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/3/bower_components/html5shiv/dist/html5shiv-printshiv.js#L374-L388 | train | Create wrapper element | [
30522,
3853,
3443,
13088,
29098,
2121,
1006,
5783,
1007,
1063,
13075,
13045,
1010,
14164,
1027,
5783,
1012,
12332,
1010,
5950,
1027,
14164,
1012,
3091,
1010,
10236,
4842,
1027,
5783,
1012,
3954,
3527,
24894,
4765,
1012,
3443,
12260,
3672,
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... |
adobe/brackets | src/extensions/default/QuickOpenJavaScript/main.js | FileLocation | function FileLocation(fullPath, line, chFrom, chTo, functionName) {
this.fullPath = fullPath;
this.line = line;
this.chFrom = chFrom;
this.chTo = chTo;
this.functionName = functionName;
} | javascript | function FileLocation(fullPath, line, chFrom, chTo, functionName) {
this.fullPath = fullPath;
this.line = line;
this.chFrom = chFrom;
this.chTo = chTo;
this.functionName = functionName;
} | [
"function",
"FileLocation",
"(",
"fullPath",
",",
"line",
",",
"chFrom",
",",
"chTo",
",",
"functionName",
")",
"{",
"this",
".",
"fullPath",
"=",
"fullPath",
";",
"this",
".",
"line",
"=",
"line",
";",
"this",
".",
"chFrom",
"=",
"chFrom",
";",
"this"... | FileLocation class
@constructor
@param {string} fullPath
@param {number} line
@param {number} chFrom column start position
@param {number} chTo column end position
@param {string} functionName | [
"FileLocation",
"class"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickOpenJavaScript/main.js#L44-L50 | train | FileLocation constructor. | [
30522,
3853,
5371,
4135,
10719,
1006,
2440,
15069,
1010,
2240,
1010,
10381,
19699,
5358,
1010,
10381,
3406,
1010,
3853,
18442,
1007,
1063,
2023,
1012,
2440,
15069,
1027,
2440,
15069,
1025,
2023,
1012,
2240,
1027,
2240,
1025,
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... |
jgraph/mxgraph | javascript/mxClient.js | mxStyleChange | function mxStyleChange(model, cell, style)
{
this.model = model;
this.cell = cell;
this.style = style;
this.previous = style;
} | javascript | function mxStyleChange(model, cell, style)
{
this.model = model;
this.cell = cell;
this.style = style;
this.previous = style;
} | [
"function",
"mxStyleChange",
"(",
"model",
",",
"cell",
",",
"style",
")",
"{",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"cell",
"=",
"cell",
";",
"this",
".",
"style",
"=",
"style",
";",
"this",
".",
"previous",
"=",
"style",
";",
"}"... | Class: mxStyleChange
Action to change a cell's style in a model.
Constructor: mxStyleChange
Constructs a change of a style in the
specified model. | [
"Class",
":",
"mxStyleChange"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L41776-L41782 | train | This is the main entry point of the mxCellChange event handler. It is called when the style of the cell changes. | [
30522,
3853,
25630,
21756,
2571,
22305,
2063,
1006,
2944,
1010,
3526,
1010,
2806,
1007,
1063,
2023,
1012,
2944,
1027,
2944,
1025,
2023,
1012,
3526,
1027,
3526,
1025,
2023,
1012,
2806,
1027,
2806,
1025,
2023,
1012,
3025,
1027,
2806,
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... |
fex-team/webuploader | dist/webuploader.withoutimage.js | function( status, text ) {
var prevStatus = statusMap[ this.id ];
typeof text !== 'undefined' && (this.statusText = text);
if ( status !== prevStatus ) {
statusMap[ this.id ] = status;
/**
* 文件状态变化
* @event statuschange
*/
this.trigger( 'statuschange', status, prevStatus );
}
} | javascript | function( status, text ) {
var prevStatus = statusMap[ this.id ];
typeof text !== 'undefined' && (this.statusText = text);
if ( status !== prevStatus ) {
statusMap[ this.id ] = status;
/**
* 文件状态变化
* @event statuschange
*/
this.trigger( 'statuschange', status, prevStatus );
}
} | [
"function",
"(",
"status",
",",
"text",
")",
"{",
"var",
"prevStatus",
"=",
"statusMap",
"[",
"this",
".",
"id",
"]",
";",
"typeof",
"text",
"!==",
"'undefined'",
"&&",
"(",
"this",
".",
"statusText",
"=",
"text",
")",
";",
"if",
"(",
"status",
"!=="... | 设置状态,状态变化时会触发`change`事件。
@method setStatus
@grammar setStatus( status[, statusText] );
@param {File.Status|String} status [文件状态值](#WebUploader:File:File.Status)
@param {String} [statusText=''] 状态说明,常在error时使用,用http, abort,server等来标记是由于什么原因导致文件错误。 | [
"设置状态,状态变化时会触发",
"change",
"事件。"
] | 7094e4476c5af3b06993d91dde2d223200b9feb7 | https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/dist/webuploader.withoutimage.js#L2053-L2068 | train | set status | [
30522,
3853,
1006,
3570,
1010,
3793,
1007,
1063,
13075,
3653,
15088,
29336,
2271,
1027,
3570,
2863,
2361,
1031,
2023,
1012,
8909,
1033,
1025,
2828,
11253,
3793,
999,
1027,
1027,
1005,
6151,
28344,
1005,
1004,
1004,
1006,
2023,
1012,
3570,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js | function(oEvent, $Cell, oTable) {
TableUtils.toggleRowSelection(oTable, $Cell, null, function(iRowIndex) {
// IE and Edge perform a text selection if holding shift while clicking. This is not desired for range selection of rows.
if ((Device.browser.msie || Device.browser.edge) && oEvent.shiftKey) {
oTable._clearTextSelection();
}
var oSelMode = oTable.getSelectionMode();
// Single selection
if (oSelMode === SelectionMode.Single) {
if (!oTable.isIndexSelected(iRowIndex)) {
oTable.setSelectedIndex(iRowIndex);
} else {
oTable.clearSelection();
}
// Multi selection (range)
} else if (oEvent.shiftKey) {
// If no row is selected, getSelectedIndex returns -1. Then we simply select the clicked row.
var iSelectedIndex = oTable.getSelectedIndex();
if (iSelectedIndex >= 0) {
oTable.addSelectionInterval(iSelectedIndex, iRowIndex);
} else {
oTable.setSelectedIndex(iRowIndex);
}
// Multi selection (toggle)
} else if (!oTable._legacyMultiSelection) {
if (!oTable.isIndexSelected(iRowIndex)) {
oTable.addSelectionInterval(iRowIndex, iRowIndex);
} else {
oTable.removeSelectionInterval(iRowIndex, iRowIndex);
}
// Multi selection (legacy)
} else {
oTable._legacyMultiSelection(iRowIndex, oEvent);
}
return true;
});
} | javascript | function(oEvent, $Cell, oTable) {
TableUtils.toggleRowSelection(oTable, $Cell, null, function(iRowIndex) {
// IE and Edge perform a text selection if holding shift while clicking. This is not desired for range selection of rows.
if ((Device.browser.msie || Device.browser.edge) && oEvent.shiftKey) {
oTable._clearTextSelection();
}
var oSelMode = oTable.getSelectionMode();
// Single selection
if (oSelMode === SelectionMode.Single) {
if (!oTable.isIndexSelected(iRowIndex)) {
oTable.setSelectedIndex(iRowIndex);
} else {
oTable.clearSelection();
}
// Multi selection (range)
} else if (oEvent.shiftKey) {
// If no row is selected, getSelectedIndex returns -1. Then we simply select the clicked row.
var iSelectedIndex = oTable.getSelectedIndex();
if (iSelectedIndex >= 0) {
oTable.addSelectionInterval(iSelectedIndex, iRowIndex);
} else {
oTable.setSelectedIndex(iRowIndex);
}
// Multi selection (toggle)
} else if (!oTable._legacyMultiSelection) {
if (!oTable.isIndexSelected(iRowIndex)) {
oTable.addSelectionInterval(iRowIndex, iRowIndex);
} else {
oTable.removeSelectionInterval(iRowIndex, iRowIndex);
}
// Multi selection (legacy)
} else {
oTable._legacyMultiSelection(iRowIndex, oEvent);
}
return true;
});
} | [
"function",
"(",
"oEvent",
",",
"$Cell",
",",
"oTable",
")",
"{",
"TableUtils",
".",
"toggleRowSelection",
"(",
"oTable",
",",
"$Cell",
",",
"null",
",",
"function",
"(",
"iRowIndex",
")",
"{",
"// IE and Edge perform a text selection if holding shift while clicking. ... | /*
Changes the selection based on the given click event on the given row selector, data cell or row action cell. | [
"/",
"*",
"Changes",
"the",
"selection",
"based",
"on",
"the",
"given",
"click",
"event",
"on",
"the",
"given",
"row",
"selector",
"data",
"cell",
"or",
"row",
"action",
"cell",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TablePointerExtension.js#L109-L151 | train | Handles the shift key event on a cell. | [
30522,
3853,
1006,
1051,
18697,
3372,
1010,
1002,
3526,
1010,
27178,
3085,
1007,
1063,
2795,
21823,
4877,
1012,
2000,
24679,
10524,
11246,
18491,
1006,
27178,
3085,
1010,
1002,
3526,
1010,
19701,
1010,
3853,
1006,
20868,
5004,
22254,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | Makefile.js | getFormatterResults | function getFormatterResults() {
const stripAnsi = require("strip-ansi");
const formatterFiles = fs.readdirSync("./lib/formatters/"),
rules = {
"no-else-return": "warn",
indent: ["warn", 4],
"space-unary-ops": "error",
semi: ["warn", "always"],
"consistent-return": "error"
},
cli = new CLIEngine({
useEslintrc: false,
baseConfig: { extends: "eslint:recommended" },
rules
}),
codeString = [
"function addOne(i) {",
" if (i != NaN) {",
" return i ++",
" } else {",
" return",
" }",
"};"
].join("\n"),
rawMessages = cli.executeOnText(codeString, "fullOfProblems.js", true),
rulesMap = cli.getRules(),
rulesMeta = {};
Object.keys(rules).forEach(ruleId => {
rulesMeta[ruleId] = rulesMap.get(ruleId).meta;
});
return formatterFiles.reduce((data, filename) => {
const fileExt = path.extname(filename),
name = path.basename(filename, fileExt);
if (fileExt === ".js") {
const formattedOutput = cli.getFormatter(name)(
rawMessages.results,
{ rulesMeta }
);
data.formatterResults[name] = {
result: stripAnsi(formattedOutput)
};
}
return data;
}, { formatterResults: {} });
} | javascript | function getFormatterResults() {
const stripAnsi = require("strip-ansi");
const formatterFiles = fs.readdirSync("./lib/formatters/"),
rules = {
"no-else-return": "warn",
indent: ["warn", 4],
"space-unary-ops": "error",
semi: ["warn", "always"],
"consistent-return": "error"
},
cli = new CLIEngine({
useEslintrc: false,
baseConfig: { extends: "eslint:recommended" },
rules
}),
codeString = [
"function addOne(i) {",
" if (i != NaN) {",
" return i ++",
" } else {",
" return",
" }",
"};"
].join("\n"),
rawMessages = cli.executeOnText(codeString, "fullOfProblems.js", true),
rulesMap = cli.getRules(),
rulesMeta = {};
Object.keys(rules).forEach(ruleId => {
rulesMeta[ruleId] = rulesMap.get(ruleId).meta;
});
return formatterFiles.reduce((data, filename) => {
const fileExt = path.extname(filename),
name = path.basename(filename, fileExt);
if (fileExt === ".js") {
const formattedOutput = cli.getFormatter(name)(
rawMessages.results,
{ rulesMeta }
);
data.formatterResults[name] = {
result: stripAnsi(formattedOutput)
};
}
return data;
}, { formatterResults: {} });
} | [
"function",
"getFormatterResults",
"(",
")",
"{",
"const",
"stripAnsi",
"=",
"require",
"(",
"\"strip-ansi\"",
")",
";",
"const",
"formatterFiles",
"=",
"fs",
".",
"readdirSync",
"(",
"\"./lib/formatters/\"",
")",
",",
"rules",
"=",
"{",
"\"no-else-return\"",
":... | Gets linting results from every formatter, based on a hard-coded snippet and config
@returns {Object} Output from each formatter | [
"Gets",
"linting",
"results",
"from",
"every",
"formatter",
"based",
"on",
"a",
"hard",
"-",
"coded",
"snippet",
"and",
"config"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/Makefile.js#L407-L456 | train | Get formatter results | [
30522,
3853,
2131,
14192,
20097,
6072,
11314,
2015,
1006,
1007,
1063,
9530,
3367,
6167,
6962,
2072,
1027,
5478,
1006,
1000,
6167,
1011,
2019,
5332,
1000,
1007,
1025,
9530,
3367,
4289,
3334,
8873,
4244,
1027,
1042,
2015,
1012,
3191,
4305,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | xdrClient | function xdrClient (request) {
return new PromiseObj(function (resolve) {
var xdr = new XDomainRequest(), handler = function (ref) {
var type = ref.type;
var status = 0;
if (type === 'load') {
status = 200;
} else if (type === 'error') {
status = 500;
}
resolve(request.respondWith(xdr.responseText, {status: status}));
};
request.abort = function () { return xdr.abort(); };
xdr.open(request.method, request.getUrl());
if (request.timeout) {
xdr.timeout = request.timeout;
}
xdr.onload = handler;
xdr.onabort = handler;
xdr.onerror = handler;
xdr.ontimeout = handler;
xdr.onprogress = function () {};
xdr.send(request.getBody());
});
} | javascript | function xdrClient (request) {
return new PromiseObj(function (resolve) {
var xdr = new XDomainRequest(), handler = function (ref) {
var type = ref.type;
var status = 0;
if (type === 'load') {
status = 200;
} else if (type === 'error') {
status = 500;
}
resolve(request.respondWith(xdr.responseText, {status: status}));
};
request.abort = function () { return xdr.abort(); };
xdr.open(request.method, request.getUrl());
if (request.timeout) {
xdr.timeout = request.timeout;
}
xdr.onload = handler;
xdr.onabort = handler;
xdr.onerror = handler;
xdr.ontimeout = handler;
xdr.onprogress = function () {};
xdr.send(request.getBody());
});
} | [
"function",
"xdrClient",
"(",
"request",
")",
"{",
"return",
"new",
"PromiseObj",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"xdr",
"=",
"new",
"XDomainRequest",
"(",
")",
",",
"handler",
"=",
"function",
"(",
"ref",
")",
"{",
"var",
"type",
"="... | XDomain client (Internet Explorer). | [
"XDomain",
"client",
"(",
"Internet",
"Explorer",
")",
"."
] | fe268fa1d6053ede5f34aef9a11e1a424a70446c | https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L783-L816 | train | Creates a XDomainRequest client | [
30522,
3853,
1060,
13626,
20464,
11638,
1006,
5227,
1007,
1063,
2709,
2047,
4872,
16429,
3501,
1006,
3853,
1006,
10663,
1007,
1063,
13075,
1060,
13626,
1027,
2047,
1060,
9527,
8113,
2890,
15500,
1006,
1007,
1010,
28213,
1027,
3853,
1006,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Issues.controller.js | function(aIssues) {
aIssues.forEach(function(element){
switch (element.severity) {
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW:
element.severityIcon = mIssueSettings.severityIcons.Low;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR;
break;
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_MEDIUM:
element.severityIcon = mIssueSettings.severityIcons.Medium;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR;
break;
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_HIGH:
element.severityIcon = mIssueSettings.severityIcons.High;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR;
break;
}
});
} | javascript | function(aIssues) {
aIssues.forEach(function(element){
switch (element.severity) {
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW:
element.severityIcon = mIssueSettings.severityIcons.Low;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR;
break;
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_MEDIUM:
element.severityIcon = mIssueSettings.severityIcons.Medium;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR;
break;
case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_HIGH:
element.severityIcon = mIssueSettings.severityIcons.High;
element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR;
break;
}
});
} | [
"function",
"(",
"aIssues",
")",
"{",
"aIssues",
".",
"forEach",
"(",
"function",
"(",
"element",
")",
"{",
"switch",
"(",
"element",
".",
"severity",
")",
"{",
"case",
"constants",
".",
"SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW",
":",
"element",
".",
"severityIco... | Set to model icon and color depending on severity.
@private
@param {array} aIssues
@returns {void} | [
"Set",
"to",
"model",
"icon",
"and",
"color",
"depending",
"on",
"severity",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Issues.controller.js#L240-L257 | train | Set the severity icon and color of all issues | [
30522,
3853,
1006,
9932,
4757,
15808,
1007,
1063,
9932,
4757,
15808,
1012,
18921,
6776,
1006,
3853,
1006,
5783,
1007,
1063,
6942,
1006,
5783,
1012,
18976,
1007,
1063,
2553,
5377,
2015,
1012,
2490,
1035,
3353,
1035,
3277,
1035,
18976,
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... | |
ecomfe/zrender | src/core/PathProxy.js | function (path) {
if (!(path instanceof Array)) {
path = [path];
}
var len = path.length;
var appendSize = 0;
var offset = this._len;
for (var i = 0; i < len; i++) {
appendSize += path[i].len();
}
if (hasTypedArray && (this.data instanceof Float32Array)) {
this.data = new Float32Array(offset + appendSize);
}
for (var i = 0; i < len; i++) {
var appendPathData = path[i].data;
for (var k = 0; k < appendPathData.length; k++) {
this.data[offset++] = appendPathData[k];
}
}
this._len = offset;
} | javascript | function (path) {
if (!(path instanceof Array)) {
path = [path];
}
var len = path.length;
var appendSize = 0;
var offset = this._len;
for (var i = 0; i < len; i++) {
appendSize += path[i].len();
}
if (hasTypedArray && (this.data instanceof Float32Array)) {
this.data = new Float32Array(offset + appendSize);
}
for (var i = 0; i < len; i++) {
var appendPathData = path[i].data;
for (var k = 0; k < appendPathData.length; k++) {
this.data[offset++] = appendPathData[k];
}
}
this._len = offset;
} | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"(",
"path",
"instanceof",
"Array",
")",
")",
"{",
"path",
"=",
"[",
"path",
"]",
";",
"}",
"var",
"len",
"=",
"path",
".",
"length",
";",
"var",
"appendSize",
"=",
"0",
";",
"var",
"offset",
"... | 添加子路径
@param {module:zrender/core/PathProxy|Array.<module:zrender/core/PathProxy>} path | [
"添加子路径"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L356-L376 | train | Append path to the current log file | [
30522,
3853,
1006,
4130,
1007,
1063,
2065,
1006,
999,
1006,
4130,
6013,
11253,
9140,
1007,
1007,
1063,
4130,
1027,
1031,
4130,
1033,
1025,
1065,
13075,
18798,
1027,
4130,
1012,
3091,
1025,
13075,
10439,
10497,
5332,
4371,
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... | |
aframevr/aframe | src/utils/src-loader.js | validateAndGetQuerySelector | function validateAndGetQuerySelector (selector) {
try {
var el = document.querySelector(selector);
if (!el) {
warn('No element was found matching the selector: "%s"', selector);
}
return el;
} catch (e) { // Capture exception if it's not a valid selector.
warn('"%s" is not a valid selector', selector);
return undefined;
}
} | javascript | function validateAndGetQuerySelector (selector) {
try {
var el = document.querySelector(selector);
if (!el) {
warn('No element was found matching the selector: "%s"', selector);
}
return el;
} catch (e) { // Capture exception if it's not a valid selector.
warn('"%s" is not a valid selector', selector);
return undefined;
}
} | [
"function",
"validateAndGetQuerySelector",
"(",
"selector",
")",
"{",
"try",
"{",
"var",
"el",
"=",
"document",
".",
"querySelector",
"(",
"selector",
")",
";",
"if",
"(",
"!",
"el",
")",
"{",
"warn",
"(",
"'No element was found matching the selector: \"%s\"'",
... | Query and validate a query selector,
@param {string} selector - DOM selector.
@return {object|null|undefined} Selected DOM element if exists.
null if query yields no results.
undefined if `selector` is not a valid selector. | [
"Query",
"and",
"validate",
"a",
"query",
"selector"
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/src-loader.js#L140-L151 | train | Checks if the selector is valid and returns the element | [
30522,
3853,
9398,
3686,
5685,
18150,
4226,
24769,
12260,
16761,
1006,
27000,
1007,
1063,
3046,
1063,
13075,
3449,
1027,
6254,
1012,
23032,
11246,
22471,
2953,
1006,
27000,
1007,
1025,
2065,
1006,
999,
3449,
1007,
1063,
11582,
1006,
1005,
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... |
wuchangming/spy-debugger | buildin_modules/weinre/web/client/UglifyJS/process.js | tighten | function tighten(statements, block_type) {
statements = statements.reduce(function(a, stat){
if (stat[0] == "block") {
if (stat[1]) {
a.push.apply(a, stat[1]);
}
} else {
a.push(stat);
}
return a;
}, []);
statements = (function(a, prev){
statements.forEach(function(cur){
if (prev && ((cur[0] == "var" && prev[0] == "var") ||
(cur[0] == "const" && prev[0] == "const"))) {
prev[1] = prev[1].concat(cur[1]);
} else {
a.push(cur);
prev = cur;
}
});
return a;
})([]);
if (options.dead_code) statements = (function(a, has_quit){
statements.forEach(function(st){
if (has_quit) {
if (member(st[0], [ "function", "defun" , "var", "const" ])) {
a.push(st);
}
else if (!options.no_warnings)
warn("Removing unreachable code: " + gen_code(st, true));
}
else {
a.push(st);
if (member(st[0], [ "return", "throw", "break", "continue" ]))
has_quit = true;
}
});
return a;
})([]);
if (options.make_seqs) statements = (function(a, prev) {
statements.forEach(function(cur){
if (prev && prev[0] == "stat" && cur[0] == "stat") {
prev[1] = [ "seq", prev[1], cur[1] ];
} else {
a.push(cur);
prev = cur;
}
});
return a;
})([]);
if (block_type == "lambda") statements = (function(i, a, stat){
while (i < statements.length) {
stat = statements[i++];
if (stat[0] == "if" && !stat[3]) {
if (stat[2][0] == "return" && stat[2][1] == null) {
a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ]));
break;
}
var last = last_stat(stat[2]);
if (last[0] == "return" && last[1] == null) {
a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ]));
break;
}
}
a.push(stat);
}
return a;
})(0, []);
return statements;
} | javascript | function tighten(statements, block_type) {
statements = statements.reduce(function(a, stat){
if (stat[0] == "block") {
if (stat[1]) {
a.push.apply(a, stat[1]);
}
} else {
a.push(stat);
}
return a;
}, []);
statements = (function(a, prev){
statements.forEach(function(cur){
if (prev && ((cur[0] == "var" && prev[0] == "var") ||
(cur[0] == "const" && prev[0] == "const"))) {
prev[1] = prev[1].concat(cur[1]);
} else {
a.push(cur);
prev = cur;
}
});
return a;
})([]);
if (options.dead_code) statements = (function(a, has_quit){
statements.forEach(function(st){
if (has_quit) {
if (member(st[0], [ "function", "defun" , "var", "const" ])) {
a.push(st);
}
else if (!options.no_warnings)
warn("Removing unreachable code: " + gen_code(st, true));
}
else {
a.push(st);
if (member(st[0], [ "return", "throw", "break", "continue" ]))
has_quit = true;
}
});
return a;
})([]);
if (options.make_seqs) statements = (function(a, prev) {
statements.forEach(function(cur){
if (prev && prev[0] == "stat" && cur[0] == "stat") {
prev[1] = [ "seq", prev[1], cur[1] ];
} else {
a.push(cur);
prev = cur;
}
});
return a;
})([]);
if (block_type == "lambda") statements = (function(i, a, stat){
while (i < statements.length) {
stat = statements[i++];
if (stat[0] == "if" && !stat[3]) {
if (stat[2][0] == "return" && stat[2][1] == null) {
a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ]));
break;
}
var last = last_stat(stat[2]);
if (last[0] == "return" && last[1] == null) {
a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ]));
break;
}
}
a.push(stat);
}
return a;
})(0, []);
return statements;
} | [
"function",
"tighten",
"(",
"statements",
",",
"block_type",
")",
"{",
"statements",
"=",
"statements",
".",
"reduce",
"(",
"function",
"(",
"a",
",",
"stat",
")",
"{",
"if",
"(",
"stat",
"[",
"0",
"]",
"==",
"\"block\"",
")",
"{",
"if",
"(",
"stat",... | we get here for blocks that have been already transformed. this function does a few things: 1. discard useless blocks 2. join consecutive var declarations 3. remove obviously dead code 4. transform consecutive statements using the comma operator 5. if block_type == "lambda" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... } | [
"we",
"get",
"here",
"for",
"blocks",
"that",
"have",
"been",
"already",
"transformed",
".",
"this",
"function",
"does",
"a",
"few",
"things",
":",
"1",
".",
"discard",
"useless",
"blocks",
"2",
".",
"join",
"consecutive",
"var",
"declarations",
"3",
".",
... | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/UglifyJS/process.js#L676-L751 | train | tighten the statements | [
30522,
3853,
21245,
1006,
8635,
1010,
3796,
1035,
2828,
1007,
1063,
8635,
1027,
8635,
1012,
5547,
1006,
3853,
1006,
1037,
1010,
28093,
1007,
1063,
2065,
1006,
28093,
1031,
1014,
1033,
1027,
1027,
1000,
3796,
1000,
1007,
1063,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableUtils.js | function(oTable) {
return oTable.getSelectionMode() !== SelectionMode.None &&
(oTable.getSelectionBehavior() === SelectionBehavior.Row || oTable.getSelectionBehavior() === SelectionBehavior.RowOnly);
} | javascript | function(oTable) {
return oTable.getSelectionMode() !== SelectionMode.None &&
(oTable.getSelectionBehavior() === SelectionBehavior.Row || oTable.getSelectionBehavior() === SelectionBehavior.RowOnly);
} | [
"function",
"(",
"oTable",
")",
"{",
"return",
"oTable",
".",
"getSelectionMode",
"(",
")",
"!==",
"SelectionMode",
".",
"None",
"&&",
"(",
"oTable",
".",
"getSelectionBehavior",
"(",
")",
"===",
"SelectionBehavior",
".",
"Row",
"||",
"oTable",
".",
"getSele... | Returns whether selection is allowed on the cells of a row (not row selector).
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {boolean} Whether selection is also possible on cells that are no selection cells. | [
"Returns",
"whether",
"selection",
"is",
"allowed",
"on",
"the",
"cells",
"of",
"a",
"row",
"(",
"not",
"row",
"selector",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L305-L308 | train | Returns true if the table has a row selection. | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
2709,
27178,
3085,
1012,
4152,
12260,
7542,
5302,
3207,
1006,
1007,
999,
1027,
1027,
4989,
5302,
3207,
1012,
3904,
1004,
1004,
1006,
27178,
3085,
1012,
4152,
12260,
7542,
4783,
3270,
25500,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | preloadDesigntimeLibrary | function preloadDesigntimeLibrary(oMetadata) {
//preload the designtime data for the library
var sLibrary = oMetadata.getLibraryName(),
sPreload = sap.ui.getCore().getConfiguration().getPreload(),
oLibrary = sap.ui.getCore().getLoadedLibraries()[sLibrary];
if (oLibrary && oLibrary.designtime) {
var oPromise;
if (sPreload === "async" || sPreload === "sync") {
//ignore errors _loadJSResourceAsync is true here, do not break if there is no preload.
oPromise = sap.ui.loader._.loadJSResourceAsync(oLibrary.designtime.replace(/\.designtime$/, "-preload.designtime.js"), true);
} else {
oPromise = Promise.resolve();
}
return new Promise(function(fnResolve) {
oPromise.then(function() {
sap.ui.require([oLibrary.designtime], function(oLib) {
fnResolve(oLib);
});
});
});
}
return Promise.resolve(null);
} | javascript | function preloadDesigntimeLibrary(oMetadata) {
//preload the designtime data for the library
var sLibrary = oMetadata.getLibraryName(),
sPreload = sap.ui.getCore().getConfiguration().getPreload(),
oLibrary = sap.ui.getCore().getLoadedLibraries()[sLibrary];
if (oLibrary && oLibrary.designtime) {
var oPromise;
if (sPreload === "async" || sPreload === "sync") {
//ignore errors _loadJSResourceAsync is true here, do not break if there is no preload.
oPromise = sap.ui.loader._.loadJSResourceAsync(oLibrary.designtime.replace(/\.designtime$/, "-preload.designtime.js"), true);
} else {
oPromise = Promise.resolve();
}
return new Promise(function(fnResolve) {
oPromise.then(function() {
sap.ui.require([oLibrary.designtime], function(oLib) {
fnResolve(oLib);
});
});
});
}
return Promise.resolve(null);
} | [
"function",
"preloadDesigntimeLibrary",
"(",
"oMetadata",
")",
"{",
"//preload the designtime data for the library",
"var",
"sLibrary",
"=",
"oMetadata",
".",
"getLibraryName",
"(",
")",
",",
"sPreload",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"getCo... | ---- Design Time capabilities -------------------------------------------------------------
Returns a promise that resolves if the designtime preload of a library is loaded for the given oMetadata
object is loaded.
If the corresponding library does not contain a designtime setting with a module path to the library.designtime file
the promise resolves immediately.
@private | [
"----",
"Design",
"Time",
"capabilities",
"-------------------------------------------------------------",
"Returns",
"a",
"promise",
"that",
"resolves",
"if",
"the",
"designtime",
"preload",
"of",
"a",
"library",
"is",
"loaded",
"for",
"the",
"given",
"oMetadata",
"obj... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L1774-L1796 | train | preloads the designtime data for the given library | [
30522,
3853,
3653,
11066,
6155,
23773,
7292,
29521,
19848,
2100,
1006,
18168,
12928,
2850,
2696,
1007,
1063,
1013,
1013,
3653,
11066,
1996,
2640,
7292,
2951,
2005,
1996,
3075,
13075,
22889,
12322,
19848,
2100,
1027,
18168,
12928,
2850,
2696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/downloads.js | downloadManager_deleteDownloadedFiles | function downloadManager_deleteDownloadedFiles(downloads) {
downloads.forEach(function(download) {
try {
var file = getLocalFileFromNativePathOrUrl(download.target);
file.remove(false);
} catch (ex) {
}
});
} | javascript | function downloadManager_deleteDownloadedFiles(downloads) {
downloads.forEach(function(download) {
try {
var file = getLocalFileFromNativePathOrUrl(download.target);
file.remove(false);
} catch (ex) {
}
});
} | [
"function",
"downloadManager_deleteDownloadedFiles",
"(",
"downloads",
")",
"{",
"downloads",
".",
"forEach",
"(",
"function",
"(",
"download",
")",
"{",
"try",
"{",
"var",
"file",
"=",
"getLocalFileFromNativePathOrUrl",
"(",
"download",
".",
"target",
")",
";",
... | Delete all downloads from the local drive
@param {download} downloads
List of downloaded files | [
"Delete",
"all",
"downloads",
"from",
"the",
"local",
"drive"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/downloads.js#L179-L187 | train | Delete downloaded files | [
30522,
3853,
8816,
24805,
4590,
1035,
17159,
12384,
17468,
8873,
4244,
1006,
22956,
1007,
1063,
22956,
1012,
18921,
6776,
1006,
3853,
1006,
8816,
1007,
1063,
3046,
1063,
13075,
5371,
1027,
2131,
4135,
9289,
8873,
2571,
19699,
5358,
19833,
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... |
adobe/brackets | src/filesystem/impls/appshell/AppshellFileSystem.js | writeFile | function writeFile(path, data, options, callback) {
var encoding = options.encoding || "utf8",
preserveBOM = options.preserveBOM;
function _finishWrite(created) {
appshell.fs.writeFile(path, data, encoding, preserveBOM, function (err) {
if (err) {
callback(_mapError(err));
} else {
stat(path, function (err, stat) {
callback(err, stat, created);
});
}
});
}
stat(path, function (err, stats) {
if (err) {
switch (err) {
case FileSystemError.NOT_FOUND:
_finishWrite(true);
break;
default:
callback(err);
}
return;
}
if (options.hasOwnProperty("expectedHash") && options.expectedHash !== stats._hash) {
console.error("Blind write attempted: ", path, stats._hash, options.expectedHash);
if (options.hasOwnProperty("expectedContents")) {
appshell.fs.readFile(path, encoding, function (_err, _data) {
if (_err || _data !== options.expectedContents) {
callback(FileSystemError.CONTENTS_MODIFIED);
return;
}
_finishWrite(false);
});
return;
} else {
callback(FileSystemError.CONTENTS_MODIFIED);
return;
}
}
_finishWrite(false);
});
} | javascript | function writeFile(path, data, options, callback) {
var encoding = options.encoding || "utf8",
preserveBOM = options.preserveBOM;
function _finishWrite(created) {
appshell.fs.writeFile(path, data, encoding, preserveBOM, function (err) {
if (err) {
callback(_mapError(err));
} else {
stat(path, function (err, stat) {
callback(err, stat, created);
});
}
});
}
stat(path, function (err, stats) {
if (err) {
switch (err) {
case FileSystemError.NOT_FOUND:
_finishWrite(true);
break;
default:
callback(err);
}
return;
}
if (options.hasOwnProperty("expectedHash") && options.expectedHash !== stats._hash) {
console.error("Blind write attempted: ", path, stats._hash, options.expectedHash);
if (options.hasOwnProperty("expectedContents")) {
appshell.fs.readFile(path, encoding, function (_err, _data) {
if (_err || _data !== options.expectedContents) {
callback(FileSystemError.CONTENTS_MODIFIED);
return;
}
_finishWrite(false);
});
return;
} else {
callback(FileSystemError.CONTENTS_MODIFIED);
return;
}
}
_finishWrite(false);
});
} | [
"function",
"writeFile",
"(",
"path",
",",
"data",
",",
"options",
",",
"callback",
")",
"{",
"var",
"encoding",
"=",
"options",
".",
"encoding",
"||",
"\"utf8\"",
",",
"preserveBOM",
"=",
"options",
".",
"preserveBOM",
";",
"function",
"_finishWrite",
"(",
... | Write data to the file at the given path, calling back asynchronously with
either a FileSystemError string or the FileSystemStats object associated
with the written file and a boolean that indicates whether the file was
created by the write (true) or not (false). If no file exists at the
given path, a new file will be created. The options parameter can be used
to specify an encoding (default "utf8"), an octal mode (default
unspecified and implementation dependent), and a consistency hash, which
is used to the current state of the file before overwriting it. If a
consistency hash is provided but does not match the hash of the file on
disk, a FileSystemError.CONTENTS_MODIFIED error is passed to the callback.
@param {string} path
@param {string} data
@param {{encoding : string=, mode : number=, expectedHash : object=, expectedContents : string=}} options
@param {function(?string, FileSystemStats=, boolean)} callback | [
"Write",
"data",
"to",
"the",
"file",
"at",
"the",
"given",
"path",
"calling",
"back",
"asynchronously",
"with",
"either",
"a",
"FileSystemError",
"string",
"or",
"the",
"FileSystemStats",
"object",
"associated",
"with",
"the",
"written",
"file",
"and",
"a",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L411-L460 | train | write file | [
30522,
3853,
4339,
8873,
2571,
1006,
4130,
1010,
2951,
1010,
7047,
1010,
2655,
5963,
1007,
1063,
13075,
17181,
1027,
7047,
1012,
17181,
1064,
1064,
1000,
21183,
2546,
2620,
1000,
1010,
30524,
1006,
2580,
1007,
1063,
18726,
18223,
1012,
1042... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/server.js | ServerWritableStream | function ServerWritableStream(call, metadata, serialize) {
Writable.call(this, {objectMode: true});
this.call = call;
this.finished = false;
setUpWritable(this, serialize);
/**
* Indicates if the call has been cancelled
* @member {boolean} grpc~ServerWritableStream#cancelled
*/
this.cancelled = false;
/**
* The request metadata from the client
* @member {grpc.Metadata} grpc~ServerWritableStream#metadata
*/
this.metadata = metadata;
/**
* The request message from the client
* @member {*} grpc~ServerWritableStream#request
*/
this.request = undefined;
} | javascript | function ServerWritableStream(call, metadata, serialize) {
Writable.call(this, {objectMode: true});
this.call = call;
this.finished = false;
setUpWritable(this, serialize);
/**
* Indicates if the call has been cancelled
* @member {boolean} grpc~ServerWritableStream#cancelled
*/
this.cancelled = false;
/**
* The request metadata from the client
* @member {grpc.Metadata} grpc~ServerWritableStream#metadata
*/
this.metadata = metadata;
/**
* The request message from the client
* @member {*} grpc~ServerWritableStream#request
*/
this.request = undefined;
} | [
"function",
"ServerWritableStream",
"(",
"call",
",",
"metadata",
",",
"serialize",
")",
"{",
"Writable",
".",
"call",
"(",
"this",
",",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"this",
".",
"call",
"=",
"call",
";",
"this",
".",
"finished",
"=",... | A stream that the server can write to. Used for calls that are streaming from
the server side.
@constructor grpc~ServerWritableStream
@extends external:Writable
@borrows grpc~ServerUnaryCall#sendMetadata as
grpc~ServerWritableStream#sendMetadata
@borrows grpc~ServerUnaryCall#getPeer as grpc~ServerWritableStream#getPeer
@param {grpc.internal~Call} call The call object to send data with
@param {grpc.Metadata} metadata The request metadata from the client
@param {grpc~serialize} serialize Serialization function for writes | [
"A",
"stream",
"that",
"the",
"server",
"can",
"write",
"to",
".",
"Used",
"for",
"calls",
"that",
"are",
"streaming",
"from",
"the",
"server",
"side",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/server.js#L270-L291 | train | A writable stream that can be used to write a request to a client. | [
30522,
3853,
8241,
13088,
6590,
13510,
25379,
1006,
2655,
1010,
27425,
1010,
7642,
4697,
1007,
1063,
25697,
3085,
1012,
2655,
1006,
2023,
1010,
1063,
4874,
5302,
3207,
1024,
2995,
1065,
1007,
1025,
2023,
1012,
2655,
1027,
2655,
1025,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tgriesser/knex | src/dialects/sqlite3/schema/ddl.js | SQLite3_DDL | function SQLite3_DDL(client, tableCompiler, pragma, connection) {
this.client = client;
this.tableCompiler = tableCompiler;
this.pragma = pragma;
this.tableNameRaw = this.tableCompiler.tableNameRaw;
this.alteredName = uniqueId('_knex_temp_alter');
this.connection = connection;
this.formatter =
client && client.config && client.config.wrapIdentifier
? client.config.wrapIdentifier
: (value) => value;
} | javascript | function SQLite3_DDL(client, tableCompiler, pragma, connection) {
this.client = client;
this.tableCompiler = tableCompiler;
this.pragma = pragma;
this.tableNameRaw = this.tableCompiler.tableNameRaw;
this.alteredName = uniqueId('_knex_temp_alter');
this.connection = connection;
this.formatter =
client && client.config && client.config.wrapIdentifier
? client.config.wrapIdentifier
: (value) => value;
} | [
"function",
"SQLite3_DDL",
"(",
"client",
",",
"tableCompiler",
",",
"pragma",
",",
"connection",
")",
"{",
"this",
".",
"client",
"=",
"client",
";",
"this",
".",
"tableCompiler",
"=",
"tableCompiler",
";",
"this",
".",
"pragma",
"=",
"pragma",
";",
"this... | So altering the schema in SQLite3 is a major pain. We have our own object to deal with the renaming and altering the types for sqlite3 things. | [
"So",
"altering",
"the",
"schema",
"in",
"SQLite3",
"is",
"a",
"major",
"pain",
".",
"We",
"have",
"our",
"own",
"object",
"to",
"deal",
"with",
"the",
"renaming",
"and",
"altering",
"the",
"types",
"for",
"sqlite3",
"things",
"."
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/dialects/sqlite3/schema/ddl.js#L22-L33 | train | SQLite3_DDL constructor. | [
30522,
3853,
29296,
4221,
2509,
1035,
20315,
2140,
1006,
7396,
1010,
2795,
9006,
22090,
2099,
1010,
10975,
8490,
2863,
1010,
4434,
1007,
1063,
2023,
1012,
7396,
1027,
7396,
1025,
2023,
1012,
2795,
9006,
22090,
2099,
1027,
2795,
9006,
22090,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config/addPlugin.js | addPlugin | function addPlugin(config, pluginName, version) {
// For default plugin, we only ensure it is enabled
if (isDefaultPlugin(pluginName, version)) {
return togglePlugin(config, pluginName, true);
}
var deps = config.getPluginDependencies();
var dep = PluginDependency.create(pluginName, version);
deps = deps.push(dep);
return config.setPluginDependencies(deps);
} | javascript | function addPlugin(config, pluginName, version) {
// For default plugin, we only ensure it is enabled
if (isDefaultPlugin(pluginName, version)) {
return togglePlugin(config, pluginName, true);
}
var deps = config.getPluginDependencies();
var dep = PluginDependency.create(pluginName, version);
deps = deps.push(dep);
return config.setPluginDependencies(deps);
} | [
"function",
"addPlugin",
"(",
"config",
",",
"pluginName",
",",
"version",
")",
"{",
"// For default plugin, we only ensure it is enabled",
"if",
"(",
"isDefaultPlugin",
"(",
"pluginName",
",",
"version",
")",
")",
"{",
"return",
"togglePlugin",
"(",
"config",
",",
... | Add a plugin to a book's configuration
@param {Config} config
@param {String} pluginName
@param {String} version (optional)
@return {Config} | [
"Add",
"a",
"plugin",
"to",
"a",
"book",
"s",
"configuration"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/config/addPlugin.js#L12-L23 | train | Add a plugin to the config | [
30522,
3853,
5587,
24759,
15916,
2378,
1006,
9530,
8873,
2290,
1010,
13354,
23111,
14074,
1010,
2544,
1007,
1063,
1013,
1013,
2005,
12398,
13354,
2378,
1010,
2057,
2069,
5676,
2009,
2003,
9124,
2065,
1006,
2003,
3207,
7011,
11314,
24759,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js | _getValidBezierParams | function _getValidBezierParams(match) {
var param,
// take ease-in-out as default value in case there are no params yet (or they are invalid)
def = [ ".42", "0", ".58", "1" ],
oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
originalString = match[0],
i;
if (match) {
match = match[1].split(",");
}
if (match) {
for (i = 0; i <= 3; i++) {
if (match[i]) {
match[i] = match[i].trim();
param = _convertToNumber(match[i]);
// Verify the param is a number
// If not, replace it with the default value
if (!param.isNumber) {
match[i] = undefined;
// Verify x coordinates are in 0-1 range
// If not, set them to the closest value in range
} else if (i === 0 || i === 2) {
if (param.value < 0) {
match[i] = "0";
} else if (param.value > 1) {
match[i] = "1";
}
}
}
if (!match[i]) {
match[i] = def[i];
}
}
} else {
match = def;
}
match = match.splice(0, 4); // make sure there are only 4 params
match = "cubic-bezier(" + match.join(", ") + ")";
match = match.match(BEZIER_CURVE_VALID_REGEX);
if (match) {
match.index = oldIndex; // re-set the index here to get the right context
match.originalString = originalString;
return match;
}
return null;
} | javascript | function _getValidBezierParams(match) {
var param,
// take ease-in-out as default value in case there are no params yet (or they are invalid)
def = [ ".42", "0", ".58", "1" ],
oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards
originalString = match[0],
i;
if (match) {
match = match[1].split(",");
}
if (match) {
for (i = 0; i <= 3; i++) {
if (match[i]) {
match[i] = match[i].trim();
param = _convertToNumber(match[i]);
// Verify the param is a number
// If not, replace it with the default value
if (!param.isNumber) {
match[i] = undefined;
// Verify x coordinates are in 0-1 range
// If not, set them to the closest value in range
} else if (i === 0 || i === 2) {
if (param.value < 0) {
match[i] = "0";
} else if (param.value > 1) {
match[i] = "1";
}
}
}
if (!match[i]) {
match[i] = def[i];
}
}
} else {
match = def;
}
match = match.splice(0, 4); // make sure there are only 4 params
match = "cubic-bezier(" + match.join(", ") + ")";
match = match.match(BEZIER_CURVE_VALID_REGEX);
if (match) {
match.index = oldIndex; // re-set the index here to get the right context
match.originalString = originalString;
return match;
}
return null;
} | [
"function",
"_getValidBezierParams",
"(",
"match",
")",
"{",
"var",
"param",
",",
"// take ease-in-out as default value in case there are no params yet (or they are invalid)",
"def",
"=",
"[",
"\".42\"",
",",
"\"0\"",
",",
"\".58\"",
",",
"\"1\"",
"]",
",",
"oldIndex",
... | Get valid params for an invalid cubic-bezier.
@param {RegExp.match} match (Invalid) matches from cubicBezierMatch()
@return {?RegExp.match} Valid match or null if the output is not valid | [
"Get",
"valid",
"params",
"for",
"an",
"invalid",
"cubic",
"-",
"bezier",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js#L85-L136 | train | Get valid bezier parameters | [
30522,
3853,
1035,
2131,
10175,
3593,
4783,
21548,
28689,
5244,
1006,
2674,
1007,
1063,
13075,
11498,
2213,
1010,
1013,
1013,
2202,
7496,
1011,
1999,
1011,
2041,
2004,
12398,
3643,
1999,
2553,
2045,
2024,
2053,
11498,
5244,
2664,
1006,
2030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/date/Japanese.js | toGregorianArguments | function toGregorianArguments(aArgs) {
var oJapanese, oGregorian,
iEra,
vYear = aArgs[0];
if (typeof vYear == "number") {
if (vYear >= 100) {
// Year greater than 100 will be treated as gregorian year
return aArgs;
} else {
// Year less than 100 is emperor year in the current era
iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
vYear = [iEra, vYear];
}
} else if (!Array.isArray(vYear)) {
// Invalid year
vYear = [];
}
oJapanese = {
era: vYear[0],
year: vYear[1],
month: aArgs[1],
day: aArgs[2] !== undefined ? aArgs[2] : 1
};
oGregorian = toGregorian(oJapanese);
aArgs[0] = oGregorian.year;
return aArgs;
} | javascript | function toGregorianArguments(aArgs) {
var oJapanese, oGregorian,
iEra,
vYear = aArgs[0];
if (typeof vYear == "number") {
if (vYear >= 100) {
// Year greater than 100 will be treated as gregorian year
return aArgs;
} else {
// Year less than 100 is emperor year in the current era
iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
vYear = [iEra, vYear];
}
} else if (!Array.isArray(vYear)) {
// Invalid year
vYear = [];
}
oJapanese = {
era: vYear[0],
year: vYear[1],
month: aArgs[1],
day: aArgs[2] !== undefined ? aArgs[2] : 1
};
oGregorian = toGregorian(oJapanese);
aArgs[0] = oGregorian.year;
return aArgs;
} | [
"function",
"toGregorianArguments",
"(",
"aArgs",
")",
"{",
"var",
"oJapanese",
",",
"oGregorian",
",",
"iEra",
",",
"vYear",
"=",
"aArgs",
"[",
"0",
"]",
";",
"if",
"(",
"typeof",
"vYear",
"==",
"\"number\"",
")",
"{",
"if",
"(",
"vYear",
">=",
"100",... | Convert arguments array from japanese date to gregorian data
@param {object} oJapanese
@return {int} | [
"Convert",
"arguments",
"array",
"from",
"japanese",
"date",
"to",
"gregorian",
"data"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Japanese.js#L85-L112 | train | Converts an array of arguments to gregorian arguments | [
30522,
3853,
2000,
17603,
20255,
11410,
10623,
27417,
3215,
1006,
9779,
10623,
2015,
1007,
1063,
13075,
1051,
3900,
9739,
6810,
1010,
13958,
2890,
20255,
2937,
1010,
29464,
2527,
1010,
1058,
29100,
1027,
9779,
10623,
2015,
1031,
30524,
2842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aframevr/aframe | src/components/sound.js | function () {
var i;
var sound;
this.isPlaying = false;
for (i = 0; i < this.pool.children.length; i++) {
sound = this.pool.children[i];
if (!sound.source || !sound.source.buffer) { return; }
sound.stop();
}
} | javascript | function () {
var i;
var sound;
this.isPlaying = false;
for (i = 0; i < this.pool.children.length; i++) {
sound = this.pool.children[i];
if (!sound.source || !sound.source.buffer) { return; }
sound.stop();
}
} | [
"function",
"(",
")",
"{",
"var",
"i",
";",
"var",
"sound",
";",
"this",
".",
"isPlaying",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"pool",
".",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"sound",
"=... | Stop all the sounds in the pool. | [
"Stop",
"all",
"the",
"sounds",
"in",
"the",
"pool",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/sound.js#L239-L248 | train | Stop all the sounds in the pool | [
30522,
3853,
1006,
1007,
1063,
13075,
1045,
1025,
13075,
2614,
1025,
2023,
1012,
2003,
13068,
2075,
1027,
6270,
1025,
2005,
1006,
1045,
1027,
1014,
1025,
1045,
1026,
2023,
1012,
4770,
1012,
2336,
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... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js | releaseTriggeredEvent | function releaseTriggeredEvent(oHandler) {
if (!oHandler) {
Log.error("Release trigger events must not be called without passing a valid handler!");
return;
}
var mEventInfo = mTriggerEventInfo[oHandler.type];
if (!mEventInfo) {
return;
} else if (!mEventInfo.domRefs[oHandler.id] || !mEventInfo.domRefs[oHandler.id].domRef) {
Log.warning("Release trigger event for event type " + oHandler.type + "on Control " + oHandler.id + ": DomRef does not exists");
return;
}
delete mEventInfo.domRefs[oHandler.id];
} | javascript | function releaseTriggeredEvent(oHandler) {
if (!oHandler) {
Log.error("Release trigger events must not be called without passing a valid handler!");
return;
}
var mEventInfo = mTriggerEventInfo[oHandler.type];
if (!mEventInfo) {
return;
} else if (!mEventInfo.domRefs[oHandler.id] || !mEventInfo.domRefs[oHandler.id].domRef) {
Log.warning("Release trigger event for event type " + oHandler.type + "on Control " + oHandler.id + ": DomRef does not exists");
return;
}
delete mEventInfo.domRefs[oHandler.id];
} | [
"function",
"releaseTriggeredEvent",
"(",
"oHandler",
")",
"{",
"if",
"(",
"!",
"oHandler",
")",
"{",
"Log",
".",
"error",
"(",
"\"Release trigger events must not be called without passing a valid handler!\"",
")",
";",
"return",
";",
"}",
"var",
"mEventInfo",
"=",
... | Stop suppressing jQuery.trigger events for a given DOM element
@param {Object} oHandler The suppression handler
@private | [
"Stop",
"suppressing",
"jQuery",
".",
"trigger",
"events",
"for",
"a",
"given",
"DOM",
"element"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/jquery/EventTriggerHook.js#L116-L132 | train | Releases a trigger event for the given control | [
30522,
3853,
2713,
18886,
13327,
14728,
15338,
1006,
2821,
5685,
3917,
1007,
1063,
2065,
1006,
999,
2821,
5685,
3917,
1007,
1063,
8833,
1012,
7561,
1006,
1000,
2713,
9495,
2824,
2442,
2025,
2022,
2170,
2302,
4458,
1037,
9398,
28213,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | Event | function Event(oClass, name, info) {
this.name = name;
this.allowPreventDefault = info.allowPreventDefault || false;
this.deprecated = info.deprecated || false;
this.visibility = 'public';
this.allowPreventDefault = !!info.allowPreventDefault;
this.enableEventBubbling = !!info.enableEventBubbling;
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = 'event:' + name;
this._iKind = Kind.EVENT;
var N = capitalize(name);
this._sMutator = 'attach' + N;
this._sDetachMutator = 'detach' + N;
this._sTrigger = 'fire' + N;
} | javascript | function Event(oClass, name, info) {
this.name = name;
this.allowPreventDefault = info.allowPreventDefault || false;
this.deprecated = info.deprecated || false;
this.visibility = 'public';
this.allowPreventDefault = !!info.allowPreventDefault;
this.enableEventBubbling = !!info.enableEventBubbling;
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = 'event:' + name;
this._iKind = Kind.EVENT;
var N = capitalize(name);
this._sMutator = 'attach' + N;
this._sDetachMutator = 'detach' + N;
this._sTrigger = 'fire' + N;
} | [
"function",
"Event",
"(",
"oClass",
",",
"name",
",",
"info",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"allowPreventDefault",
"=",
"info",
".",
"allowPreventDefault",
"||",
"false",
";",
"this",
".",
"deprecated",
"=",
"info",
".",
... | ---- Event -----------------------------------------------------------------------------
Event info object
@private
@since 1.27.1 | [
"----",
"Event",
"-----------------------------------------------------------------------------",
"Event",
"info",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L752-L767 | train | Event constructor. | [
30522,
3853,
2724,
1006,
1051,
26266,
1010,
2171,
1010,
18558,
1007,
1063,
2023,
1012,
2171,
1027,
2171,
1025,
2023,
1012,
3499,
28139,
15338,
3207,
7011,
11314,
1027,
18558,
1012,
3499,
28139,
15338,
3207,
7011,
11314,
1064,
1064,
6270,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/config/config-file.js | write | function write(config, filePath) {
switch (path.extname(filePath)) {
case ".js":
writeJSConfigFile(config, filePath);
break;
case ".json":
writeJSONConfigFile(config, filePath);
break;
case ".yaml":
case ".yml":
writeYAMLConfigFile(config, filePath);
break;
default:
throw new Error("Can't write to unknown file type.");
}
} | javascript | function write(config, filePath) {
switch (path.extname(filePath)) {
case ".js":
writeJSConfigFile(config, filePath);
break;
case ".json":
writeJSONConfigFile(config, filePath);
break;
case ".yaml":
case ".yml":
writeYAMLConfigFile(config, filePath);
break;
default:
throw new Error("Can't write to unknown file type.");
}
} | [
"function",
"write",
"(",
"config",
",",
"filePath",
")",
"{",
"switch",
"(",
"path",
".",
"extname",
"(",
"filePath",
")",
")",
"{",
"case",
"\".js\"",
":",
"writeJSConfigFile",
"(",
"config",
",",
"filePath",
")",
";",
"break",
";",
"case",
"\".json\""... | Writes a configuration file.
@param {Object} config The configuration object to write.
@param {string} filePath The filename to write to.
@returns {void}
@throws {Error} When an unknown file type is specified.
@private | [
"Writes",
"a",
"configuration",
"file",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L323-L341 | train | Writes a config file to a file path. | [
30522,
3853,
4339,
1006,
9530,
8873,
2290,
1010,
5371,
15069,
1007,
1063,
6942,
1006,
4130,
1012,
4654,
2102,
18442,
1006,
5371,
15069,
1007,
1007,
1063,
2553,
1000,
1012,
1046,
2015,
30524,
15069,
1007,
1025,
3338,
1025,
2553,
1000,
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... |
apache/incubator-echarts | build/addHeader.js | run | function run() {
const updatedFiles = [];
const passFiles = [];
const pendingFiles = [];
eachFile(function (absolutePath, fileExt) {
const fileStr = fs.readFileSync(absolutePath, 'utf-8');
const existLicense = preamble.extractLicense(fileStr, fileExt);
if (existLicense) {
passFiles.push(absolutePath);
return;
}
// Conside binary files, only add for files with known ext.
if (!preamble.hasPreamble(fileExt)) {
pendingFiles.push(absolutePath);
return;
}
fs.writeFileSync(absolutePath, preamble.addPreamble(fileStr, fileExt), 'utf-8');
updatedFiles.push(absolutePath);
});
console.log('\n');
console.log('----------------------------');
console.log(' Files that exists license: ');
console.log('----------------------------');
if (passFiles.length) {
if (isVerbose) {
passFiles.forEach(function (path) {
console.log(color('fgGreen', 'dim')(path));
});
}
else {
console.log(color('fgGreen', 'dim')(passFiles.length + ' files. (use argument "--verbose" see details)'));
}
}
else {
console.log('Nothing.');
}
console.log('\n');
console.log('--------------------');
console.log(' License added for: ');
console.log('--------------------');
if (updatedFiles.length) {
updatedFiles.forEach(function (path) {
console.log(color('fgGreen', 'bright')(path));
});
}
else {
console.log('Nothing.');
}
console.log('\n');
console.log('----------------');
console.log(' Pending files: ');
console.log('----------------');
if (pendingFiles.length) {
pendingFiles.forEach(function (path) {
console.log(color('fgRed', 'dim')(path));
});
}
else {
console.log('Nothing.');
}
console.log('\nDone.');
} | javascript | function run() {
const updatedFiles = [];
const passFiles = [];
const pendingFiles = [];
eachFile(function (absolutePath, fileExt) {
const fileStr = fs.readFileSync(absolutePath, 'utf-8');
const existLicense = preamble.extractLicense(fileStr, fileExt);
if (existLicense) {
passFiles.push(absolutePath);
return;
}
// Conside binary files, only add for files with known ext.
if (!preamble.hasPreamble(fileExt)) {
pendingFiles.push(absolutePath);
return;
}
fs.writeFileSync(absolutePath, preamble.addPreamble(fileStr, fileExt), 'utf-8');
updatedFiles.push(absolutePath);
});
console.log('\n');
console.log('----------------------------');
console.log(' Files that exists license: ');
console.log('----------------------------');
if (passFiles.length) {
if (isVerbose) {
passFiles.forEach(function (path) {
console.log(color('fgGreen', 'dim')(path));
});
}
else {
console.log(color('fgGreen', 'dim')(passFiles.length + ' files. (use argument "--verbose" see details)'));
}
}
else {
console.log('Nothing.');
}
console.log('\n');
console.log('--------------------');
console.log(' License added for: ');
console.log('--------------------');
if (updatedFiles.length) {
updatedFiles.forEach(function (path) {
console.log(color('fgGreen', 'bright')(path));
});
}
else {
console.log('Nothing.');
}
console.log('\n');
console.log('----------------');
console.log(' Pending files: ');
console.log('----------------');
if (pendingFiles.length) {
pendingFiles.forEach(function (path) {
console.log(color('fgRed', 'dim')(path));
});
}
else {
console.log('Nothing.');
}
console.log('\nDone.');
} | [
"function",
"run",
"(",
")",
"{",
"const",
"updatedFiles",
"=",
"[",
"]",
";",
"const",
"passFiles",
"=",
"[",
"]",
";",
"const",
"pendingFiles",
"=",
"[",
"]",
";",
"eachFile",
"(",
"function",
"(",
"absolutePath",
",",
"fileExt",
")",
"{",
"const",
... | const lists = [ '../src/**/*.js', '../build/*.js', '../benchmark/src/*.js', '../benchmark/src/gulpfile.js', '../extension-src/**/*.js', '../extension/**/*.js', '../map/js/**/*.js', '../test/build/**/*.js', '../test/node/**/*.js', '../test/ut/core/*.js', '../test/ut/spe/*.js', '../test/ut/ut.js', '../test/*.js', '../theme/*.js', '../theme/tool/**/*.js', '../echarts.all.js', '../echarts.blank.js', '../echarts.common.js', '../echarts.simple.js', '../index.js', '../index.common.js', '../index.simple.js' ]; | [
"const",
"lists",
"=",
"[",
"..",
"/",
"src",
"/",
"**",
"/",
"*",
".",
"js",
"..",
"/",
"build",
"/",
"*",
".",
"js",
"..",
"/",
"benchmark",
"/",
"src",
"/",
"*",
".",
"js",
"..",
"/",
"benchmark",
"/",
"src",
"/",
"gulpfile",
".",
"js",
... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/build/addHeader.js#L59-L129 | train | Run the algorithm | [
30522,
3853,
2448,
1006,
1007,
1063,
9530,
3367,
7172,
8873,
4244,
1027,
1031,
1033,
1025,
9530,
3367,
3413,
8873,
4244,
1027,
1031,
1033,
1025,
9530,
3367,
14223,
8873,
4244,
1027,
1031,
1033,
1025,
2169,
8873,
2571,
1006,
3853,
1006,
76... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | scan | function scan () {
rootInstances.length = 0
let inFragment = false
let currentFragment = null
function processInstance (instance) {
if (instance) {
if (rootInstances.indexOf(instance.$root) === -1) {
instance = instance.$root
}
if (instance._isFragment) {
inFragment = true
currentFragment = instance
}
// respect Vue.config.devtools option
let baseVue = instance.constructor
while (baseVue.super) {
baseVue = baseVue.super
}
if (baseVue.config && baseVue.config.devtools) {
// give a unique id to root instance so we can
// 'namespace' its children
if (typeof instance.__VUE_DEVTOOLS_ROOT_UID__ === 'undefined') {
instance.__VUE_DEVTOOLS_ROOT_UID__ = ++rootUID
}
rootInstances.push(instance)
}
return true
}
}
if (isBrowser) {
walk(document, function (node) {
if (inFragment) {
if (node === currentFragment._fragmentEnd) {
inFragment = false
currentFragment = null
}
return true
}
let instance = node.__vue__
return processInstance(instance)
})
} else {
if (Array.isArray(target.__VUE_ROOT_INSTANCES__)) {
target.__VUE_ROOT_INSTANCES__.map(processInstance)
}
}
hook.emit('router:init')
flush()
} | javascript | function scan () {
rootInstances.length = 0
let inFragment = false
let currentFragment = null
function processInstance (instance) {
if (instance) {
if (rootInstances.indexOf(instance.$root) === -1) {
instance = instance.$root
}
if (instance._isFragment) {
inFragment = true
currentFragment = instance
}
// respect Vue.config.devtools option
let baseVue = instance.constructor
while (baseVue.super) {
baseVue = baseVue.super
}
if (baseVue.config && baseVue.config.devtools) {
// give a unique id to root instance so we can
// 'namespace' its children
if (typeof instance.__VUE_DEVTOOLS_ROOT_UID__ === 'undefined') {
instance.__VUE_DEVTOOLS_ROOT_UID__ = ++rootUID
}
rootInstances.push(instance)
}
return true
}
}
if (isBrowser) {
walk(document, function (node) {
if (inFragment) {
if (node === currentFragment._fragmentEnd) {
inFragment = false
currentFragment = null
}
return true
}
let instance = node.__vue__
return processInstance(instance)
})
} else {
if (Array.isArray(target.__VUE_ROOT_INSTANCES__)) {
target.__VUE_ROOT_INSTANCES__.map(processInstance)
}
}
hook.emit('router:init')
flush()
} | [
"function",
"scan",
"(",
")",
"{",
"rootInstances",
".",
"length",
"=",
"0",
"let",
"inFragment",
"=",
"false",
"let",
"currentFragment",
"=",
"null",
"function",
"processInstance",
"(",
"instance",
")",
"{",
"if",
"(",
"instance",
")",
"{",
"if",
"(",
"... | Scan the page for root level Vue instances. | [
"Scan",
"the",
"page",
"for",
"root",
"level",
"Vue",
"instances",
"."
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L189-L242 | train | scan for root instances | [
30522,
3853,
13594,
1006,
1007,
1063,
7117,
7076,
26897,
2015,
1012,
3091,
1027,
1014,
2292,
1999,
27843,
21693,
4765,
1027,
6270,
2292,
2783,
27843,
21693,
4765,
1027,
19701,
3853,
2832,
7076,
26897,
1006,
6013,
1007,
1063,
2065,
1006,
601... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wendux/fly | _.js | wrap | function wrap(interceptor) {
var resolve;
var reject;
function _clear() {
interceptor.p = resolve = reject = null;
}
utils.merge(interceptor, {
lock() {
if (!resolve) {
interceptor.p = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject;
})
}
},
unlock() {
if (resolve) {
resolve()
_clear();
}
},
clear() {
if (reject) {
reject("cancel");
_clear();
}
}
})
} | javascript | function wrap(interceptor) {
var resolve;
var reject;
function _clear() {
interceptor.p = resolve = reject = null;
}
utils.merge(interceptor, {
lock() {
if (!resolve) {
interceptor.p = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject;
})
}
},
unlock() {
if (resolve) {
resolve()
_clear();
}
},
clear() {
if (reject) {
reject("cancel");
_clear();
}
}
})
} | [
"function",
"wrap",
"(",
"interceptor",
")",
"{",
"var",
"resolve",
";",
"var",
"reject",
";",
"function",
"_clear",
"(",
")",
"{",
"interceptor",
".",
"p",
"=",
"resolve",
"=",
"reject",
"=",
"null",
";",
"}",
"utils",
".",
"merge",
"(",
"interceptor"... | Add lock/unlock API for interceptor.
Once an request/response interceptor is locked, the incoming request/response
will be added to a queue before they enter the interceptor, they will not be
continued until the interceptor is unlocked.
@param [interceptor] either is interceptors.request or interceptors.response | [
"Add",
"lock",
"/",
"unlock",
"API",
"for",
"interceptor",
"."
] | fced928bfe7449d0fa18d5fea466cce1e3bda465 | https://github.com/wendux/fly/blob/fced928bfe7449d0fa18d5fea466cce1e3bda465/_.js#L19-L49 | train | wrap the interceptor function | [
30522,
3853,
10236,
1006,
24727,
1007,
1063,
13075,
10663,
1025,
13075,
15454,
1025,
3853,
1035,
3154,
1006,
1007,
1063,
24727,
1012,
1052,
1027,
10663,
1027,
15454,
1027,
19701,
1025,
1065,
21183,
12146,
1012,
13590,
1006,
24727,
1010,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onPopupRedirectSamlProviderClick | function onPopupRedirectSamlProviderClick() {
var providerId = $('#popup-redirect-saml-providerid').val();
var provider = new firebase.auth.SAMLAuthProvider(providerId);
signInWithPopupRedirect(provider);
} | javascript | function onPopupRedirectSamlProviderClick() {
var providerId = $('#popup-redirect-saml-providerid').val();
var provider = new firebase.auth.SAMLAuthProvider(providerId);
signInWithPopupRedirect(provider);
} | [
"function",
"onPopupRedirectSamlProviderClick",
"(",
")",
"{",
"var",
"providerId",
"=",
"$",
"(",
"'#popup-redirect-saml-providerid'",
")",
".",
"val",
"(",
")",
";",
"var",
"provider",
"=",
"new",
"firebase",
".",
"auth",
".",
"SAMLAuthProvider",
"(",
"provide... | Performs the corresponding popup/redirect action for a SAML provider. | [
"Performs",
"the",
"corresponding",
"popup",
"/",
"redirect",
"action",
"for",
"a",
"SAML",
"provider",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L928-L932 | train | Popup redirect provider click handler. | [
30522,
3853,
2006,
16340,
6279,
5596,
7442,
16649,
3286,
14277,
12298,
18688,
20464,
6799,
1006,
1007,
1063,
13075,
10802,
3593,
1027,
1002,
1006,
1005,
1001,
3769,
6279,
1011,
2417,
7442,
6593,
1011,
3520,
2140,
1011,
10802,
3593,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kriasoft/react-starter-kit | src/client.js | onLocationChange | async function onLocationChange(location, action) {
// Remember the latest scroll position for the previous location
scrollPositionsHistory[currentLocation.key] = {
scrollX: window.pageXOffset,
scrollY: window.pageYOffset,
};
// Delete stored scroll position for next page if any
if (action === 'PUSH') {
delete scrollPositionsHistory[location.key];
}
currentLocation = location;
const isInitialRender = !action;
try {
context.pathname = location.pathname;
context.query = queryString.parse(location.search);
// Traverses the list of routes in the order they are defined until
// it finds the first route that matches provided URL path string
// and whose action method returns anything other than `undefined`.
const route = await router.resolve(context);
// Prevent multiple page renders during the routing process
if (currentLocation.key !== location.key) {
return;
}
if (route.redirect) {
history.replace(route.redirect);
return;
}
const renderReactApp = isInitialRender ? ReactDOM.hydrate : ReactDOM.render;
appInstance = renderReactApp(
<App context={context}>{route.component}</App>,
container,
() => {
if (isInitialRender) {
// Switch off the native scroll restoration behavior and handle it manually
// https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration
if (window.history && 'scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual';
}
const elem = document.getElementById('css');
if (elem) elem.parentNode.removeChild(elem);
return;
}
document.title = route.title;
updateMeta('description', route.description);
// Update necessary tags in <head> at runtime here, ie:
// updateMeta('keywords', route.keywords);
// updateCustomMeta('og:url', route.canonicalUrl);
// updateCustomMeta('og:image', route.imageUrl);
// updateLink('canonical', route.canonicalUrl);
// etc.
let scrollX = 0;
let scrollY = 0;
const pos = scrollPositionsHistory[location.key];
if (pos) {
scrollX = pos.scrollX;
scrollY = pos.scrollY;
} else {
const targetHash = location.hash.substr(1);
if (targetHash) {
const target = document.getElementById(targetHash);
if (target) {
scrollY = window.pageYOffset + target.getBoundingClientRect().top;
}
}
}
// Restore the scroll position if it was saved into the state
// or scroll to the given #hash anchor
// or scroll to top of the page
window.scrollTo(scrollX, scrollY);
// Google Analytics tracking. Don't send 'pageview' event after
// the initial rendering, as it was already sent
if (window.ga) {
window.ga('send', 'pageview', createPath(location));
}
},
);
} catch (error) {
if (__DEV__) {
throw error;
}
console.error(error);
// Do a full page reload if error occurs during client-side navigation
if (!isInitialRender && currentLocation.key === location.key) {
console.error('RSK will reload your page after error');
window.location.reload();
}
}
} | javascript | async function onLocationChange(location, action) {
// Remember the latest scroll position for the previous location
scrollPositionsHistory[currentLocation.key] = {
scrollX: window.pageXOffset,
scrollY: window.pageYOffset,
};
// Delete stored scroll position for next page if any
if (action === 'PUSH') {
delete scrollPositionsHistory[location.key];
}
currentLocation = location;
const isInitialRender = !action;
try {
context.pathname = location.pathname;
context.query = queryString.parse(location.search);
// Traverses the list of routes in the order they are defined until
// it finds the first route that matches provided URL path string
// and whose action method returns anything other than `undefined`.
const route = await router.resolve(context);
// Prevent multiple page renders during the routing process
if (currentLocation.key !== location.key) {
return;
}
if (route.redirect) {
history.replace(route.redirect);
return;
}
const renderReactApp = isInitialRender ? ReactDOM.hydrate : ReactDOM.render;
appInstance = renderReactApp(
<App context={context}>{route.component}</App>,
container,
() => {
if (isInitialRender) {
// Switch off the native scroll restoration behavior and handle it manually
// https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration
if (window.history && 'scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual';
}
const elem = document.getElementById('css');
if (elem) elem.parentNode.removeChild(elem);
return;
}
document.title = route.title;
updateMeta('description', route.description);
// Update necessary tags in <head> at runtime here, ie:
// updateMeta('keywords', route.keywords);
// updateCustomMeta('og:url', route.canonicalUrl);
// updateCustomMeta('og:image', route.imageUrl);
// updateLink('canonical', route.canonicalUrl);
// etc.
let scrollX = 0;
let scrollY = 0;
const pos = scrollPositionsHistory[location.key];
if (pos) {
scrollX = pos.scrollX;
scrollY = pos.scrollY;
} else {
const targetHash = location.hash.substr(1);
if (targetHash) {
const target = document.getElementById(targetHash);
if (target) {
scrollY = window.pageYOffset + target.getBoundingClientRect().top;
}
}
}
// Restore the scroll position if it was saved into the state
// or scroll to the given #hash anchor
// or scroll to top of the page
window.scrollTo(scrollX, scrollY);
// Google Analytics tracking. Don't send 'pageview' event after
// the initial rendering, as it was already sent
if (window.ga) {
window.ga('send', 'pageview', createPath(location));
}
},
);
} catch (error) {
if (__DEV__) {
throw error;
}
console.error(error);
// Do a full page reload if error occurs during client-side navigation
if (!isInitialRender && currentLocation.key === location.key) {
console.error('RSK will reload your page after error');
window.location.reload();
}
}
} | [
"async",
"function",
"onLocationChange",
"(",
"location",
",",
"action",
")",
"{",
"// Remember the latest scroll position for the previous location",
"scrollPositionsHistory",
"[",
"currentLocation",
".",
"key",
"]",
"=",
"{",
"scrollX",
":",
"window",
".",
"pageXOffset"... | Re-render the app when window.location changes | [
"Re",
"-",
"render",
"the",
"app",
"when",
"window",
".",
"location",
"changes"
] | 8d6c018f3198dec2a580ecafb011a32f06e38dbf | https://github.com/kriasoft/react-starter-kit/blob/8d6c018f3198dec2a580ecafb011a32f06e38dbf/src/client.js#L47-L147 | train | When the location changes update the page s meta and app instance | [
30522,
2004,
6038,
2278,
3853,
2006,
4135,
10719,
22305,
2063,
1006,
3295,
1010,
2895,
1007,
1063,
1013,
1013,
3342,
1996,
6745,
17186,
2597,
2005,
1996,
3025,
3295,
17186,
26994,
6182,
23809,
2100,
1031,
2783,
4135,
10719,
1012,
3145,
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... |
jgraph/mxgraph | javascript/mxClient.js | function(constraint)
{
var result = 0;
result = (constraint & mxConstants.DIRECTION_MASK_WEST) << 3;
result |= (constraint & mxConstants.DIRECTION_MASK_NORTH) << 1;
result |= (constraint & mxConstants.DIRECTION_MASK_SOUTH) >> 1;
result |= (constraint & mxConstants.DIRECTION_MASK_EAST) >> 3;
return result;
} | javascript | function(constraint)
{
var result = 0;
result = (constraint & mxConstants.DIRECTION_MASK_WEST) << 3;
result |= (constraint & mxConstants.DIRECTION_MASK_NORTH) << 1;
result |= (constraint & mxConstants.DIRECTION_MASK_SOUTH) >> 1;
result |= (constraint & mxConstants.DIRECTION_MASK_EAST) >> 3;
return result;
} | [
"function",
"(",
"constraint",
")",
"{",
"var",
"result",
"=",
"0",
";",
"result",
"=",
"(",
"constraint",
"&",
"mxConstants",
".",
"DIRECTION_MASK_WEST",
")",
"<<",
"3",
";",
"result",
"|=",
"(",
"constraint",
"&",
"mxConstants",
".",
"DIRECTION_MASK_NORTH"... | Function: reversePortConstraints
Reverse the port constraint bitmask. For example, north | east
becomes south | west | [
"Function",
":",
"reversePortConstraints"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L4399-L4409 | train | Returns the result of the constraint | [
30522,
3853,
1006,
27142,
1007,
1063,
13075,
2765,
1027,
1014,
1025,
2765,
1027,
1006,
27142,
1004,
25630,
8663,
12693,
3215,
1012,
3257,
1035,
7308,
1035,
2225,
1007,
1026,
1026,
1017,
1025,
2765,
1064,
1027,
30524,
1025,
2765,
1064,
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/core/util/MockServer.js | function(oEntitySet, sKeys, sUrlParams) {
// Set the default entity name
var sSetName = oEntitySet.name;
// If there are sUrlParams try to find a navigation property
var navProp;
if (sUrlParams) {
navProp = oEntitySet.navprops[sUrlParams];
}
if (navProp) {
// instead of the default entity name use the endpoints entity
// name
sSetName = navProp.to.entitySet;
}
return sSetName;
} | javascript | function(oEntitySet, sKeys, sUrlParams) {
// Set the default entity name
var sSetName = oEntitySet.name;
// If there are sUrlParams try to find a navigation property
var navProp;
if (sUrlParams) {
navProp = oEntitySet.navprops[sUrlParams];
}
if (navProp) {
// instead of the default entity name use the endpoints entity
// name
sSetName = navProp.to.entitySet;
}
return sSetName;
} | [
"function",
"(",
"oEntitySet",
",",
"sKeys",
",",
"sUrlParams",
")",
"{",
"// Set the default entity name",
"var",
"sSetName",
"=",
"oEntitySet",
".",
"name",
";",
"// If there are sUrlParams try to find a navigation property",
"var",
"navProp",
";",
"if",
"(",
"sUrlPar... | helper to resolve an entity set for insert/delete/update operations | [
"helper",
"to",
"resolve",
"an",
"entity",
"set",
"for",
"insert",
"/",
"delete",
"/",
"update",
"operations"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/MockServer.js#L2066-L2080 | train | Returns the name of the entity set | [
30522,
3853,
1006,
1051,
4765,
3012,
13462,
1010,
15315,
3240,
2015,
1010,
7505,
14277,
5400,
5244,
1007,
1063,
1013,
1013,
2275,
1996,
12398,
9178,
2171,
13075,
7020,
3388,
18442,
1027,
1051,
4765,
3012,
13462,
1012,
2171,
1025,
1013,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
angular/material | src/components/tabs/js/tabsController.js | defineProperty | function defineProperty (key, handler, value) {
Object.defineProperty(ctrl, key, {
get: function () { return value; },
set: function (newValue) {
var oldValue = value;
value = newValue;
handler && handler(newValue, oldValue);
}
});
} | javascript | function defineProperty (key, handler, value) {
Object.defineProperty(ctrl, key, {
get: function () { return value; },
set: function (newValue) {
var oldValue = value;
value = newValue;
handler && handler(newValue, oldValue);
}
});
} | [
"function",
"defineProperty",
"(",
"key",
",",
"handler",
",",
"value",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"ctrl",
",",
"key",
",",
"{",
"get",
":",
"function",
"(",
")",
"{",
"return",
"value",
";",
"}",
",",
"set",
":",
"function",
"("... | Utility methods
Defines a property using a getter and setter in order to trigger a change handler without
using `$watch` to observe changes.
@param {PropertyKey} key
@param {Function} handler
@param {any} value | [
"Utility",
"methods",
"Defines",
"a",
"property",
"using",
"a",
"getter",
"and",
"setter",
"in",
"order",
"to",
"trigger",
"a",
"change",
"handler",
"without",
"using",
"$watch",
"to",
"observe",
"changes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L622-L631 | train | define property for the log file | [
30522,
3853,
9375,
21572,
4842,
3723,
1006,
3145,
1010,
28213,
1010,
3643,
1007,
1063,
4874,
1012,
9375,
21572,
4842,
3723,
1006,
14931,
12190,
1010,
3145,
1010,
1063,
2131,
1024,
3853,
1006,
1007,
1063,
2709,
3643,
1025,
1065,
1010,
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... |
adobe/brackets | src/JSUtils/Session.js | filterWithQueryAndMatcher | function filterWithQueryAndMatcher(hints, matcher) {
var matchResults = $.map(hints, function (hint) {
var searchResult = matcher.match(hint.value, query);
if (searchResult) {
searchResult.value = hint.value;
searchResult.guess = hint.guess;
searchResult.type = hint.type;
if (hint.keyword !== undefined) {
searchResult.keyword = hint.keyword;
}
if (hint.literal !== undefined) {
searchResult.literal = hint.literal;
}
if (hint.depth !== undefined) {
searchResult.depth = hint.depth;
}
if (hint.doc) {
searchResult.doc = hint.doc;
}
if (hint.url) {
searchResult.url = hint.url;
}
if (!type.property && !type.showFunctionType && hint.origin &&
isBuiltin(hint.origin)) {
searchResult.builtin = 1;
} else {
searchResult.builtin = 0;
}
}
return searchResult;
});
return matchResults;
} | javascript | function filterWithQueryAndMatcher(hints, matcher) {
var matchResults = $.map(hints, function (hint) {
var searchResult = matcher.match(hint.value, query);
if (searchResult) {
searchResult.value = hint.value;
searchResult.guess = hint.guess;
searchResult.type = hint.type;
if (hint.keyword !== undefined) {
searchResult.keyword = hint.keyword;
}
if (hint.literal !== undefined) {
searchResult.literal = hint.literal;
}
if (hint.depth !== undefined) {
searchResult.depth = hint.depth;
}
if (hint.doc) {
searchResult.doc = hint.doc;
}
if (hint.url) {
searchResult.url = hint.url;
}
if (!type.property && !type.showFunctionType && hint.origin &&
isBuiltin(hint.origin)) {
searchResult.builtin = 1;
} else {
searchResult.builtin = 0;
}
}
return searchResult;
});
return matchResults;
} | [
"function",
"filterWithQueryAndMatcher",
"(",
"hints",
",",
"matcher",
")",
"{",
"var",
"matchResults",
"=",
"$",
".",
"map",
"(",
"hints",
",",
"function",
"(",
"hint",
")",
"{",
"var",
"searchResult",
"=",
"matcher",
".",
"match",
"(",
"hint",
".",
"va... | Filter an array hints using a given query and matcher.
The hints are returned in the format of the matcher.
The matcher returns the value in the "label" property,
the match score in "matchGoodness" property.
@param {Array} hints - array of hints
@param {StringMatcher} matcher
@return {Array} - array of matching hints. | [
"Filter",
"an",
"array",
"hints",
"using",
"a",
"given",
"query",
"and",
"matcher",
".",
"The",
"hints",
"are",
"returned",
"in",
"the",
"format",
"of",
"the",
"matcher",
".",
"The",
"matcher",
"returns",
"the",
"value",
"in",
"the",
"label",
"property",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/Session.js#L549-L589 | train | filterWithQueryAndMatcher - Filter hints using a matcher | [
30522,
3853,
11307,
24415,
4226,
20444,
4859,
18900,
7474,
1006,
20385,
1010,
2674,
2121,
1007,
1063,
13075,
2674,
6072,
11314,
2015,
1027,
1002,
1012,
4949,
1006,
20385,
1010,
3853,
1006,
9374,
1007,
1063,
13075,
3945,
6072,
11314,
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... |
angular/material | src/components/select/select.js | watchAsyncLoad | function watchAsyncLoad() {
if (opts.loadingAsync && !opts.isRemoved) {
scope.$$loadingAsyncDone = false;
$q.when(opts.loadingAsync)
.then(function() {
scope.$$loadingAsyncDone = true;
delete opts.loadingAsync;
}).then(function() {
$$rAF(positionAndFocusMenu);
});
}
} | javascript | function watchAsyncLoad() {
if (opts.loadingAsync && !opts.isRemoved) {
scope.$$loadingAsyncDone = false;
$q.when(opts.loadingAsync)
.then(function() {
scope.$$loadingAsyncDone = true;
delete opts.loadingAsync;
}).then(function() {
$$rAF(positionAndFocusMenu);
});
}
} | [
"function",
"watchAsyncLoad",
"(",
")",
"{",
"if",
"(",
"opts",
".",
"loadingAsync",
"&&",
"!",
"opts",
".",
"isRemoved",
")",
"{",
"scope",
".",
"$$loadingAsyncDone",
"=",
"false",
";",
"$q",
".",
"when",
"(",
"opts",
".",
"loadingAsync",
")",
".",
"t... | If asynchronously loading, watch and update internal
'$$loadingAsyncDone' flag | [
"If",
"asynchronously",
"loading",
"watch",
"and",
"update",
"internal",
"$$loadingAsyncDone",
"flag"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1453-L1465 | train | watch async load | [
30522,
3853,
3422,
3022,
6038,
20464,
10441,
2094,
1006,
1007,
1063,
2065,
1006,
23569,
2015,
1012,
10578,
3022,
6038,
2278,
1004,
1004,
999,
23569,
2015,
1012,
2003,
28578,
21818,
2094,
1007,
1063,
9531,
1012,
1002,
1002,
10578,
3022,
6038... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ksky521/nodeppt | packages/nodeppt-parser/lib/markdown/prism.js | loadPrismLang | function loadPrismLang(lang) {
if (!lang) return undefined;
let langObject = Prism.languages[lang];
if (langObject === undefined) {
try {
require('prismjs/components/prism-' + lang);
return Prism.languages[lang];
} catch (e) {
// nothing to do
}
}
return langObject;
} | javascript | function loadPrismLang(lang) {
if (!lang) return undefined;
let langObject = Prism.languages[lang];
if (langObject === undefined) {
try {
require('prismjs/components/prism-' + lang);
return Prism.languages[lang];
} catch (e) {
// nothing to do
}
}
return langObject;
} | [
"function",
"loadPrismLang",
"(",
"lang",
")",
"{",
"if",
"(",
"!",
"lang",
")",
"return",
"undefined",
";",
"let",
"langObject",
"=",
"Prism",
".",
"languages",
"[",
"lang",
"]",
";",
"if",
"(",
"langObject",
"===",
"undefined",
")",
"{",
"try",
"{",
... | Loads the provided {@code lang} into prism.
@param {String} lang
Code of the language to load.
@return {Object} The Prism language object for the provided {@code lang} code. {@code undefined} if the language is not known to Prism. | [
"Loads",
"the",
"provided",
"{",
"@code",
"lang",
"}",
"into",
"prism",
"."
] | ca77e29ef818c08b0522b31e3925b073cf159b9c | https://github.com/ksky521/nodeppt/blob/ca77e29ef818c08b0522b31e3925b073cf159b9c/packages/nodeppt-parser/lib/markdown/prism.js#L43-L55 | train | Load Prism language | [
30522,
3853,
7170,
18098,
2964,
25023,
1006,
11374,
1007,
1063,
2065,
1006,
999,
11374,
1007,
2709,
6151,
28344,
1025,
2292,
11374,
16429,
20614,
1027,
26113,
1012,
4155,
1031,
11374,
1033,
1025,
2065,
1006,
11374,
16429,
20614,
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... |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | getIdToken | function getIdToken(forceRefresh) {
if (activeUser() == null) {
alertError('No user logged in.');
return;
}
if (activeUser().getIdToken) {
activeUser().getIdToken(forceRefresh).then(alertSuccess, function() {
log("No token");
});
} else {
activeUser().getToken(forceRefresh).then(alertSuccess, function() {
log("No token");
});
}
} | javascript | function getIdToken(forceRefresh) {
if (activeUser() == null) {
alertError('No user logged in.');
return;
}
if (activeUser().getIdToken) {
activeUser().getIdToken(forceRefresh).then(alertSuccess, function() {
log("No token");
});
} else {
activeUser().getToken(forceRefresh).then(alertSuccess, function() {
log("No token");
});
}
} | [
"function",
"getIdToken",
"(",
"forceRefresh",
")",
"{",
"if",
"(",
"activeUser",
"(",
")",
"==",
"null",
")",
"{",
"alertError",
"(",
"'No user logged in.'",
")",
";",
"return",
";",
"}",
"if",
"(",
"activeUser",
"(",
")",
".",
"getIdToken",
")",
"{",
... | Gets or refreshes the ID token.
@param {boolean} forceRefresh Whether to force the refresh of the token
or not. | [
"Gets",
"or",
"refreshes",
"the",
"ID",
"token",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L810-L824 | train | Get ID Token | [
30522,
3853,
2131,
3593,
18715,
2368,
1006,
2486,
2890,
19699,
9953,
1007,
1063,
2065,
1006,
3161,
20330,
1006,
1007,
1027,
1027,
19701,
1007,
1063,
9499,
2121,
29165,
1006,
1005,
2053,
5310,
26618,
1999,
1012,
1005,
1007,
1025,
2709,
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... |
firebase/firebaseui-web | javascript/widgets/handler/common.js | function() {
// Sets pending redirect status before redirect to
// accountchooser.com.
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
firebaseui.auth.acClient.trySelectAccount(
function(isAvailable) {
// Removes the pending redirect status if does not get
// redirected to accountchooser.com.
firebaseui.auth.storage.removePendingRedirectStatus(
app.getAppId());
// On empty response, post accountchooser.com result (either
// empty or unavailable).
var AccountChooserResult =
firebaseui.auth.widget.Config.AccountChooserResult;
firebaseui.auth.widget.handler.common.accountChooserResult(
app,
isAvailable ?
AccountChooserResult.EMPTY :
AccountChooserResult.UNAVAILABLE,
function() {
// If not available, go to the sign-in screen and no
// UI shown callback.
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.SIGN_IN,
app,
container,
opt_email);
});
},
firebaseui.auth.storage.getRememberedAccounts(app.getAppId()),
app.getConfig().getWidgetUrl(
firebaseui.auth.widget.Config.WidgetMode.SELECT));
} | javascript | function() {
// Sets pending redirect status before redirect to
// accountchooser.com.
firebaseui.auth.storage.setPendingRedirectStatus(app.getAppId());
firebaseui.auth.acClient.trySelectAccount(
function(isAvailable) {
// Removes the pending redirect status if does not get
// redirected to accountchooser.com.
firebaseui.auth.storage.removePendingRedirectStatus(
app.getAppId());
// On empty response, post accountchooser.com result (either
// empty or unavailable).
var AccountChooserResult =
firebaseui.auth.widget.Config.AccountChooserResult;
firebaseui.auth.widget.handler.common.accountChooserResult(
app,
isAvailable ?
AccountChooserResult.EMPTY :
AccountChooserResult.UNAVAILABLE,
function() {
// If not available, go to the sign-in screen and no
// UI shown callback.
firebaseui.auth.widget.handler.handle(
firebaseui.auth.widget.HandlerName.SIGN_IN,
app,
container,
opt_email);
});
},
firebaseui.auth.storage.getRememberedAccounts(app.getAppId()),
app.getConfig().getWidgetUrl(
firebaseui.auth.widget.Config.WidgetMode.SELECT));
} | [
"function",
"(",
")",
"{",
"// Sets pending redirect status before redirect to",
"// accountchooser.com.",
"firebaseui",
".",
"auth",
".",
"storage",
".",
"setPendingRedirectStatus",
"(",
"app",
".",
"getAppId",
"(",
")",
")",
";",
"firebaseui",
".",
"auth",
".",
"a... | Do not redirect to accountchooser.com directly, instead package routine in continue callback function to be passed to accountchooser.com invoked handler. | [
"Do",
"not",
"redirect",
"to",
"accountchooser",
".",
"com",
"directly",
"instead",
"package",
"routine",
"in",
"continue",
"callback",
"function",
"to",
"be",
"passed",
"to",
"accountchooser",
".",
"com",
"invoked",
"handler",
"."
] | c10aa51e38aeb38dc63baa22b48cd6690c2be087 | https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/common.js#L1649-L1681 | train | Select the account in the accountchooser. com account. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
4520,
14223,
2417,
7442,
6593,
3570,
2077,
2417,
7442,
6593,
2000,
1013,
1013,
4070,
9905,
9232,
2099,
1012,
4012,
1012,
2543,
15058,
10179,
1012,
8740,
2705,
1012,
5527,
1012,
2275,
11837,
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... | |
exceljs/exceljs | lib/utils/stream-buf.js | function(target, targetOffset, offset, length) {
// eslint-disable-next-line no-underscore-dangle
return this._data._buf.copy(target, targetOffset, offset, length);
} | javascript | function(target, targetOffset, offset, length) {
// eslint-disable-next-line no-underscore-dangle
return this._data._buf.copy(target, targetOffset, offset, length);
} | [
"function",
"(",
"target",
",",
"targetOffset",
",",
"offset",
",",
"length",
")",
"{",
"// eslint-disable-next-line no-underscore-dangle",
"return",
"this",
".",
"_data",
".",
"_buf",
".",
"copy",
"(",
"target",
",",
"targetOffset",
",",
"offset",
",",
"length"... | copy to target buffer | [
"copy",
"to",
"target",
"buffer"
] | c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2 | https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/utils/stream-buf.js#L39-L42 | train | Copy the data to the specified buffer. | [
30522,
3853,
1006,
4539,
1010,
4539,
27475,
3388,
1010,
16396,
1010,
3091,
1007,
1063,
1013,
1013,
9686,
4115,
2102,
1011,
4487,
19150,
1011,
2279,
1011,
2240,
2053,
1011,
2104,
9363,
2890,
1011,
4907,
9354,
2709,
2023,
1012,
1035,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js | _adaptDeepChildObservation | function _adaptDeepChildObservation(caller, oControl, oAggregation, bObserve) {
var aChildren = oAggregation.get(oControl) || [], oChild, bRecord;
for (var i = 0; i < aChildren.length; i++) {
oChild = aChildren[i];
if (!(oChild instanceof ManagedObject)) {
continue;
}
bRecord = true;
if (bObserve) {
caller._oObserver.observe(oChild, {
properties: true,
aggregations: true
});
} else {
caller._oObserver.unobserve(oChild, {
properties: true,
aggregations: true
});
}
var mAggregations = oChild.getMetadata().getAllAggregations();
for (var sKey in mAggregations) {
_adaptDeepChildObservation(caller, oChild, mAggregations[sKey], bObserve);
}
}
if (bRecord) {
var sKey = oControl.getId() + "/@" + oAggregation.name;
if (bObserve) {
if (!caller._mObservedCount.aggregations[sKey]) {
caller._mObservedCount.aggregations[sKey] = 0;
}
caller._mObservedCount.aggregations[sKey]++;
} else {
delete caller._mObservedCount.aggregations[sKey];
}
}
} | javascript | function _adaptDeepChildObservation(caller, oControl, oAggregation, bObserve) {
var aChildren = oAggregation.get(oControl) || [], oChild, bRecord;
for (var i = 0; i < aChildren.length; i++) {
oChild = aChildren[i];
if (!(oChild instanceof ManagedObject)) {
continue;
}
bRecord = true;
if (bObserve) {
caller._oObserver.observe(oChild, {
properties: true,
aggregations: true
});
} else {
caller._oObserver.unobserve(oChild, {
properties: true,
aggregations: true
});
}
var mAggregations = oChild.getMetadata().getAllAggregations();
for (var sKey in mAggregations) {
_adaptDeepChildObservation(caller, oChild, mAggregations[sKey], bObserve);
}
}
if (bRecord) {
var sKey = oControl.getId() + "/@" + oAggregation.name;
if (bObserve) {
if (!caller._mObservedCount.aggregations[sKey]) {
caller._mObservedCount.aggregations[sKey] = 0;
}
caller._mObservedCount.aggregations[sKey]++;
} else {
delete caller._mObservedCount.aggregations[sKey];
}
}
} | [
"function",
"_adaptDeepChildObservation",
"(",
"caller",
",",
"oControl",
",",
"oAggregation",
",",
"bObserve",
")",
"{",
"var",
"aChildren",
"=",
"oAggregation",
".",
"get",
"(",
"oControl",
")",
"||",
"[",
"]",
",",
"oChild",
",",
"bRecord",
";",
"for",
... | Adapt the observation of child controls in order to be able to react when e.g. the value
of a select inside a list changed. Currently the MOM is not updated then
@param {object} the caller, here the managed object model
@param {control} the control which shall be (un)observed
@param {object} the observed aggregation
@param {boolean} <code>true</code> for observing and <code>false</code> for unobserving
@private | [
"Adapt",
"the",
"observation",
"of",
"child",
"controls",
"in",
"order",
"to",
"be",
"able",
"to",
"react",
"when",
"e",
".",
"g",
".",
"the",
"value",
"of",
"a",
"select",
"inside",
"a",
"list",
"changed",
".",
"Currently",
"the",
"MOM",
"is",
"not",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/base/ManagedObjectModel.js#L20-L61 | train | Adaptes the observers of a deep child aggregation. | [
30522,
3853,
1035,
15581,
26095,
15042,
19466,
3527,
5910,
2121,
21596,
1006,
20587,
1010,
1051,
8663,
13181,
2140,
1010,
1051,
8490,
17603,
12540,
1010,
3960,
8043,
3726,
1007,
1063,
13075,
9353,
19466,
16200,
2078,
1027,
1051,
8490,
17603,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DebugCommands/main.js | _getPrefType | function _getPrefType(prefItem) {
var finalPrefType = "undefined";
if (prefItem) {
// check the type parameter.
var _prefType = prefItem.type;
if (_prefType !== undefined) {
finalPrefType = prefItem.type.toLowerCase();
// make sure the initial property's
// object type matches to that of 'type' property.
if (prefItem.initial !== undefined) {
if (Array.isArray(prefItem.initial)) {
_prefType = "array";
} else {
var _initialType = typeof (prefItem.initial);
_initialType = _initialType.toLowerCase();
if (_prefType !== _initialType) {
_prefType = _initialType;
}
}
}
}
if (_prefType) {
// preference object's type
// is defined. Check if that is valid or not.
finalPrefType = _prefType;
if (!_isSupportedPrefType(finalPrefType)) {
finalPrefType = "undefined";
}
} else if (Array.isArray(prefItem)) {
// Check if the object itself
// is an array, in which case
// we log the default.
finalPrefType = "array";
} else if (prefItem.initial !== undefined ||
prefItem.keys !== undefined) {
// OK looks like this preference has
// no explicit type defined. instead
// it needs to be deduced from initial/keys
// variable.
var _prefVar;
if (prefItem.initial !== undefined) {
_prefVar = prefItem.initial;
} else {
_prefVar = prefItem.keys;
}
if (Array.isArray(_prefVar)) {
// In cases of array the
// typeof is returning a function.
finalPrefType = "array";
}
} else {
finalPrefType = typeof (prefItem);
}
}
// Now make sure we recognize this format.
if (!_isSupportedPrefType(finalPrefType)) {
finalPrefType = "undefined";
}
return finalPrefType;
} | javascript | function _getPrefType(prefItem) {
var finalPrefType = "undefined";
if (prefItem) {
// check the type parameter.
var _prefType = prefItem.type;
if (_prefType !== undefined) {
finalPrefType = prefItem.type.toLowerCase();
// make sure the initial property's
// object type matches to that of 'type' property.
if (prefItem.initial !== undefined) {
if (Array.isArray(prefItem.initial)) {
_prefType = "array";
} else {
var _initialType = typeof (prefItem.initial);
_initialType = _initialType.toLowerCase();
if (_prefType !== _initialType) {
_prefType = _initialType;
}
}
}
}
if (_prefType) {
// preference object's type
// is defined. Check if that is valid or not.
finalPrefType = _prefType;
if (!_isSupportedPrefType(finalPrefType)) {
finalPrefType = "undefined";
}
} else if (Array.isArray(prefItem)) {
// Check if the object itself
// is an array, in which case
// we log the default.
finalPrefType = "array";
} else if (prefItem.initial !== undefined ||
prefItem.keys !== undefined) {
// OK looks like this preference has
// no explicit type defined. instead
// it needs to be deduced from initial/keys
// variable.
var _prefVar;
if (prefItem.initial !== undefined) {
_prefVar = prefItem.initial;
} else {
_prefVar = prefItem.keys;
}
if (Array.isArray(_prefVar)) {
// In cases of array the
// typeof is returning a function.
finalPrefType = "array";
}
} else {
finalPrefType = typeof (prefItem);
}
}
// Now make sure we recognize this format.
if (!_isSupportedPrefType(finalPrefType)) {
finalPrefType = "undefined";
}
return finalPrefType;
} | [
"function",
"_getPrefType",
"(",
"prefItem",
")",
"{",
"var",
"finalPrefType",
"=",
"\"undefined\"",
";",
"if",
"(",
"prefItem",
")",
"{",
"// check the type parameter.",
"var",
"_prefType",
"=",
"prefItem",
".",
"type",
";",
"if",
"(",
"_prefType",
"!==",
"un... | /*
This method tries to deduce the preference type
based on various parameters like objects initial
value, object type, object's type property. | [
"/",
"*",
"This",
"method",
"tries",
"to",
"deduce",
"the",
"preference",
"type",
"based",
"on",
"various",
"parameters",
"like",
"objects",
"initial",
"value",
"object",
"type",
"object",
"s",
"type",
"property",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/DebugCommands/main.js#L357-L425 | train | Get the type of the preference object. | [
30522,
3853,
1035,
2131,
28139,
6199,
18863,
1006,
3653,
8873,
18532,
1007,
1063,
13075,
2345,
28139,
6199,
18863,
1027,
1000,
6151,
28344,
1000,
1025,
2065,
1006,
3653,
8873,
18532,
1007,
1063,
1013,
1013,
4638,
1996,
2828,
16381,
1012,
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... |
adobe/brackets | src/extensions/default/AutoUpdate/main.js | handleSafeToDownload | function handleSafeToDownload() {
var downloadFn = function () {
if (isFirstIterationDownload()) {
// For the first iteration of download, show download
//status info in Status bar, and pass download to node
UpdateStatus.showUpdateStatus("initial-download");
postMessageToNode(MessageIds.DOWNLOAD_INSTALLER, true);
} else {
/* For the retry iterations of download, modify the
download status info in Status bar, and pass download to node */
var attempt = (MAX_DOWNLOAD_ATTEMPTS - downloadAttemptsRemaining);
if (attempt > 1) {
var info = attempt.toString() + "/5";
var status = {
target: "retry-download",
spans: [{
id: "attempt",
val: info
}]
};
UpdateStatus.modifyUpdateStatus(status);
} else {
UpdateStatus.showUpdateStatus("retry-download");
}
postMessageToNode(MessageIds.DOWNLOAD_INSTALLER, false);
}
--downloadAttemptsRemaining;
};
if(!isAutoUpdateInitiated) {
isAutoUpdateInitiated = true;
updateJsonHandler.refresh()
.done(function() {
setUpdateStateInJSON('downloadCompleted', false)
.done(downloadFn);
});
} else {
setUpdateStateInJSON('downloadCompleted', false)
.done(downloadFn);
}
} | javascript | function handleSafeToDownload() {
var downloadFn = function () {
if (isFirstIterationDownload()) {
// For the first iteration of download, show download
//status info in Status bar, and pass download to node
UpdateStatus.showUpdateStatus("initial-download");
postMessageToNode(MessageIds.DOWNLOAD_INSTALLER, true);
} else {
/* For the retry iterations of download, modify the
download status info in Status bar, and pass download to node */
var attempt = (MAX_DOWNLOAD_ATTEMPTS - downloadAttemptsRemaining);
if (attempt > 1) {
var info = attempt.toString() + "/5";
var status = {
target: "retry-download",
spans: [{
id: "attempt",
val: info
}]
};
UpdateStatus.modifyUpdateStatus(status);
} else {
UpdateStatus.showUpdateStatus("retry-download");
}
postMessageToNode(MessageIds.DOWNLOAD_INSTALLER, false);
}
--downloadAttemptsRemaining;
};
if(!isAutoUpdateInitiated) {
isAutoUpdateInitiated = true;
updateJsonHandler.refresh()
.done(function() {
setUpdateStateInJSON('downloadCompleted', false)
.done(downloadFn);
});
} else {
setUpdateStateInJSON('downloadCompleted', false)
.done(downloadFn);
}
} | [
"function",
"handleSafeToDownload",
"(",
")",
"{",
"var",
"downloadFn",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"isFirstIterationDownload",
"(",
")",
")",
"{",
"// For the first iteration of download, show download",
"//status info in Status bar, and pass download to node"... | Handles a safe download of the latest installer,
safety is ensured by cleaning up any pre-existing installers
from update directory before beginning a fresh download | [
"Handles",
"a",
"safe",
"download",
"of",
"the",
"latest",
"installer",
"safety",
"is",
"ensured",
"by",
"cleaning",
"up",
"any",
"pre",
"-",
"existing",
"installers",
"from",
"update",
"directory",
"before",
"beginning",
"a",
"fresh",
"download"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L651-L692 | train | Handle safe to download | [
30522,
3853,
16024,
10354,
18903,
7698,
11066,
1006,
1007,
1063,
13075,
8816,
2546,
2078,
1027,
3853,
1006,
1007,
1063,
2065,
1006,
2003,
8873,
12096,
21646,
3370,
7698,
11066,
1006,
1007,
1007,
1063,
1013,
1013,
2005,
1996,
2034,
27758,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ecomfe/zrender | src/dom/HandlerProxy.js | function (event) {
event = normalizeEvent(this.dom, event);
var element = event.toElement || event.relatedTarget;
if (element !== this.dom) {
while (element && element.nodeType !== 9) {
// 忽略包含在root中的dom引起的mouseOut
if (element === this.dom) {
return;
}
element = element.parentNode;
}
}
this.trigger('mouseout', event);
} | javascript | function (event) {
event = normalizeEvent(this.dom, event);
var element = event.toElement || event.relatedTarget;
if (element !== this.dom) {
while (element && element.nodeType !== 9) {
// 忽略包含在root中的dom引起的mouseOut
if (element === this.dom) {
return;
}
element = element.parentNode;
}
}
this.trigger('mouseout', event);
} | [
"function",
"(",
"event",
")",
"{",
"event",
"=",
"normalizeEvent",
"(",
"this",
".",
"dom",
",",
"event",
")",
";",
"var",
"element",
"=",
"event",
".",
"toElement",
"||",
"event",
".",
"relatedTarget",
";",
"if",
"(",
"element",
"!==",
"this",
".",
... | Mouse out handler
@inner
@param {Event} event | [
"Mouse",
"out",
"handler"
] | 30321b57cba3149c30eacb0c1e18276f0f001b9f | https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/dom/HandlerProxy.js#L81-L97 | train | mouseout event handler | [
30522,
3853,
1006,
2724,
1007,
1063,
2724,
1027,
3671,
4697,
18697,
3372,
1006,
2023,
1012,
14383,
1010,
2724,
1007,
1025,
13075,
5783,
1027,
2724,
1012,
11756,
16930,
4765,
1064,
30524,
7559,
18150,
1025,
2065,
1006,
5783,
999,
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... | |
adobe/brackets | src/LiveDevelopment/transports/node/WebSocketTransportDomain.js | init | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("webSocketTransport")) {
domainManager.registerDomain("webSocketTransport", {major: 0, minor: 1});
}
domainManager.registerEvent(
"webSocketTransport",
"message",
[
{
name: "msg",
type: "string",
description: "JSON message from client page"
}
]
);
domainManager.registerCommand(
"webSocketTransport", // domain name
"start", // command name
_cmdStart, // command handler function
false, // this command is synchronous in Node
"Creates the WS server",
[
{
name: "port",
type: "number",
description: "Port on which server needs to listen"
}
],
[]
);
domainManager.registerCommand(
"webSocketTransport", // domain name
"close", // command name
_cmdClose, // command handler function
false, // this command is synchronous in Node
"Kills the websocket server",
[]
);
} | javascript | function init(domainManager) {
_domainManager = domainManager;
if (!domainManager.hasDomain("webSocketTransport")) {
domainManager.registerDomain("webSocketTransport", {major: 0, minor: 1});
}
domainManager.registerEvent(
"webSocketTransport",
"message",
[
{
name: "msg",
type: "string",
description: "JSON message from client page"
}
]
);
domainManager.registerCommand(
"webSocketTransport", // domain name
"start", // command name
_cmdStart, // command handler function
false, // this command is synchronous in Node
"Creates the WS server",
[
{
name: "port",
type: "number",
description: "Port on which server needs to listen"
}
],
[]
);
domainManager.registerCommand(
"webSocketTransport", // domain name
"close", // command name
_cmdClose, // command handler function
false, // this command is synchronous in Node
"Kills the websocket server",
[]
);
} | [
"function",
"init",
"(",
"domainManager",
")",
"{",
"_domainManager",
"=",
"domainManager",
";",
"if",
"(",
"!",
"domainManager",
".",
"hasDomain",
"(",
"\"webSocketTransport\"",
")",
")",
"{",
"domainManager",
".",
"registerDomain",
"(",
"\"webSocketTransport\"",
... | Initializes the domain and registers commands.
@param {DomainManager} domainManager The DomainManager for the server | [
"Initializes",
"the",
"domain",
"and",
"registers",
"commands",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/transports/node/WebSocketTransportDomain.js#L108-L150 | train | Initializes the domain manager | [
30522,
3853,
1999,
4183,
1006,
5884,
24805,
4590,
1007,
1063,
1035,
5884,
24805,
4590,
1027,
5884,
24805,
4590,
1025,
2065,
1006,
999,
5884,
24805,
4590,
1012,
2038,
9527,
8113,
1006,
1000,
4773,
6499,
19869,
4779,
5521,
20205,
1000,
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... |
facebook/relay | packages/babel-plugin-relay/getValidGraphQLTag.js | getValidGraphQLTag | function getValidGraphQLTag(path: any): ?DocumentNode {
const tag = path.get('tag');
if (!tag.isIdentifier({name: 'graphql'})) {
return null;
}
const quasis = path.node.quasi.quasis;
if (quasis.length !== 1) {
throw new Error(
'BabelPluginRelay: Substitutions are not allowed in graphql fragments. ' +
'Included fragments should be referenced as `...MyModule_propName`.',
);
}
const text = quasis[0].value.raw;
const ast = GraphQL.parse(text);
if (ast.definitions.length === 0) {
throw new Error('BabelPluginRelay: Unexpected empty graphql tag.');
}
return ast;
} | javascript | function getValidGraphQLTag(path: any): ?DocumentNode {
const tag = path.get('tag');
if (!tag.isIdentifier({name: 'graphql'})) {
return null;
}
const quasis = path.node.quasi.quasis;
if (quasis.length !== 1) {
throw new Error(
'BabelPluginRelay: Substitutions are not allowed in graphql fragments. ' +
'Included fragments should be referenced as `...MyModule_propName`.',
);
}
const text = quasis[0].value.raw;
const ast = GraphQL.parse(text);
if (ast.definitions.length === 0) {
throw new Error('BabelPluginRelay: Unexpected empty graphql tag.');
}
return ast;
} | [
"function",
"getValidGraphQLTag",
"(",
"path",
":",
"any",
")",
":",
"?",
"DocumentNode",
"{",
"const",
"tag",
"=",
"path",
".",
"get",
"(",
"'tag'",
")",
";",
"if",
"(",
"!",
"tag",
".",
"isIdentifier",
"(",
"{",
"name",
":",
"'graphql'",
"}",
")",
... | Given a babel AST path to a tagged template literal, return an AST if it is
a graphql literal being used in a valid way.
If it is some other type of template literal then return nothing. | [
"Given",
"a",
"babel",
"AST",
"path",
"to",
"a",
"tagged",
"template",
"literal",
"return",
"an",
"AST",
"if",
"it",
"is",
"a",
"graphql",
"literal",
"being",
"used",
"in",
"a",
"valid",
"way",
".",
"If",
"it",
"is",
"some",
"other",
"type",
"of",
"t... | 7fb9be5182b9650637d7b92ead9a42713ac30aa4 | https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/babel-plugin-relay/getValidGraphQLTag.js#L22-L47 | train | Returns a valid graphql tag | [
30522,
3853,
2131,
10175,
3593,
14413,
4160,
24458,
2290,
1006,
4130,
1024,
2151,
1007,
1024,
1029,
6254,
3630,
3207,
1063,
9530,
3367,
6415,
1027,
4130,
1012,
2131,
1006,
1005,
6415,
1005,
1007,
1025,
2065,
1006,
999,
6415,
1012,
2003,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(graph)
{
var wnd = window.open();
var bounds = graph.getGraphBounds();
mxUtils.show(graph, wnd.document);
var print = function()
{
wnd.focus();
wnd.print();
wnd.close();
};
// Workaround for Google Chrome which needs a bit of a
// delay in order to render the SVG contents
if (mxClient.IS_GC)
{
wnd.setTimeout(print, 500);
}
else
{
print();
}
} | javascript | function(graph)
{
var wnd = window.open();
var bounds = graph.getGraphBounds();
mxUtils.show(graph, wnd.document);
var print = function()
{
wnd.focus();
wnd.print();
wnd.close();
};
// Workaround for Google Chrome which needs a bit of a
// delay in order to render the SVG contents
if (mxClient.IS_GC)
{
wnd.setTimeout(print, 500);
}
else
{
print();
}
} | [
"function",
"(",
"graph",
")",
"{",
"var",
"wnd",
"=",
"window",
".",
"open",
"(",
")",
";",
"var",
"bounds",
"=",
"graph",
".",
"getGraphBounds",
"(",
")",
";",
"mxUtils",
".",
"show",
"(",
"graph",
",",
"wnd",
".",
"document",
")",
";",
"var",
... | Function: printScreen
Prints the specified graph using a new window and the built-in print
dialog.
This function should be called from within the document with the graph.
Parameters:
graph - <mxGraph> to be printed. | [
"Function",
":",
"printScreen"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L6195-L6218 | train | This function is called by the mxUtils constructor to render the SVG contents of the graph | [
30522,
3853,
1006,
10629,
1007,
1063,
13075,
1059,
4859,
1027,
3332,
1012,
2330,
1006,
1007,
1025,
13075,
19202,
1027,
10629,
1012,
2131,
14413,
15494,
2015,
1006,
1007,
1025,
25630,
21823,
4877,
1012,
2265,
1006,
10629,
1010,
1059,
4859,
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... | |
adobe/brackets | src/extensions/default/InlineColorEditor/ColorEditor.js | checkSetFormat | function checkSetFormat(color, convertToStr) {
if ((/^0x/).test(color)) {
return _0xColorToHex(color, convertToStr);
}
if (convertToStr) {
return tinycolor(color).toString();
}
return tinycolor(color);
} | javascript | function checkSetFormat(color, convertToStr) {
if ((/^0x/).test(color)) {
return _0xColorToHex(color, convertToStr);
}
if (convertToStr) {
return tinycolor(color).toString();
}
return tinycolor(color);
} | [
"function",
"checkSetFormat",
"(",
"color",
",",
"convertToStr",
")",
"{",
"if",
"(",
"(",
"/",
"^0x",
"/",
")",
".",
"test",
"(",
"color",
")",
")",
"{",
"return",
"_0xColorToHex",
"(",
"color",
",",
"convertToStr",
")",
";",
"}",
"if",
"(",
"conver... | Ensures that a string is in Tinycolor supported format
@param {string} color - Color to check the format for
@param {boolean} convertToString - true if color should
be returned as string
@returns {tinycolor|string} - Color as a Tinycolor object
or a hex string | [
"Ensures",
"that",
"a",
"string",
"is",
"in",
"Tinycolor",
"supported",
"format"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineColorEditor/ColorEditor.js#L89-L97 | train | Check if the color is a valid set format | [
30522,
3853,
14148,
3388,
14192,
4017,
1006,
3609,
1010,
10463,
13122,
16344,
1007,
1063,
2065,
1006,
1006,
1013,
1034,
1014,
2595,
1013,
1007,
1012,
3231,
1006,
3609,
1007,
1007,
1063,
2709,
1035,
1014,
2595,
18717,
3406,
5369,
2595,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/search/FileFilters.js | _getFilterIndex | function _getFilterIndex(filterSets, filter) {
var index = -1;
if (!filter || !filterSets.length) {
return index;
}
return _.findIndex(filterSets, _.partial(_.isEqual, filter));
} | javascript | function _getFilterIndex(filterSets, filter) {
var index = -1;
if (!filter || !filterSets.length) {
return index;
}
return _.findIndex(filterSets, _.partial(_.isEqual, filter));
} | [
"function",
"_getFilterIndex",
"(",
"filterSets",
",",
"filter",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"!",
"filter",
"||",
"!",
"filterSets",
".",
"length",
")",
"{",
"return",
"index",
";",
"}",
"return",
"_",
".",
"findIndex",
"... | Find the index of a filter set in the list of saved filter sets.
@param {Array.<{name: string, patterns: Array.<string>}>} filterSets
@return {{name: string, patterns: Array.<string>}} filter | [
"Find",
"the",
"index",
"of",
"a",
"filter",
"set",
"in",
"the",
"list",
"of",
"saved",
"filter",
"sets",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L115-L123 | train | Get the index of the filter set | [
30522,
3853,
1035,
2131,
8873,
21928,
22254,
10288,
1006,
17736,
8454,
1010,
11307,
1007,
1063,
13075,
5950,
1027,
1011,
1015,
1025,
2065,
1006,
999,
11307,
1064,
1064,
999,
17736,
8454,
1012,
3091,
1007,
1063,
2709,
5950,
1025,
1065,
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... |
tensorflow/tfjs-models | posenet/demos/demo_util.js | drawPoints | function drawPoints(ctx, points, radius, color) {
const data = points.buffer().values;
for (let i = 0; i < data.length; i += 2) {
const pointY = data[i];
const pointX = data[i + 1];
if (pointX !== 0 && pointY !== 0) {
ctx.beginPath();
ctx.arc(pointX, pointY, radius, 0, 2 * Math.PI);
ctx.fillStyle = color;
ctx.fill();
}
}
} | javascript | function drawPoints(ctx, points, radius, color) {
const data = points.buffer().values;
for (let i = 0; i < data.length; i += 2) {
const pointY = data[i];
const pointX = data[i + 1];
if (pointX !== 0 && pointY !== 0) {
ctx.beginPath();
ctx.arc(pointX, pointY, radius, 0, 2 * Math.PI);
ctx.fillStyle = color;
ctx.fill();
}
}
} | [
"function",
"drawPoints",
"(",
"ctx",
",",
"points",
",",
"radius",
",",
"color",
")",
"{",
"const",
"data",
"=",
"points",
".",
"buffer",
"(",
")",
".",
"values",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
... | Used by the drawHeatMapValues method to draw heatmap points on to
the canvas | [
"Used",
"by",
"the",
"drawHeatMapValues",
"method",
"to",
"draw",
"heatmap",
"points",
"on",
"to",
"the",
"canvas"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/demo_util.js#L143-L157 | train | Draw a polygon of points | [
30522,
3853,
4009,
26521,
1006,
14931,
2595,
1010,
2685,
1010,
12177,
1010,
3609,
1007,
1063,
9530,
3367,
2951,
1027,
2685,
1012,
17698,
1006,
1007,
1012,
5300,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
2951,
1012,
3091,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js | function(wheelDelta, timeStamp, pageX, pageY) {
var self = this;
var change = wheelDelta > 0 ? 0.97 : 1.03;
return self.zoomTo(self.__zoomLevel * change, false, pageX - self.__clientLeft, pageY - self.__clientTop);
} | javascript | function(wheelDelta, timeStamp, pageX, pageY) {
var self = this;
var change = wheelDelta > 0 ? 0.97 : 1.03;
return self.zoomTo(self.__zoomLevel * change, false, pageX - self.__clientLeft, pageY - self.__clientTop);
} | [
"function",
"(",
"wheelDelta",
",",
"timeStamp",
",",
"pageX",
",",
"pageY",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"change",
"=",
"wheelDelta",
">",
"0",
"?",
"0.97",
":",
"1.03",
";",
"return",
"self",
".",
"zoomTo",
"(",
"self",
".",
... | /*
---------------------------------------------------------------------------
EVENT CALLBACKS
---------------------------------------------------------------------------
Mouse wheel handler for zooming support | [
"/",
"*",
"---------------------------------------------------------------------------",
"EVENT",
"CALLBACKS",
"---------------------------------------------------------------------------",
"Mouse",
"wheel",
"handler",
"for",
"zooming",
"support"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/zyngascroll.js#L894-L901 | train | zoom to the given location | [
30522,
3853,
1006,
5217,
9247,
2696,
1010,
2335,
15464,
2361,
1010,
3931,
2595,
1010,
3931,
2100,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
2689,
1027,
5217,
9247,
2696,
1028,
1014,
1029,
1014,
1012,
5989,
1024,
1015,
1012,
6021,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/http.js | headersToString | function headersToString(headers) {
let ret = [];
headers.forEach(function(value, name) {
ret.push(`${name.toLowerCase()}: ${value}`);
});
return ret.join('\n');
} | javascript | function headersToString(headers) {
let ret = [];
headers.forEach(function(value, name) {
ret.push(`${name.toLowerCase()}: ${value}`);
});
return ret.join('\n');
} | [
"function",
"headersToString",
"(",
"headers",
")",
"{",
"let",
"ret",
"=",
"[",
"]",
";",
"headers",
".",
"forEach",
"(",
"function",
"(",
"value",
",",
"name",
")",
"{",
"ret",
".",
"push",
"(",
"`",
"${",
"name",
".",
"toLowerCase",
"(",
")",
"}... | Converts a headers map to a HTTP header block string.
@param {!Map<string, string>} headers The map to convert.
@return {string} The headers as a string. | [
"Converts",
"a",
"headers",
"map",
"to",
"a",
"HTTP",
"header",
"block",
"string",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/http.js#L70-L76 | train | Converts an array of headers to a string | [
30522,
3853,
20346,
16033,
3367,
4892,
1006,
20346,
2015,
1007,
1063,
2292,
2128,
2102,
1027,
1031,
1033,
1025,
20346,
2015,
1012,
18921,
6776,
1006,
3853,
1006,
3643,
1010,
2171,
1007,
1063,
2128,
2102,
1012,
5245,
1006,
1036,
1002,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/gesture/gesture.js | jQueryDispatchEvent | function jQueryDispatchEvent(srcEvent, eventType, eventPointer) {
eventPointer = eventPointer || pointer;
var eventObj = new angular.element.Event(eventType);
eventObj.$material = true;
eventObj.pointer = eventPointer;
eventObj.srcEvent = srcEvent;
angular.extend(eventObj, {
clientX: eventPointer.x,
clientY: eventPointer.y,
screenX: eventPointer.x,
screenY: eventPointer.y,
pageX: eventPointer.x,
pageY: eventPointer.y,
ctrlKey: srcEvent.ctrlKey,
altKey: srcEvent.altKey,
shiftKey: srcEvent.shiftKey,
metaKey: srcEvent.metaKey
});
angular.element(eventPointer.target).trigger(eventObj);
} | javascript | function jQueryDispatchEvent(srcEvent, eventType, eventPointer) {
eventPointer = eventPointer || pointer;
var eventObj = new angular.element.Event(eventType);
eventObj.$material = true;
eventObj.pointer = eventPointer;
eventObj.srcEvent = srcEvent;
angular.extend(eventObj, {
clientX: eventPointer.x,
clientY: eventPointer.y,
screenX: eventPointer.x,
screenY: eventPointer.y,
pageX: eventPointer.x,
pageY: eventPointer.y,
ctrlKey: srcEvent.ctrlKey,
altKey: srcEvent.altKey,
shiftKey: srcEvent.shiftKey,
metaKey: srcEvent.metaKey
});
angular.element(eventPointer.target).trigger(eventObj);
} | [
"function",
"jQueryDispatchEvent",
"(",
"srcEvent",
",",
"eventType",
",",
"eventPointer",
")",
"{",
"eventPointer",
"=",
"eventPointer",
"||",
"pointer",
";",
"var",
"eventObj",
"=",
"new",
"angular",
".",
"element",
".",
"Event",
"(",
"eventType",
")",
";",
... | /*
Dispatch an event with jQuery
TODO: Make sure this sends bubbling events
@param srcEvent the original DOM touch event that started this.
@param eventType the name of the custom event to send (eg 'click' or '$md.drag')
@param eventPointer the pointer object that matches this event. | [
"/",
"*",
"Dispatch",
"an",
"event",
"with",
"jQuery",
"TODO",
":",
"Make",
"sure",
"this",
"sends",
"bubbling",
"events"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L488-L509 | train | jQueryDispatchEvent - Dispatches a jQuery event to the element | [
30522,
3853,
1046,
4226,
2854,
10521,
4502,
10649,
18697,
3372,
1006,
5034,
3401,
15338,
1010,
2724,
13874,
1010,
2724,
8400,
2121,
1007,
1063,
2724,
8400,
2121,
1027,
2724,
8400,
2121,
1064,
1064,
20884,
1025,
13075,
2724,
16429,
3501,
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... |
immerjs/immer | src/proxy.js | getOwnPropertyDescriptor | function getOwnPropertyDescriptor(state, prop) {
const owner = source(state)
const desc = Reflect.getOwnPropertyDescriptor(owner, prop)
if (desc) {
desc.writable = true
desc.configurable = !Array.isArray(owner) || prop !== "length"
}
return desc
} | javascript | function getOwnPropertyDescriptor(state, prop) {
const owner = source(state)
const desc = Reflect.getOwnPropertyDescriptor(owner, prop)
if (desc) {
desc.writable = true
desc.configurable = !Array.isArray(owner) || prop !== "length"
}
return desc
} | [
"function",
"getOwnPropertyDescriptor",
"(",
"state",
",",
"prop",
")",
"{",
"const",
"owner",
"=",
"source",
"(",
"state",
")",
"const",
"desc",
"=",
"Reflect",
".",
"getOwnPropertyDescriptor",
"(",
"owner",
",",
"prop",
")",
"if",
"(",
"desc",
")",
"{",
... | Note: We never coerce `desc.value` into an Immer draft, because we can't make the same guarantee in ES5 mode. | [
"Note",
":",
"We",
"never",
"coerce",
"desc",
".",
"value",
"into",
"an",
"Immer",
"draft",
"because",
"we",
"can",
"t",
"make",
"the",
"same",
"guarantee",
"in",
"ES5",
"mode",
"."
] | 4443cace6c23d14536955ce5b2aec92c8c76cacc | https://github.com/immerjs/immer/blob/4443cace6c23d14536955ce5b2aec92c8c76cacc/src/proxy.js#L166-L174 | train | Get the descriptor for a property | [
30522,
3853,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
2110,
1010,
17678,
1007,
1063,
9530,
3367,
3954,
1027,
3120,
1006,
2110,
1007,
9530,
3367,
4078,
2278,
1027,
8339,
1012,
2131,
12384,
21572,
4842,
3723,
6155,
23235,
2953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js | getReportHtml | function getReportHtml(oData) {
return getResources().then(function () {
var styles = [],
scripts = [],
html = '',
i,
template = {},
reportContext = {};
for (i = 0; i < arguments.length; i++) {
switch (arguments[i].type) {
case 'template': html = arguments[i].content; break;
case 'css': styles.push(arguments[i].content); break;
case 'js': scripts.push(arguments[i].content); break;
}
}
template = Handlebars.compile(html);
reportContext = {
technicalInfo: oData.technical,
issues: oData.issues,
appInfo: oData.application,
rules: oData.rules,
rulePreset: oData.rulePreset,
metadata: {
title: oData.name + ' Analysis Results',
title_TechnicalInfo: 'Technical Information',
title_Issues: 'Issues',
title_AppInfo: 'Application Information',
title_SelectedRules: 'Available and (<span class="checked"></span>) Selected Rules',
timestamp: new Date(),
scope: oData.scope,
analysisDuration: oData.analysisDuration,
analysisDurationTitle: oData.analysisDurationTitle,
styles: styles,
scripts: scripts
}
};
return template(reportContext);
});
} | javascript | function getReportHtml(oData) {
return getResources().then(function () {
var styles = [],
scripts = [],
html = '',
i,
template = {},
reportContext = {};
for (i = 0; i < arguments.length; i++) {
switch (arguments[i].type) {
case 'template': html = arguments[i].content; break;
case 'css': styles.push(arguments[i].content); break;
case 'js': scripts.push(arguments[i].content); break;
}
}
template = Handlebars.compile(html);
reportContext = {
technicalInfo: oData.technical,
issues: oData.issues,
appInfo: oData.application,
rules: oData.rules,
rulePreset: oData.rulePreset,
metadata: {
title: oData.name + ' Analysis Results',
title_TechnicalInfo: 'Technical Information',
title_Issues: 'Issues',
title_AppInfo: 'Application Information',
title_SelectedRules: 'Available and (<span class="checked"></span>) Selected Rules',
timestamp: new Date(),
scope: oData.scope,
analysisDuration: oData.analysisDuration,
analysisDurationTitle: oData.analysisDurationTitle,
styles: styles,
scripts: scripts
}
};
return template(reportContext);
});
} | [
"function",
"getReportHtml",
"(",
"oData",
")",
"{",
"return",
"getResources",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"styles",
"=",
"[",
"]",
",",
"scripts",
"=",
"[",
"]",
",",
"html",
"=",
"''",
",",
"i",
",",
"template",
... | Public functions
Creates an html string containing the whole report.
@param {Object} oData - the data required to create a report
@returns {String} | [
"Public",
"functions",
"Creates",
"an",
"html",
"string",
"containing",
"the",
"whole",
"report",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/ReportProvider.js#L352-L394 | train | Get HTML for the report | [
30522,
3853,
2131,
2890,
6442,
11039,
19968,
1006,
1051,
2850,
2696,
1007,
1063,
2709,
2131,
6072,
8162,
9623,
1006,
1007,
1012,
2059,
1006,
3853,
1006,
1007,
1063,
13075,
6782,
1027,
1031,
1033,
1010,
14546,
1027,
1031,
1033,
1010,
16129,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function(sBaseId, sScenario, sProjectId) {
var sRootNamespace = "apps/";
var oError = new Error("Error in sap.ui.fl.Utils#buildLrepRootNamespace: ");
if (!sBaseId) {
oError.message += "for every scenario you need a base ID";
throw oError;
}
switch (sScenario) {
case sap.ui.fl.Scenario.VersionedAppVariant:
if (!sProjectId) {
oError.message += "in a versioned app variant scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/appVariants/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.AppVariant:
if (!sProjectId) {
oError.message += "in an app variant scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/appVariants/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.AdaptationProject:
if (!sProjectId) {
oError.message += "in a adaptation project scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/adapt/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.FioriElementsFromScratch:
case sap.ui.fl.Scenario.UiAdaptation:
default:
sRootNamespace += sBaseId + "/";
}
return sRootNamespace;
} | javascript | function(sBaseId, sScenario, sProjectId) {
var sRootNamespace = "apps/";
var oError = new Error("Error in sap.ui.fl.Utils#buildLrepRootNamespace: ");
if (!sBaseId) {
oError.message += "for every scenario you need a base ID";
throw oError;
}
switch (sScenario) {
case sap.ui.fl.Scenario.VersionedAppVariant:
if (!sProjectId) {
oError.message += "in a versioned app variant scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/appVariants/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.AppVariant:
if (!sProjectId) {
oError.message += "in an app variant scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/appVariants/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.AdaptationProject:
if (!sProjectId) {
oError.message += "in a adaptation project scenario you additionally need a project ID";
throw oError;
}
sRootNamespace += sBaseId + "/adapt/" + sProjectId + "/";
break;
case sap.ui.fl.Scenario.FioriElementsFromScratch:
case sap.ui.fl.Scenario.UiAdaptation:
default:
sRootNamespace += sBaseId + "/";
}
return sRootNamespace;
} | [
"function",
"(",
"sBaseId",
",",
"sScenario",
",",
"sProjectId",
")",
"{",
"var",
"sRootNamespace",
"=",
"\"apps/\"",
";",
"var",
"oError",
"=",
"new",
"Error",
"(",
"\"Error in sap.ui.fl.Utils#buildLrepRootNamespace: \"",
")",
";",
"if",
"(",
"!",
"sBaseId",
")... | builds the root namespace with a given base ID and project ID for the following scenarios:
App Variants, adaptation project, adapting new fiori elements app and UI adaptation
@param {string} sBaseId base ID
@param {string} sScenario current scenario
@param {string} sProjectId project ID
@returns {string} Returns the root LRep namespace | [
"builds",
"the",
"root",
"namespace",
"with",
"a",
"given",
"base",
"ID",
"and",
"project",
"ID",
"for",
"the",
"following",
"scenarios",
":",
"App",
"Variants",
"adaptation",
"project",
"adapting",
"new",
"fiori",
"elements",
"app",
"and",
"UI",
"adaptation"
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L995-L1032 | train | Build the root namespace for the LREP | [
30522,
3853,
1006,
24829,
11022,
3593,
1010,
7020,
27524,
16843,
1010,
11867,
3217,
20614,
3593,
1007,
1063,
13075,
5034,
17206,
18442,
23058,
1027,
1000,
18726,
1013,
1000,
1025,
13075,
1051,
2121,
29165,
1027,
2047,
7561,
1006,
1000,
7561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
laurent22/joplin | Clipper/joplin-webclipper/content_scripts/Readability.js | function(nodeList, newTagName) {
for (var i = nodeList.length - 1; i >= 0; i--) {
var node = nodeList[i];
this._setNodeTag(node, newTagName);
}
} | javascript | function(nodeList, newTagName) {
for (var i = nodeList.length - 1; i >= 0; i--) {
var node = nodeList[i];
this._setNodeTag(node, newTagName);
}
} | [
"function",
"(",
"nodeList",
",",
"newTagName",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"nodeList",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"node",
"=",
"nodeList",
"[",
"i",
"]",
";",
"this",
".",
"_setNod... | Iterates over a NodeList, and calls _setNodeTag for each node.
@param NodeList nodeList The nodes to operate on
@param String newTagName the new tag name to use
@return void | [
"Iterates",
"over",
"a",
"NodeList",
"and",
"calls",
"_setNodeTag",
"for",
"each",
"node",
"."
] | beb428b246cecba4630a3ca57b472f43c0933a43 | https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L194-L199 | train | Sets the tag name of the last node in the list | [
30522,
3853,
1006,
13045,
9863,
1010,
25597,
8490,
18442,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
13045,
9863,
1012,
3091,
1011,
1015,
1025,
1045,
1028,
1027,
1014,
1025,
1045,
1011,
1011,
1007,
1063,
13075,
13045,
1027,
13045,
9863,
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... | |
adobe/brackets | src/document/DocumentCommandHandlers.js | showFileOpenError | function showFileOpenError(name, path) {
return Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
StringUtils.format(
Strings.ERROR_OPENING_FILE,
StringUtils.breakableUrl(path),
FileUtils.getFileErrorString(name)
)
);
} | javascript | function showFileOpenError(name, path) {
return Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
StringUtils.format(
Strings.ERROR_OPENING_FILE,
StringUtils.breakableUrl(path),
FileUtils.getFileErrorString(name)
)
);
} | [
"function",
"showFileOpenError",
"(",
"name",
",",
"path",
")",
"{",
"return",
"Dialogs",
".",
"showModalDialog",
"(",
"DefaultDialogs",
".",
"DIALOG_ID_ERROR",
",",
"Strings",
".",
"ERROR_OPENING_FILE_TITLE",
",",
"StringUtils",
".",
"format",
"(",
"Strings",
"."... | Shows an error dialog indicating that the given file could not be opened due to the given error
@param {!FileSystemError} name
@return {!Dialog} | [
"Shows",
"an",
"error",
"dialog",
"indicating",
"that",
"the",
"given",
"file",
"could",
"not",
"be",
"opened",
"due",
"to",
"the",
"given",
"error"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L272-L282 | train | show file open error | [
30522,
3853,
2265,
8873,
2571,
26915,
2121,
29165,
1006,
2171,
1010,
4130,
1007,
1063,
2709,
13764,
8649,
2015,
1012,
2265,
5302,
9305,
27184,
8649,
1006,
12398,
27184,
8649,
2015,
1012,
13764,
8649,
1035,
8909,
1035,
7561,
1010,
7817,
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... |
GitbookIO/gitbook | lib/json/encodeFile.js | encodeFileToJson | function encodeFileToJson(file) {
var filePath = file.getPath();
if (!filePath) {
return undefined;
}
return {
path: filePath,
mtime: file.getMTime(),
type: file.getType()
};
} | javascript | function encodeFileToJson(file) {
var filePath = file.getPath();
if (!filePath) {
return undefined;
}
return {
path: filePath,
mtime: file.getMTime(),
type: file.getType()
};
} | [
"function",
"encodeFileToJson",
"(",
"file",
")",
"{",
"var",
"filePath",
"=",
"file",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"!",
"filePath",
")",
"{",
"return",
"undefined",
";",
"}",
"return",
"{",
"path",
":",
"filePath",
",",
"mtime",
":",
"f... | Return a JSON representation of a file
@param {File} file
@return {Object} | [
"Return",
"a",
"JSON",
"representation",
"of",
"a",
"file"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/json/encodeFile.js#L8-L19 | train | Encode a file to JSON | [
30522,
3853,
4372,
16044,
8873,
7485,
29147,
3385,
1006,
5371,
1007,
1063,
13075,
5371,
15069,
1027,
5371,
1012,
2131,
15069,
1006,
1007,
1025,
2065,
1006,
999,
5371,
15069,
1007,
1063,
2709,
6151,
28344,
1025,
1065,
2709,
1063,
4130,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/MainViewManager.js | _makeFileMostRecent | function _makeFileMostRecent(paneId, file) {
var index,
entry,
pane = _getPane(paneId);
if (!_traversingFileList) {
pane.makeViewMostRecent(file);
index = _findFileInMRUList(pane.id, file);
entry = _makeMRUListEntry(file, pane.id);
if (index !== -1) {
_mruList.splice(index, 1);
}
if (_findFileInMRUList(pane.id, file) !== -1) {
console.log(file.fullPath + " duplicated in mru list");
}
// add it to the front of the list
_mruList.unshift(entry);
}
} | javascript | function _makeFileMostRecent(paneId, file) {
var index,
entry,
pane = _getPane(paneId);
if (!_traversingFileList) {
pane.makeViewMostRecent(file);
index = _findFileInMRUList(pane.id, file);
entry = _makeMRUListEntry(file, pane.id);
if (index !== -1) {
_mruList.splice(index, 1);
}
if (_findFileInMRUList(pane.id, file) !== -1) {
console.log(file.fullPath + " duplicated in mru list");
}
// add it to the front of the list
_mruList.unshift(entry);
}
} | [
"function",
"_makeFileMostRecent",
"(",
"paneId",
",",
"file",
")",
"{",
"var",
"index",
",",
"entry",
",",
"pane",
"=",
"_getPane",
"(",
"paneId",
")",
";",
"if",
"(",
"!",
"_traversingFileList",
")",
"{",
"pane",
".",
"makeViewMostRecent",
"(",
"file",
... | Makes the file the most recent for the pane and the global mru lists
@param {!string} paneId - id of the pane to mae th file most recent or ACTIVE_PANE
@param {!File} file - File object to make most recent
@private | [
"Makes",
"the",
"file",
"the",
"most",
"recent",
"for",
"the",
"pane",
"and",
"the",
"global",
"mru",
"lists"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L338-L361 | train | make file most recent | [
30522,
3853,
1035,
2191,
8873,
16930,
14122,
2890,
13013,
1006,
6090,
7416,
2094,
1010,
5371,
1007,
1063,
13075,
5950,
1010,
4443,
1010,
6090,
2063,
1027,
1035,
2131,
9739,
2063,
1006,
6090,
7416,
2094,
1007,
1025,
2065,
1006,
999,
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... |
eslint/eslint | lib/rules/no-var.js | getEnclosingFunctionScope | function getEnclosingFunctionScope(scope) {
let currentScope = scope;
while (currentScope.type !== "function" && currentScope.type !== "global") {
currentScope = currentScope.upper;
}
return currentScope;
} | javascript | function getEnclosingFunctionScope(scope) {
let currentScope = scope;
while (currentScope.type !== "function" && currentScope.type !== "global") {
currentScope = currentScope.upper;
}
return currentScope;
} | [
"function",
"getEnclosingFunctionScope",
"(",
"scope",
")",
"{",
"let",
"currentScope",
"=",
"scope",
";",
"while",
"(",
"currentScope",
".",
"type",
"!==",
"\"function\"",
"&&",
"currentScope",
".",
"type",
"!==",
"\"global\"",
")",
"{",
"currentScope",
"=",
... | Finds the nearest function scope or global scope walking up the scope
hierarchy.
@param {eslint-scope.Scope} scope - The scope to traverse.
@returns {eslint-scope.Scope} a function scope or global scope containing the given
scope. | [
"Finds",
"the",
"nearest",
"function",
"scope",
"or",
"global",
"scope",
"walking",
"up",
"the",
"scope",
"hierarchy",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-var.js#L35-L42 | train | Get the enclosing function scope | [
30522,
3853,
2131,
2368,
20464,
18606,
11263,
27989,
26127,
1006,
9531,
1007,
1063,
2292,
14731,
16186,
1027,
9531,
1025,
2096,
1006,
14731,
16186,
1012,
2828,
999,
1027,
1027,
1000,
3853,
1000,
1004,
1004,
14731,
16186,
1012,
2828,
999,
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... |
uber/deck.gl | modules/geo-layers/src/s2-layer/s2-utils.js | getLevelFromToken | function getLevelFromToken(token) {
// leaf level token size is 16. Each 2 bit add a level
const lastHex = token.substr(token.length - 1);
// a) token = trailing-zero trimmed hex id
// b) 64 bit hex id - 3 face bit + 60 bits for 30 levels + 1 bit lsb marker
const level = 2 * (token.length - 1) - ((lastHex & 1) === 0);
// c) If lsb bit of last hex digit is zero, we have one more level less of
return level;
} | javascript | function getLevelFromToken(token) {
// leaf level token size is 16. Each 2 bit add a level
const lastHex = token.substr(token.length - 1);
// a) token = trailing-zero trimmed hex id
// b) 64 bit hex id - 3 face bit + 60 bits for 30 levels + 1 bit lsb marker
const level = 2 * (token.length - 1) - ((lastHex & 1) === 0);
// c) If lsb bit of last hex digit is zero, we have one more level less of
return level;
} | [
"function",
"getLevelFromToken",
"(",
"token",
")",
"{",
"// leaf level token size is 16. Each 2 bit add a level",
"const",
"lastHex",
"=",
"token",
".",
"substr",
"(",
"token",
".",
"length",
"-",
"1",
")",
";",
"// a) token = trailing-zero trimmed hex id",
"// b) 64 bit... | Given a S2 hex token this function returns cell level
cells level is a number between 1 and 30
S2 cell id is a 64 bit number
S2 token removed all trailing zeros from the 16 bit converted number | [
"Given",
"a",
"S2",
"hex",
"token",
"this",
"function",
"returns",
"cell",
"level",
"cells",
"level",
"is",
"a",
"number",
"between",
"1",
"and",
"30"
] | a2010448b7f268bbd03617b812334c68a6b9e5b2 | https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/geo-layers/src/s2-layer/s2-utils.js#L12-L20 | train | Get level from token | [
30522,
3853,
2131,
20414,
2884,
19699,
5358,
18715,
2368,
1006,
19204,
1007,
1063,
1013,
1013,
7053,
2504,
19204,
2946,
2003,
2385,
1012,
2169,
1016,
2978,
5587,
1037,
2504,
9530,
3367,
2197,
5369,
2595,
1027,
19204,
1012,
4942,
3367,
2099,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moleculerjs/moleculer | src/serializers/proto/packets.proto.js | PacketGossipHello | function PacketGossipHello(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function PacketGossipHello(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"PacketGossipHello",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")"... | Properties of a PacketGossipHello.
@memberof packets
@interface IPacketGossipHello
@property {string} ver PacketGossipHello ver
@property {string} sender PacketGossipHello sender
@property {string} host PacketGossipHello host
@property {number} port PacketGossipHello port
Constructs a new PacketGossipHello.
@memberof packets
@classdesc Represents a PacketGossipHello.
@implements IPacketGossipHello
@constructor
@param {packets.IPacketGossipHello=} [properties] Properties to set | [
"Properties",
"of",
"a",
"PacketGossipHello",
"."
] | f95aadc2d61b0d0e3c643a43c3ed28bca6425cde | https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/src/serializers/proto/packets.proto.js#L2924-L2929 | train | Properties of a PacketGossipHello. | [
30522,
3853,
14771,
12333,
5332,
8458,
15350,
1006,
5144,
1007,
1063,
2065,
1006,
5144,
1007,
2005,
1006,
13075,
6309,
1027,
4874,
1012,
6309,
1006,
5144,
1007,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
6309,
1012,
3091,
1025,
1009,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | parse | function parse(text, providedParserOptions, parserName, parserMap, filePath) {
const textToParse = stripUnicodeBOM(text).replace(astUtils.SHEBANG_MATCHER, (match, captured) => `//${captured}`);
const parserOptions = Object.assign({}, providedParserOptions, {
loc: true,
range: true,
raw: true,
tokens: true,
comment: true,
eslintVisitorKeys: true,
eslintScopeManager: true,
filePath
});
if (!parserMap.has(parserName)) {
return {
success: false,
error: {
ruleId: null,
fatal: true,
severity: 2,
message: `Configured parser '${parserName}' was not found.`,
line: 0,
column: 0
}
};
}
const parser = parserMap.get(parserName);
/*
* Check for parsing errors first. If there's a parsing error, nothing
* else can happen. However, a parsing error does not throw an error
* from this method - it's just considered a fatal error message, a
* problem that ESLint identified just like any other.
*/
try {
const parseResult = (typeof parser.parseForESLint === "function")
? parser.parseForESLint(textToParse, parserOptions)
: { ast: parser.parse(textToParse, parserOptions) };
const ast = parseResult.ast;
const parserServices = parseResult.services || {};
const visitorKeys = parseResult.visitorKeys || evk.KEYS;
const scopeManager = parseResult.scopeManager || analyzeScope(ast, parserOptions, visitorKeys);
return {
success: true,
/*
* Save all values that `parseForESLint()` returned.
* If a `SourceCode` object is given as the first parameter instead of source code text,
* linter skips the parsing process and reuses the source code object.
* In that case, linter needs all the values that `parseForESLint()` returned.
*/
sourceCode: new SourceCode({
text,
ast,
parserServices,
scopeManager,
visitorKeys
})
};
} catch (ex) {
// If the message includes a leading line number, strip it:
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
return {
success: false,
error: {
ruleId: null,
fatal: true,
severity: 2,
message,
line: ex.lineNumber,
column: ex.column
}
};
}
} | javascript | function parse(text, providedParserOptions, parserName, parserMap, filePath) {
const textToParse = stripUnicodeBOM(text).replace(astUtils.SHEBANG_MATCHER, (match, captured) => `//${captured}`);
const parserOptions = Object.assign({}, providedParserOptions, {
loc: true,
range: true,
raw: true,
tokens: true,
comment: true,
eslintVisitorKeys: true,
eslintScopeManager: true,
filePath
});
if (!parserMap.has(parserName)) {
return {
success: false,
error: {
ruleId: null,
fatal: true,
severity: 2,
message: `Configured parser '${parserName}' was not found.`,
line: 0,
column: 0
}
};
}
const parser = parserMap.get(parserName);
/*
* Check for parsing errors first. If there's a parsing error, nothing
* else can happen. However, a parsing error does not throw an error
* from this method - it's just considered a fatal error message, a
* problem that ESLint identified just like any other.
*/
try {
const parseResult = (typeof parser.parseForESLint === "function")
? parser.parseForESLint(textToParse, parserOptions)
: { ast: parser.parse(textToParse, parserOptions) };
const ast = parseResult.ast;
const parserServices = parseResult.services || {};
const visitorKeys = parseResult.visitorKeys || evk.KEYS;
const scopeManager = parseResult.scopeManager || analyzeScope(ast, parserOptions, visitorKeys);
return {
success: true,
/*
* Save all values that `parseForESLint()` returned.
* If a `SourceCode` object is given as the first parameter instead of source code text,
* linter skips the parsing process and reuses the source code object.
* In that case, linter needs all the values that `parseForESLint()` returned.
*/
sourceCode: new SourceCode({
text,
ast,
parserServices,
scopeManager,
visitorKeys
})
};
} catch (ex) {
// If the message includes a leading line number, strip it:
const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`;
return {
success: false,
error: {
ruleId: null,
fatal: true,
severity: 2,
message,
line: ex.lineNumber,
column: ex.column
}
};
}
} | [
"function",
"parse",
"(",
"text",
",",
"providedParserOptions",
",",
"parserName",
",",
"parserMap",
",",
"filePath",
")",
"{",
"const",
"textToParse",
"=",
"stripUnicodeBOM",
"(",
"text",
")",
".",
"replace",
"(",
"astUtils",
".",
"SHEBANG_MATCHER",
",",
"(",... | Parses text into an AST. Moved out here because the try-catch prevents
optimization of functions, so it's best to keep the try-catch as isolated
as possible
@param {string} text The text to parse.
@param {Object} providedParserOptions Options to pass to the parser
@param {string} parserName The name of the parser
@param {Map<string, Object>} parserMap A map from names to loaded parsers
@param {string} filePath The path to the file being parsed.
@returns {{success: false, error: Problem}|{success: true, sourceCode: SourceCode}}
An object containing the AST and parser services if parsing was successful, or the error if parsing failed
@private | [
"Parses",
"text",
"into",
"an",
"AST",
".",
"Moved",
"out",
"here",
"because",
"the",
"try",
"-",
"catch",
"prevents",
"optimization",
"of",
"functions",
"so",
"it",
"s",
"best",
"to",
"keep",
"the",
"try",
"-",
"catch",
"as",
"isolated",
"as",
"possible... | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/linter.js#L458-L538 | train | Parses the given text using the specified parser. | [
30522,
3853,
11968,
3366,
1006,
3793,
1010,
3024,
19362,
8043,
7361,
9285,
1010,
11968,
8043,
18442,
1010,
11968,
8043,
2863,
2361,
1010,
5371,
15069,
1007,
1063,
9530,
3367,
3793,
14399,
11650,
2063,
1027,
6167,
19496,
16044,
5092,
2213,
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... |
adobe/brackets | src/command/KeyBindingManager.js | _handleCommandRegistered | function _handleCommandRegistered(event, command) {
var commandId = command.getID(),
defaults = KeyboardPrefs[commandId];
if (defaults) {
addBinding(commandId, defaults);
}
} | javascript | function _handleCommandRegistered(event, command) {
var commandId = command.getID(),
defaults = KeyboardPrefs[commandId];
if (defaults) {
addBinding(commandId, defaults);
}
} | [
"function",
"_handleCommandRegistered",
"(",
"event",
",",
"command",
")",
"{",
"var",
"commandId",
"=",
"command",
".",
"getID",
"(",
")",
",",
"defaults",
"=",
"KeyboardPrefs",
"[",
"commandId",
"]",
";",
"if",
"(",
"defaults",
")",
"{",
"addBinding",
"(... | Adds default key bindings when commands are registered to CommandManager
@param {$.Event} event jQuery event
@param {Command} command Newly registered command | [
"Adds",
"default",
"key",
"bindings",
"when",
"commands",
"are",
"registered",
"to",
"CommandManager"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L919-L926 | train | Handle command registered | [
30522,
3853,
1035,
5047,
9006,
2386,
16200,
24063,
6850,
1006,
2724,
1010,
3094,
1007,
1063,
13075,
3094,
3593,
1027,
3094,
1012,
2131,
3593,
1006,
1007,
1010,
12398,
2015,
1027,
9019,
28139,
10343,
1031,
3094,
3593,
1033,
1025,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vuepress | packages/vuepress/lib/util.js | wrapCommand | function wrapCommand (fn) {
return (...args) => {
return fn(...args).catch(err => {
console.error(chalk.red(err.stack))
process.exitCode = 1
})
}
} | javascript | function wrapCommand (fn) {
return (...args) => {
return fn(...args).catch(err => {
console.error(chalk.red(err.stack))
process.exitCode = 1
})
}
} | [
"function",
"wrapCommand",
"(",
"fn",
")",
"{",
"return",
"(",
"...",
"args",
")",
"=>",
"{",
"return",
"fn",
"(",
"...",
"args",
")",
".",
"catch",
"(",
"err",
"=>",
"{",
"console",
".",
"error",
"(",
"chalk",
".",
"red",
"(",
"err",
".",
"stack... | Wrap a function to catch error.
@param {function} fn
@returns {function(...[*]): (*|Promise|Promise<T | never>)} | [
"Wrap",
"a",
"function",
"to",
"catch",
"error",
"."
] | 15784acc0cf2e87de3c147895b2c3977b0195d78 | https://github.com/vuejs/vuepress/blob/15784acc0cf2e87de3c147895b2c3977b0195d78/packages/vuepress/lib/util.js#L33-L40 | train | Wrap a command function | [
30522,
3853,
10236,
9006,
2386,
2094,
1006,
1042,
2078,
1007,
1063,
2709,
1006,
1012,
1012,
1012,
12098,
5620,
1007,
1027,
1028,
1063,
2709,
1042,
2078,
1006,
1012,
1012,
1012,
12098,
5620,
1007,
1012,
4608,
1006,
9413,
2099,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/LocaleData.js | function(sCalendarType) {
//TODO Adapt generation so that eradates are an array instead of object
var oEraDates = this._get("eras-" + sCalendarType.toLowerCase()),
aEraDates = [];
for (var i in oEraDates) {
aEraDates[parseInt(i)] = oEraDates[i];
}
return aEraDates;
} | javascript | function(sCalendarType) {
//TODO Adapt generation so that eradates are an array instead of object
var oEraDates = this._get("eras-" + sCalendarType.toLowerCase()),
aEraDates = [];
for (var i in oEraDates) {
aEraDates[parseInt(i)] = oEraDates[i];
}
return aEraDates;
} | [
"function",
"(",
"sCalendarType",
")",
"{",
"//TODO Adapt generation so that eradates are an array instead of object",
"var",
"oEraDates",
"=",
"this",
".",
"_get",
"(",
"\"eras-\"",
"+",
"sCalendarType",
".",
"toLowerCase",
"(",
")",
")",
",",
"aEraDates",
"=",
"[",
... | Returns the map of era IDs to era dates.
@param {sap.ui.core.CalendarType} [sCalendarType] the type of calendar
@return {array} the array of eras containing objects with either an _end or _start property with a date
@public
@since 1.32.0 | [
"Returns",
"the",
"map",
"of",
"era",
"IDs",
"to",
"era",
"dates",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L1486-L1494 | train | Returns an array of era dates for the given calendar type | [
30522,
3853,
1006,
4094,
8943,
5339,
18863,
1007,
1063,
1013,
1013,
28681,
2080,
15581,
4245,
2061,
2008,
3690,
27122,
2024,
2019,
9140,
2612,
1997,
4874,
13075,
1051,
6906,
27122,
1027,
2023,
1012,
1035,
2131,
1006,
1000,
28500,
1011,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js | function (oTree, sSeparator) {
var oObject = this.toHierarchy(oTree),
aFilters = [];
function collect(sName, oObject) {
var aChildren, bChildren;
if (typeof oObject === 'object') {
if (oObject['']) {
aFilters.push(sName + '/');
return;
}
aChildren = Object.keys(oObject);
bChildren = aChildren.length;
}
if (bChildren) {
aChildren.forEach(function (sChild) {
if (sChild === '') {
return;
}
if (oObject[sChild] === true) {
aFilters.push((sName ? sName + '/' : '') + sChild);
} else if (typeof oObject[sChild] === 'object') {
collect((sName ? sName + '/' : '') + sChild, oObject[sChild]);
}
});
}
}
if (this.get(oObject, '/')) {
return true;
}
collect('', oObject);
return (aFilters.length > 0 ? aFilters.join(sSeparator || ',') : false);
} | javascript | function (oTree, sSeparator) {
var oObject = this.toHierarchy(oTree),
aFilters = [];
function collect(sName, oObject) {
var aChildren, bChildren;
if (typeof oObject === 'object') {
if (oObject['']) {
aFilters.push(sName + '/');
return;
}
aChildren = Object.keys(oObject);
bChildren = aChildren.length;
}
if (bChildren) {
aChildren.forEach(function (sChild) {
if (sChild === '') {
return;
}
if (oObject[sChild] === true) {
aFilters.push((sName ? sName + '/' : '') + sChild);
} else if (typeof oObject[sChild] === 'object') {
collect((sName ? sName + '/' : '') + sChild, oObject[sChild]);
}
});
}
}
if (this.get(oObject, '/')) {
return true;
}
collect('', oObject);
return (aFilters.length > 0 ? aFilters.join(sSeparator || ',') : false);
} | [
"function",
"(",
"oTree",
",",
"sSeparator",
")",
"{",
"var",
"oObject",
"=",
"this",
".",
"toHierarchy",
"(",
"oTree",
")",
",",
"aFilters",
"=",
"[",
"]",
";",
"function",
"collect",
"(",
"sName",
",",
"oObject",
")",
"{",
"var",
"aChildren",
",",
... | Converts a bindable tree structure to a valid value for sap-ui-debug
@param {object} oTree The tree to be converted
@param {string} sSeparator=, A separator character, default is a comma
@return {string} The tree selection represented as string | [
"Converts",
"a",
"bindable",
"tree",
"structure",
"to",
"a",
"valid",
"value",
"for",
"sap",
"-",
"ui",
"-",
"debug"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/moduleTreeHelper.js#L235-L270 | train | Returns the hierarchy of the given tree. | [
30522,
3853,
1006,
27178,
9910,
1010,
7020,
13699,
25879,
2953,
1007,
1063,
13075,
1051,
16429,
20614,
1027,
2023,
1012,
2000,
4048,
6906,
29389,
1006,
27178,
9910,
1007,
1010,
28697,
21928,
2015,
1027,
1031,
1033,
1025,
3853,
8145,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
NetEase/pomelo | lib/util/countDownLatch.js | function(count, opts, cb) {
this.count = count;
this.cb = cb;
var self = this;
if (opts.timeout) {
this.timerId = setTimeout(function() {
self.cb(true);
}, opts.timeout);
}
} | javascript | function(count, opts, cb) {
this.count = count;
this.cb = cb;
var self = this;
if (opts.timeout) {
this.timerId = setTimeout(function() {
self.cb(true);
}, opts.timeout);
}
} | [
"function",
"(",
"count",
",",
"opts",
",",
"cb",
")",
"{",
"this",
".",
"count",
"=",
"count",
";",
"this",
".",
"cb",
"=",
"cb",
";",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"opts",
".",
"timeout",
")",
"{",
"this",
".",
"timerId",
"=",
... | Count down to zero or timeout and invoke cb finally. | [
"Count",
"down",
"to",
"zero",
"or",
"timeout",
"and",
"invoke",
"cb",
"finally",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/countDownLatch.js#L6-L15 | train | A kludge algorithm for the algorithm | [
30522,
3853,
1006,
4175,
1010,
23569,
2015,
1010,
17324,
1007,
1063,
2023,
1012,
4175,
1027,
4175,
1025,
2023,
1012,
17324,
1027,
17324,
30524,
1025,
2065,
1006,
23569,
2015,
1012,
2051,
5833,
1007,
1063,
2023,
1012,
25309,
3593,
1027,
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... | |
eslint/eslint | lib/rules/newline-before-return.js | isFirstNode | function isFirstNode(node) {
const parentType = node.parent.type;
if (node.parent.body) {
return Array.isArray(node.parent.body)
? node.parent.body[0] === node
: node.parent.body === node;
}
if (parentType === "IfStatement") {
return isPrecededByTokens(node, ["else", ")"]);
}
if (parentType === "DoWhileStatement") {
return isPrecededByTokens(node, ["do"]);
}
if (parentType === "SwitchCase") {
return isPrecededByTokens(node, [":"]);
}
return isPrecededByTokens(node, [")"]);
} | javascript | function isFirstNode(node) {
const parentType = node.parent.type;
if (node.parent.body) {
return Array.isArray(node.parent.body)
? node.parent.body[0] === node
: node.parent.body === node;
}
if (parentType === "IfStatement") {
return isPrecededByTokens(node, ["else", ")"]);
}
if (parentType === "DoWhileStatement") {
return isPrecededByTokens(node, ["do"]);
}
if (parentType === "SwitchCase") {
return isPrecededByTokens(node, [":"]);
}
return isPrecededByTokens(node, [")"]);
} | [
"function",
"isFirstNode",
"(",
"node",
")",
"{",
"const",
"parentType",
"=",
"node",
".",
"parent",
".",
"type",
";",
"if",
"(",
"node",
".",
"parent",
".",
"body",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"node",
".",
"parent",
".",
"body"... | Checks whether node is the first node after statement or in block
@param {ASTNode} node - node to check
@returns {boolean} Whether or not the node is the first node after statement or in block
@private | [
"Checks",
"whether",
"node",
"is",
"the",
"first",
"node",
"after",
"statement",
"or",
"in",
"block"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/newline-before-return.js#L59-L79 | train | returns true if node is the first node in the block | [
30522,
3853,
2003,
8873,
12096,
3630,
3207,
1006,
13045,
1007,
1063,
9530,
3367,
6687,
13874,
1027,
13045,
1012,
6687,
1012,
2828,
1025,
2065,
1006,
13045,
1012,
6687,
1012,
2303,
1007,
1063,
2709,
9140,
1012,
18061,
11335,
2100,
1006,
1304... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js | Aggregation | function Aggregation(oClass, name, info) {
info = typeof info !== 'object' ? { type: info } : info;
this.name = name;
this.type = info.type || 'sap.ui.core.Control';
this.altTypes = Array.isArray(info.altTypes) ? info.altTypes : undefined;
this.multiple = typeof info.multiple === 'boolean' ? info.multiple : true;
this.singularName = this.multiple ? info.singularName || guessSingularName(name) : undefined;
this.bindable = !!info.bindable;
this.deprecated = info.deprecated || false;
this.visibility = info.visibility || 'public';
this.selector = info.selector || null;
this.forwarding = info.forwarding;
this._doesNotRequireFactory = !!info._doesNotRequireFactory; // TODO clarify if public
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = 'aggregation:' + name;
this._iKind = this.multiple ? Kind.MULTIPLE_AGGREGATION : Kind.SINGLE_AGGREGATION;
this._oForwarder = this.forwarding ? new AggregationForwarder(this) : undefined;
var N = capitalize(name);
this._sGetter = 'get' + N;
if ( this.multiple ) {
var N1 = capitalize(this.singularName);
this._sMutator = 'add' + N1;
this._sInsertMutator = 'insert' + N1;
this._sRemoveMutator = 'remove' + N1;
this._sRemoveAllMutator = 'removeAll' + N;
this._sIndexGetter = 'indexOf' + N1;
this._sUpdater = 'update' + N;
this._sRefresher = 'refresh' + N;
} else {
this._sMutator = 'set' + N;
this._sInsertMutator =
this._sRemoveMutator =
this._sRemoveAllMutator =
this._sIndexGetter =
this._sUpdater =
this._sRefresher = undefined;
}
this._sDestructor = 'destroy' + N;
if ( this.bindable ) {
this._sBind = 'bind' + N;
this._sUnbind = 'unbind' + N;
} else {
this._sBind =
this._sUnbind = undefined;
}
} | javascript | function Aggregation(oClass, name, info) {
info = typeof info !== 'object' ? { type: info } : info;
this.name = name;
this.type = info.type || 'sap.ui.core.Control';
this.altTypes = Array.isArray(info.altTypes) ? info.altTypes : undefined;
this.multiple = typeof info.multiple === 'boolean' ? info.multiple : true;
this.singularName = this.multiple ? info.singularName || guessSingularName(name) : undefined;
this.bindable = !!info.bindable;
this.deprecated = info.deprecated || false;
this.visibility = info.visibility || 'public';
this.selector = info.selector || null;
this.forwarding = info.forwarding;
this._doesNotRequireFactory = !!info._doesNotRequireFactory; // TODO clarify if public
this.appData = remainder(this, info);
this._oParent = oClass;
this._sUID = 'aggregation:' + name;
this._iKind = this.multiple ? Kind.MULTIPLE_AGGREGATION : Kind.SINGLE_AGGREGATION;
this._oForwarder = this.forwarding ? new AggregationForwarder(this) : undefined;
var N = capitalize(name);
this._sGetter = 'get' + N;
if ( this.multiple ) {
var N1 = capitalize(this.singularName);
this._sMutator = 'add' + N1;
this._sInsertMutator = 'insert' + N1;
this._sRemoveMutator = 'remove' + N1;
this._sRemoveAllMutator = 'removeAll' + N;
this._sIndexGetter = 'indexOf' + N1;
this._sUpdater = 'update' + N;
this._sRefresher = 'refresh' + N;
} else {
this._sMutator = 'set' + N;
this._sInsertMutator =
this._sRemoveMutator =
this._sRemoveAllMutator =
this._sIndexGetter =
this._sUpdater =
this._sRefresher = undefined;
}
this._sDestructor = 'destroy' + N;
if ( this.bindable ) {
this._sBind = 'bind' + N;
this._sUnbind = 'unbind' + N;
} else {
this._sBind =
this._sUnbind = undefined;
}
} | [
"function",
"Aggregation",
"(",
"oClass",
",",
"name",
",",
"info",
")",
"{",
"info",
"=",
"typeof",
"info",
"!==",
"'object'",
"?",
"{",
"type",
":",
"info",
"}",
":",
"info",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"type",
"=",
... | ---- Aggregation -----------------------------------------------------------------------
Aggregation info object
@private
@since 1.27.1 | [
"----",
"Aggregation",
"-----------------------------------------------------------------------",
"Aggregation",
"info",
"object"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectMetadata.js#L251-L297 | train | Aggregation constructor. | [
30522,
3853,
28041,
1006,
1051,
26266,
1010,
2171,
1010,
18558,
1007,
1063,
18558,
1027,
2828,
11253,
18558,
999,
1027,
1027,
1005,
4874,
1005,
1029,
1063,
2828,
1024,
18558,
1065,
1024,
18558,
1025,
2023,
1012,
2171,
1027,
2171,
1025,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jiahaog/nativefier | src/build/buildMain.js | removeInvalidOptions | function removeInvalidOptions(options, param) {
const packageOptions = JSON.parse(JSON.stringify(options));
if (options.platform === 'win32' && !isWindows()) {
if (!hasBinary.sync('wine')) {
log.warn(
`Wine is required to use "${param}" option for a Windows app when packaging on non-windows platforms`,
);
packageOptions[param] = null;
}
}
return packageOptions;
} | javascript | function removeInvalidOptions(options, param) {
const packageOptions = JSON.parse(JSON.stringify(options));
if (options.platform === 'win32' && !isWindows()) {
if (!hasBinary.sync('wine')) {
log.warn(
`Wine is required to use "${param}" option for a Windows app when packaging on non-windows platforms`,
);
packageOptions[param] = null;
}
}
return packageOptions;
} | [
"function",
"removeInvalidOptions",
"(",
"options",
",",
"param",
")",
"{",
"const",
"packageOptions",
"=",
"JSON",
".",
"parse",
"(",
"JSON",
".",
"stringify",
"(",
"options",
")",
")",
";",
"if",
"(",
"options",
".",
"platform",
"===",
"'win32'",
"&&",
... | Removes invalid parameters from options if building for Windows while not on Windows
and Wine is not installed
@param options | [
"Removes",
"invalid",
"parameters",
"from",
"options",
"if",
"building",
"for",
"Windows",
"while",
"not",
"on",
"Windows",
"and",
"Wine",
"is",
"not",
"installed"
] | b959956a38ce51a9dd95d42308f0a6c66489b624 | https://github.com/jiahaog/nativefier/blob/b959956a38ce51a9dd95d42308f0a6c66489b624/src/build/buildMain.js#L90-L101 | train | Remove invalid options | [
30522,
3853,
6366,
2378,
10175,
13820,
16790,
2015,
1006,
7047,
1010,
11498,
2213,
1007,
1063,
9530,
3367,
7427,
7361,
9285,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
1046,
3385,
1012,
5164,
8757,
30524,
2065,
1006,
999,
2038,
21114,
2854,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | str2binb | function str2binb(str)
{
var bin = [];
var mask = 255;
for (var i = 0; i < str.length * 8; i += 8)
{
bin[i>>5] |= (str.charCodeAt(i / 8) & mask) << (24 - i%32);
}
return bin;
} | javascript | function str2binb(str)
{
var bin = [];
var mask = 255;
for (var i = 0; i < str.length * 8; i += 8)
{
bin[i>>5] |= (str.charCodeAt(i / 8) & mask) << (24 - i%32);
}
return bin;
} | [
"function",
"str2binb",
"(",
"str",
")",
"{",
"var",
"bin",
"=",
"[",
"]",
";",
"var",
"mask",
"=",
"255",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"*",
"8",
";",
"i",
"+=",
"8",
")",
"{",
"bin",
"[",
"i... | /*
Convert an 8-bit or 16-bit string to an array of big-endian words
In 8-bit function, characters >255 have their hi-byte silently ignored. | [
"/",
"*",
"Convert",
"an",
"8",
"-",
"bit",
"or",
"16",
"-",
"bit",
"string",
"to",
"an",
"array",
"of",
"big",
"-",
"endian",
"words",
"In",
"8",
"-",
"bit",
"function",
"characters",
">",
"255",
"have",
"their",
"hi",
"-",
"byte",
"silently",
"ig... | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L223-L232 | train | Convert a string to an array of big - endian words | [
30522,
3853,
2358,
2099,
2475,
8428,
2497,
1006,
2358,
2099,
1007,
1063,
13075,
8026,
1027,
1031,
1033,
1025,
13075,
7308,
1027,
20637,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
2358,
2099,
1012,
3091,
1008,
1022,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(array, obj)
{
if (array != null && obj != null)
{
for (var i = 0; i < array.length; i++)
{
if (array[i] == obj)
{
return i;
}
}
}
return -1;
} | javascript | function(array, obj)
{
if (array != null && obj != null)
{
for (var i = 0; i < array.length; i++)
{
if (array[i] == obj)
{
return i;
}
}
}
return -1;
} | [
"function",
"(",
"array",
",",
"obj",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
"&&",
"obj",
"!=",
"null",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[... | Function: indexOf
Returns the index of obj in array or -1 if the array does not contain
the given object.
Parameters:
array - Array to check for the given obj.
obj - Object to find in the given array. | [
"Function",
":",
"indexOf"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L2476-L2490 | train | Returns the index of obj in array | [
30522,
3853,
1006,
9140,
1010,
27885,
3501,
1007,
1063,
2065,
1006,
9140,
999,
1027,
19701,
1004,
1004,
27885,
3501,
999,
1027,
19701,
1007,
1063,
2005,
1006,
13075,
1045,
1027,
1014,
1025,
1045,
1026,
9140,
1012,
3091,
1025,
1045,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AutoUpdate/node/AutoUpdateDomain.js | getFunctionArgs | function getFunctionArgs(args) {
if (args.length > 2) {
var fnArgs = new Array(args.length - 2),
i;
for (i = 2; i < args.length; ++i) {
fnArgs[i - 2] = args[i];
}
return fnArgs;
}
return [];
} | javascript | function getFunctionArgs(args) {
if (args.length > 2) {
var fnArgs = new Array(args.length - 2),
i;
for (i = 2; i < args.length; ++i) {
fnArgs[i - 2] = args[i];
}
return fnArgs;
}
return [];
} | [
"function",
"getFunctionArgs",
"(",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
">",
"2",
")",
"{",
"var",
"fnArgs",
"=",
"new",
"Array",
"(",
"args",
".",
"length",
"-",
"2",
")",
",",
"i",
";",
"for",
"(",
"i",
"=",
"2",
";",
"i",
"... | Gets the arguments to a function in an array
@param {object} args - the arguments object
@returns {Array} - array of actual arguments | [
"Gets",
"the",
"arguments",
"to",
"a",
"function",
"in",
"an",
"array"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L75-L85 | train | get function arguments | [
30522,
3853,
2131,
11263,
27989,
2906,
5620,
1006,
12098,
5620,
1007,
1063,
2065,
1006,
12098,
5620,
1012,
3091,
1028,
1016,
1007,
1063,
13075,
1042,
11802,
5620,
1027,
2047,
9140,
1006,
12098,
5620,
1012,
3091,
1011,
1016,
1007,
1010,
1045... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
google/closure-library | browser_capabilities.js | getBrowserName | function getBrowserName(browserCap) {
var name = browserCap.browserName == 'internet explorer' ?
'ie' :
browserCap.browserName;
var version = browserCap.version || '-latest';
return name + version;
} | javascript | function getBrowserName(browserCap) {
var name = browserCap.browserName == 'internet explorer' ?
'ie' :
browserCap.browserName;
var version = browserCap.version || '-latest';
return name + version;
} | [
"function",
"getBrowserName",
"(",
"browserCap",
")",
"{",
"var",
"name",
"=",
"browserCap",
".",
"browserName",
"==",
"'internet explorer'",
"?",
"'ie'",
":",
"browserCap",
".",
"browserName",
";",
"var",
"version",
"=",
"browserCap",
".",
"version",
"||",
"'... | Returns a versioned name for the given capability object.
@param {!Object} browserCap
@return {string} | [
"Returns",
"a",
"versioned",
"name",
"for",
"the",
"given",
"capability",
"object",
"."
] | 97390e9ca4483cebb9628e06026139fbb3023d65 | https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/browser_capabilities.js#L22-L28 | train | Get the browser name | [
30522,
3853,
2131,
12618,
9333,
11795,
14074,
1006,
16602,
17695,
1007,
1063,
13075,
2171,
1027,
16602,
17695,
1012,
16602,
18442,
1027,
1027,
1005,
4274,
10566,
1005,
1029,
1005,
29464,
1005,
1024,
16602,
17695,
1012,
16602,
18442,
1025,
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... |
catapult-project/catapult | tracing/third_party/oboe/src/publicApi.js | oboe | function oboe(arg1) {
// We use duck-typing to detect if the parameter given is a stream, with the
// below list of parameters.
// Unpipe and unshift would normally be present on a stream but this breaks
// compatibility with Request streams.
// See https://github.com/jimhigson/oboe.js/issues/65
var nodeStreamMethodNames = list('resume', 'pause', 'pipe'),
isStream = partialComplete(
hasAllProperties
, nodeStreamMethodNames
);
if( arg1 ) {
if (isStream(arg1) || isString(arg1)) {
// simple version for GETs. Signature is:
// oboe( url )
// or, under node:
// oboe( readableStream )
return applyDefaults(
wire,
arg1 // url
);
} else {
// method signature is:
// oboe({method:m, url:u, body:b, headers:{...}})
return applyDefaults(
wire,
arg1.url,
arg1.method,
arg1.body,
arg1.headers,
arg1.withCredentials,
arg1.cached
);
}
} else {
// wire up a no-AJAX, no-stream Oboe. Will have to have content
// fed in externally and using .emit.
return wire();
}
} | javascript | function oboe(arg1) {
// We use duck-typing to detect if the parameter given is a stream, with the
// below list of parameters.
// Unpipe and unshift would normally be present on a stream but this breaks
// compatibility with Request streams.
// See https://github.com/jimhigson/oboe.js/issues/65
var nodeStreamMethodNames = list('resume', 'pause', 'pipe'),
isStream = partialComplete(
hasAllProperties
, nodeStreamMethodNames
);
if( arg1 ) {
if (isStream(arg1) || isString(arg1)) {
// simple version for GETs. Signature is:
// oboe( url )
// or, under node:
// oboe( readableStream )
return applyDefaults(
wire,
arg1 // url
);
} else {
// method signature is:
// oboe({method:m, url:u, body:b, headers:{...}})
return applyDefaults(
wire,
arg1.url,
arg1.method,
arg1.body,
arg1.headers,
arg1.withCredentials,
arg1.cached
);
}
} else {
// wire up a no-AJAX, no-stream Oboe. Will have to have content
// fed in externally and using .emit.
return wire();
}
} | [
"function",
"oboe",
"(",
"arg1",
")",
"{",
"// We use duck-typing to detect if the parameter given is a stream, with the",
"// below list of parameters.",
"// Unpipe and unshift would normally be present on a stream but this breaks",
"// compatibility with Request streams.",
"// See https://gith... | export public API | [
"export",
"public",
"API"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/publicApi.js#L2-L49 | train | Oboe function. | [
30522,
3853,
22523,
1006,
12098,
2290,
2487,
1007,
1063,
1013,
1013,
2057,
2224,
9457,
1011,
22868,
2000,
11487,
2065,
1996,
16381,
30524,
1010,
2007,
1996,
1013,
1013,
2917,
2862,
1997,
11709,
1012,
1013,
1013,
4895,
24548,
1998,
4895,
618... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | removeMultipleColsByCells | function removeMultipleColsByCells($cells) {
const numberOfCells = $cells.length;
for (let i = 0; i < numberOfCells; i += 1) {
const $cellToDelete = $cells.eq(i);
if ($cellToDelete.length > 0) {
removeColByCell($cells.eq(i));
}
}
} | javascript | function removeMultipleColsByCells($cells) {
const numberOfCells = $cells.length;
for (let i = 0; i < numberOfCells; i += 1) {
const $cellToDelete = $cells.eq(i);
if ($cellToDelete.length > 0) {
removeColByCell($cells.eq(i));
}
}
} | [
"function",
"removeMultipleColsByCells",
"(",
"$cells",
")",
"{",
"const",
"numberOfCells",
"=",
"$cells",
".",
"length",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfCells",
";",
"i",
"+=",
"1",
")",
"{",
"const",
"$cellToDelete",
"=",... | Remove columns by given cells
@param {jQuery} $cells - jQuery table cells | [
"Remove",
"columns",
"by",
"given",
"cells"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L84-L92 | train | Remove multiple columns by cell | [
30522,
3853,
6366,
12274,
7096,
11514,
2571,
25778,
14478,
29109,
4877,
1006,
1002,
4442,
1007,
1063,
9530,
3367,
2193,
11253,
29109,
4877,
1027,
1002,
4442,
1012,
3091,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026,
2193,
1125... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sass/node-sass | lib/extensions.js | getBinaryPath | function getBinaryPath() {
var binaryPath;
if (getArgument('--sass-binary-path')) {
binaryPath = getArgument('--sass-binary-path');
} else if (process.env.SASS_BINARY_PATH) {
binaryPath = process.env.SASS_BINARY_PATH;
} else if (process.env.npm_config_sass_binary_path) {
binaryPath = process.env.npm_config_sass_binary_path;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.binaryPath) {
binaryPath = pkg.nodeSassConfig.binaryPath;
} else {
binaryPath = path.join(getBinaryDir(), getBinaryName().replace(/_(?=binding\.node)/, '/'));
}
if (process.versions.modules < 46) {
return binaryPath;
}
try {
return trueCasePathSync(binaryPath) || binaryPath;
} catch (e) {
return binaryPath;
}
} | javascript | function getBinaryPath() {
var binaryPath;
if (getArgument('--sass-binary-path')) {
binaryPath = getArgument('--sass-binary-path');
} else if (process.env.SASS_BINARY_PATH) {
binaryPath = process.env.SASS_BINARY_PATH;
} else if (process.env.npm_config_sass_binary_path) {
binaryPath = process.env.npm_config_sass_binary_path;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.binaryPath) {
binaryPath = pkg.nodeSassConfig.binaryPath;
} else {
binaryPath = path.join(getBinaryDir(), getBinaryName().replace(/_(?=binding\.node)/, '/'));
}
if (process.versions.modules < 46) {
return binaryPath;
}
try {
return trueCasePathSync(binaryPath) || binaryPath;
} catch (e) {
return binaryPath;
}
} | [
"function",
"getBinaryPath",
"(",
")",
"{",
"var",
"binaryPath",
";",
"if",
"(",
"getArgument",
"(",
"'--sass-binary-path'",
")",
")",
"{",
"binaryPath",
"=",
"getArgument",
"(",
"'--sass-binary-path'",
")",
";",
"}",
"else",
"if",
"(",
"process",
".",
"env"... | Get binary path.
If environment variable SASS_BINARY_PATH,
.npmrc variable sass_binary_path or
process argument --sass-binary-path is provided,
select it by appending binary name, otherwise
make default binary path using binary name.
Once the primary selection is made, check if
callers wants to throw if file not exists before
returning.
@api public | [
"Get",
"binary",
"path",
".",
"If",
"environment",
"variable",
"SASS_BINARY_PATH",
".",
"npmrc",
"variable",
"sass_binary_path",
"or",
"process",
"argument",
"--",
"sass",
"-",
"binary",
"-",
"path",
"is",
"provided",
"select",
"it",
"by",
"appending",
"binary",... | 0c1a49eefa37544d16041c5fe5b2e3d9168004b7 | https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/extensions.js#L296-L320 | train | Get binary path from arguments | [
30522,
3853,
2131,
21114,
2854,
15069,
1006,
1007,
1063,
13075,
12441,
15069,
1025,
2065,
1006,
2131,
2906,
22850,
4765,
1006,
1005,
1011,
1011,
21871,
2015,
1011,
12441,
1011,
4130,
1005,
1007,
1007,
1063,
12441,
15069,
1027,
2131,
2906,
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... |
Shopify/draggable | src/Draggable/Plugins/Mirror/Mirror.js | removeMirrorID | function removeMirrorID({mirror, ...args}) {
return withPromise((resolve) => {
mirror.removeAttribute('id');
delete mirror.id;
resolve({mirror, ...args});
});
} | javascript | function removeMirrorID({mirror, ...args}) {
return withPromise((resolve) => {
mirror.removeAttribute('id');
delete mirror.id;
resolve({mirror, ...args});
});
} | [
"function",
"removeMirrorID",
"(",
"{",
"mirror",
",",
"...",
"args",
"}",
")",
"{",
"return",
"withPromise",
"(",
"(",
"resolve",
")",
"=>",
"{",
"mirror",
".",
"removeAttribute",
"(",
"'id'",
")",
";",
"delete",
"mirror",
".",
"id",
";",
"resolve",
"... | Removes source ID from cloned mirror element
@param {Object} state
@param {HTMLElement} state.mirror
@return {Promise}
@private | [
"Removes",
"source",
"ID",
"from",
"cloned",
"mirror",
"element"
] | ecc04b2cdb8b5009664862472ff8cb237c38cfeb | https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Draggable/Plugins/Mirror/Mirror.js#L414-L420 | train | Remove the id attribute from the node | [
30522,
3853,
6366,
14503,
29165,
3593,
1006,
1063,
5259,
1010,
1012,
1012,
1012,
12098,
5620,
1065,
1007,
1063,
2709,
2007,
21572,
28732,
1006,
1006,
10663,
1007,
1027,
1028,
1063,
5259,
1012,
6366,
19321,
3089,
8569,
2618,
1006,
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... |
netlify/netlify-cms | packages/netlify-cms-widget-markdown/src/serializers/index.js | remarkAllowAllText | function remarkAllowAllText() {
const Compiler = this.Compiler;
const visitors = Compiler.prototype.visitors;
visitors.text = node => node.value;
} | javascript | function remarkAllowAllText() {
const Compiler = this.Compiler;
const visitors = Compiler.prototype.visitors;
visitors.text = node => node.value;
} | [
"function",
"remarkAllowAllText",
"(",
")",
"{",
"const",
"Compiler",
"=",
"this",
".",
"Compiler",
";",
"const",
"visitors",
"=",
"Compiler",
".",
"prototype",
".",
"visitors",
";",
"visitors",
".",
"text",
"=",
"node",
"=>",
"node",
".",
"value",
";",
... | Rewrite the remark-stringify text visitor to simply return the text value,
without encoding or escaping any characters. This means we're completely
trusting the markdown that we receive. | [
"Rewrite",
"the",
"remark",
"-",
"stringify",
"text",
"visitor",
"to",
"simply",
"return",
"the",
"text",
"value",
"without",
"encoding",
"or",
"escaping",
"any",
"characters",
".",
"This",
"means",
"we",
"re",
"completely",
"trusting",
"the",
"markdown",
"tha... | 2488556590cbfdcefa626f2f2de01e7a160cf6ee | https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-widget-markdown/src/serializers/index.js#L101-L105 | train | Remark - only - text | [
30522,
3853,
17674,
8095,
21293,
3363,
18209,
1006,
1007,
1063,
9530,
3367,
21624,
1027,
2023,
1012,
21624,
1025,
9530,
3367,
5731,
1027,
21624,
1012,
8773,
1012,
5731,
1025,
5731,
1012,
3793,
1027,
13045,
1027,
1028,
13045,
1012,
3643,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.