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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(sName) {
if (this._oMeasureSet[sName]) { // the easy case
return this._oMeasureSet[sName];
}
for ( var sMeasureName in this._oMeasureSet) {
var oMeasure = this._oMeasureSet[sMeasureName];
var oFormattedValueProperty = oMeasure.getFormattedValueProperty();
if (oFormattedValueProperty && oFormattedValueProperty.name == sName) {
return oMeasure;
}
}
return null;
} | javascript | function(sName) {
if (this._oMeasureSet[sName]) { // the easy case
return this._oMeasureSet[sName];
}
for ( var sMeasureName in this._oMeasureSet) {
var oMeasure = this._oMeasureSet[sMeasureName];
var oFormattedValueProperty = oMeasure.getFormattedValueProperty();
if (oFormattedValueProperty && oFormattedValueProperty.name == sName) {
return oMeasure;
}
}
return null;
} | [
"function",
"(",
"sName",
")",
"{",
"if",
"(",
"this",
".",
"_oMeasureSet",
"[",
"sName",
"]",
")",
"{",
"// the easy case",
"return",
"this",
".",
"_oMeasureSet",
"[",
"sName",
"]",
";",
"}",
"for",
"(",
"var",
"sMeasureName",
"in",
"this",
".",
"_oMe... | Find measure by property name
@param {string}
sName Property name
@returns {sap.ui.model.analytics.odata4analytics.Measure} The measure object to which
the given property name is related, because the property holds
the raw measure value or its formatted value. If no such measure
exists, null is returned.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResult#findMeasureByPropertyName | [
"Find",
"measure",
"by",
"property",
"name"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L1163-L1176 | train | Returns the measure with the given name | [
30522,
3853,
1006,
1055,
18442,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
18168,
5243,
28632,
13462,
1031,
1055,
18442,
1033,
1007,
1063,
1013,
1013,
1996,
3733,
2553,
2709,
2023,
1012,
1035,
18168,
5243,
28632,
13462,
1031,
1055,
18442,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Requestor.js | reject | function reject(oError, vRequest) {
if (Array.isArray(vRequest)) {
vRequest.forEach(reject.bind(null, oError));
} else {
vRequest.$reject(oError);
}
} | javascript | function reject(oError, vRequest) {
if (Array.isArray(vRequest)) {
vRequest.forEach(reject.bind(null, oError));
} else {
vRequest.$reject(oError);
}
} | [
"function",
"reject",
"(",
"oError",
",",
"vRequest",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"vRequest",
")",
")",
"{",
"vRequest",
".",
"forEach",
"(",
"reject",
".",
"bind",
"(",
"null",
",",
"oError",
")",
")",
";",
"}",
"else",
"{",... | /*
(Recursively) rejects the request(s) with the given error
@param {Error} oError
@param {object|object[]} vRequest | [
"/",
"*",
"(",
"Recursively",
")",
"rejects",
"the",
"request",
"(",
"s",
")",
"with",
"the",
"given",
"error"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Requestor.js#L1385-L1391 | train | rejects all the errors in the request | [
30522,
3853,
15454,
1006,
1051,
2121,
29165,
1010,
27830,
2063,
15500,
1007,
1063,
2065,
1006,
9140,
1012,
18061,
11335,
2100,
1006,
27830,
2063,
15500,
1007,
1007,
1063,
27830,
2063,
15500,
1012,
18921,
6776,
1006,
15454,
1012,
14187,
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 | third_party/js/mozmill/shared-modules/dom-utils.js | DOMWalker_modalWindowHelper | function DOMWalker_modalWindowHelper(controller) {
let domWalker = new DOMWalker(controller,
persisted.modalInfos.callbackFilter,
persisted.modalInfos.callbackNodeTest,
persisted.modalInfos.callbackResults);
domWalker.walk(persisted.modalInfos.ids,
controller.window.document.documentElement,
persisted.modalInfos.waitFunction);
delete persisted.modalInfos;
controller.window.close();
} | javascript | function DOMWalker_modalWindowHelper(controller) {
let domWalker = new DOMWalker(controller,
persisted.modalInfos.callbackFilter,
persisted.modalInfos.callbackNodeTest,
persisted.modalInfos.callbackResults);
domWalker.walk(persisted.modalInfos.ids,
controller.window.document.documentElement,
persisted.modalInfos.waitFunction);
delete persisted.modalInfos;
controller.window.close();
} | [
"function",
"DOMWalker_modalWindowHelper",
"(",
"controller",
")",
"{",
"let",
"domWalker",
"=",
"new",
"DOMWalker",
"(",
"controller",
",",
"persisted",
".",
"modalInfos",
".",
"callbackFilter",
",",
"persisted",
".",
"modalInfos",
".",
"callbackNodeTest",
",",
"... | Callback function to handle new windows
@param {MozMillController} controller
MozMill controller of the new window to operate on. | [
"Callback",
"function",
"to",
"handle",
"new",
"windows"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/dom-utils.js#L457-L469 | train | DOMWalker_modalWindowHelper - Helper function for the modal window | [
30522,
3853,
14383,
26965,
1035,
16913,
2389,
11101,
5004,
16001,
4842,
1006,
11486,
1007,
1063,
2292,
14383,
26965,
1027,
2047,
14383,
26965,
1006,
11486,
1010,
19035,
1012,
16913,
11475,
2078,
14876,
2015,
1012,
2655,
5963,
8873,
21928,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
TryGhost/Ghost | core/server/models/post.js | filterData | function filterData(data) {
var filteredData = ghostBookshelf.Model.filterData.apply(this, arguments),
extraData = _.pick(data, this.prototype.relationships);
_.merge(filteredData, extraData);
return filteredData;
} | javascript | function filterData(data) {
var filteredData = ghostBookshelf.Model.filterData.apply(this, arguments),
extraData = _.pick(data, this.prototype.relationships);
_.merge(filteredData, extraData);
return filteredData;
} | [
"function",
"filterData",
"(",
"data",
")",
"{",
"var",
"filteredData",
"=",
"ghostBookshelf",
".",
"Model",
".",
"filterData",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
",",
"extraData",
"=",
"_",
".",
"pick",
"(",
"data",
",",
"this",
".",
"p... | Manually add 'tags' attribute since it's not in the schema and call parent.
@param {Object} data Has keys representing the model's attributes/fields in the database.
@return {Object} The filtered results of the passed in data, containing only what's allowed in the schema. | [
"Manually",
"add",
"tags",
"attribute",
"since",
"it",
"s",
"not",
"in",
"the",
"schema",
"and",
"call",
"parent",
"."
] | bb7bb55cf3e60af99ebbc56099928827b58461bc | https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/post.js#L749-L755 | train | filterData - Filter data | [
30522,
3853,
11307,
2850,
2696,
1006,
2951,
1007,
1063,
13075,
21839,
2850,
2696,
1027,
5745,
17470,
16001,
2546,
1012,
2944,
1012,
11307,
2850,
2696,
1012,
6611,
1006,
2023,
1010,
9918,
1007,
1010,
4469,
2850,
2696,
1027,
1035,
1012,
4060,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mochajs/mocha | lib/errors.js | createInvalidExceptionError | function createInvalidExceptionError(message, value) {
var err = new Error(message);
err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
err.valueType = typeof value;
err.value = value;
return err;
} | javascript | function createInvalidExceptionError(message, value) {
var err = new Error(message);
err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
err.valueType = typeof value;
err.value = value;
return err;
} | [
"function",
"createInvalidExceptionError",
"(",
"message",
",",
"value",
")",
"{",
"var",
"err",
"=",
"new",
"Error",
"(",
"message",
")",
";",
"err",
".",
"code",
"=",
"'ERR_MOCHA_INVALID_EXCEPTION'",
";",
"err",
".",
"valueType",
"=",
"typeof",
"value",
";... | Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
@public
@param {string} message - Error message to be displayed.
@returns {Error} instance detailing the error condition | [
"Creates",
"an",
"error",
"object",
"to",
"be",
"thrown",
"when",
"an",
"exception",
"was",
"caught",
"but",
"the",
"Error",
"is",
"falsy",
"or",
"undefined",
"."
] | 9b00fedb610241e33f7592c40164e42a38a793cf | https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/errors.js#L124-L130 | train | Creates an error object that can be thrown when the value is not a valid type | [
30522,
3853,
3443,
2378,
10175,
5178,
2595,
24422,
2121,
29165,
1006,
4471,
1010,
3643,
1007,
1063,
13075,
9413,
2099,
1027,
2047,
7561,
1006,
4471,
1007,
1025,
9413,
2099,
1012,
3642,
1027,
1005,
9413,
2099,
1035,
9587,
7507,
1035,
19528,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-js | lib/s3/managed_upload.js | function(callback) {
var self = this;
self.failed = false;
self.callback = callback || function(err) { if (err) throw err; };
var runFill = true;
if (self.sliceFn) {
self.fillQueue = self.fillBuffer;
} else if (AWS.util.isNode()) {
var Stream = AWS.util.stream.Stream;
if (self.body instanceof Stream) {
runFill = false;
self.fillQueue = self.fillStream;
self.partBuffers = [];
self.body.
on('error', function(err) { self.cleanup(err); }).
on('readable', function() { self.fillQueue(); }).
on('end', function() {
self.isDoneChunking = true;
self.numParts = self.totalPartNumbers;
self.fillQueue.call(self);
if (self.isDoneChunking && self.totalPartNumbers >= 1 && self.doneParts === self.numParts) {
self.finishMultiPart();
}
});
}
}
if (runFill) self.fillQueue.call(self);
} | javascript | function(callback) {
var self = this;
self.failed = false;
self.callback = callback || function(err) { if (err) throw err; };
var runFill = true;
if (self.sliceFn) {
self.fillQueue = self.fillBuffer;
} else if (AWS.util.isNode()) {
var Stream = AWS.util.stream.Stream;
if (self.body instanceof Stream) {
runFill = false;
self.fillQueue = self.fillStream;
self.partBuffers = [];
self.body.
on('error', function(err) { self.cleanup(err); }).
on('readable', function() { self.fillQueue(); }).
on('end', function() {
self.isDoneChunking = true;
self.numParts = self.totalPartNumbers;
self.fillQueue.call(self);
if (self.isDoneChunking && self.totalPartNumbers >= 1 && self.doneParts === self.numParts) {
self.finishMultiPart();
}
});
}
}
if (runFill) self.fillQueue.call(self);
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"failed",
"=",
"false",
";",
"self",
".",
"callback",
"=",
"callback",
"||",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
";",
"}",
"... | Initiates the managed upload for the payload.
@callback callback function(err, data)
@param err [Error] an error or null if no error occurred.
@param data [map] The response data from the successful upload:
* `Location` (String) the URL of the uploaded object
* `ETag` (String) the ETag of the uploaded object
* `Bucket` (String) the bucket to which the object was uploaded
* `Key` (String) the key to which the object was uploaded
@example Sending a managed upload object
var params = {Bucket: 'bucket', Key: 'key', Body: stream};
var upload = new AWS.S3.ManagedUpload({params: params});
upload.send(function(err, data) {
console.log(err, data);
}); | [
"Initiates",
"the",
"managed",
"upload",
"for",
"the",
"payload",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/s3/managed_upload.js#L170-L200 | train | This method is called by the next iteration of the iteration. | [
30522,
3853,
1006,
2655,
5963,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
2969,
1012,
3478,
1027,
6270,
1025,
2969,
1012,
2655,
5963,
1027,
2655,
5963,
1064,
1064,
3853,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
9413,
2099,
1007,
5466,
94... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(sSkeleton, oAvailableFormats, sCalendarType, vDiff) {
var vPattern, aPatterns, oIntervalFormats;
if (!vDiff) {
// the call is from getCustomDateTimePattern
vPattern = oAvailableFormats[sSkeleton];
} else if (typeof vDiff === "string") {
// vDiff is given as a symbol
if (vDiff == "j" || vDiff == "J") {
vDiff = this.getPreferredHourSymbol();
}
oIntervalFormats = oAvailableFormats[sSkeleton];
vPattern = oIntervalFormats && oIntervalFormats[vDiff];
}
if (vPattern) {
if (typeof vPattern === "object") {
aPatterns = Object.keys(vPattern).map(function(sKey) {
return vPattern[sKey];
});
} else {
return vPattern;
}
}
if (!aPatterns) {
aPatterns = this._createFormatPattern(sSkeleton, oAvailableFormats, sCalendarType, vDiff);
}
if (aPatterns && aPatterns.length === 1) {
return aPatterns[0];
}
return aPatterns;
} | javascript | function(sSkeleton, oAvailableFormats, sCalendarType, vDiff) {
var vPattern, aPatterns, oIntervalFormats;
if (!vDiff) {
// the call is from getCustomDateTimePattern
vPattern = oAvailableFormats[sSkeleton];
} else if (typeof vDiff === "string") {
// vDiff is given as a symbol
if (vDiff == "j" || vDiff == "J") {
vDiff = this.getPreferredHourSymbol();
}
oIntervalFormats = oAvailableFormats[sSkeleton];
vPattern = oIntervalFormats && oIntervalFormats[vDiff];
}
if (vPattern) {
if (typeof vPattern === "object") {
aPatterns = Object.keys(vPattern).map(function(sKey) {
return vPattern[sKey];
});
} else {
return vPattern;
}
}
if (!aPatterns) {
aPatterns = this._createFormatPattern(sSkeleton, oAvailableFormats, sCalendarType, vDiff);
}
if (aPatterns && aPatterns.length === 1) {
return aPatterns[0];
}
return aPatterns;
} | [
"function",
"(",
"sSkeleton",
",",
"oAvailableFormats",
",",
"sCalendarType",
",",
"vDiff",
")",
"{",
"var",
"vPattern",
",",
"aPatterns",
",",
"oIntervalFormats",
";",
"if",
"(",
"!",
"vDiff",
")",
"{",
"// the call is from getCustomDateTimePattern",
"vPattern",
... | /* Helper functions for skeleton pattern processing | [
"/",
"*",
"Helper",
"functions",
"for",
"skeleton",
"pattern",
"processing"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/LocaleData.js#L350-L384 | train | Returns the pattern for the given format skeleton. | [
30522,
3853,
1006,
7020,
11705,
18903,
2078,
1010,
1051,
12462,
11733,
3468,
14192,
11149,
1010,
4094,
8943,
30524,
1013,
1013,
1996,
2655,
2003,
2013,
2131,
7874,
20389,
13701,
7292,
4502,
12079,
2078,
21210,
20097,
2078,
1027,
1051,
12462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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) {
if (!oTable) {
return false;
}
var oRowSettingsTemplate = oTable.getRowSettingsTemplate();
if (!oRowSettingsTemplate) {
return false;
}
var sHighlight = oRowSettingsTemplate.getHighlight();
return oRowSettingsTemplate.isBound("highlight")
|| (sHighlight != null && sHighlight !== MessageType.None);
} | javascript | function(oTable) {
if (!oTable) {
return false;
}
var oRowSettingsTemplate = oTable.getRowSettingsTemplate();
if (!oRowSettingsTemplate) {
return false;
}
var sHighlight = oRowSettingsTemplate.getHighlight();
return oRowSettingsTemplate.isBound("highlight")
|| (sHighlight != null && sHighlight !== MessageType.None);
} | [
"function",
"(",
"oTable",
")",
"{",
"if",
"(",
"!",
"oTable",
")",
"{",
"return",
"false",
";",
"}",
"var",
"oRowSettingsTemplate",
"=",
"oTable",
".",
"getRowSettingsTemplate",
"(",
")",
";",
"if",
"(",
"!",
"oRowSettingsTemplate",
")",
"{",
"return",
... | Returns whether the table has row highlights.
@param {sap.ui.table.Table} oTable Instance of the table.
@returns {boolean} Whether the table has row highlights. | [
"Returns",
"whether",
"the",
"table",
"has",
"row",
"highlights",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L257-L272 | train | Returns true if the table has a row highlight property | [
30522,
3853,
1006,
27178,
3085,
1007,
1063,
2065,
1006,
999,
27178,
3085,
1007,
1063,
2709,
6270,
1025,
1065,
13075,
20298,
9333,
18319,
3070,
13473,
8737,
13806,
1027,
27178,
3085,
1012,
2131,
10524,
21678,
30524,
13473,
8737,
13806,
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... | |
ramda/ramda | scripts/transpile/esm-to-cjs.js | function(path, state) {
var defaultReexportSpecifier = path.get('specifiers')[0];
var local = defaultReexportSpecifier.get('local').get('name').node;
var exported = defaultReexportSpecifier.get('exported').get('name').node;
if (local !== 'default') {
throw path.buildCodeFrameError('Only named exports allowed are reexports in index.js');
}
// used by Program's exit visitor
state.set('reexports', true);
path.replaceWith(
buildExportsAssignment(
t.callExpression(
t.identifier('require'),
[t.stringLiteral(path.node.source.value)]
),
exported
)
);
} | javascript | function(path, state) {
var defaultReexportSpecifier = path.get('specifiers')[0];
var local = defaultReexportSpecifier.get('local').get('name').node;
var exported = defaultReexportSpecifier.get('exported').get('name').node;
if (local !== 'default') {
throw path.buildCodeFrameError('Only named exports allowed are reexports in index.js');
}
// used by Program's exit visitor
state.set('reexports', true);
path.replaceWith(
buildExportsAssignment(
t.callExpression(
t.identifier('require'),
[t.stringLiteral(path.node.source.value)]
),
exported
)
);
} | [
"function",
"(",
"path",
",",
"state",
")",
"{",
"var",
"defaultReexportSpecifier",
"=",
"path",
".",
"get",
"(",
"'specifiers'",
")",
"[",
"0",
"]",
";",
"var",
"local",
"=",
"defaultReexportSpecifier",
".",
"get",
"(",
"'local'",
")",
".",
"get",
"(",
... | /*
before
export { default as curryN } from './curryN';
after
module.exports.curryN = require('./curryN'); | [
"/",
"*",
"before",
"export",
"{",
"default",
"as",
"curryN",
"}",
"from",
".",
"/",
"curryN",
";"
] | 072d417a345e7087a95466a9825d43b6ca3a4941 | https://github.com/ramda/ramda/blob/072d417a345e7087a95466a9825d43b6ca3a4941/scripts/transpile/esm-to-cjs.js#L113-L134 | train | reexports is a function | [
30522,
3853,
1006,
4130,
1010,
2110,
1007,
1063,
13075,
12398,
9910,
2595,
25378,
5051,
6895,
8873,
2121,
1027,
4130,
1012,
2131,
1006,
1005,
28699,
28295,
1005,
1007,
1031,
1014,
1033,
1025,
13075,
2334,
1027,
12398,
9910,
2595,
25378,
505... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_XFCRC | function parse_XFCRC(blob) {
blob.l += 2;
var o = {cxfs:0, crc:0};
o.cxfs = blob.read_shift(2);
o.crc = blob.read_shift(4);
return o;
} | javascript | function parse_XFCRC(blob) {
blob.l += 2;
var o = {cxfs:0, crc:0};
o.cxfs = blob.read_shift(2);
o.crc = blob.read_shift(4);
return o;
} | [
"function",
"parse_XFCRC",
"(",
"blob",
")",
"{",
"blob",
".",
"l",
"+=",
"2",
";",
"var",
"o",
"=",
"{",
"cxfs",
":",
"0",
",",
"crc",
":",
"0",
"}",
";",
"o",
".",
"cxfs",
"=",
"blob",
".",
"read_shift",
"(",
"2",
")",
";",
"o",
".",
"crc... | /* [MS-XLS] 2.4.354 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"4",
".",
"354"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L6497-L6503 | train | Parse XFCRC | [
30522,
3853,
11968,
3366,
1035,
1060,
11329,
11890,
1006,
1038,
4135,
2497,
1007,
1063,
1038,
4135,
2497,
1012,
1048,
1009,
1027,
1016,
1025,
13075,
1051,
1027,
1063,
1039,
2595,
10343,
1024,
1014,
1010,
13675,
2278,
1024,
1014,
1065,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | javascript/atoms/dom.js | hiddenByOverflow | function hiddenByOverflow(e) {
return bot.dom.getOverflowState(e) == bot.dom.OverflowState.HIDDEN &&
goog.array.every(e.childNodes, function(n) {
return !bot.dom.isElement(n) || hiddenByOverflow(n) ||
!positiveSize(n);
});
} | javascript | function hiddenByOverflow(e) {
return bot.dom.getOverflowState(e) == bot.dom.OverflowState.HIDDEN &&
goog.array.every(e.childNodes, function(n) {
return !bot.dom.isElement(n) || hiddenByOverflow(n) ||
!positiveSize(n);
});
} | [
"function",
"hiddenByOverflow",
"(",
"e",
")",
"{",
"return",
"bot",
".",
"dom",
".",
"getOverflowState",
"(",
"e",
")",
"==",
"bot",
".",
"dom",
".",
"OverflowState",
".",
"HIDDEN",
"&&",
"goog",
".",
"array",
".",
"every",
"(",
"e",
".",
"childNodes"... | Elements that are hidden by overflow are not shown. | [
"Elements",
"that",
"are",
"hidden",
"by",
"overflow",
"are",
"not",
"shown",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/dom.js#L552-L558 | train | Checks if an element is hidden by overflow | [
30522,
3853,
5023,
3762,
7840,
12314,
1006,
1041,
1007,
1063,
2709,
28516,
1012,
14383,
1012,
2131,
7840,
12314,
9153,
2618,
1006,
1041,
1007,
1027,
1027,
28516,
1012,
14383,
1012,
2058,
12314,
9153,
2618,
1012,
5023,
1004,
1004,
27571,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Core.js | preloadLibrarySync | function preloadLibrarySync(libConfig) {
libConfig = evalLibConfig(libConfig);
var lib = libConfig.name,
fileType = libConfig.fileType,
libPackage = lib.replace(/\./g, '/'),
libLoaded = !!sap.ui.loader._.getModuleState(libPackage + '/library.js');
if ( fileType === 'none' || libLoaded ) {
return;
}
var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { });
// already preloaded?
if ( libInfo.pending === false ) {
return;
}
// currently loading
if ( libInfo.pending ) {
if ( libInfo.async ) {
Log.warning("request to load " + lib + " synchronously while async loading is pending; this causes a duplicate request and should be avoided by caller");
// fall through and preload synchronously
} else {
// sync cycle -> ignore nested call (would nevertheless be a dependency cycle)
Log.warning("request to load " + lib + " synchronously while sync loading is pending (cycle, ignored)");
return;
}
}
libInfo.pending = true;
libInfo.async = false;
var resolve;
libInfo.promise = new Promise(function(_resolve, _reject) {
resolve = _resolve;
});
var dependencies;
if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) {
var sPreloadModule = libPackage + '/library-preload';
try {
sap.ui.requireSync(sPreloadModule);
dependencies = dependenciesFromManifest(lib);
} catch (e) {
Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + ")");
if ( e && e.loadError && fileType !== 'js' ) {
dependencies = loadJSONSync(lib);
} // ignore other errors (preload shouldn't fail)
}
} else {
dependencies = loadJSONSync(lib);
}
if ( dependencies && dependencies.length ) {
dependencies.forEach(preloadLibrarySync);
}
libInfo.pending = false;
resolve();
} | javascript | function preloadLibrarySync(libConfig) {
libConfig = evalLibConfig(libConfig);
var lib = libConfig.name,
fileType = libConfig.fileType,
libPackage = lib.replace(/\./g, '/'),
libLoaded = !!sap.ui.loader._.getModuleState(libPackage + '/library.js');
if ( fileType === 'none' || libLoaded ) {
return;
}
var libInfo = mLibraryPreloadBundles[lib] || (mLibraryPreloadBundles[lib] = { });
// already preloaded?
if ( libInfo.pending === false ) {
return;
}
// currently loading
if ( libInfo.pending ) {
if ( libInfo.async ) {
Log.warning("request to load " + lib + " synchronously while async loading is pending; this causes a duplicate request and should be avoided by caller");
// fall through and preload synchronously
} else {
// sync cycle -> ignore nested call (would nevertheless be a dependency cycle)
Log.warning("request to load " + lib + " synchronously while sync loading is pending (cycle, ignored)");
return;
}
}
libInfo.pending = true;
libInfo.async = false;
var resolve;
libInfo.promise = new Promise(function(_resolve, _reject) {
resolve = _resolve;
});
var dependencies;
if ( fileType !== 'json' /* 'js' or 'both', not forced to JSON */ ) {
var sPreloadModule = libPackage + '/library-preload';
try {
sap.ui.requireSync(sPreloadModule);
dependencies = dependenciesFromManifest(lib);
} catch (e) {
Log.error("failed to load '" + sPreloadModule + "' (" + (e && e.message || e) + ")");
if ( e && e.loadError && fileType !== 'js' ) {
dependencies = loadJSONSync(lib);
} // ignore other errors (preload shouldn't fail)
}
} else {
dependencies = loadJSONSync(lib);
}
if ( dependencies && dependencies.length ) {
dependencies.forEach(preloadLibrarySync);
}
libInfo.pending = false;
resolve();
} | [
"function",
"preloadLibrarySync",
"(",
"libConfig",
")",
"{",
"libConfig",
"=",
"evalLibConfig",
"(",
"libConfig",
")",
";",
"var",
"lib",
"=",
"libConfig",
".",
"name",
",",
"fileType",
"=",
"libConfig",
".",
"fileType",
",",
"libPackage",
"=",
"lib",
".",
... | Preloads a library synchronously.
@param {string|object} libConfig Name of the library to preload or settings object describing library.
@param {string} [libConfig.name] Name of the library to preload
@param {boolean|undefined} [libConfig.json] Whether library supports only JSON (<code>true</code>) or only JS (<code>false</code>)
or whether both should be tried (undefined)
@private | [
"Preloads",
"a",
"library",
"synchronously",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Core.js#L1777-L1840 | train | Loads a library synchronously | [
30522,
3853,
3653,
11066,
29521,
19848,
7274,
6038,
2278,
1006,
5622,
9818,
2239,
8873,
2290,
1007,
1063,
5622,
9818,
2239,
8873,
2290,
1027,
9345,
6894,
9818,
2239,
8873,
2290,
1006,
5622,
9818,
2239,
8873,
2290,
1007,
1025,
13075,
5622,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rules/App.support.js | function(oController, viewId, aInvalidContent, fnProcessInvalidFunction) {
var _aInvalidControllerFunctions = [];
Object.keys(oController).forEach(function(sProtoKey) {
var sFnContent = oController[sProtoKey].toString().replace(/(\r\n|\n|\r)/gm, "");
aInvalidContent.forEach(function(sInvalidContent) {
if (sFnContent.indexOf(sInvalidContent) > 0) {
fnProcessInvalidFunction(oController.getMetadata().getName(), sProtoKey, sInvalidContent, viewId);
}
});
});
return _aInvalidControllerFunctions;
} | javascript | function(oController, viewId, aInvalidContent, fnProcessInvalidFunction) {
var _aInvalidControllerFunctions = [];
Object.keys(oController).forEach(function(sProtoKey) {
var sFnContent = oController[sProtoKey].toString().replace(/(\r\n|\n|\r)/gm, "");
aInvalidContent.forEach(function(sInvalidContent) {
if (sFnContent.indexOf(sInvalidContent) > 0) {
fnProcessInvalidFunction(oController.getMetadata().getName(), sProtoKey, sInvalidContent, viewId);
}
});
});
return _aInvalidControllerFunctions;
} | [
"function",
"(",
"oController",
",",
"viewId",
",",
"aInvalidContent",
",",
"fnProcessInvalidFunction",
")",
"{",
"var",
"_aInvalidControllerFunctions",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"oController",
")",
".",
"forEach",
"(",
"function",
"(",
"... | checks the given module's functions code for invalidContent returns an array which contains the functions with invalid content | [
"checks",
"the",
"given",
"module",
"s",
"functions",
"code",
"for",
"invalidContent",
"returns",
"an",
"array",
"which",
"contains",
"the",
"functions",
"with",
"invalid",
"content"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/rules/App.support.js#L65-L79 | train | Process invalid content | [
30522,
3853,
1006,
1051,
8663,
13181,
10820,
1010,
3193,
3593,
1010,
7110,
10175,
3593,
8663,
6528,
2102,
1010,
1042,
16275,
3217,
9623,
11493,
10175,
3593,
11263,
27989,
1007,
1063,
13075,
1035,
7110,
10175,
3593,
8663,
13181,
10820,
11263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/scene/screenshot.js | function () {
this.canvas.toBlob(function (blob) {
var fileName = 'screenshot-' + document.title.toLowerCase() + '-' + Date.now() + '.png';
var linkEl = document.createElement('a');
var url = URL.createObjectURL(blob);
linkEl.href = url;
linkEl.setAttribute('download', fileName);
linkEl.innerHTML = 'downloading...';
linkEl.style.display = 'none';
document.body.appendChild(linkEl);
setTimeout(function () {
linkEl.click();
document.body.removeChild(linkEl);
}, 1);
}, 'image/png');
} | javascript | function () {
this.canvas.toBlob(function (blob) {
var fileName = 'screenshot-' + document.title.toLowerCase() + '-' + Date.now() + '.png';
var linkEl = document.createElement('a');
var url = URL.createObjectURL(blob);
linkEl.href = url;
linkEl.setAttribute('download', fileName);
linkEl.innerHTML = 'downloading...';
linkEl.style.display = 'none';
document.body.appendChild(linkEl);
setTimeout(function () {
linkEl.click();
document.body.removeChild(linkEl);
}, 1);
}, 'image/png');
} | [
"function",
"(",
")",
"{",
"this",
".",
"canvas",
".",
"toBlob",
"(",
"function",
"(",
"blob",
")",
"{",
"var",
"fileName",
"=",
"'screenshot-'",
"+",
"document",
".",
"title",
".",
"toLowerCase",
"(",
")",
"+",
"'-'",
"+",
"Date",
".",
"now",
"(",
... | Download capture to file. | [
"Download",
"capture",
"to",
"file",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/screenshot.js#L238-L253 | train | Download the screenshot | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
10683,
1012,
2000,
16558,
16429,
1006,
3853,
1006,
1038,
4135,
2497,
1007,
1063,
13075,
5371,
18442,
1027,
1005,
12117,
12326,
1011,
1005,
1009,
6254,
1012,
2516,
1012,
2000,
27663,
18992,
3366,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/screenshot.js | create | function create(controller, boxes) {
var doc = controller.window.document;
var maxWidth = doc.documentElement.boxObject.width;
var maxHeight = doc.documentElement.boxObject.height;
var rect = [];
for (var i = 0, j = boxes.length; i < j; ++i) {
rect = boxes[i];
if (rect[0] + rect[2] > maxWidth) maxWidth = rect[0] + rect[2];
if (rect[1] + rect[3] > maxHeight) maxHeight = rect[1] + rect[3];
}
var canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
var width = doc.documentElement.boxObject.width;
var height = doc.documentElement.boxObject.height;
canvas.width = maxWidth;
canvas.height = maxHeight;
var ctx = canvas.getContext("2d");
ctx.clearRect(0,0, canvas.width, canvas.height);
ctx.save();
ctx.drawWindow(controller.window, 0, 0, width, height, "rgb(0,0,0)");
ctx.restore();
ctx.save();
ctx.fillStyle = "rgba(255,0,0,0.4)";
for (var i = 0, j = boxes.length; i < j; ++i) {
rect = boxes[i];
ctx.fillRect(rect[0], rect[1], rect[2], rect[3]);
}
ctx.restore();
_saveCanvas(canvas);
} | javascript | function create(controller, boxes) {
var doc = controller.window.document;
var maxWidth = doc.documentElement.boxObject.width;
var maxHeight = doc.documentElement.boxObject.height;
var rect = [];
for (var i = 0, j = boxes.length; i < j; ++i) {
rect = boxes[i];
if (rect[0] + rect[2] > maxWidth) maxWidth = rect[0] + rect[2];
if (rect[1] + rect[3] > maxHeight) maxHeight = rect[1] + rect[3];
}
var canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
var width = doc.documentElement.boxObject.width;
var height = doc.documentElement.boxObject.height;
canvas.width = maxWidth;
canvas.height = maxHeight;
var ctx = canvas.getContext("2d");
ctx.clearRect(0,0, canvas.width, canvas.height);
ctx.save();
ctx.drawWindow(controller.window, 0, 0, width, height, "rgb(0,0,0)");
ctx.restore();
ctx.save();
ctx.fillStyle = "rgba(255,0,0,0.4)";
for (var i = 0, j = boxes.length; i < j; ++i) {
rect = boxes[i];
ctx.fillRect(rect[0], rect[1], rect[2], rect[3]);
}
ctx.restore();
_saveCanvas(canvas);
} | [
"function",
"create",
"(",
"controller",
",",
"boxes",
")",
"{",
"var",
"doc",
"=",
"controller",
".",
"window",
".",
"document",
";",
"var",
"maxWidth",
"=",
"doc",
".",
"documentElement",
".",
"boxObject",
".",
"width",
";",
"var",
"maxHeight",
"=",
"d... | This function creates a screenshot of the window provided in the given
controller and highlights elements from the coordinates provided in the
given boxes-array.
@param {array of array of int} boxes
@param {MozmillController} controller | [
"This",
"function",
"creates",
"a",
"screenshot",
"of",
"the",
"window",
"provided",
"in",
"the",
"given",
"controller",
"and",
"highlights",
"elements",
"from",
"the",
"coordinates",
"provided",
"in",
"the",
"given",
"boxes",
"-",
"array",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/screenshot.js#L50-L79 | train | Create a canvas | [
30522,
3853,
3443,
1006,
11486,
1010,
8378,
1007,
1063,
13075,
9986,
1027,
11486,
1012,
3332,
1012,
6254,
1025,
13075,
4098,
9148,
11927,
2232,
1027,
9986,
1012,
6254,
12260,
3672,
1012,
3482,
16429,
20614,
1012,
9381,
1025,
13075,
4098,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/node/TernNodeDomain.js | inferArrTypeToString | function inferArrTypeToString(inferArrType) {
var result = "Array.<";
result += inferArrType.props["<i>"].types.map(inferTypeToString).join(", ");
// workaround case where types is zero length
if (inferArrType.props["<i>"].types.length === 0) {
result += "Object";
}
result += ">";
return result;
} | javascript | function inferArrTypeToString(inferArrType) {
var result = "Array.<";
result += inferArrType.props["<i>"].types.map(inferTypeToString).join(", ");
// workaround case where types is zero length
if (inferArrType.props["<i>"].types.length === 0) {
result += "Object";
}
result += ">";
return result;
} | [
"function",
"inferArrTypeToString",
"(",
"inferArrType",
")",
"{",
"var",
"result",
"=",
"\"Array.<\"",
";",
"result",
"+=",
"inferArrType",
".",
"props",
"[",
"\"<i>\"",
"]",
".",
"types",
".",
"map",
"(",
"inferTypeToString",
")",
".",
"join",
"(",
"\", \"... | Convert an infer array type to a string.
Formatted using google closure style. For example:
"Array.<string, number>"
@param {Infer.Arr} inferArrType
@return {string} - array formatted in google closure style. | [
"Convert",
"an",
"infer",
"array",
"type",
"to",
"a",
"string",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L515-L527 | train | Convert an array type to a string | [
30522,
3853,
1999,
27709,
12171,
13874,
13122,
18886,
3070,
1006,
1999,
27709,
12171,
13874,
1007,
1063,
13075,
2765,
1027,
1000,
9140,
1012,
1026,
1000,
30524,
1006,
1000,
1010,
1000,
1007,
1025,
1013,
1013,
2147,
24490,
2553,
2073,
4127,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/connectors/mqttsocket.js | function(id, socket, adaptor) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.stream.remoteAddress,
port: socket.stream.remotePort
};
this.adaptor = adaptor;
var self = this;
socket.on('close', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'disconnect'));
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('pingreq', function(packet) {
socket.pingresp();
});
socket.on('subscribe', this.adaptor.onSubscribe.bind(this.adaptor, this));
socket.on('publish', this.adaptor.onPublish.bind(this.adaptor, this));
this.state = ST_INITED;
// TODO: any other events?
} | javascript | function(id, socket, adaptor) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.stream.remoteAddress,
port: socket.stream.remotePort
};
this.adaptor = adaptor;
var self = this;
socket.on('close', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'disconnect'));
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('pingreq', function(packet) {
socket.pingresp();
});
socket.on('subscribe', this.adaptor.onSubscribe.bind(this.adaptor, this));
socket.on('publish', this.adaptor.onPublish.bind(this.adaptor, this));
this.state = ST_INITED;
// TODO: any other events?
} | [
"function",
"(",
"id",
",",
"socket",
",",
"adaptor",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"this",
".",
"remoteAddress",
"=",
"{",
"ip",
":",
"... | Socket class that wraps socket and websocket to provide unified interface for up level. | [
"Socket",
"class",
"that",
"wraps",
"socket",
"and",
"websocket",
"to",
"provide",
"unified",
"interface",
"for",
"up",
"level",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/mqttsocket.js#L10-L37 | train | A Knockout connection | [
30522,
3853,
1006,
8909,
1010,
22278,
1010,
15581,
2953,
1007,
1063,
2724,
23238,
12079,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
8909,
1027,
8909,
1025,
2023,
1012,
22278,
1027,
22278,
1025,
2023,
1012,
6556,
4215,
16200,
4757,
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... | |
pixijs/pixi.js | packages/utils/src/color/premultiply.js | mapPremultipliedBlendModes | function mapPremultipliedBlendModes()
{
const pm = [];
const npm = [];
for (let i = 0; i < 32; i++)
{
pm[i] = i;
npm[i] = i;
}
pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;
pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;
pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;
npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;
npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;
npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;
const array = [];
array.push(npm);
array.push(pm);
return array;
} | javascript | function mapPremultipliedBlendModes()
{
const pm = [];
const npm = [];
for (let i = 0; i < 32; i++)
{
pm[i] = i;
npm[i] = i;
}
pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;
pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;
pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;
npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;
npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;
npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;
const array = [];
array.push(npm);
array.push(pm);
return array;
} | [
"function",
"mapPremultipliedBlendModes",
"(",
")",
"{",
"const",
"pm",
"=",
"[",
"]",
";",
"const",
"npm",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"32",
";",
"i",
"++",
")",
"{",
"pm",
"[",
"i",
"]",
"=",
"i",
... | Corrects PixiJS blend, takes premultiplied alpha into account
@memberof PIXI.utils
@function mapPremultipliedBlendModes
@private
@param {Array<number[]>} [array] - The array to output into.
@return {Array<number[]>} Mapped modes. | [
"Corrects",
"PixiJS",
"blend",
"takes",
"premultiplied",
"alpha",
"into",
"account"
] | 99ae03b7565ae7ca5a6de633b0a277f7128fa4d0 | https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/utils/src/color/premultiply.js#L12-L37 | train | Map premultiplied blend modes to the correct order | [
30522,
3853,
4949,
28139,
12274,
7096,
11514,
8751,
18939,
7770,
22117,
19847,
1006,
1007,
1063,
9530,
3367,
7610,
1027,
1031,
1033,
1025,
9530,
3367,
27937,
2213,
1027,
1031,
1033,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1025,
1045,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/measure.js | function(evt) {
if (evt.dragging) {
return;
}
/** @type {string} */
let helpMsg = 'Click to start drawing';
if (sketch) {
const geom = sketch.getGeometry();
if (geom instanceof Polygon) {
helpMsg = continuePolygonMsg;
} else if (geom instanceof LineString) {
helpMsg = continueLineMsg;
}
}
helpTooltipElement.innerHTML = helpMsg;
helpTooltip.setPosition(evt.coordinate);
helpTooltipElement.classList.remove('hidden');
} | javascript | function(evt) {
if (evt.dragging) {
return;
}
/** @type {string} */
let helpMsg = 'Click to start drawing';
if (sketch) {
const geom = sketch.getGeometry();
if (geom instanceof Polygon) {
helpMsg = continuePolygonMsg;
} else if (geom instanceof LineString) {
helpMsg = continueLineMsg;
}
}
helpTooltipElement.innerHTML = helpMsg;
helpTooltip.setPosition(evt.coordinate);
helpTooltipElement.classList.remove('hidden');
} | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
".",
"dragging",
")",
"{",
"return",
";",
"}",
"/** @type {string} */",
"let",
"helpMsg",
"=",
"'Click to start drawing'",
";",
"if",
"(",
"sketch",
")",
"{",
"const",
"geom",
"=",
"sketch",
".",
"getGe... | Handle pointer move.
@param {import("../src/ol/MapBrowserEvent").default} evt The event. | [
"Handle",
"pointer",
"move",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/measure.js#L92-L112 | train | This function is called when the user clicks on a drag event. | [
30522,
3853,
1006,
23408,
2102,
1007,
1063,
2065,
1006,
23408,
2102,
1012,
11920,
1007,
1063,
2709,
1025,
1065,
1013,
1008,
1008,
1030,
2828,
1063,
5164,
1065,
1008,
1013,
2292,
2393,
5244,
2290,
1027,
1005,
11562,
2000,
2707,
5059,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dequelabs/axe-core | lib/core/utils/get-xpath.js | getXPathArray | function getXPathArray(node, path) {
var sibling, count;
// Gets an XPath for an element which describes its hierarchical location.
if (!node) {
return [];
}
if (!path && node.nodeType === 9) {
// special case for when we are called and give the document itself as the starting node
path = [
{
str: 'html'
}
];
return path;
}
path = path || [];
if (node.parentNode && node.parentNode !== node) {
path = getXPathArray(node.parentNode, path);
}
if (node.previousSibling) {
count = 1;
sibling = node.previousSibling;
do {
if (sibling.nodeType === 1 && sibling.nodeName === node.nodeName) {
count++;
}
sibling = sibling.previousSibling;
} while (sibling);
if (count === 1) {
count = null;
}
} else if (node.nextSibling) {
sibling = node.nextSibling;
do {
if (sibling.nodeType === 1 && sibling.nodeName === node.nodeName) {
count = 1;
sibling = null;
} else {
count = null;
sibling = sibling.previousSibling;
}
} while (sibling);
}
if (node.nodeType === 1) {
var element = {};
element.str = node.nodeName.toLowerCase();
// add the id and the count so we can construct robust versions of the xpath
var id =
node.getAttribute && axe.utils.escapeSelector(node.getAttribute('id'));
if (id && node.ownerDocument.querySelectorAll('#' + id).length === 1) {
element.id = node.getAttribute('id');
}
if (count > 1) {
element.count = count;
}
path.push(element);
}
return path;
} | javascript | function getXPathArray(node, path) {
var sibling, count;
// Gets an XPath for an element which describes its hierarchical location.
if (!node) {
return [];
}
if (!path && node.nodeType === 9) {
// special case for when we are called and give the document itself as the starting node
path = [
{
str: 'html'
}
];
return path;
}
path = path || [];
if (node.parentNode && node.parentNode !== node) {
path = getXPathArray(node.parentNode, path);
}
if (node.previousSibling) {
count = 1;
sibling = node.previousSibling;
do {
if (sibling.nodeType === 1 && sibling.nodeName === node.nodeName) {
count++;
}
sibling = sibling.previousSibling;
} while (sibling);
if (count === 1) {
count = null;
}
} else if (node.nextSibling) {
sibling = node.nextSibling;
do {
if (sibling.nodeType === 1 && sibling.nodeName === node.nodeName) {
count = 1;
sibling = null;
} else {
count = null;
sibling = sibling.previousSibling;
}
} while (sibling);
}
if (node.nodeType === 1) {
var element = {};
element.str = node.nodeName.toLowerCase();
// add the id and the count so we can construct robust versions of the xpath
var id =
node.getAttribute && axe.utils.escapeSelector(node.getAttribute('id'));
if (id && node.ownerDocument.querySelectorAll('#' + id).length === 1) {
element.id = node.getAttribute('id');
}
if (count > 1) {
element.count = count;
}
path.push(element);
}
return path;
} | [
"function",
"getXPathArray",
"(",
"node",
",",
"path",
")",
"{",
"var",
"sibling",
",",
"count",
";",
"// Gets an XPath for an element which describes its hierarchical location.",
"if",
"(",
"!",
"node",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"!",
... | /*global axe | [
"/",
"*",
"global",
"axe"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/get-xpath.js#L3-L63 | train | Returns an array of XPath expression nodes that are closest to the given node. | [
30522,
3853,
2131,
2595,
15069,
2906,
9447,
1006,
13045,
1010,
4130,
1007,
1063,
13075,
22941,
1010,
4175,
1025,
1013,
1013,
4152,
2019,
26726,
8988,
2005,
2019,
5783,
2029,
5577,
2049,
25835,
3295,
1012,
2065,
1006,
999,
13045,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zeit/pkg | prelude/bootstrap.js | findNativeAddonForExists | function findNativeAddonForExists (path) {
var foundPath = findNativeAddonSyncFreeFromRequire(path);
if (!foundPath) return false;
return ancestor.existsSync.call(fs, foundPath);
} | javascript | function findNativeAddonForExists (path) {
var foundPath = findNativeAddonSyncFreeFromRequire(path);
if (!foundPath) return false;
return ancestor.existsSync.call(fs, foundPath);
} | [
"function",
"findNativeAddonForExists",
"(",
"path",
")",
"{",
"var",
"foundPath",
"=",
"findNativeAddonSyncFreeFromRequire",
"(",
"path",
")",
";",
"if",
"(",
"!",
"foundPath",
")",
"return",
"false",
";",
"return",
"ancestor",
".",
"existsSync",
".",
"call",
... | /////////////////////////////////////////////////////////////// exists //////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// | [
"///////////////////////////////////////////////////////////////",
"exists",
"////////////////////////////////////////////////////////",
"///////////////////////////////////////////////////////////////"
] | 3775ab6decc2f8f013142e1282934c12fbd1881e | https://github.com/zeit/pkg/blob/3775ab6decc2f8f013142e1282934c12fbd1881e/prelude/bootstrap.js#L1003-L1007 | train | Find a native add - on | [
30522,
3853,
2424,
19833,
3512,
4215,
5280,
29278,
10288,
5130,
1006,
4130,
1007,
1063,
13075,
2179,
15069,
1027,
2424,
19833,
3512,
4215,
5280,
6508,
12273,
23301,
19699,
5358,
2890,
15549,
2890,
1006,
4130,
1007,
1025,
2065,
1006,
999,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
testing-library/dom-testing-library | src/query-helpers.js | makeFindQuery | function makeFindQuery(getter) {
return (container, text, options, waitForElementOptions) =>
waitForElement(
() => getter(container, text, options),
waitForElementOptions,
)
} | javascript | function makeFindQuery(getter) {
return (container, text, options, waitForElementOptions) =>
waitForElement(
() => getter(container, text, options),
waitForElementOptions,
)
} | [
"function",
"makeFindQuery",
"(",
"getter",
")",
"{",
"return",
"(",
"container",
",",
"text",
",",
"options",
",",
"waitForElementOptions",
")",
"=>",
"waitForElement",
"(",
"(",
")",
"=>",
"getter",
"(",
"container",
",",
"text",
",",
"options",
")",
","... | this accepts a getter query function and returns a function which calls waitForElement and passing a function which invokes the getter. | [
"this",
"accepts",
"a",
"getter",
"query",
"function",
"and",
"returns",
"a",
"function",
"which",
"calls",
"waitForElement",
"and",
"passing",
"a",
"function",
"which",
"invokes",
"the",
"getter",
"."
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L95-L101 | train | Creates a function to return a query that will wait until the element is found | [
30522,
3853,
2191,
16294,
2094,
4226,
2854,
1006,
2131,
3334,
1007,
1063,
2709,
1006,
11661,
1010,
3793,
1010,
7047,
1010,
3524,
29278,
12260,
23065,
16790,
2015,
1007,
1027,
1028,
3524,
29278,
12260,
3672,
1006,
1006,
1007,
1027,
1028,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lovell/sharp | lib/output.js | webp | function webp (options) {
if (is.object(options) && is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
this.options.webpQuality = options.quality;
} else {
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
}
}
if (is.object(options) && is.defined(options.alphaQuality)) {
if (is.integer(options.alphaQuality) && is.inRange(options.alphaQuality, 0, 100)) {
this.options.webpAlphaQuality = options.alphaQuality;
} else {
throw new Error('Invalid webp alpha quality (integer, 0-100) ' + options.alphaQuality);
}
}
if (is.object(options) && is.defined(options.lossless)) {
this._setBooleanOption('webpLossless', options.lossless);
}
if (is.object(options) && is.defined(options.nearLossless)) {
this._setBooleanOption('webpNearLossless', options.nearLossless);
}
return this._updateFormatOut('webp', options);
} | javascript | function webp (options) {
if (is.object(options) && is.defined(options.quality)) {
if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
this.options.webpQuality = options.quality;
} else {
throw new Error('Invalid quality (integer, 1-100) ' + options.quality);
}
}
if (is.object(options) && is.defined(options.alphaQuality)) {
if (is.integer(options.alphaQuality) && is.inRange(options.alphaQuality, 0, 100)) {
this.options.webpAlphaQuality = options.alphaQuality;
} else {
throw new Error('Invalid webp alpha quality (integer, 0-100) ' + options.alphaQuality);
}
}
if (is.object(options) && is.defined(options.lossless)) {
this._setBooleanOption('webpLossless', options.lossless);
}
if (is.object(options) && is.defined(options.nearLossless)) {
this._setBooleanOption('webpNearLossless', options.nearLossless);
}
return this._updateFormatOut('webp', options);
} | [
"function",
"webp",
"(",
"options",
")",
"{",
"if",
"(",
"is",
".",
"object",
"(",
"options",
")",
"&&",
"is",
".",
"defined",
"(",
"options",
".",
"quality",
")",
")",
"{",
"if",
"(",
"is",
".",
"integer",
"(",
"options",
".",
"quality",
")",
"&... | Use these WebP options for output image.
@example
// Convert any input to lossless WebP output
const data = await sharp(input)
.webp({ lossless: true })
.toBuffer();
@param {Object} [options] - output options
@param {Number} [options.quality=80] - quality, integer 1-100
@param {Number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100
@param {Boolean} [options.lossless=false] - use lossless compression mode
@param {Boolean} [options.nearLossless=false] - use near_lossless compression mode
@param {Boolean} [options.force=true] - force WebP output, otherwise attempt to use input format
@returns {Sharp}
@throws {Error} Invalid options | [
"Use",
"these",
"WebP",
"options",
"for",
"output",
"image",
"."
] | 05d76eeadfe54713606a615185b2da047923406b | https://github.com/lovell/sharp/blob/05d76eeadfe54713606a615185b2da047923406b/lib/output.js#L297-L319 | train | Update webp format | [
30522,
3853,
4773,
2361,
1006,
7047,
1007,
1063,
2065,
1006,
2003,
1012,
4874,
1006,
7047,
1007,
1004,
1004,
2003,
1012,
4225,
1006,
7047,
1012,
3737,
1007,
1007,
1063,
2065,
1006,
2003,
1012,
16109,
1006,
7047,
1012,
3737,
1007,
1004,
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... |
aws/aws-sdk-js | lib/services/s3.js | correctBucketRegionFromCache | function correctBucketRegionFromCache(req) {
var bucket = req.params.Bucket || null;
if (bucket) {
var service = req.service;
var requestRegion = req.httpRequest.region;
var cachedRegion = service.bucketRegionCache[bucket];
if (cachedRegion && cachedRegion !== requestRegion) {
service.updateReqBucketRegion(req, cachedRegion);
}
}
} | javascript | function correctBucketRegionFromCache(req) {
var bucket = req.params.Bucket || null;
if (bucket) {
var service = req.service;
var requestRegion = req.httpRequest.region;
var cachedRegion = service.bucketRegionCache[bucket];
if (cachedRegion && cachedRegion !== requestRegion) {
service.updateReqBucketRegion(req, cachedRegion);
}
}
} | [
"function",
"correctBucketRegionFromCache",
"(",
"req",
")",
"{",
"var",
"bucket",
"=",
"req",
".",
"params",
".",
"Bucket",
"||",
"null",
";",
"if",
"(",
"bucket",
")",
"{",
"var",
"service",
"=",
"req",
".",
"service",
";",
"var",
"requestRegion",
"=",... | Corrects request region if bucket's cached region is different
@api private | [
"Corrects",
"request",
"region",
"if",
"bucket",
"s",
"cached",
"region",
"is",
"different"
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/s3.js#L703-L713 | train | This function is called by the regionCache function to check if the region is not the same as the request region. | [
30522,
3853,
6149,
24204,
3388,
23784,
19699,
5358,
3540,
5403,
1006,
2128,
4160,
1007,
1063,
13075,
13610,
1027,
2128,
4160,
1012,
11498,
5244,
1012,
13610,
1064,
1064,
19701,
1025,
2065,
1006,
13610,
1007,
1063,
13075,
2326,
1027,
2128,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/qunit.js | bindCallbacks | function bindCallbacks( o, callbacks, args ) {
var prop = QUnit.objectType( o );
if ( prop ) {
if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
return callbacks[ prop ].apply( callbacks, args );
} else {
return callbacks[ prop ]; // or undefined
}
}
} | javascript | function bindCallbacks( o, callbacks, args ) {
var prop = QUnit.objectType( o );
if ( prop ) {
if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
return callbacks[ prop ].apply( callbacks, args );
} else {
return callbacks[ prop ]; // or undefined
}
}
} | [
"function",
"bindCallbacks",
"(",
"o",
",",
"callbacks",
",",
"args",
")",
"{",
"var",
"prop",
"=",
"QUnit",
".",
"objectType",
"(",
"o",
")",
";",
"if",
"(",
"prop",
")",
"{",
"if",
"(",
"QUnit",
".",
"objectType",
"(",
"callbacks",
"[",
"prop",
"... | Call the o related callback with the given arguments. | [
"Call",
"the",
"o",
"related",
"callback",
"with",
"the",
"given",
"arguments",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/qunit.js#L1427-L1436 | train | bind callbacks to object | [
30522,
3853,
14187,
9289,
20850,
8684,
2015,
1006,
1051,
1010,
2655,
12221,
1010,
12098,
5620,
1007,
1063,
13075,
17678,
1027,
24209,
3490,
2102,
1012,
4874,
13874,
1006,
1051,
1007,
1025,
2065,
1006,
17678,
1007,
1063,
2065,
1006,
24209,
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... |
apache/incubator-echarts | src/util/graphic.js | rollbackDefaultTextStyle | function rollbackDefaultTextStyle(style) {
var insideRollback = style.insideRollback;
if (insideRollback) {
style.textFill = insideRollback.textFill;
style.textStroke = insideRollback.textStroke;
style.textStrokeWidth = insideRollback.textStrokeWidth;
style.insideRollback = null;
}
} | javascript | function rollbackDefaultTextStyle(style) {
var insideRollback = style.insideRollback;
if (insideRollback) {
style.textFill = insideRollback.textFill;
style.textStroke = insideRollback.textStroke;
style.textStrokeWidth = insideRollback.textStrokeWidth;
style.insideRollback = null;
}
} | [
"function",
"rollbackDefaultTextStyle",
"(",
"style",
")",
"{",
"var",
"insideRollback",
"=",
"style",
".",
"insideRollback",
";",
"if",
"(",
"insideRollback",
")",
"{",
"style",
".",
"textFill",
"=",
"insideRollback",
".",
"textFill",
";",
"style",
".",
"text... | Consider the case: in a scatter,
label: {
normal: {position: 'inside'},
emphasis: {position: 'top'}
}
In the normal state, the `textFill` will be set as '#fff' for pretty view (see
`applyDefaultTextStyle`), but when switching to emphasis state, the `textFill`
should be retured to 'autoColor', but not keep '#fff'. | [
"Consider",
"the",
"case",
":",
"in",
"a",
"scatter",
"label",
":",
"{",
"normal",
":",
"{",
"position",
":",
"inside",
"}",
"emphasis",
":",
"{",
"position",
":",
"top",
"}",
"}",
"In",
"the",
"normal",
"state",
"the",
"textFill",
"will",
"be",
"set... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/util/graphic.js#L979-L987 | train | Rollback the default text style | [
30522,
3853,
4897,
5963,
3207,
7011,
11314,
18209,
21756,
2571,
1006,
2806,
1007,
1063,
13075,
25297,
14511,
5963,
1027,
2806,
1012,
25297,
14511,
5963,
1025,
2065,
1006,
25297,
14511,
5963,
1007,
1063,
2806,
1012,
3793,
8873,
3363,
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... |
radare/radare2 | shlr/www/graph/js-graph-it.js | BlocksToMoveVisitor | function BlocksToMoveVisitor() {
this.visit = function(element) {
if (isBlock(element)) {
blocksToMove.push(findBlock(element.id));
return false;
}
return true;
}
} | javascript | function BlocksToMoveVisitor() {
this.visit = function(element) {
if (isBlock(element)) {
blocksToMove.push(findBlock(element.id));
return false;
}
return true;
}
} | [
"function",
"BlocksToMoveVisitor",
"(",
")",
"{",
"this",
".",
"visit",
"=",
"function",
"(",
"element",
")",
"{",
"if",
"(",
"isBlock",
"(",
"element",
")",
")",
"{",
"blocksToMove",
".",
"push",
"(",
"findBlock",
"(",
"element",
".",
"id",
")",
")",
... | this visitor is used to find blocks nested in the element being moved. | [
"this",
"visitor",
"is",
"used",
"to",
"find",
"blocks",
"nested",
"in",
"the",
"element",
"being",
"moved",
"."
] | bf5e3028810a0ec7c267c6fe4bfad639b4819e35 | https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L69-L77 | train | This is the visitor that will find blocks that are not in the DOM. | [
30522,
3853,
5991,
20389,
21818,
11365,
15660,
1006,
1007,
1063,
2023,
1012,
3942,
1027,
3853,
1006,
5783,
1007,
1063,
2065,
1006,
2003,
23467,
1006,
5783,
1007,
1007,
1063,
5991,
20389,
21818,
1012,
5245,
1006,
2424,
23467,
1006,
5783,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js | _getRelevantElements | function _getRelevantElements(oElement, oRelevantContainer, sAggregationName) {
if (oRelevantContainer && oRelevantContainer !== oElement) {
var sEntityName = RtaUtils.getEntityTypeByPath(
oElement.getModel(),
_getBindingPath(oElement, sAggregationName)
);
return ElementUtil
.findAllSiblingsInContainer(oElement, oRelevantContainer)
// We accept only siblings that are bound on the same model
.filter(function (oSiblingElement) {
var sPath = _getBindingPath(oSiblingElement, sAggregationName);
if (sPath) {
return RtaUtils.getEntityTypeByPath(oSiblingElement.getModel(), sPath) === sEntityName;
}
return false;
});
} else {
return [oElement];
}
} | javascript | function _getRelevantElements(oElement, oRelevantContainer, sAggregationName) {
if (oRelevantContainer && oRelevantContainer !== oElement) {
var sEntityName = RtaUtils.getEntityTypeByPath(
oElement.getModel(),
_getBindingPath(oElement, sAggregationName)
);
return ElementUtil
.findAllSiblingsInContainer(oElement, oRelevantContainer)
// We accept only siblings that are bound on the same model
.filter(function (oSiblingElement) {
var sPath = _getBindingPath(oSiblingElement, sAggregationName);
if (sPath) {
return RtaUtils.getEntityTypeByPath(oSiblingElement.getModel(), sPath) === sEntityName;
}
return false;
});
} else {
return [oElement];
}
} | [
"function",
"_getRelevantElements",
"(",
"oElement",
",",
"oRelevantContainer",
",",
"sAggregationName",
")",
"{",
"if",
"(",
"oRelevantContainer",
"&&",
"oRelevantContainer",
"!==",
"oElement",
")",
"{",
"var",
"sEntityName",
"=",
"RtaUtils",
".",
"getEntityTypeByPat... | Retrieving sibling elements from its parent container which are bound to the same Model (important!)
@param {sap.ui.core.Control} oElement - element for which we're looking for siblings
@param {sap.ui.core.Control} oRelevantContainer - "parent" container of the oElement
@param {string} sAggregationName - name of the aggregation of the action
@return {Array.<sap.ui.core.Control>} - returns an array with found siblings elements
@private | [
"Retrieving",
"sibling",
"elements",
"from",
"its",
"parent",
"container",
"which",
"are",
"bound",
"to",
"the",
"same",
"Model",
"(",
"important!",
")"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L264-L284 | train | Returns an array of elements that are siblings of the given element | [
30522,
3853,
1035,
2131,
16570,
13331,
10111,
16930,
11187,
1006,
1051,
12260,
3672,
1010,
10848,
20414,
4630,
8663,
18249,
2121,
1010,
7842,
13871,
2890,
12540,
18442,
1007,
1063,
2065,
1006,
10848,
20414,
4630,
8663,
18249,
2121,
1004,
1004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js | function(oList, bSkipNotify, fCallback){
var fFinalize = function(jRef) {
if (!bSkipNotify) {
var oAttr = oList._getAtt();
var iSelectedIndex = oAttr.getParent().indexOfAttribute(oAttr);
clearAttribute(oList.getParent(), oAttr, iSelectedIndex, true);
setHeaderText(oList.getParent());
getTopList(oList)._selectionChanged(oAttr);
}
oList.destroy();
if (fCallback) {
fCallback();
}
};
var oListRef = oList.getDomRef();
if (oListRef) {
animate(jQuery(oListRef), true, 0, function(jRef) {
jRef.css("overflow", "hidden");
}, fFinalize);
} else {
fFinalize();
}
} | javascript | function(oList, bSkipNotify, fCallback){
var fFinalize = function(jRef) {
if (!bSkipNotify) {
var oAttr = oList._getAtt();
var iSelectedIndex = oAttr.getParent().indexOfAttribute(oAttr);
clearAttribute(oList.getParent(), oAttr, iSelectedIndex, true);
setHeaderText(oList.getParent());
getTopList(oList)._selectionChanged(oAttr);
}
oList.destroy();
if (fCallback) {
fCallback();
}
};
var oListRef = oList.getDomRef();
if (oListRef) {
animate(jQuery(oListRef), true, 0, function(jRef) {
jRef.css("overflow", "hidden");
}, fFinalize);
} else {
fFinalize();
}
} | [
"function",
"(",
"oList",
",",
"bSkipNotify",
",",
"fCallback",
")",
"{",
"var",
"fFinalize",
"=",
"function",
"(",
"jRef",
")",
"{",
"if",
"(",
"!",
"bSkipNotify",
")",
"{",
"var",
"oAttr",
"=",
"oList",
".",
"_getAtt",
"(",
")",
";",
"var",
"iSelec... | Handles the close of the list | [
"Handles",
"the",
"close",
"of",
"the",
"list"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L1375-L1398 | train | Clears the attribute of the given list and calls the callback function | [
30522,
3853,
1006,
19330,
2923,
1010,
18667,
3211,
2361,
17048,
8757,
1010,
4429,
8095,
5963,
1007,
1063,
13075,
21461,
13290,
4697,
1027,
3853,
1006,
3781,
12879,
1007,
1063,
2065,
1006,
999,
18667,
3211,
2361,
17048,
8757,
1007,
1063,
130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js | seekMetadataLRU | function seekMetadataLRU(self) {
while (self._lru <= self._mru && self._metadata.__byIndex__[self._lru] == undefined) {
self._lru++;
}
// The lru should never skip item. So current value should always point to the 1st (numeric order) non-empty
// item in self._metadata.__byIndex map
return (self._lru <= self._mru);
} | javascript | function seekMetadataLRU(self) {
while (self._lru <= self._mru && self._metadata.__byIndex__[self._lru] == undefined) {
self._lru++;
}
// The lru should never skip item. So current value should always point to the 1st (numeric order) non-empty
// item in self._metadata.__byIndex map
return (self._lru <= self._mru);
} | [
"function",
"seekMetadataLRU",
"(",
"self",
")",
"{",
"while",
"(",
"self",
".",
"_lru",
"<=",
"self",
".",
"_mru",
"&&",
"self",
".",
"_metadata",
".",
"__byIndex__",
"[",
"self",
".",
"_lru",
"]",
"==",
"undefined",
")",
"{",
"self",
".",
"_lru",
"... | Moves the pointer of LRU to the next available (non-empty) item starting from the current position.
@returns {boolean} true if the seek moved the pointer to an existing item, false - if no item is found | [
"Moves",
"the",
"pointer",
"of",
"LRU",
"to",
"the",
"next",
"available",
"(",
"non",
"-",
"empty",
")",
"item",
"starting",
"from",
"the",
"current",
"position",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/cache/LRUPersistentCache.js#L831-L838 | train | Seeks the metadata LRU to the next non - empty item in the metadata. | [
30522,
3853,
6148,
11368,
8447,
9080,
6820,
1006,
2969,
1007,
1063,
2096,
1006,
2969,
1012,
1035,
1048,
6820,
1026,
1027,
2969,
1012,
1035,
2720,
2226,
1004,
1004,
2969,
1012,
1035,
27425,
1012,
1035,
1035,
2011,
22254,
10288,
1035,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jhipster/generator-jhipster | generators/utils.js | getAllJhipsterConfig | function getAllJhipsterConfig(generator, force) {
let configuration = generator && generator.config ? generator.config.getAll() || {} : {};
if ((force || !configuration.baseName) && jhiCore.FileUtils.doesFileExist('.yo-rc.json')) {
const yoRc = JSON.parse(fs.readFileSync('.yo-rc.json', { encoding: 'utf-8' }));
configuration = yoRc['generator-jhipster'];
// merge the blueprint config if available
if (configuration.blueprint) {
configuration = { ...configuration, ...yoRc[configuration.blueprint] };
}
}
if (!configuration.get || typeof configuration.get !== 'function') {
configuration = {
...configuration,
getAll: () => configuration,
get: key => configuration[key],
set: (key, value) => {
configuration[key] = value;
}
};
}
return configuration;
} | javascript | function getAllJhipsterConfig(generator, force) {
let configuration = generator && generator.config ? generator.config.getAll() || {} : {};
if ((force || !configuration.baseName) && jhiCore.FileUtils.doesFileExist('.yo-rc.json')) {
const yoRc = JSON.parse(fs.readFileSync('.yo-rc.json', { encoding: 'utf-8' }));
configuration = yoRc['generator-jhipster'];
// merge the blueprint config if available
if (configuration.blueprint) {
configuration = { ...configuration, ...yoRc[configuration.blueprint] };
}
}
if (!configuration.get || typeof configuration.get !== 'function') {
configuration = {
...configuration,
getAll: () => configuration,
get: key => configuration[key],
set: (key, value) => {
configuration[key] = value;
}
};
}
return configuration;
} | [
"function",
"getAllJhipsterConfig",
"(",
"generator",
",",
"force",
")",
"{",
"let",
"configuration",
"=",
"generator",
"&&",
"generator",
".",
"config",
"?",
"generator",
".",
"config",
".",
"getAll",
"(",
")",
"||",
"{",
"}",
":",
"{",
"}",
";",
"if",
... | Get all the generator configuration from the .yo-rc.json file
@param {Generator} generator the generator instance to use
@param {boolean} force force getting direct from file | [
"Get",
"all",
"the",
"generator",
"configuration",
"from",
"the",
".",
"yo",
"-",
"rc",
".",
"json",
"file"
] | f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff | https://github.com/jhipster/generator-jhipster/blob/f76fa8de0818ce6bda6c7b1455942e2a9b0ae3ff/generators/utils.js#L417-L438 | train | Get all the jhipster config | [
30522,
3853,
2131,
8095,
3501,
19801,
3334,
8663,
8873,
2290,
1006,
13103,
1010,
2486,
1007,
1063,
2292,
9563,
1027,
13103,
1004,
1004,
13103,
1012,
9530,
8873,
2290,
1029,
13103,
1012,
9530,
8873,
2290,
1012,
2131,
8095,
1006,
1007,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mui-org/material-ui | docs/src/modules/components/GoogleAnalytics.js | handleClick | function handleClick(event) {
const rootNode = document;
let element = event.target;
while (element && element !== rootNode) {
const category = element.getAttribute('data-ga-event-category');
// We reach a tracking element, no need to look higher in the dom tree.
if (category) {
window.ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: element.getAttribute('data-ga-event-action'),
eventLabel: element.getAttribute('data-ga-event-label'),
});
break;
}
element = element.parentNode;
}
} | javascript | function handleClick(event) {
const rootNode = document;
let element = event.target;
while (element && element !== rootNode) {
const category = element.getAttribute('data-ga-event-category');
// We reach a tracking element, no need to look higher in the dom tree.
if (category) {
window.ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: element.getAttribute('data-ga-event-action'),
eventLabel: element.getAttribute('data-ga-event-label'),
});
break;
}
element = element.parentNode;
}
} | [
"function",
"handleClick",
"(",
"event",
")",
"{",
"const",
"rootNode",
"=",
"document",
";",
"let",
"element",
"=",
"event",
".",
"target",
";",
"while",
"(",
"element",
"&&",
"element",
"!==",
"rootNode",
")",
"{",
"const",
"category",
"=",
"element",
... | So we can write code like: <Button ga-event-category="demo" ga-event-action="expand" > Foo </Button> | [
"So",
"we",
"can",
"write",
"code",
"like",
":",
"<Button",
"ga",
"-",
"event",
"-",
"category",
"=",
"demo",
"ga",
"-",
"event",
"-",
"action",
"=",
"expand",
">",
"Foo",
"<",
"/",
"Button",
">"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/components/GoogleAnalytics.js#L12-L32 | train | Handle click events | [
30522,
3853,
5047,
20464,
6799,
1006,
2724,
1007,
1063,
9530,
3367,
7117,
3630,
3207,
1027,
6254,
1025,
2292,
5783,
1027,
2724,
1012,
4539,
1025,
2096,
1006,
5783,
1004,
1004,
5783,
999,
1027,
1027,
7117,
3630,
3207,
1007,
1063,
9530,
336... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fengyuanchen/cropper | dist/cropper.common.js | getData$$1 | function getData$$1() {
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData;
var data = void 0;
if (this.ready && this.cropped) {
data = {
x: cropBoxData.left - canvasData.left,
y: cropBoxData.top - canvasData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
var ratio = imageData.width / imageData.naturalWidth;
forEach(data, function (n, i) {
n /= ratio;
data[i] = rounded ? Math.round(n) : n;
});
} else {
data = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
if (options.rotatable) {
data.rotate = imageData.rotate || 0;
}
if (options.scalable) {
data.scaleX = imageData.scaleX || 1;
data.scaleY = imageData.scaleY || 1;
}
return data;
} | javascript | function getData$$1() {
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData;
var data = void 0;
if (this.ready && this.cropped) {
data = {
x: cropBoxData.left - canvasData.left,
y: cropBoxData.top - canvasData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
var ratio = imageData.width / imageData.naturalWidth;
forEach(data, function (n, i) {
n /= ratio;
data[i] = rounded ? Math.round(n) : n;
});
} else {
data = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
if (options.rotatable) {
data.rotate = imageData.rotate || 0;
}
if (options.scalable) {
data.scaleX = imageData.scaleX || 1;
data.scaleY = imageData.scaleY || 1;
}
return data;
} | [
"function",
"getData$$1",
"(",
")",
"{",
"var",
"rounded",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"false",
";",
"var",
"options",
"=",
"this",
".",
"optio... | Get the cropped area position and size data (base on the original image)
@param {boolean} [rounded=false] - Indicate if round the data values or not.
@returns {Object} The result cropped data. | [
"Get",
"the",
"cropped",
"area",
"position",
"and",
"size",
"data",
"(",
"base",
"on",
"the",
"original",
"image",
")"
] | 6677332a6a375b647f58808dfc24ea09f5804041 | https://github.com/fengyuanchen/cropper/blob/6677332a6a375b647f58808dfc24ea09f5804041/dist/cropper.common.js#L2805-L2847 | train | Get the data for the image | [
30522,
3853,
2131,
2850,
2696,
1002,
1002,
1015,
1006,
1007,
1063,
13075,
8352,
1027,
9918,
1012,
3091,
1028,
1014,
1004,
1004,
9918,
1031,
1014,
1033,
999,
1027,
1027,
6151,
28344,
1029,
9918,
1031,
1014,
1033,
1024,
6270,
1025,
13075,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/look-controls.js | function (evt) {
var direction;
var canvas = this.el.sceneEl.canvas;
var deltaY;
var yawObject = this.yawObject;
if (!this.touchStarted || !this.data.touchEnabled) { return; }
deltaY = 2 * Math.PI * (evt.touches[0].pageX - this.touchStart.x) / canvas.clientWidth;
direction = this.data.reverseTouchDrag ? 1 : -1;
// Limit touch orientaion to to yaw (y axis).
yawObject.rotation.y -= deltaY * 0.5 * direction;
this.touchStart = {
x: evt.touches[0].pageX,
y: evt.touches[0].pageY
};
} | javascript | function (evt) {
var direction;
var canvas = this.el.sceneEl.canvas;
var deltaY;
var yawObject = this.yawObject;
if (!this.touchStarted || !this.data.touchEnabled) { return; }
deltaY = 2 * Math.PI * (evt.touches[0].pageX - this.touchStart.x) / canvas.clientWidth;
direction = this.data.reverseTouchDrag ? 1 : -1;
// Limit touch orientaion to to yaw (y axis).
yawObject.rotation.y -= deltaY * 0.5 * direction;
this.touchStart = {
x: evt.touches[0].pageX,
y: evt.touches[0].pageY
};
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"direction",
";",
"var",
"canvas",
"=",
"this",
".",
"el",
".",
"sceneEl",
".",
"canvas",
";",
"var",
"deltaY",
";",
"var",
"yawObject",
"=",
"this",
".",
"yawObject",
";",
"if",
"(",
"!",
"this",
".",
"touc... | Translate touch move to Y-axis rotation. | [
"Translate",
"touch",
"move",
"to",
"Y",
"-",
"axis",
"rotation",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/look-controls.js#L316-L333 | train | Touch drag event handler | [
30522,
3853,
1006,
23408,
2102,
1007,
1063,
13075,
3257,
1025,
13075,
10683,
1027,
2023,
1012,
3449,
1012,
3496,
2884,
1012,
10683,
1025,
13075,
7160,
2100,
1025,
13075,
8038,
12155,
2497,
20614,
1027,
2023,
1012,
8038,
12155,
2497,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/output/json/onPage.js | onPage | function onPage(output, page) {
var file = page.getFile();
var readme = output.getBook().getReadme().getFile();
return Modifiers.modifyHTML(page, getModifiers(output, page))
.then(function(resultPage) {
// Generate the JSON
var json = JSONUtils.encodeBookWithPage(output.getBook(), resultPage);
// Delete some private properties
delete json.config;
// Specify JSON output version
json.version = JSON_VERSION;
// File path in the output folder
var filePath = file.getPath() == readme.getPath()? 'README.json' : file.getPath();
filePath = PathUtils.setExtension(filePath, '.json');
// Write it to the disk
return writeFile(
output,
filePath,
JSON.stringify(json, null, 4)
);
});
} | javascript | function onPage(output, page) {
var file = page.getFile();
var readme = output.getBook().getReadme().getFile();
return Modifiers.modifyHTML(page, getModifiers(output, page))
.then(function(resultPage) {
// Generate the JSON
var json = JSONUtils.encodeBookWithPage(output.getBook(), resultPage);
// Delete some private properties
delete json.config;
// Specify JSON output version
json.version = JSON_VERSION;
// File path in the output folder
var filePath = file.getPath() == readme.getPath()? 'README.json' : file.getPath();
filePath = PathUtils.setExtension(filePath, '.json');
// Write it to the disk
return writeFile(
output,
filePath,
JSON.stringify(json, null, 4)
);
});
} | [
"function",
"onPage",
"(",
"output",
",",
"page",
")",
"{",
"var",
"file",
"=",
"page",
".",
"getFile",
"(",
")",
";",
"var",
"readme",
"=",
"output",
".",
"getBook",
"(",
")",
".",
"getReadme",
"(",
")",
".",
"getFile",
"(",
")",
";",
"return",
... | Write a page as a json file
@param {Output} output
@param {Page} page | [
"Write",
"a",
"page",
"as",
"a",
"json",
"file"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/json/onPage.js#L15-L41 | train | Modify the page | [
30522,
3853,
2006,
13704,
1006,
6434,
1010,
3931,
1007,
1063,
13075,
5371,
1027,
3931,
1012,
2131,
8873,
2571,
1006,
1007,
1025,
13075,
3191,
4168,
1027,
6434,
1012,
2131,
8654,
1006,
1007,
1012,
2131,
16416,
22117,
2063,
1006,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/DeprecationWarning.js | deprecationWarning | function deprecationWarning(message, oncePerCaller, callerStackPos) {
// If oncePerCaller isn't set, then only show the message once no matter who calls it.
if (!message || (!oncePerCaller && displayedWarnings[message])) {
return;
}
// Don't show the warning again if we've already gotten it from the current caller.
// The true caller location is the fourth line in the stack trace:
// * 0 is the word "Error"
// * 1 is this function
// * 2 is the caller of this function (the one throwing the deprecation warning)
// * 3 is the actual caller of the deprecated function.
var stack = new Error().stack,
callerLocation = stack.split("\n")[callerStackPos || 3];
if (oncePerCaller && displayedWarnings[message] && displayedWarnings[message][callerLocation]) {
return;
}
console.warn(message + "\n" + _trimStack(stack));
if (!displayedWarnings[message]) {
displayedWarnings[message] = {};
}
displayedWarnings[message][callerLocation] = true;
} | javascript | function deprecationWarning(message, oncePerCaller, callerStackPos) {
// If oncePerCaller isn't set, then only show the message once no matter who calls it.
if (!message || (!oncePerCaller && displayedWarnings[message])) {
return;
}
// Don't show the warning again if we've already gotten it from the current caller.
// The true caller location is the fourth line in the stack trace:
// * 0 is the word "Error"
// * 1 is this function
// * 2 is the caller of this function (the one throwing the deprecation warning)
// * 3 is the actual caller of the deprecated function.
var stack = new Error().stack,
callerLocation = stack.split("\n")[callerStackPos || 3];
if (oncePerCaller && displayedWarnings[message] && displayedWarnings[message][callerLocation]) {
return;
}
console.warn(message + "\n" + _trimStack(stack));
if (!displayedWarnings[message]) {
displayedWarnings[message] = {};
}
displayedWarnings[message][callerLocation] = true;
} | [
"function",
"deprecationWarning",
"(",
"message",
",",
"oncePerCaller",
",",
"callerStackPos",
")",
"{",
"// If oncePerCaller isn't set, then only show the message once no matter who calls it.",
"if",
"(",
"!",
"message",
"||",
"(",
"!",
"oncePerCaller",
"&&",
"displayedWarni... | Show deprecation warning with the call stack if it
has never been displayed before.
@param {!string} message The deprecation message to be displayed.
@param {boolean=} oncePerCaller If true, displays the message once for each unique call location.
If false (the default), only displays the message once no matter where it's called from.
Note that setting this to true can cause a slight performance hit (because it has to generate
a stack trace), so don't set this for functions that you expect to be called from performance-
sensitive code (e.g. tight loops).
@param {number=} callerStackPos Only used if oncePerCaller=true. Overrides the `Error().stack` depth
where the client-code caller can be found. Only needed if extra shim layers are involved. | [
"Show",
"deprecation",
"warning",
"with",
"the",
"call",
"stack",
"if",
"it",
"has",
"never",
"been",
"displayed",
"before",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DeprecationWarning.js#L70-L93 | train | Show a deprecation warning | [
30522,
3853,
2139,
28139,
10719,
9028,
5582,
1006,
4471,
1010,
2320,
4842,
9289,
3917,
1010,
20587,
30524,
2065,
1006,
999,
4471,
1064,
1064,
1006,
999,
2320,
4842,
9289,
3917,
1004,
1004,
6913,
9028,
5582,
2015,
1031,
4471,
1033,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hakimel/reveal.js | plugin/highlight/highlight.js | betterTrim | function betterTrim(snippetEl) {
// Helper functions
function trimLeft(val) {
// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
return val.replace(/^[\s\uFEFF\xA0]+/g, '');
}
function trimLineBreaks(input) {
var lines = input.split('\n');
// Trim line-breaks from the beginning
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim() === '') {
lines.splice(i--, 1);
} else break;
}
// Trim line-breaks from the end
for (var i = lines.length-1; i >= 0; i--) {
if (lines[i].trim() === '') {
lines.splice(i, 1);
} else break;
}
return lines.join('\n');
}
// Main function for betterTrim()
return (function(snippetEl) {
var content = trimLineBreaks(snippetEl.innerHTML);
var lines = content.split('\n');
// Calculate the minimum amount to remove on each line start of the snippet (can be 0)
var pad = lines.reduce(function(acc, line) {
if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {
return line.length - trimLeft(line).length;
}
return acc;
}, Number.POSITIVE_INFINITY);
// Slice each line with this amount
return lines.map(function(line, index) {
return line.slice(pad);
})
.join('\n');
})(snippetEl);
} | javascript | function betterTrim(snippetEl) {
// Helper functions
function trimLeft(val) {
// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
return val.replace(/^[\s\uFEFF\xA0]+/g, '');
}
function trimLineBreaks(input) {
var lines = input.split('\n');
// Trim line-breaks from the beginning
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim() === '') {
lines.splice(i--, 1);
} else break;
}
// Trim line-breaks from the end
for (var i = lines.length-1; i >= 0; i--) {
if (lines[i].trim() === '') {
lines.splice(i, 1);
} else break;
}
return lines.join('\n');
}
// Main function for betterTrim()
return (function(snippetEl) {
var content = trimLineBreaks(snippetEl.innerHTML);
var lines = content.split('\n');
// Calculate the minimum amount to remove on each line start of the snippet (can be 0)
var pad = lines.reduce(function(acc, line) {
if (line.length > 0 && trimLeft(line).length > 0 && acc > line.length - trimLeft(line).length) {
return line.length - trimLeft(line).length;
}
return acc;
}, Number.POSITIVE_INFINITY);
// Slice each line with this amount
return lines.map(function(line, index) {
return line.slice(pad);
})
.join('\n');
})(snippetEl);
} | [
"function",
"betterTrim",
"(",
"snippetEl",
")",
"{",
"// Helper functions",
"function",
"trimLeft",
"(",
"val",
")",
"{",
"// Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill",
"return",
"val",
".",
"replace",
"("... | Function to perform a better "data-trim" on code snippets Will slice an indentation amount on each line of the snippet (amount based on the line having the lowest indentation length) | [
"Function",
"to",
"perform",
"a",
"better",
"data",
"-",
"trim",
"on",
"code",
"snippets",
"Will",
"slice",
"an",
"indentation",
"amount",
"on",
"each",
"line",
"of",
"the",
"snippet",
"(",
"amount",
"based",
"on",
"the",
"line",
"having",
"the",
"lowest",... | 33bed47daca3f08c396215415e6ece005970734a | https://github.com/hakimel/reveal.js/blob/33bed47daca3f08c396215415e6ece005970734a/plugin/highlight/highlight.js#L25-L68 | train | This function is a bit of a hack to make sure that the trimming of the content is not a problem | [
30522,
3853,
2488,
18886,
2213,
1006,
1055,
3490,
29519,
2884,
1007,
1063,
1013,
1013,
2393,
2121,
4972,
3853,
12241,
2571,
6199,
1006,
11748,
1007,
1063,
1013,
1013,
5967,
2013,
16770,
1024,
1013,
1013,
9722,
1012,
9587,
5831,
4571,
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... |
Dogfalo/materialize | dist/js/materialize.js | destroy | function destroy() {
this._resetDropdownStyles();
this._removeEventHandlers();
Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1);
this.el.M_Dropdown = undefined;
} | javascript | function destroy() {
this._resetDropdownStyles();
this._removeEventHandlers();
Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1);
this.el.M_Dropdown = undefined;
} | [
"function",
"destroy",
"(",
")",
"{",
"this",
".",
"_resetDropdownStyles",
"(",
")",
";",
"this",
".",
"_removeEventHandlers",
"(",
")",
";",
"Dropdown",
".",
"_dropdowns",
".",
"splice",
"(",
"Dropdown",
".",
"_dropdowns",
".",
"indexOf",
"(",
"this",
")"... | Teardown component | [
"Teardown",
"component"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L2317-L2322 | train | Destroys the Dropdown instance | [
30522,
3853,
6033,
1006,
1007,
1063,
2023,
1012,
1035,
25141,
25711,
7698,
21756,
4244,
1006,
1007,
1025,
2023,
1012,
1035,
6366,
18697,
3372,
11774,
12910,
1006,
1007,
1025,
4530,
7698,
1012,
1035,
4530,
7698,
2015,
1012,
11867,
13231,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/RemoteFunctions.js | _scrollHandler | function _scrollHandler(e) {
// Document scrolls can be updated immediately. Any other scrolls
// need to be updated on a timer to ensure the layout is correct.
if (e.target === window.document) {
redrawHighlights();
} else {
if (_remoteHighlight || _localHighlight) {
window.setTimeout(redrawHighlights, 0);
}
}
} | javascript | function _scrollHandler(e) {
// Document scrolls can be updated immediately. Any other scrolls
// need to be updated on a timer to ensure the layout is correct.
if (e.target === window.document) {
redrawHighlights();
} else {
if (_remoteHighlight || _localHighlight) {
window.setTimeout(redrawHighlights, 0);
}
}
} | [
"function",
"_scrollHandler",
"(",
"e",
")",
"{",
"// Document scrolls can be updated immediately. Any other scrolls",
"// need to be updated on a timer to ensure the layout is correct.",
"if",
"(",
"e",
".",
"target",
"===",
"window",
".",
"document",
")",
"{",
"redrawHighligh... | Add a capture-phase scroll listener to update highlights when any element scrolls. | [
"Add",
"a",
"capture",
"-",
"phase",
"scroll",
"listener",
"to",
"update",
"highlights",
"when",
"any",
"element",
"scrolls",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L695-L705 | train | The scroll handler for the document. | [
30522,
3853,
1035,
17186,
11774,
3917,
1006,
1041,
1007,
1063,
1013,
1013,
6254,
23074,
2064,
2022,
7172,
3202,
1012,
2151,
2060,
23074,
1013,
1013,
2342,
2000,
2022,
7172,
2006,
1037,
25309,
2000,
5676,
1996,
30524,
2860,
4048,
5603,
15733... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/chart/tree/layoutHelper.js | apportion | function apportion(subtreeV, subtreeW, ancestor, separation) {
if (subtreeW) {
var nodeOutRight = subtreeV;
var nodeInRight = subtreeV;
var nodeOutLeft = nodeInRight.parentNode.children[0];
var nodeInLeft = subtreeW;
var sumOutRight = nodeOutRight.hierNode.modifier;
var sumInRight = nodeInRight.hierNode.modifier;
var sumOutLeft = nodeOutLeft.hierNode.modifier;
var sumInLeft = nodeInLeft.hierNode.modifier;
while (nodeInLeft = nextRight(nodeInLeft), nodeInRight = nextLeft(nodeInRight), nodeInLeft && nodeInRight) {
nodeOutRight = nextRight(nodeOutRight);
nodeOutLeft = nextLeft(nodeOutLeft);
nodeOutRight.hierNode.ancestor = subtreeV;
var shift = nodeInLeft.hierNode.prelim + sumInLeft - nodeInRight.hierNode.prelim
- sumInRight + separation(nodeInLeft, nodeInRight);
if (shift > 0) {
moveSubtree(nextAncestor(nodeInLeft, subtreeV, ancestor), subtreeV, shift);
sumInRight += shift;
sumOutRight += shift;
}
sumInLeft += nodeInLeft.hierNode.modifier;
sumInRight += nodeInRight.hierNode.modifier;
sumOutRight += nodeOutRight.hierNode.modifier;
sumOutLeft += nodeOutLeft.hierNode.modifier;
}
if (nodeInLeft && !nextRight(nodeOutRight)) {
nodeOutRight.hierNode.thread = nodeInLeft;
nodeOutRight.hierNode.modifier += sumInLeft - sumOutRight;
}
if (nodeInRight && !nextLeft(nodeOutLeft)) {
nodeOutLeft.hierNode.thread = nodeInRight;
nodeOutLeft.hierNode.modifier += sumInRight - sumOutLeft;
ancestor = subtreeV;
}
}
return ancestor;
} | javascript | function apportion(subtreeV, subtreeW, ancestor, separation) {
if (subtreeW) {
var nodeOutRight = subtreeV;
var nodeInRight = subtreeV;
var nodeOutLeft = nodeInRight.parentNode.children[0];
var nodeInLeft = subtreeW;
var sumOutRight = nodeOutRight.hierNode.modifier;
var sumInRight = nodeInRight.hierNode.modifier;
var sumOutLeft = nodeOutLeft.hierNode.modifier;
var sumInLeft = nodeInLeft.hierNode.modifier;
while (nodeInLeft = nextRight(nodeInLeft), nodeInRight = nextLeft(nodeInRight), nodeInLeft && nodeInRight) {
nodeOutRight = nextRight(nodeOutRight);
nodeOutLeft = nextLeft(nodeOutLeft);
nodeOutRight.hierNode.ancestor = subtreeV;
var shift = nodeInLeft.hierNode.prelim + sumInLeft - nodeInRight.hierNode.prelim
- sumInRight + separation(nodeInLeft, nodeInRight);
if (shift > 0) {
moveSubtree(nextAncestor(nodeInLeft, subtreeV, ancestor), subtreeV, shift);
sumInRight += shift;
sumOutRight += shift;
}
sumInLeft += nodeInLeft.hierNode.modifier;
sumInRight += nodeInRight.hierNode.modifier;
sumOutRight += nodeOutRight.hierNode.modifier;
sumOutLeft += nodeOutLeft.hierNode.modifier;
}
if (nodeInLeft && !nextRight(nodeOutRight)) {
nodeOutRight.hierNode.thread = nodeInLeft;
nodeOutRight.hierNode.modifier += sumInLeft - sumOutRight;
}
if (nodeInRight && !nextLeft(nodeOutLeft)) {
nodeOutLeft.hierNode.thread = nodeInRight;
nodeOutLeft.hierNode.modifier += sumInRight - sumOutLeft;
ancestor = subtreeV;
}
}
return ancestor;
} | [
"function",
"apportion",
"(",
"subtreeV",
",",
"subtreeW",
",",
"ancestor",
",",
"separation",
")",
"{",
"if",
"(",
"subtreeW",
")",
"{",
"var",
"nodeOutRight",
"=",
"subtreeV",
";",
"var",
"nodeInRight",
"=",
"subtreeV",
";",
"var",
"nodeOutLeft",
"=",
"n... | The implementation of this function was originally copied from "d3.js"
<https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
with some modifications made for this program.
See the license statement at the head of this file.
The core of the algorithm. Here, a new subtree is combined with the
previous subtrees. Threads are used to traverse the inside and outside
contours of the left and right subtree up to the highest common level.
Whenever two nodes of the inside contours conflict, we compute the left
one of the greatest uncommon ancestors using the function nextAncestor()
and call moveSubtree() to shift the subtree and prepare the shifts of
smaller subtrees. Finally, we add a new thread (if necessary).
@param {module:echarts/data/Tree~TreeNode} subtreeV
@param {module:echarts/data/Tree~TreeNode} subtreeW
@param {module:echarts/data/Tree~TreeNode} ancestor
@param {Function} separation
@return {module:echarts/data/Tree~TreeNode} | [
"The",
"implementation",
"of",
"this",
"function",
"was",
"originally",
"copied",
"from",
"d3",
".",
"js",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"d3",
"/",
"d3",
"-",
"hierarchy",
"/",
"blob",
"/",
"4c1f038f2725d6eae2e49b61d01456400694bac4",
"/",
"... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/tree/layoutHelper.js#L219-L260 | train | applicable to subtreeV | [
30522,
3853,
10439,
11589,
3258,
1006,
4942,
13334,
2615,
1010,
4942,
13334,
2860,
1010,
13032,
1010,
8745,
1007,
1063,
2065,
1006,
4942,
13334,
2860,
1007,
1063,
13075,
13045,
5833,
15950,
1027,
4942,
13334,
2615,
1025,
13075,
13045,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cytoscape/cytoscape.js | src/collection/style.js | function( name, value ){
let cy = this.cy();
if( !cy.styleEnabled() ){ return this; }
let updateTransitions = false;
let style = cy.style();
if( is.plainObject( name ) ){ // then extend the bypass
let props = name;
style.applyBypass( this, props, updateTransitions );
this.emitAndNotify( 'style' ); // let the renderer know we've updated style
} else if( is.string( name ) ){
if( value === undefined ){ // then get the property from the style
let ele = this[0];
if( ele ){
return style.getStylePropertyValue( ele, name );
} else { // empty collection => can't get any value
return;
}
} else { // then set the bypass with the property value
style.applyBypass( this, name, value, updateTransitions );
this.emitAndNotify( 'style' ); // let the renderer know we've updated style
}
} else if( name === undefined ){
let ele = this[0];
if( ele ){
return style.getRawStyle( ele );
} else { // empty collection => can't get any value
return;
}
}
return this; // chaining
} | javascript | function( name, value ){
let cy = this.cy();
if( !cy.styleEnabled() ){ return this; }
let updateTransitions = false;
let style = cy.style();
if( is.plainObject( name ) ){ // then extend the bypass
let props = name;
style.applyBypass( this, props, updateTransitions );
this.emitAndNotify( 'style' ); // let the renderer know we've updated style
} else if( is.string( name ) ){
if( value === undefined ){ // then get the property from the style
let ele = this[0];
if( ele ){
return style.getStylePropertyValue( ele, name );
} else { // empty collection => can't get any value
return;
}
} else { // then set the bypass with the property value
style.applyBypass( this, name, value, updateTransitions );
this.emitAndNotify( 'style' ); // let the renderer know we've updated style
}
} else if( name === undefined ){
let ele = this[0];
if( ele ){
return style.getRawStyle( ele );
} else { // empty collection => can't get any value
return;
}
}
return this; // chaining
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"let",
"cy",
"=",
"this",
".",
"cy",
"(",
")",
";",
"if",
"(",
"!",
"cy",
".",
"styleEnabled",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"let",
"updateTransitions",
"=",
"false",
";",
"let",
... | read the calculated css style of the element or override the style (via a bypass) | [
"read",
"the",
"calculated",
"css",
"style",
"of",
"the",
"element",
"or",
"override",
"the",
"style",
"(",
"via",
"a",
"bypass",
")"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/src/collection/style.js#L171-L213 | train | get the style of the node | [
30522,
3853,
1006,
2171,
1010,
3643,
1007,
1063,
2292,
22330,
1027,
2023,
1012,
22330,
1006,
1007,
1025,
2065,
1006,
999,
22330,
1012,
2806,
8189,
23242,
1006,
1007,
1007,
1063,
2709,
2023,
1025,
1065,
2292,
10651,
6494,
3619,
22753,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
GitbookIO/gitbook | lib/plugins/loadPlugin.js | loadPlugin | function loadPlugin(book, plugin) {
var logger = book.getLogger();
var name = plugin.getName();
var pkgPath = plugin.getPath();
// Try loading plugins from different location
var p = Promise()
.then(function() {
var packageContent;
var packageMain;
var content;
// Locate plugin and load package.json
try {
var res = resolve.sync('./package.json', { basedir: pkgPath });
pkgPath = path.dirname(res);
packageContent = require(res);
} catch (err) {
if (!isModuleNotFound(err)) throw err;
packageContent = undefined;
content = undefined;
return;
}
// Locate the main package
try {
var indexJs = path.normalize(packageContent.main || 'index.js');
packageMain = resolve.sync('./' + indexJs, { basedir: pkgPath });
} catch (err) {
if (!isModuleNotFound(err)) throw err;
packageMain = undefined;
}
// Load plugin JS content
if (packageMain) {
try {
content = require(packageMain);
} catch(err) {
throw new error.PluginError(err, {
plugin: name
});
}
}
// Update plugin
return plugin.merge({
'package': Immutable.fromJS(packageContent),
'content': Immutable.fromJS(content || {})
});
})
.then(validatePlugin);
p = timing.measure('plugin.load', p);
logger.info('loading plugin "' + name + '"... ');
return logger.info.promise(p);
} | javascript | function loadPlugin(book, plugin) {
var logger = book.getLogger();
var name = plugin.getName();
var pkgPath = plugin.getPath();
// Try loading plugins from different location
var p = Promise()
.then(function() {
var packageContent;
var packageMain;
var content;
// Locate plugin and load package.json
try {
var res = resolve.sync('./package.json', { basedir: pkgPath });
pkgPath = path.dirname(res);
packageContent = require(res);
} catch (err) {
if (!isModuleNotFound(err)) throw err;
packageContent = undefined;
content = undefined;
return;
}
// Locate the main package
try {
var indexJs = path.normalize(packageContent.main || 'index.js');
packageMain = resolve.sync('./' + indexJs, { basedir: pkgPath });
} catch (err) {
if (!isModuleNotFound(err)) throw err;
packageMain = undefined;
}
// Load plugin JS content
if (packageMain) {
try {
content = require(packageMain);
} catch(err) {
throw new error.PluginError(err, {
plugin: name
});
}
}
// Update plugin
return plugin.merge({
'package': Immutable.fromJS(packageContent),
'content': Immutable.fromJS(content || {})
});
})
.then(validatePlugin);
p = timing.measure('plugin.load', p);
logger.info('loading plugin "' + name + '"... ');
return logger.info.promise(p);
} | [
"function",
"loadPlugin",
"(",
"book",
",",
"plugin",
")",
"{",
"var",
"logger",
"=",
"book",
".",
"getLogger",
"(",
")",
";",
"var",
"name",
"=",
"plugin",
".",
"getName",
"(",
")",
";",
"var",
"pkgPath",
"=",
"plugin",
".",
"getPath",
"(",
")",
"... | Load a plugin in a book
@param {Book} book
@param {Plugin} plugin
@param {String} pkgPath (optional)
@return {Promise<Plugin>} | [
"Load",
"a",
"plugin",
"in",
"a",
"book"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/plugins/loadPlugin.js#L25-L86 | train | Load a plugin from the same location | [
30522,
3853,
7170,
24759,
15916,
2378,
1006,
2338,
1010,
13354,
2378,
1007,
1063,
13075,
8833,
4590,
1027,
2338,
1012,
2131,
21197,
4590,
1006,
1007,
1025,
13075,
2171,
1027,
13354,
2378,
1012,
2131,
18442,
1006,
1007,
1025,
13075,
1052,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/hello-mui/js/mui.js | function(event, target) {
if (!event.detail) {
event.detail = {
currentTarget: target
};
} else {
event.detail.currentTarget = target;
}
$.each(eventMethods, function(name, predicate) {
var sourceMethod = event[name];
event[name] = function() {
this[predicate] = returnTrue;
return sourceMethod && sourceMethod.apply(event, arguments)
}
event[predicate] = returnFalse;
}, true);
return event;
} | javascript | function(event, target) {
if (!event.detail) {
event.detail = {
currentTarget: target
};
} else {
event.detail.currentTarget = target;
}
$.each(eventMethods, function(name, predicate) {
var sourceMethod = event[name];
event[name] = function() {
this[predicate] = returnTrue;
return sourceMethod && sourceMethod.apply(event, arguments)
}
event[predicate] = returnFalse;
}, true);
return event;
} | [
"function",
"(",
"event",
",",
"target",
")",
"{",
"if",
"(",
"!",
"event",
".",
"detail",
")",
"{",
"event",
".",
"detail",
"=",
"{",
"currentTarget",
":",
"target",
"}",
";",
"}",
"else",
"{",
"event",
".",
"detail",
".",
"currentTarget",
"=",
"t... | wrap浏览器事件 | [
"wrap浏览器事件"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.js#L572-L589 | train | This method is called by the event handler when an event is triggered. | [
30522,
3853,
1006,
2724,
1010,
4539,
1007,
1063,
2065,
1006,
999,
2724,
1012,
6987,
1007,
1063,
2724,
1012,
6987,
1027,
1063,
2783,
7559,
18150,
1024,
4539,
1065,
1025,
1065,
2842,
1063,
2724,
1012,
6987,
1012,
2783,
7559,
18150,
1027,
45... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/ScriptAgent.js | _onChildNodeInserted | function _onChildNodeInserted(event, res) {
// res = {parentNodeId, previousNodeId, node}
if (_insertTrace) {
var node = DOMAgent.nodeWithId(res.node.nodeId);
node.trace = _insertTrace;
_insertTrace = undefined;
}
} | javascript | function _onChildNodeInserted(event, res) {
// res = {parentNodeId, previousNodeId, node}
if (_insertTrace) {
var node = DOMAgent.nodeWithId(res.node.nodeId);
node.trace = _insertTrace;
_insertTrace = undefined;
}
} | [
"function",
"_onChildNodeInserted",
"(",
"event",
",",
"res",
")",
"{",
"// res = {parentNodeId, previousNodeId, node}",
"if",
"(",
"_insertTrace",
")",
"{",
"var",
"node",
"=",
"DOMAgent",
".",
"nodeWithId",
"(",
"res",
".",
"node",
".",
"nodeId",
")",
";",
"... | WebInspector Event: DOM.childNodeInserted | [
"WebInspector",
"Event",
":",
"DOM",
".",
"childNodeInserted"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/ScriptAgent.js#L62-L69 | train | onChildNodeInserted - event handler for insertNode | [
30522,
3853,
1035,
2006,
19339,
3630,
3207,
7076,
28728,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
6687,
3630,
3207,
3593,
1010,
3025,
3630,
3207,
3593,
1010,
13045,
1065,
2065,
1006,
1035,
19274,
6494,
3401,
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... |
catapult-project/catapult | third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js | consumeToken | function consumeToken(regex, string) {
var result = regex.exec(string);
if (result) {
result = regex.ignoreCase ? result[0].toLowerCase() : result[0];
return [result, string.substr(result.length)];
}
} | javascript | function consumeToken(regex, string) {
var result = regex.exec(string);
if (result) {
result = regex.ignoreCase ? result[0].toLowerCase() : result[0];
return [result, string.substr(result.length)];
}
} | [
"function",
"consumeToken",
"(",
"regex",
",",
"string",
")",
"{",
"var",
"result",
"=",
"regex",
".",
"exec",
"(",
"string",
")",
";",
"if",
"(",
"result",
")",
"{",
"result",
"=",
"regex",
".",
"ignoreCase",
"?",
"result",
"[",
"0",
"]",
".",
"to... | consume* functions return a 2 value array of [parsed-data, '' or not-yet consumed input] Regex should be anchored with /^ | [
"consume",
"*",
"functions",
"return",
"a",
"2",
"value",
"array",
"of",
"[",
"parsed",
"-",
"data",
"or",
"not",
"-",
"yet",
"consumed",
"input",
"]",
"Regex",
"should",
"be",
"anchored",
"with",
"/",
"^"
] | 992929ffccac68827869a497f01ee4d653ed4f25 | https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js#L20-L26 | train | Consumes a token from a string | [
30522,
3853,
16678,
18715,
2368,
1006,
19723,
10288,
1010,
5164,
1007,
1063,
13075,
2765,
1027,
19723,
10288,
1012,
4654,
8586,
1006,
5164,
1007,
1025,
2065,
1006,
2765,
1007,
1063,
2765,
1027,
19723,
10288,
1012,
8568,
18382,
1029,
2765,
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... |
badges/shields | services/nuget/nuget-v2-service-family.js | createServiceFamily | function createServiceFamily({
title,
name = title,
defaultLabel,
serviceBaseUrl,
apiBaseUrl,
odataFormat,
examplePackageName,
exampleVersion,
examplePrereleaseVersion,
exampleDownloadCount,
}) {
let Base
if (odataFormat === 'xml') {
Base = BaseXmlService
} else if (odataFormat === 'json') {
Base = BaseJsonService
} else {
throw Error(`Unsupported Atom OData format: ${odataFormat}`)
}
class NugetVersionService extends Base {
static get name() {
return `${name}Version`
}
static get category() {
return 'version'
}
static get route() {
return {
base: serviceBaseUrl,
pattern: ':which(v|vpre)/:packageName',
}
}
static get examples() {
if (!title) return []
return [
{
title,
pattern: 'v/:packageName',
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ version: exampleVersion }),
},
{
title: `${title} (with prereleases)`,
pattern: 'vpre/:packageName',
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ version: examplePrereleaseVersion }),
},
]
}
static get defaultBadgeData() {
return {
label: defaultLabel,
}
}
static render(props) {
return renderVersionBadge(props)
}
async handle({ which, packageName }) {
const packageData = await fetch(this, {
odataFormat,
baseUrl: apiBaseUrl,
packageName,
includePrereleases: which === 'vpre',
})
const version = packageData.NormalizedVersion || packageData.Version
return this.constructor.render({ version })
}
}
class NugetDownloadService extends Base {
static get name() {
return `${name}Downloads`
}
static get category() {
return 'downloads'
}
static get route() {
return {
base: serviceBaseUrl,
pattern: 'dt/:packageName',
}
}
static get examples() {
if (!title) return []
return [
{
title,
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ downloads: exampleDownloadCount }),
},
]
}
static render(props) {
return renderDownloadBadge(props)
}
async handle({ packageName }) {
const packageData = await fetch(this, {
odataFormat,
baseUrl: apiBaseUrl,
packageName,
})
const { DownloadCount: downloads } = packageData
return this.constructor.render({ downloads })
}
}
return { NugetVersionService, NugetDownloadService }
} | javascript | function createServiceFamily({
title,
name = title,
defaultLabel,
serviceBaseUrl,
apiBaseUrl,
odataFormat,
examplePackageName,
exampleVersion,
examplePrereleaseVersion,
exampleDownloadCount,
}) {
let Base
if (odataFormat === 'xml') {
Base = BaseXmlService
} else if (odataFormat === 'json') {
Base = BaseJsonService
} else {
throw Error(`Unsupported Atom OData format: ${odataFormat}`)
}
class NugetVersionService extends Base {
static get name() {
return `${name}Version`
}
static get category() {
return 'version'
}
static get route() {
return {
base: serviceBaseUrl,
pattern: ':which(v|vpre)/:packageName',
}
}
static get examples() {
if (!title) return []
return [
{
title,
pattern: 'v/:packageName',
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ version: exampleVersion }),
},
{
title: `${title} (with prereleases)`,
pattern: 'vpre/:packageName',
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ version: examplePrereleaseVersion }),
},
]
}
static get defaultBadgeData() {
return {
label: defaultLabel,
}
}
static render(props) {
return renderVersionBadge(props)
}
async handle({ which, packageName }) {
const packageData = await fetch(this, {
odataFormat,
baseUrl: apiBaseUrl,
packageName,
includePrereleases: which === 'vpre',
})
const version = packageData.NormalizedVersion || packageData.Version
return this.constructor.render({ version })
}
}
class NugetDownloadService extends Base {
static get name() {
return `${name}Downloads`
}
static get category() {
return 'downloads'
}
static get route() {
return {
base: serviceBaseUrl,
pattern: 'dt/:packageName',
}
}
static get examples() {
if (!title) return []
return [
{
title,
namedParams: { packageName: examplePackageName },
staticPreview: this.render({ downloads: exampleDownloadCount }),
},
]
}
static render(props) {
return renderDownloadBadge(props)
}
async handle({ packageName }) {
const packageData = await fetch(this, {
odataFormat,
baseUrl: apiBaseUrl,
packageName,
})
const { DownloadCount: downloads } = packageData
return this.constructor.render({ downloads })
}
}
return { NugetVersionService, NugetDownloadService }
} | [
"function",
"createServiceFamily",
"(",
"{",
"title",
",",
"name",
"=",
"title",
",",
"defaultLabel",
",",
"serviceBaseUrl",
",",
"apiBaseUrl",
",",
"odataFormat",
",",
"examplePackageName",
",",
"exampleVersion",
",",
"examplePrereleaseVersion",
",",
"exampleDownload... | /*
Create a version and download service for a NuGet v2 API. Return an object
containing both services.
defaultLabel: The label for the left hand side of the badge.
serviceBaseUrl: The base URL for the Shields service, e.g. chocolatey, resharper
apiBaseUrl: The complete base URL of the API, e.g. https://api.example.com/api/v2 | [
"/",
"*",
"Create",
"a",
"version",
"and",
"download",
"service",
"for",
"a",
"NuGet",
"v2",
"API",
".",
"Return",
"an",
"object",
"containing",
"both",
"services",
"."
] | 283601423f3d1a19aae83bf62032d40683948636 | https://github.com/badges/shields/blob/283601423f3d1a19aae83bf62032d40683948636/services/nuget/nuget-v2-service-family.js#L98-L220 | train | Creates a service family | [
30522,
3853,
9005,
2121,
7903,
12879,
10631,
2135,
1006,
1063,
2516,
1010,
2171,
1027,
2516,
1010,
12398,
20470,
2884,
1010,
2326,
15058,
3126,
2140,
1010,
17928,
15058,
3126,
2140,
1010,
1051,
2850,
2696,
14192,
4017,
1010,
2742,
23947,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | dist/howler.js | function(sprite, internal) {
var self = this;
var id = null;
// Determine if a sprite, sound id or nothing was passed
if (typeof sprite === 'number') {
id = sprite;
sprite = null;
} else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) {
// If the passed sprite doesn't exist, do nothing.
return null;
} else if (typeof sprite === 'undefined') {
// Use the default sound sprite (plays the full audio length).
sprite = '__default';
// Check if there is a single paused sound that isn't ended.
// If there is, play that sound. If not, continue as usual.
if (!self._playLock) {
var num = 0;
for (var i=0; i<self._sounds.length; i++) {
if (self._sounds[i]._paused && !self._sounds[i]._ended) {
num++;
id = self._sounds[i]._id;
}
}
if (num === 1) {
sprite = null;
} else {
id = null;
}
}
}
// Get the selected node, or get one from the pool.
var sound = id ? self._soundById(id) : self._inactiveSound();
// If the sound doesn't exist, do nothing.
if (!sound) {
return null;
}
// Select the sprite definition.
if (id && !sprite) {
sprite = sound._sprite || '__default';
}
// If the sound hasn't loaded, we must wait to get the audio's duration.
// We also need to wait to make sure we don't run into race conditions with
// the order of function calls.
if (self._state !== 'loaded') {
// Set the sprite value on this sound.
sound._sprite = sprite;
// Mark this sound as not ended in case another sound is played before this one loads.
sound._ended = false;
// Add the sound to the queue to be played on load.
var soundId = sound._id;
self._queue.push({
event: 'play',
action: function() {
self.play(soundId);
}
});
return soundId;
}
// Don't play the sound if an id was passed and it is already playing.
if (id && !sound._paused) {
// Trigger the play event, in order to keep iterating through queue.
if (!internal) {
self._loadQueue('play');
}
return sound._id;
}
// Make sure the AudioContext isn't suspended, and resume it if it is.
if (self._webAudio) {
Howler._autoResume();
}
// Determine how long to play for and where to start playing.
var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
var timeout = (duration * 1000) / Math.abs(sound._rate);
var start = self._sprite[sprite][0] / 1000;
var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000;
var loop = !!(sound._loop || self._sprite[sprite][2]);
sound._sprite = sprite;
// Mark the sound as ended instantly so that this async playback
// doesn't get grabbed by another call to play while this one waits to start.
sound._ended = false;
// Update the parameters of the sound.
var setParams = function() {
sound._paused = false;
sound._seek = seek;
sound._start = start;
sound._stop = stop;
sound._loop = loop;
};
// End the sound instantly if seek is at the end.
if (seek >= stop) {
self._ended(sound);
return;
}
// Begin the actual playback.
var node = sound._node;
if (self._webAudio) {
// Fire this when the sound is ready to play to begin Web Audio playback.
var playWebAudio = function() {
self._playLock = false;
setParams();
self._refreshBuffer(sound);
// Setup the playback params.
var vol = (sound._muted || self._muted) ? 0 : sound._volume;
node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
sound._playStart = Howler.ctx.currentTime;
// Play the sound using the supported method.
if (typeof node.bufferSource.start === 'undefined') {
sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
} else {
sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
}
// Start a new timer if none is present.
if (timeout !== Infinity) {
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
}
if (!internal) {
setTimeout(function() {
self._emit('play', sound._id);
self._loadQueue();
}, 0);
}
};
if (Howler.state === 'running') {
playWebAudio();
} else {
self._playLock = true;
// Wait for the audio context to resume before playing.
self.once('resume', playWebAudio);
// Cancel the end timer.
self._clearTimer(sound._id);
}
} else {
// Fire this when the sound is ready to play to begin HTML5 Audio playback.
var playHtml5 = function() {
node.currentTime = seek;
node.muted = sound._muted || self._muted || Howler._muted || node.muted;
node.volume = sound._volume * Howler.volume();
node.playbackRate = sound._rate;
// Some browsers will throw an error if this is called without user interaction.
try {
var play = node.play();
// Support older browsers that don't support promises, and thus don't have this issue.
if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
// Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
self._playLock = true;
// Set param values immediately.
setParams();
// Releases the lock and executes queued actions.
play
.then(function() {
self._playLock = false;
node._unlocked = true;
if (!internal) {
self._emit('play', sound._id);
self._loadQueue();
}
})
.catch(function() {
self._playLock = false;
self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
'on mobile devices and Chrome where playback was not within a user interaction.');
// Reset the ended and paused values.
sound._ended = true;
sound._paused = true;
});
} else if (!internal) {
self._playLock = false;
setParams();
self._emit('play', sound._id);
self._loadQueue();
}
// Setting rate before playing won't work in IE, so we set it again here.
node.playbackRate = sound._rate;
// If the node is still paused, then we can assume there was a playback issue.
if (node.paused) {
self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
'on mobile devices and Chrome where playback was not within a user interaction.');
return;
}
// Setup the end timer on sprites or listen for the ended event.
if (sprite !== '__default' || sound._loop) {
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
} else {
self._endTimers[sound._id] = function() {
// Fire ended on this audio node.
self._ended(sound);
// Clear this listener.
node.removeEventListener('ended', self._endTimers[sound._id], false);
};
node.addEventListener('ended', self._endTimers[sound._id], false);
}
} catch (err) {
self._emit('playerror', sound._id, err);
}
};
// If this is streaming audio, make sure the src is set and load again.
if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
node.src = self._src;
node.load();
}
// Play immediately if ready, or wait for the 'canplaythrough'e vent.
var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
if (node.readyState >= 3 || loadedNoReadyState) {
playHtml5();
} else {
self._playLock = true;
var listener = function() {
// Begin playback.
playHtml5();
// Clear this listener.
node.removeEventListener(Howler._canPlayEvent, listener, false);
};
node.addEventListener(Howler._canPlayEvent, listener, false);
// Cancel the end timer.
self._clearTimer(sound._id);
}
}
return sound._id;
} | javascript | function(sprite, internal) {
var self = this;
var id = null;
// Determine if a sprite, sound id or nothing was passed
if (typeof sprite === 'number') {
id = sprite;
sprite = null;
} else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) {
// If the passed sprite doesn't exist, do nothing.
return null;
} else if (typeof sprite === 'undefined') {
// Use the default sound sprite (plays the full audio length).
sprite = '__default';
// Check if there is a single paused sound that isn't ended.
// If there is, play that sound. If not, continue as usual.
if (!self._playLock) {
var num = 0;
for (var i=0; i<self._sounds.length; i++) {
if (self._sounds[i]._paused && !self._sounds[i]._ended) {
num++;
id = self._sounds[i]._id;
}
}
if (num === 1) {
sprite = null;
} else {
id = null;
}
}
}
// Get the selected node, or get one from the pool.
var sound = id ? self._soundById(id) : self._inactiveSound();
// If the sound doesn't exist, do nothing.
if (!sound) {
return null;
}
// Select the sprite definition.
if (id && !sprite) {
sprite = sound._sprite || '__default';
}
// If the sound hasn't loaded, we must wait to get the audio's duration.
// We also need to wait to make sure we don't run into race conditions with
// the order of function calls.
if (self._state !== 'loaded') {
// Set the sprite value on this sound.
sound._sprite = sprite;
// Mark this sound as not ended in case another sound is played before this one loads.
sound._ended = false;
// Add the sound to the queue to be played on load.
var soundId = sound._id;
self._queue.push({
event: 'play',
action: function() {
self.play(soundId);
}
});
return soundId;
}
// Don't play the sound if an id was passed and it is already playing.
if (id && !sound._paused) {
// Trigger the play event, in order to keep iterating through queue.
if (!internal) {
self._loadQueue('play');
}
return sound._id;
}
// Make sure the AudioContext isn't suspended, and resume it if it is.
if (self._webAudio) {
Howler._autoResume();
}
// Determine how long to play for and where to start playing.
var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
var timeout = (duration * 1000) / Math.abs(sound._rate);
var start = self._sprite[sprite][0] / 1000;
var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000;
var loop = !!(sound._loop || self._sprite[sprite][2]);
sound._sprite = sprite;
// Mark the sound as ended instantly so that this async playback
// doesn't get grabbed by another call to play while this one waits to start.
sound._ended = false;
// Update the parameters of the sound.
var setParams = function() {
sound._paused = false;
sound._seek = seek;
sound._start = start;
sound._stop = stop;
sound._loop = loop;
};
// End the sound instantly if seek is at the end.
if (seek >= stop) {
self._ended(sound);
return;
}
// Begin the actual playback.
var node = sound._node;
if (self._webAudio) {
// Fire this when the sound is ready to play to begin Web Audio playback.
var playWebAudio = function() {
self._playLock = false;
setParams();
self._refreshBuffer(sound);
// Setup the playback params.
var vol = (sound._muted || self._muted) ? 0 : sound._volume;
node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
sound._playStart = Howler.ctx.currentTime;
// Play the sound using the supported method.
if (typeof node.bufferSource.start === 'undefined') {
sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
} else {
sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
}
// Start a new timer if none is present.
if (timeout !== Infinity) {
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
}
if (!internal) {
setTimeout(function() {
self._emit('play', sound._id);
self._loadQueue();
}, 0);
}
};
if (Howler.state === 'running') {
playWebAudio();
} else {
self._playLock = true;
// Wait for the audio context to resume before playing.
self.once('resume', playWebAudio);
// Cancel the end timer.
self._clearTimer(sound._id);
}
} else {
// Fire this when the sound is ready to play to begin HTML5 Audio playback.
var playHtml5 = function() {
node.currentTime = seek;
node.muted = sound._muted || self._muted || Howler._muted || node.muted;
node.volume = sound._volume * Howler.volume();
node.playbackRate = sound._rate;
// Some browsers will throw an error if this is called without user interaction.
try {
var play = node.play();
// Support older browsers that don't support promises, and thus don't have this issue.
if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
// Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
self._playLock = true;
// Set param values immediately.
setParams();
// Releases the lock and executes queued actions.
play
.then(function() {
self._playLock = false;
node._unlocked = true;
if (!internal) {
self._emit('play', sound._id);
self._loadQueue();
}
})
.catch(function() {
self._playLock = false;
self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
'on mobile devices and Chrome where playback was not within a user interaction.');
// Reset the ended and paused values.
sound._ended = true;
sound._paused = true;
});
} else if (!internal) {
self._playLock = false;
setParams();
self._emit('play', sound._id);
self._loadQueue();
}
// Setting rate before playing won't work in IE, so we set it again here.
node.playbackRate = sound._rate;
// If the node is still paused, then we can assume there was a playback issue.
if (node.paused) {
self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
'on mobile devices and Chrome where playback was not within a user interaction.');
return;
}
// Setup the end timer on sprites or listen for the ended event.
if (sprite !== '__default' || sound._loop) {
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
} else {
self._endTimers[sound._id] = function() {
// Fire ended on this audio node.
self._ended(sound);
// Clear this listener.
node.removeEventListener('ended', self._endTimers[sound._id], false);
};
node.addEventListener('ended', self._endTimers[sound._id], false);
}
} catch (err) {
self._emit('playerror', sound._id, err);
}
};
// If this is streaming audio, make sure the src is set and load again.
if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
node.src = self._src;
node.load();
}
// Play immediately if ready, or wait for the 'canplaythrough'e vent.
var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
if (node.readyState >= 3 || loadedNoReadyState) {
playHtml5();
} else {
self._playLock = true;
var listener = function() {
// Begin playback.
playHtml5();
// Clear this listener.
node.removeEventListener(Howler._canPlayEvent, listener, false);
};
node.addEventListener(Howler._canPlayEvent, listener, false);
// Cancel the end timer.
self._clearTimer(sound._id);
}
}
return sound._id;
} | [
"function",
"(",
"sprite",
",",
"internal",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"id",
"=",
"null",
";",
"// Determine if a sprite, sound id or nothing was passed",
"if",
"(",
"typeof",
"sprite",
"===",
"'number'",
")",
"{",
"id",
"=",
"sprite",
... | Play a sound or resume previous playback.
@param {String/Number} sprite Sprite name for sprite playback or sound id to continue previous.
@param {Boolean} internal Internal Use: true prevents event firing.
@return {Number} Sound ID. | [
"Play",
"a",
"sound",
"or",
"resume",
"previous",
"playback",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L709-L968 | train | Get the current node or the first active sound. | [
30522,
3853,
1006,
11867,
17625,
1010,
4722,
1007,
1063,
13075,
2969,
1027,
2023,
1025,
13075,
8909,
1027,
19701,
1025,
1013,
1013,
5646,
2065,
1037,
11867,
17625,
1010,
2614,
8909,
2030,
2498,
2001,
2979,
2065,
1006,
2828,
11253,
11867,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DraftEnabledMockServer.js | function(sEntityset, mEntitySets) {
var aSemanticKey = [];
for (var annotationsProperty in this._oDraftMetadata.annotations) {
if (annotationsProperty.lastIndexOf(mEntitySets[sEntityset].type) > -1) {
aSemanticKey = this._oDraftMetadata.annotations[annotationsProperty][this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY] || [];
break;
}
}
var aSemanticKeys = [];
var element;
for (var i = 0; i < aSemanticKey.length; i++) {
element = aSemanticKey[i];
for (var key in element) {
aSemanticKeys.push(element[key]);
}
}
return aSemanticKeys;
} | javascript | function(sEntityset, mEntitySets) {
var aSemanticKey = [];
for (var annotationsProperty in this._oDraftMetadata.annotations) {
if (annotationsProperty.lastIndexOf(mEntitySets[sEntityset].type) > -1) {
aSemanticKey = this._oDraftMetadata.annotations[annotationsProperty][this._oConstants.COM_SAP_VOCABULARIES_COMMON_V1_SEMANTICKEY] || [];
break;
}
}
var aSemanticKeys = [];
var element;
for (var i = 0; i < aSemanticKey.length; i++) {
element = aSemanticKey[i];
for (var key in element) {
aSemanticKeys.push(element[key]);
}
}
return aSemanticKeys;
} | [
"function",
"(",
"sEntityset",
",",
"mEntitySets",
")",
"{",
"var",
"aSemanticKey",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"annotationsProperty",
"in",
"this",
".",
"_oDraftMetadata",
".",
"annotations",
")",
"{",
"if",
"(",
"annotationsProperty",
".",
"last... | Returns an array with key of the corresponding "draft-less" entity type
@param {string} sEntityset name of the entityset
@param {object} mEntitySets
@return {object} array with key of the corresponding "draft-less" entity type | [
"Returns",
"an",
"array",
"with",
"key",
"of",
"the",
"corresponding",
"draft",
"-",
"less",
"entity",
"type"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/DraftEnabledMockServer.js#L132-L149 | train | Returns an array of all semantic keys for the given entityset | [
30522,
3853,
1006,
2741,
3012,
13462,
1010,
2273,
3775,
3723,
13462,
2015,
1007,
1063,
13075,
2004,
16704,
26348,
3240,
1027,
1031,
1033,
1025,
2005,
1006,
13075,
5754,
17287,
9285,
21572,
4842,
3723,
1999,
2023,
1012,
1035,
1051,
7265,
619... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aws/aws-sdk-js | lib/discover_endpoint.js | hasCustomEndpoint | function hasCustomEndpoint(client) {
//if set endpoint is set for specific client, enable endpoint discovery will raise an error.
if (client._originalConfig && client._originalConfig.endpoint && client._originalConfig.endpointDiscoveryEnabled === true) {
throw util.error(new Error(), {
code: 'ConfigurationException',
message: 'Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'
});
};
var svcConfig = AWS.config[client.serviceIdentifier] || {};
return Boolean(AWS.config.endpoint || svcConfig.endpoint || (client._originalConfig && client._originalConfig.endpoint));
} | javascript | function hasCustomEndpoint(client) {
//if set endpoint is set for specific client, enable endpoint discovery will raise an error.
if (client._originalConfig && client._originalConfig.endpoint && client._originalConfig.endpointDiscoveryEnabled === true) {
throw util.error(new Error(), {
code: 'ConfigurationException',
message: 'Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'
});
};
var svcConfig = AWS.config[client.serviceIdentifier] || {};
return Boolean(AWS.config.endpoint || svcConfig.endpoint || (client._originalConfig && client._originalConfig.endpoint));
} | [
"function",
"hasCustomEndpoint",
"(",
"client",
")",
"{",
"//if set endpoint is set for specific client, enable endpoint discovery will raise an error.",
"if",
"(",
"client",
".",
"_originalConfig",
"&&",
"client",
".",
"_originalConfig",
".",
"endpoint",
"&&",
"client",
".",... | If endpoint is explicitly configured, SDK should not do endpoint discovery in anytime.
@param [object] client Service client object.
@api private | [
"If",
"endpoint",
"is",
"explicitly",
"configured",
"SDK",
"should",
"not",
"do",
"endpoint",
"discovery",
"in",
"anytime",
"."
] | c23e5f0edd150f8885267e5f7c8a564f8e6e8562 | https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L247-L257 | train | Check if custom endpoint is set for specific client | [
30522,
3853,
2038,
7874,
20389,
10497,
8400,
1006,
7396,
1007,
1063,
1013,
1013,
2065,
2275,
2203,
8400,
2003,
2275,
2005,
3563,
7396,
1010,
9585,
2203,
8400,
5456,
2097,
5333,
2019,
7561,
1012,
2065,
1006,
7396,
1012,
1035,
2434,
8663,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/datepicker/js/calendar.spec.js | findCellByLabel | function findCellByLabel(monthElement, day) {
var tds = monthElement.querySelectorAll('td');
var td;
for (var i = 0; i < tds.length; i++) {
td = tds[i];
if (td.textContent === day.toString()) {
return td;
}
}
} | javascript | function findCellByLabel(monthElement, day) {
var tds = monthElement.querySelectorAll('td');
var td;
for (var i = 0; i < tds.length; i++) {
td = tds[i];
if (td.textContent === day.toString()) {
return td;
}
}
} | [
"function",
"findCellByLabel",
"(",
"monthElement",
",",
"day",
")",
"{",
"var",
"tds",
"=",
"monthElement",
".",
"querySelectorAll",
"(",
"'td'",
")",
";",
"var",
"td",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"tds",
".",
"length",
";",... | Finds a td given a label. | [
"Finds",
"a",
"td",
"given",
"a",
"label",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L44-L54 | train | Find a cell by label | [
30522,
3853,
2424,
29109,
14510,
20470,
2884,
1006,
3204,
12260,
3672,
1010,
2154,
1007,
1063,
13075,
14595,
2015,
1027,
3204,
12260,
3672,
1012,
23032,
11246,
22471,
6525,
3363,
1006,
1005,
14595,
1005,
1007,
1025,
13075,
14595,
1025,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/DragAndDrop.js | openDroppedFiles | function openDroppedFiles(paths) {
var errorFiles = [],
ERR_MULTIPLE_ITEMS_WITH_DIR = {};
return Async.doInParallel(paths, function (path, idx) {
var result = new $.Deferred();
// Only open files.
FileSystem.resolve(path, function (err, item) {
if (!err && item.isFile) {
// If the file is already open, and this isn't the last
// file in the list, return. If this *is* the last file,
// always open it so it gets selected.
if (idx < paths.length - 1) {
if (MainViewManager.findInWorkingSet(MainViewManager.ALL_PANES, path) !== -1) {
result.resolve();
return;
}
}
CommandManager.execute(Commands.CMD_ADD_TO_WORKINGSET_AND_OPEN,
{fullPath: path, silent: true})
.done(function () {
result.resolve();
})
.fail(function (openErr) {
errorFiles.push({path: path, error: openErr});
result.reject();
});
} else if (!err && item.isDirectory && paths.length === 1) {
// One folder was dropped, open it.
ProjectManager.openProject(path)
.done(function () {
result.resolve();
})
.fail(function () {
// User was already notified of the error.
result.reject();
});
} else {
errorFiles.push({path: path, error: err || ERR_MULTIPLE_ITEMS_WITH_DIR});
result.reject();
}
});
return result.promise();
}, false)
.fail(function () {
function errorToString(err) {
if (err === ERR_MULTIPLE_ITEMS_WITH_DIR) {
return Strings.ERROR_MIXED_DRAGDROP;
} else {
return FileUtils.getFileErrorString(err);
}
}
if (errorFiles.length > 0) {
var message = Strings.ERROR_OPENING_FILES;
message += "<ul class='dialog-list'>";
errorFiles.forEach(function (info) {
message += "<li><span class='dialog-filename'>" +
StringUtils.breakableUrl(ProjectManager.makeProjectRelativeIfPossible(info.path)) +
"</span> - " + errorToString(info.error) +
"</li>";
});
message += "</ul>";
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
message
);
}
});
} | javascript | function openDroppedFiles(paths) {
var errorFiles = [],
ERR_MULTIPLE_ITEMS_WITH_DIR = {};
return Async.doInParallel(paths, function (path, idx) {
var result = new $.Deferred();
// Only open files.
FileSystem.resolve(path, function (err, item) {
if (!err && item.isFile) {
// If the file is already open, and this isn't the last
// file in the list, return. If this *is* the last file,
// always open it so it gets selected.
if (idx < paths.length - 1) {
if (MainViewManager.findInWorkingSet(MainViewManager.ALL_PANES, path) !== -1) {
result.resolve();
return;
}
}
CommandManager.execute(Commands.CMD_ADD_TO_WORKINGSET_AND_OPEN,
{fullPath: path, silent: true})
.done(function () {
result.resolve();
})
.fail(function (openErr) {
errorFiles.push({path: path, error: openErr});
result.reject();
});
} else if (!err && item.isDirectory && paths.length === 1) {
// One folder was dropped, open it.
ProjectManager.openProject(path)
.done(function () {
result.resolve();
})
.fail(function () {
// User was already notified of the error.
result.reject();
});
} else {
errorFiles.push({path: path, error: err || ERR_MULTIPLE_ITEMS_WITH_DIR});
result.reject();
}
});
return result.promise();
}, false)
.fail(function () {
function errorToString(err) {
if (err === ERR_MULTIPLE_ITEMS_WITH_DIR) {
return Strings.ERROR_MIXED_DRAGDROP;
} else {
return FileUtils.getFileErrorString(err);
}
}
if (errorFiles.length > 0) {
var message = Strings.ERROR_OPENING_FILES;
message += "<ul class='dialog-list'>";
errorFiles.forEach(function (info) {
message += "<li><span class='dialog-filename'>" +
StringUtils.breakableUrl(ProjectManager.makeProjectRelativeIfPossible(info.path)) +
"</span> - " + errorToString(info.error) +
"</li>";
});
message += "</ul>";
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.ERROR_OPENING_FILE_TITLE,
message
);
}
});
} | [
"function",
"openDroppedFiles",
"(",
"paths",
")",
"{",
"var",
"errorFiles",
"=",
"[",
"]",
",",
"ERR_MULTIPLE_ITEMS_WITH_DIR",
"=",
"{",
"}",
";",
"return",
"Async",
".",
"doInParallel",
"(",
"paths",
",",
"function",
"(",
"path",
",",
"idx",
")",
"{",
... | Open dropped files
@param {Array.<string>} files Array of files dropped on the application.
@return {Promise} Promise that is resolved if all files are opened, or rejected
if there was an error. | [
"Open",
"dropped",
"files"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DragAndDrop.js#L96-L171 | train | Open dropped files | [
30522,
3853,
2330,
25711,
5669,
8873,
4244,
1006,
10425,
1007,
1063,
13075,
7561,
8873,
4244,
1027,
1031,
1033,
1010,
9413,
2099,
1035,
3674,
1035,
5167,
1035,
2007,
1035,
16101,
1027,
1063,
1065,
1025,
2709,
2004,
6038,
2278,
1012,
24341,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | _mapError | function _mapError(err) {
if (!err) {
return null;
}
switch (err) {
case appshell.fs.ERR_INVALID_PARAMS:
return FileSystemError.INVALID_PARAMS;
case appshell.fs.ERR_NOT_FOUND:
return FileSystemError.NOT_FOUND;
case appshell.fs.ERR_CANT_READ:
return FileSystemError.NOT_READABLE;
case appshell.fs.ERR_CANT_WRITE:
return FileSystemError.NOT_WRITABLE;
case appshell.fs.ERR_UNSUPPORTED_ENCODING:
return FileSystemError.UNSUPPORTED_ENCODING;
case appshell.fs.ERR_OUT_OF_SPACE:
return FileSystemError.OUT_OF_SPACE;
case appshell.fs.ERR_FILE_EXISTS:
return FileSystemError.ALREADY_EXISTS;
case appshell.fs.ERR_ENCODE_FILE_FAILED:
return FileSystemError.ENCODE_FILE_FAILED;
case appshell.fs.ERR_DECODE_FILE_FAILED:
return FileSystemError.DECODE_FILE_FAILED;
case appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING:
return FileSystemError.UNSUPPORTED_UTF16_ENCODING;
}
return FileSystemError.UNKNOWN;
} | javascript | function _mapError(err) {
if (!err) {
return null;
}
switch (err) {
case appshell.fs.ERR_INVALID_PARAMS:
return FileSystemError.INVALID_PARAMS;
case appshell.fs.ERR_NOT_FOUND:
return FileSystemError.NOT_FOUND;
case appshell.fs.ERR_CANT_READ:
return FileSystemError.NOT_READABLE;
case appshell.fs.ERR_CANT_WRITE:
return FileSystemError.NOT_WRITABLE;
case appshell.fs.ERR_UNSUPPORTED_ENCODING:
return FileSystemError.UNSUPPORTED_ENCODING;
case appshell.fs.ERR_OUT_OF_SPACE:
return FileSystemError.OUT_OF_SPACE;
case appshell.fs.ERR_FILE_EXISTS:
return FileSystemError.ALREADY_EXISTS;
case appshell.fs.ERR_ENCODE_FILE_FAILED:
return FileSystemError.ENCODE_FILE_FAILED;
case appshell.fs.ERR_DECODE_FILE_FAILED:
return FileSystemError.DECODE_FILE_FAILED;
case appshell.fs.ERR_UNSUPPORTED_UTF16_ENCODING:
return FileSystemError.UNSUPPORTED_UTF16_ENCODING;
}
return FileSystemError.UNKNOWN;
} | [
"function",
"_mapError",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"err",
")",
"{",
"case",
"appshell",
".",
"fs",
".",
"ERR_INVALID_PARAMS",
":",
"return",
"FileSystemError",
".",
"INVALID_PARAMS",... | Convert appshell error codes to FileSystemError values.
@param {?number} err An appshell error code
@return {?string} A FileSystemError string, or null if there was no error code.
@private | [
"Convert",
"appshell",
"error",
"codes",
"to",
"FileSystemError",
"values",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/filesystem/impls/appshell/AppshellFileSystem.js#L143-L171 | train | map error to FileSystemError | [
30522,
3853,
1035,
4949,
2121,
29165,
1006,
9413,
2099,
1007,
1063,
2065,
1006,
999,
9413,
2099,
1007,
1063,
2709,
19701,
1025,
1065,
6942,
1006,
9413,
2099,
1007,
1063,
2553,
18726,
18223,
1012,
1042,
2015,
1012,
9413,
2099,
1035,
19528,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (elem)
{
// delete unneeded handlers
if (this._sasl_success_handler) {
this.deleteHandler(this._sasl_success_handler);
this._sasl_success_handler = null;
}
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
if(this._sasl_mechanism)
this._sasl_mechanism.onFailure();
this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
return false;
} | javascript | function (elem)
{
// delete unneeded handlers
if (this._sasl_success_handler) {
this.deleteHandler(this._sasl_success_handler);
this._sasl_success_handler = null;
}
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
if(this._sasl_mechanism)
this._sasl_mechanism.onFailure();
this._changeConnectStatus(Strophe.Status.AUTHFAIL, null);
return false;
} | [
"function",
"(",
"elem",
")",
"{",
"// delete unneeded handlers\r",
"if",
"(",
"this",
".",
"_sasl_success_handler",
")",
"{",
"this",
".",
"deleteHandler",
"(",
"this",
".",
"_sasl_success_handler",
")",
";",
"this",
".",
"_sasl_success_handler",
"=",
"null",
"... | PrivateFunction: _sasl_failure_cb
_Private_ handler for SASL authentication failure.
Parameters:
(XMLElement) elem - The matching stanza.
Returns:
false to remove the handler.
/* jshint unused:false | [
"PrivateFunction",
":",
"_sasl_failure_cb",
"_Private_",
"handler",
"for",
"SASL",
"authentication",
"failure",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L3328-L3344 | train | endregion endregion endregion | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
1013,
1013,
3972,
12870,
4895,
24045,
5732,
28213,
2015,
2065,
1006,
2023,
1012,
1035,
21871,
2140,
1035,
3112,
1035,
28213,
1007,
1063,
2023,
1012,
3972,
12870,
11774,
3917,
1006,
2023,
1012,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js | addLeafSymbol | function addLeafSymbol(sId) {
// Note: this function is executed at load time only!
mFilterParserSymbols[sId] = {
lbp : 0,
nud : function (oToken) {
oToken.precedence = 99; // prevent it from being enclosed in brackets
return oToken;
}
};
} | javascript | function addLeafSymbol(sId) {
// Note: this function is executed at load time only!
mFilterParserSymbols[sId] = {
lbp : 0,
nud : function (oToken) {
oToken.precedence = 99; // prevent it from being enclosed in brackets
return oToken;
}
};
} | [
"function",
"addLeafSymbol",
"(",
"sId",
")",
"{",
"// Note: this function is executed at load time only!",
"mFilterParserSymbols",
"[",
"sId",
"]",
"=",
"{",
"lbp",
":",
"0",
",",
"nud",
":",
"function",
"(",
"oToken",
")",
"{",
"oToken",
".",
"precedence",
"="... | Adds a leaf symbol to mFilterParserSymbols.
@param {string} sId The token ID | [
"Adds",
"a",
"leaf",
"symbol",
"to",
"mFilterParserSymbols",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Parser.js#L189-L198 | train | Adds a leaf symbol to the filter parser | [
30522,
3853,
5587,
19213,
6508,
13344,
2140,
1006,
15765,
1007,
1063,
1013,
1013,
3602,
1024,
2023,
3853,
2003,
6472,
2012,
7170,
2051,
2069,
999,
1049,
8873,
21928,
19362,
8043,
6508,
13344,
4877,
1031,
15765,
1033,
1027,
1063,
6053,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/ODataMessageParser.js | filterDuplicates | function filterDuplicates(/*ref*/ aMessages){
if (aMessages.length > 1) {
for (var iIndex = 1; iIndex < aMessages.length; iIndex++) {
if (aMessages[0].getCode() == aMessages[iIndex].getCode() && aMessages[0].getMessage() == aMessages[iIndex].getMessage()) {
aMessages.shift(); // Remove outer error, since inner error is more detailed
break;
}
}
}
} | javascript | function filterDuplicates(/*ref*/ aMessages){
if (aMessages.length > 1) {
for (var iIndex = 1; iIndex < aMessages.length; iIndex++) {
if (aMessages[0].getCode() == aMessages[iIndex].getCode() && aMessages[0].getMessage() == aMessages[iIndex].getMessage()) {
aMessages.shift(); // Remove outer error, since inner error is more detailed
break;
}
}
}
} | [
"function",
"filterDuplicates",
"(",
"/*ref*/",
"aMessages",
")",
"{",
"if",
"(",
"aMessages",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"var",
"iIndex",
"=",
"1",
";",
"iIndex",
"<",
"aMessages",
".",
"length",
";",
"iIndex",
"++",
")",
"{",
"i... | The message container returned by the backend could contain duplicate messages in some scenarios.
The outer error could be identical to an inner error. This makes sense when the outer error is only though as error message container
for the inner errors and therefore shouldn't be end up in a seperate UI message.
This function is used to filter out not relevant outer errors.
@example
{
"error": {
"code": "ABC",
"message": {
"value": "Bad things happened."
},
"innererror": {
"errordetails": [
{
"code": "ABC",
"message": "Bad things happened."
},
...
@private | [
"The",
"message",
"container",
"returned",
"by",
"the",
"backend",
"could",
"contain",
"duplicate",
"messages",
"in",
"some",
"scenarios",
".",
"The",
"outer",
"error",
"could",
"be",
"identical",
"to",
"an",
"inner",
"error",
".",
"This",
"makes",
"sense",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataMessageParser.js#L892-L901 | train | Filter duplicates from the messages array | [
30522,
3853,
11307,
8566,
24759,
24695,
2015,
1006,
1013,
1008,
25416,
1008,
1013,
19900,
3736,
8449,
1007,
1063,
2065,
1006,
19900,
3736,
8449,
1012,
3091,
1028,
1015,
1007,
1063,
2005,
1006,
13075,
2462,
13629,
2595,
1027,
1015,
1025,
246... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | pushPoint | function pushPoint(pt)
{
if (lastPushed == null || Math.abs(lastPushed.x - pt.x) >= tol || Math.abs(lastPushed.y - pt.y) >= tol)
{
result.push(pt);
lastPushed = pt;
}
return lastPushed;
} | javascript | function pushPoint(pt)
{
if (lastPushed == null || Math.abs(lastPushed.x - pt.x) >= tol || Math.abs(lastPushed.y - pt.y) >= tol)
{
result.push(pt);
lastPushed = pt;
}
return lastPushed;
} | [
"function",
"pushPoint",
"(",
"pt",
")",
"{",
"if",
"(",
"lastPushed",
"==",
"null",
"||",
"Math",
".",
"abs",
"(",
"lastPushed",
".",
"x",
"-",
"pt",
".",
"x",
")",
">=",
"tol",
"||",
"Math",
".",
"abs",
"(",
"lastPushed",
".",
"y",
"-",
"pt",
... | Adds waypoints only if outside of tolerance | [
"Adds",
"waypoints",
"only",
"if",
"outside",
"of",
"tolerance"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L50016-L50025 | train | push point to result | [
30522,
3853,
5245,
8400,
1006,
13866,
1007,
1063,
2065,
1006,
2197,
12207,
9072,
1027,
1027,
19701,
1064,
1064,
8785,
1012,
14689,
1006,
2197,
12207,
9072,
1012,
1060,
1011,
13866,
1012,
1060,
1007,
1028,
1027,
2000,
2140,
1064,
1064,
8785,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/interfaces/interfaces.js | reapplyDisplayStyle | function reapplyDisplayStyle(className, value) {
value = value ? "block" : "none"
;[].slice.call(document.querySelectorAll(className)).forEach(function(element) {
element.style.display = value
})
} | javascript | function reapplyDisplayStyle(className, value) {
value = value ? "block" : "none"
;[].slice.call(document.querySelectorAll(className)).forEach(function(element) {
element.style.display = value
})
} | [
"function",
"reapplyDisplayStyle",
"(",
"className",
",",
"value",
")",
"{",
"value",
"=",
"value",
"?",
"\"block\"",
":",
"\"none\"",
";",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"document",
".",
"querySelectorAll",
"(",
"className",
")",
")",
".",
"f... | ----------------------------------------------------------------------------- | [
"-----------------------------------------------------------------------------"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L97-L102 | train | reapply display style to the page | [
30522,
3853,
2128,
29098,
2135,
10521,
13068,
21756,
2571,
1006,
2465,
18442,
1010,
3643,
1007,
1063,
3643,
1027,
3643,
1029,
1000,
3796,
1000,
1024,
1000,
3904,
1000,
1025,
1031,
1033,
1012,
14704,
1012,
2655,
1006,
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... |
tgriesser/knex | src/dialects/mssql/index.js | Client_MSSQL | function Client_MSSQL(config = {}) {
// #1235 mssql module wants 'server', not 'host'. This is to enforce the same
// options object across all dialects.
if (config && config.connection && config.connection.host) {
config.connection.server = config.connection.host;
}
// mssql always creates pool :( lets try to unpool it as much as possible
this.mssqlPoolSettings = {
min: 1,
max: 1,
idleTimeoutMillis: Number.MAX_SAFE_INTEGER,
evictionRunIntervalMillis: 0,
};
Client.call(this, config);
} | javascript | function Client_MSSQL(config = {}) {
// #1235 mssql module wants 'server', not 'host'. This is to enforce the same
// options object across all dialects.
if (config && config.connection && config.connection.host) {
config.connection.server = config.connection.host;
}
// mssql always creates pool :( lets try to unpool it as much as possible
this.mssqlPoolSettings = {
min: 1,
max: 1,
idleTimeoutMillis: Number.MAX_SAFE_INTEGER,
evictionRunIntervalMillis: 0,
};
Client.call(this, config);
} | [
"function",
"Client_MSSQL",
"(",
"config",
"=",
"{",
"}",
")",
"{",
"// #1235 mssql module wants 'server', not 'host'. This is to enforce the same",
"// options object across all dialects.",
"if",
"(",
"config",
"&&",
"config",
".",
"connection",
"&&",
"config",
".",
"conne... | Always initialize with the "QueryBuilder" and "QueryCompiler" objects, which extend the base 'lib/query/builder' and 'lib/query/compiler', respectively. | [
"Always",
"initialize",
"with",
"the",
"QueryBuilder",
"and",
"QueryCompiler",
"objects",
"which",
"extend",
"the",
"base",
"lib",
"/",
"query",
"/",
"builder",
"and",
"lib",
"/",
"query",
"/",
"compiler",
"respectively",
"."
] | 6a4fecfe7822442ee5c43d924958eadfe6e17a93 | https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/dialects/mssql/index.js#L23-L39 | train | MSSQL Client constructor | [
30522,
3853,
7396,
1035,
5796,
2015,
4160,
2140,
1006,
9530,
8873,
2290,
1027,
1063,
1065,
1007,
1063,
1013,
1013,
1001,
13138,
2629,
5796,
2015,
4160,
2140,
11336,
4122,
1005,
8241,
1005,
1010,
2025,
1005,
3677,
1005,
1012,
2023,
2003,
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... |
aframevr/aframe | src/components/look-controls.js | function (event) {
var direction;
var movementX;
var movementY;
var pitchObject = this.pitchObject;
var previousMouseEvent = this.previousMouseEvent;
var yawObject = this.yawObject;
// Not dragging or not enabled.
if (!this.data.enabled || (!this.mouseDown && !this.pointerLocked)) { return; }
// Calculate delta.
if (this.pointerLocked) {
movementX = event.movementX || event.mozMovementX || 0;
movementY = event.movementY || event.mozMovementY || 0;
} else {
movementX = event.screenX - previousMouseEvent.screenX;
movementY = event.screenY - previousMouseEvent.screenY;
}
this.previousMouseEvent = event;
// Calculate rotation.
direction = this.data.reverseMouseDrag ? 1 : -1;
yawObject.rotation.y += movementX * 0.002 * direction;
pitchObject.rotation.x += movementY * 0.002 * direction;
pitchObject.rotation.x = Math.max(-PI_2, Math.min(PI_2, pitchObject.rotation.x));
} | javascript | function (event) {
var direction;
var movementX;
var movementY;
var pitchObject = this.pitchObject;
var previousMouseEvent = this.previousMouseEvent;
var yawObject = this.yawObject;
// Not dragging or not enabled.
if (!this.data.enabled || (!this.mouseDown && !this.pointerLocked)) { return; }
// Calculate delta.
if (this.pointerLocked) {
movementX = event.movementX || event.mozMovementX || 0;
movementY = event.movementY || event.mozMovementY || 0;
} else {
movementX = event.screenX - previousMouseEvent.screenX;
movementY = event.screenY - previousMouseEvent.screenY;
}
this.previousMouseEvent = event;
// Calculate rotation.
direction = this.data.reverseMouseDrag ? 1 : -1;
yawObject.rotation.y += movementX * 0.002 * direction;
pitchObject.rotation.x += movementY * 0.002 * direction;
pitchObject.rotation.x = Math.max(-PI_2, Math.min(PI_2, pitchObject.rotation.x));
} | [
"function",
"(",
"event",
")",
"{",
"var",
"direction",
";",
"var",
"movementX",
";",
"var",
"movementY",
";",
"var",
"pitchObject",
"=",
"this",
".",
"pitchObject",
";",
"var",
"previousMouseEvent",
"=",
"this",
".",
"previousMouseEvent",
";",
"var",
"yawOb... | Translate mouse drag into rotation.
Dragging up and down rotates the camera around the X-axis (yaw).
Dragging left and right rotates the camera around the Y-axis (pitch). | [
"Translate",
"mouse",
"drag",
"into",
"rotation",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/look-controls.js#L227-L253 | train | Handles mouse move. | [
30522,
3853,
1006,
2724,
1007,
1063,
13075,
3257,
1025,
13075,
2929,
2595,
1025,
13075,
2929,
2100,
1025,
13075,
6510,
16429,
20614,
1027,
2023,
1012,
6510,
16429,
20614,
1025,
13075,
3025,
27711,
4402,
15338,
1027,
2023,
1012,
3025,
27711,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
jquery/jquery | build/release/dist.js | push | function push() {
Release.chdir( Release.dir.dist );
console.log( "Pushing release to dist repo..." );
Release.exec( "git push " + distRemote + " master --tags",
"Error pushing master and tags to git repo." );
// Set repo for npm publish
Release.dir.origRepo = Release.dir.repo;
Release.dir.repo = Release.dir.dist;
} | javascript | function push() {
Release.chdir( Release.dir.dist );
console.log( "Pushing release to dist repo..." );
Release.exec( "git push " + distRemote + " master --tags",
"Error pushing master and tags to git repo." );
// Set repo for npm publish
Release.dir.origRepo = Release.dir.repo;
Release.dir.repo = Release.dir.dist;
} | [
"function",
"push",
"(",
")",
"{",
"Release",
".",
"chdir",
"(",
"Release",
".",
"dir",
".",
"dist",
")",
";",
"console",
".",
"log",
"(",
"\"Pushing release to dist repo...\"",
")",
";",
"Release",
".",
"exec",
"(",
"\"git push \"",
"+",
"distRemote",
"+"... | Push files to dist repo | [
"Push",
"files",
"to",
"dist",
"repo"
] | ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3 | https://github.com/jquery/jquery/blob/ccbd6b93424cbdbf86f07a86c2e55cbab497d7a3/build/release/dist.js#L134-L144 | train | Pushes the release to dist repo | [
30522,
3853,
5245,
1006,
1007,
1063,
2713,
1012,
10381,
4305,
2099,
1006,
2713,
1012,
16101,
1012,
4487,
3367,
1007,
1025,
10122,
1012,
8833,
1006,
1000,
6183,
2713,
2000,
4487,
3367,
16360,
2080,
1012,
1012,
1012,
1000,
1007,
1025,
2713,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js | function (context) {
var oElement;
var oFocusControl;
var that = context;
var defaultFocusableElements = [that._mParameters.firstFocusable, that._mParameters.lastFocusable];
// jQuery custom selectors ":sapTabbable"
var aTabbables = jQuery(":sapTabbable", that.$()).get();
// search the first tabbable element
for (var i = 0; i < aTabbables.length; i++) {
if (defaultFocusableElements.indexOf(aTabbables[i].id) === -1) {
oElement = aTabbables[i];
break;
}
}
// If a tabbable element is part of a control, focus the control instead
// jQuery Plugin "control"
oFocusControl = jQuery(oElement).control();
if (oFocusControl[0]) {
var oFocusDomRef = oFocusControl[0].getFocusDomRef();
oElement = oFocusDomRef || oElement;
} else {
// if there is no tabbable element in the content use the first fake
// element to set the focus to the toolpopup
oElement = defaultFocusableElements[0] ? window.document.getElementById(defaultFocusableElements[0]) : null;
}
// oElement might not be available if this function is called during destroy
if (oElement) {
if (oElement) {
oElement.focus();
}
that._sInitialFocusId = oElement.id;
}
} | javascript | function (context) {
var oElement;
var oFocusControl;
var that = context;
var defaultFocusableElements = [that._mParameters.firstFocusable, that._mParameters.lastFocusable];
// jQuery custom selectors ":sapTabbable"
var aTabbables = jQuery(":sapTabbable", that.$()).get();
// search the first tabbable element
for (var i = 0; i < aTabbables.length; i++) {
if (defaultFocusableElements.indexOf(aTabbables[i].id) === -1) {
oElement = aTabbables[i];
break;
}
}
// If a tabbable element is part of a control, focus the control instead
// jQuery Plugin "control"
oFocusControl = jQuery(oElement).control();
if (oFocusControl[0]) {
var oFocusDomRef = oFocusControl[0].getFocusDomRef();
oElement = oFocusDomRef || oElement;
} else {
// if there is no tabbable element in the content use the first fake
// element to set the focus to the toolpopup
oElement = defaultFocusableElements[0] ? window.document.getElementById(defaultFocusableElements[0]) : null;
}
// oElement might not be available if this function is called during destroy
if (oElement) {
if (oElement) {
oElement.focus();
}
that._sInitialFocusId = oElement.id;
}
} | [
"function",
"(",
"context",
")",
"{",
"var",
"oElement",
";",
"var",
"oFocusControl",
";",
"var",
"that",
"=",
"context",
";",
"var",
"defaultFocusableElements",
"=",
"[",
"that",
".",
"_mParameters",
".",
"firstFocusable",
",",
"that",
".",
"_mParameters",
... | Determines the new element which will gain the focus.
@param {sap.ui.ux3.ToolPopup} context to get/set instance values
@private | [
"Determines",
"the",
"new",
"element",
"which",
"will",
"gain",
"the",
"focus",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js#L327-L362 | train | This function is called when the control is not available | [
30522,
3853,
1006,
6123,
1007,
1063,
13075,
1051,
12260,
3672,
1025,
13075,
1997,
10085,
2271,
8663,
13181,
2140,
1025,
13075,
2008,
1027,
6123,
1025,
13075,
12398,
14876,
7874,
3085,
12260,
8163,
1027,
1031,
2008,
1012,
1035,
6131,
5400,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/DOMAgent.js | nodeAtLocation | function nodeAtLocation(location) {
return exports.root.find(function each(n) {
return n.isAtLocation(location, false);
});
} | javascript | function nodeAtLocation(location) {
return exports.root.find(function each(n) {
return n.isAtLocation(location, false);
});
} | [
"function",
"nodeAtLocation",
"(",
"location",
")",
"{",
"return",
"exports",
".",
"root",
".",
"find",
"(",
"function",
"each",
"(",
"n",
")",
"{",
"return",
"n",
".",
"isAtLocation",
"(",
"location",
",",
"false",
")",
";",
"}",
")",
";",
"}"
] | Get the node at the given location
@param {location} | [
"Get",
"the",
"node",
"at",
"the",
"given",
"location"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMAgent.js#L79-L83 | train | Returns the node at the given location | [
30522,
3853,
13045,
4017,
4135,
10719,
1006,
3295,
1007,
1063,
2709,
14338,
1012,
7117,
1012,
2424,
1006,
3853,
2169,
1006,
1050,
1007,
1063,
2709,
1050,
1012,
18061,
19646,
23909,
1006,
3295,
1010,
6270,
1007,
1025,
1065,
1007,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
webpack/webpack | lib/web/JsonpMainTemplate.runtime.js | hotDownloadUpdateChunk | function hotDownloadUpdateChunk(chunkId) {
var script = document.createElement("script");
script.charset = "utf-8";
script.src = $require$.p + $hotChunkFilename$;
if ($crossOriginLoading$) script.crossOrigin = $crossOriginLoading$;
document.head.appendChild(script);
} | javascript | function hotDownloadUpdateChunk(chunkId) {
var script = document.createElement("script");
script.charset = "utf-8";
script.src = $require$.p + $hotChunkFilename$;
if ($crossOriginLoading$) script.crossOrigin = $crossOriginLoading$;
document.head.appendChild(script);
} | [
"function",
"hotDownloadUpdateChunk",
"(",
"chunkId",
")",
"{",
"var",
"script",
"=",
"document",
".",
"createElement",
"(",
"\"script\"",
")",
";",
"script",
".",
"charset",
"=",
"\"utf-8\"",
";",
"script",
".",
"src",
"=",
"$require$",
".",
"p",
"+",
"$h... | $semicolon eslint-disable-next-line no-unused-vars | [
"$semicolon",
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"no",
"-",
"unused",
"-",
"vars"
] | 81cf088cd6a0231b94fa2399bd29294eccee1907 | https://github.com/webpack/webpack/blob/81cf088cd6a0231b94fa2399bd29294eccee1907/lib/web/JsonpMainTemplate.runtime.js#L14-L20 | train | Download a chunk | [
30522,
3853,
2980,
7698,
11066,
6279,
13701,
20760,
8950,
1006,
20000,
3593,
1007,
1063,
13075,
5896,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1000,
5896,
1000,
1007,
1025,
5896,
1012,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/CodeInspection.js | getProvidersForPath | function getProvidersForPath(filePath) {
var language = LanguageManager.getLanguageForPath(filePath).getId(),
context = PreferencesManager._buildContext(filePath, language),
installedProviders = getProvidersForLanguageId(language),
preferredProviders,
prefPreferredProviderNames = prefs.get(PREF_PREFER_PROVIDERS, context),
prefPreferredOnly = prefs.get(PREF_PREFERRED_ONLY, context),
providers;
if (prefPreferredProviderNames && prefPreferredProviderNames.length) {
if (typeof prefPreferredProviderNames === "string") {
prefPreferredProviderNames = [prefPreferredProviderNames];
}
preferredProviders = prefPreferredProviderNames.reduce(function (result, key) {
var provider = _.find(installedProviders, {name: key});
if (provider) {
result.push(provider);
}
return result;
}, []);
if (prefPreferredOnly) {
providers = preferredProviders;
} else {
providers = _.union(preferredProviders, installedProviders);
}
} else {
providers = installedProviders;
}
return providers;
} | javascript | function getProvidersForPath(filePath) {
var language = LanguageManager.getLanguageForPath(filePath).getId(),
context = PreferencesManager._buildContext(filePath, language),
installedProviders = getProvidersForLanguageId(language),
preferredProviders,
prefPreferredProviderNames = prefs.get(PREF_PREFER_PROVIDERS, context),
prefPreferredOnly = prefs.get(PREF_PREFERRED_ONLY, context),
providers;
if (prefPreferredProviderNames && prefPreferredProviderNames.length) {
if (typeof prefPreferredProviderNames === "string") {
prefPreferredProviderNames = [prefPreferredProviderNames];
}
preferredProviders = prefPreferredProviderNames.reduce(function (result, key) {
var provider = _.find(installedProviders, {name: key});
if (provider) {
result.push(provider);
}
return result;
}, []);
if (prefPreferredOnly) {
providers = preferredProviders;
} else {
providers = _.union(preferredProviders, installedProviders);
}
} else {
providers = installedProviders;
}
return providers;
} | [
"function",
"getProvidersForPath",
"(",
"filePath",
")",
"{",
"var",
"language",
"=",
"LanguageManager",
".",
"getLanguageForPath",
"(",
"filePath",
")",
".",
"getId",
"(",
")",
",",
"context",
"=",
"PreferencesManager",
".",
"_buildContext",
"(",
"filePath",
",... | Returns a list of provider for given file path, if available.
Decision is made depending on the file extension.
@param {!string} filePath
@return {Array.<{name:string, scanFileAsync:?function(string, string):!{$.Promise}, scanFile:?function(string, string):?{errors:!Array, aborted:boolean}}>} | [
"Returns",
"a",
"list",
"of",
"provider",
"for",
"given",
"file",
"path",
"if",
"available",
".",
"Decision",
"is",
"made",
"depending",
"on",
"the",
"file",
"extension",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/CodeInspection.js#L157-L188 | train | Get the list of providers for a given file path | [
30522,
3853,
2131,
21572,
17258,
2545,
29278,
15069,
1006,
5371,
15069,
1007,
1063,
13075,
2653,
1027,
2653,
24805,
4590,
1012,
2131,
25023,
6692,
3351,
29278,
15069,
1006,
5371,
15069,
1007,
1012,
2131,
3593,
1006,
1007,
1010,
6123,
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... |
angular/angular | aio/tools/transforms/angular-api-package/content-rules/noMarkdownHeadings.js | listify | function listify(values) {
if (values.length <= 1) return values;
const last = values[values.length - 1];
const rest = values.slice(0, values.length - 1);
return [rest.join(', '), last].join(' and ');
} | javascript | function listify(values) {
if (values.length <= 1) return values;
const last = values[values.length - 1];
const rest = values.slice(0, values.length - 1);
return [rest.join(', '), last].join(' and ');
} | [
"function",
"listify",
"(",
"values",
")",
"{",
"if",
"(",
"values",
".",
"length",
"<=",
"1",
")",
"return",
"values",
";",
"const",
"last",
"=",
"values",
"[",
"values",
".",
"length",
"-",
"1",
"]",
";",
"const",
"rest",
"=",
"values",
".",
"sli... | Convert an array of strings in to a human list - e.g separated by commas and the word `and`.
@param {string[]} values The strings to convert to a list | [
"Convert",
"an",
"array",
"of",
"strings",
"in",
"to",
"a",
"human",
"list",
"-",
"e",
".",
"g",
"separated",
"by",
"commas",
"and",
"the",
"word",
"and",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/aio/tools/transforms/angular-api-package/content-rules/noMarkdownHeadings.js#L45-L50 | train | Listify a list of values | [
30522,
3853,
2862,
8757,
1006,
5300,
1007,
1063,
2065,
1006,
5300,
1012,
3091,
1026,
1027,
1015,
1007,
2709,
5300,
1025,
9530,
3367,
2197,
1027,
5300,
1031,
5300,
1012,
3091,
1011,
1015,
1033,
1025,
9530,
3367,
2717,
1027,
5300,
1012,
147... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
transloadit/uppy | packages/@uppy/webcam/src/index.js | getMediaDevices | function getMediaDevices () {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
return navigator.mediaDevices
}
const getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia
if (!getUserMedia) {
return null
}
return {
getUserMedia (opts) {
return new Promise((resolve, reject) => {
getUserMedia.call(navigator, opts, resolve, reject)
})
}
}
} | javascript | function getMediaDevices () {
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
return navigator.mediaDevices
}
const getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia
if (!getUserMedia) {
return null
}
return {
getUserMedia (opts) {
return new Promise((resolve, reject) => {
getUserMedia.call(navigator, opts, resolve, reject)
})
}
}
} | [
"function",
"getMediaDevices",
"(",
")",
"{",
"if",
"(",
"navigator",
".",
"mediaDevices",
"&&",
"navigator",
".",
"mediaDevices",
".",
"getUserMedia",
")",
"{",
"return",
"navigator",
".",
"mediaDevices",
"}",
"const",
"getUserMedia",
"=",
"navigator",
".",
"... | Setup getUserMedia, with polyfill for older browsers Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia | [
"Setup",
"getUserMedia",
"with",
"polyfill",
"for",
"older",
"browsers",
"Adapted",
"from",
":",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
"US",
"/",
"docs",
"/",
"Web",
"/",
"API",
"/",
"MediaDevices",
"/",
"getUserMed... | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/webcam/src/index.js#L13-L30 | train | getMediaDevices - returns a Promise | [
30522,
3853,
2131,
16969,
24844,
23522,
1006,
1007,
1063,
2065,
1006,
20532,
1012,
2865,
24844,
23522,
1004,
1004,
20532,
1012,
2865,
24844,
23522,
1012,
2131,
20330,
16969,
1007,
1063,
2709,
20532,
1012,
2865,
24844,
23522,
1065,
9530,
3367,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tensorflow/tfjs-models | posenet/demos/camera.js | setupCamera | async function setupCamera() {
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
throw new Error(
'Browser API navigator.mediaDevices.getUserMedia not available');
}
const video = document.getElementById('video');
video.width = videoWidth;
video.height = videoHeight;
const mobile = isMobile();
const stream = await navigator.mediaDevices.getUserMedia({
'audio': false,
'video': {
facingMode: 'user',
width: mobile ? undefined : videoWidth,
height: mobile ? undefined : videoHeight,
},
});
video.srcObject = stream;
return new Promise((resolve) => {
video.onloadedmetadata = () => {
resolve(video);
};
});
} | javascript | async function setupCamera() {
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
throw new Error(
'Browser API navigator.mediaDevices.getUserMedia not available');
}
const video = document.getElementById('video');
video.width = videoWidth;
video.height = videoHeight;
const mobile = isMobile();
const stream = await navigator.mediaDevices.getUserMedia({
'audio': false,
'video': {
facingMode: 'user',
width: mobile ? undefined : videoWidth,
height: mobile ? undefined : videoHeight,
},
});
video.srcObject = stream;
return new Promise((resolve) => {
video.onloadedmetadata = () => {
resolve(video);
};
});
} | [
"async",
"function",
"setupCamera",
"(",
")",
"{",
"if",
"(",
"!",
"navigator",
".",
"mediaDevices",
"||",
"!",
"navigator",
".",
"mediaDevices",
".",
"getUserMedia",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Browser API navigator.mediaDevices.getUserMedia not avail... | Loads a the camera to be used in the demo | [
"Loads",
"a",
"the",
"camera",
"to",
"be",
"used",
"in",
"the",
"demo"
] | af194797c90cc5bcac1060d3cd41b0258a34c7dc | https://github.com/tensorflow/tfjs-models/blob/af194797c90cc5bcac1060d3cd41b0258a34c7dc/posenet/demos/camera.js#L43-L69 | train | Setup camera | [
30522,
2004,
6038,
2278,
3853,
16437,
28727,
6906,
1006,
1007,
1063,
2065,
1006,
999,
20532,
1012,
2865,
24844,
23522,
1064,
1064,
999,
20532,
1012,
2865,
24844,
23522,
1012,
2131,
20330,
16969,
1007,
1063,
5466,
2047,
7561,
1006,
1005,
166... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dogfalo/materialize | dist/js/materialize.js | function (eventName, data) {
if (document.createEvent) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent(eventName, true, false);
evt = this.extend(evt, data);
return this.each(function (v) {
return v.dispatchEvent(evt);
});
}
} | javascript | function (eventName, data) {
if (document.createEvent) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent(eventName, true, false);
evt = this.extend(evt, data);
return this.each(function (v) {
return v.dispatchEvent(evt);
});
}
} | [
"function",
"(",
"eventName",
",",
"data",
")",
"{",
"if",
"(",
"document",
".",
"createEvent",
")",
"{",
"var",
"evt",
"=",
"document",
".",
"createEvent",
"(",
"'HTMLEvents'",
")",
";",
"evt",
".",
"initEvent",
"(",
"eventName",
",",
"true",
",",
"fa... | Modified
Triggers browser event
@param String eventName
@param Object data - Add properties to event object | [
"Modified",
"Triggers",
"browser",
"event"
] | 1122efadad8f1433d404696f7613e3cc13fb83a4 | https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/dist/js/materialize.js#L636-L645 | train | Dispatches an event on each element in the sequence | [
30522,
3853,
1006,
2724,
18442,
1010,
2951,
30524,
1027,
6254,
1012,
3443,
18697,
3372,
1006,
1005,
16129,
18697,
7666,
1005,
1007,
1025,
23408,
2102,
1012,
1999,
4221,
15338,
1006,
2724,
18442,
1010,
2995,
1010,
6270,
1007,
1025,
23408,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/constructor-super.js | isCalledInEveryPath | function isCalledInEveryPath(segment) {
/*
* If specific segment is the looped segment of the current segment,
* skip the segment.
* If not skipped, this never becomes true after a loop.
*/
if (segment.nextSegments.length === 1 &&
segment.nextSegments[0].isLoopedPrevSegment(segment)
) {
return true;
}
return segment.reachable && segInfoMap[segment.id].calledInEveryPaths;
} | javascript | function isCalledInEveryPath(segment) {
/*
* If specific segment is the looped segment of the current segment,
* skip the segment.
* If not skipped, this never becomes true after a loop.
*/
if (segment.nextSegments.length === 1 &&
segment.nextSegments[0].isLoopedPrevSegment(segment)
) {
return true;
}
return segment.reachable && segInfoMap[segment.id].calledInEveryPaths;
} | [
"function",
"isCalledInEveryPath",
"(",
"segment",
")",
"{",
"/*\n * If specific segment is the looped segment of the current segment,\n * skip the segment.\n * If not skipped, this never becomes true after a loop.\n */",
"if",
"(",
"segment",
".",... | Gets the flag which shows `super()` is called in all paths.
@param {CodePathSegment} segment - A code path segment to get.
@returns {boolean} The flag which shows `super()` is called in all paths. | [
"Gets",
"the",
"flag",
"which",
"shows",
"super",
"()",
"is",
"called",
"in",
"all",
"paths",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/constructor-super.js#L152-L165 | train | Returns true if segment is called in every path | [
30522,
3853,
30524,
1063,
1013,
1008,
1008,
2065,
3563,
6903,
2003,
1996,
7077,
2098,
6903,
1997,
1996,
2783,
6903,
1010,
1008,
13558,
1996,
6903,
1012,
1008,
2065,
2025,
16791,
1010,
2023,
2196,
4150,
2995,
2044,
1037,
7077,
1012,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
expressjs/express | examples/cookie-sessions/index.js | count | function count(req, res) {
req.session.count = (req.session.count || 0) + 1
res.send('viewed ' + req.session.count + ' times\n')
} | javascript | function count(req, res) {
req.session.count = (req.session.count || 0) + 1
res.send('viewed ' + req.session.count + ' times\n')
} | [
"function",
"count",
"(",
"req",
",",
"res",
")",
"{",
"req",
".",
"session",
".",
"count",
"=",
"(",
"req",
".",
"session",
".",
"count",
"||",
"0",
")",
"+",
"1",
"res",
".",
"send",
"(",
"'viewed '",
"+",
"req",
".",
"session",
".",
"count",
... | custom middleware | [
"custom",
"middleware"
] | dc538f6e810bd462c98ee7e6aae24c64d4b1da93 | https://github.com/expressjs/express/blob/dc538f6e810bd462c98ee7e6aae24c64d4b1da93/examples/cookie-sessions/index.js#L17-L20 | train | Count the number of views | [
30522,
3853,
4175,
1006,
2128,
4160,
1010,
24501,
1007,
1063,
2128,
4160,
1012,
5219,
1012,
4175,
1027,
1006,
2128,
4160,
1012,
5219,
1012,
4175,
1064,
1064,
1014,
1007,
1009,
1015,
24501,
1012,
4604,
1006,
1005,
7021,
1005,
1009,
2128,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/project/FileSyncManager.js | syncUnopenWorkingSet | function syncUnopenWorkingSet() {
// We only care about working set entries that have never been open (have no Document).
var unopenWorkingSetFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES).filter(function (wsFile) {
return !DocumentManager.getOpenDocumentForPath(wsFile.fullPath);
});
function checkWorkingSetFile(file) {
var result = new $.Deferred();
file.stat(function (err, stat) {
if (!err) {
// File still exists
result.resolve();
} else {
// File has been deleted externally
if (err === FileSystemError.NOT_FOUND) {
DocumentManager.notifyFileDeleted(file);
result.resolve();
} else {
// Some other error fetching metadata: treat as a real error
console.log("Error checking for deletion of " + file.fullPath, err);
result.reject();
}
}
});
return result.promise();
}
// Check all these files in parallel
return Async.doInParallel(unopenWorkingSetFiles, checkWorkingSetFile, false);
} | javascript | function syncUnopenWorkingSet() {
// We only care about working set entries that have never been open (have no Document).
var unopenWorkingSetFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES).filter(function (wsFile) {
return !DocumentManager.getOpenDocumentForPath(wsFile.fullPath);
});
function checkWorkingSetFile(file) {
var result = new $.Deferred();
file.stat(function (err, stat) {
if (!err) {
// File still exists
result.resolve();
} else {
// File has been deleted externally
if (err === FileSystemError.NOT_FOUND) {
DocumentManager.notifyFileDeleted(file);
result.resolve();
} else {
// Some other error fetching metadata: treat as a real error
console.log("Error checking for deletion of " + file.fullPath, err);
result.reject();
}
}
});
return result.promise();
}
// Check all these files in parallel
return Async.doInParallel(unopenWorkingSetFiles, checkWorkingSetFile, false);
} | [
"function",
"syncUnopenWorkingSet",
"(",
")",
"{",
"// We only care about working set entries that have never been open (have no Document).",
"var",
"unopenWorkingSetFiles",
"=",
"MainViewManager",
".",
"getWorkingSet",
"(",
"MainViewManager",
".",
"ALL_PANES",
")",
".",
"filter"... | Scans all the files in the working set that do not have Documents (and thus were not scanned
by findExternalChanges()). If any were deleted on disk, removes them from the working set. | [
"Scans",
"all",
"the",
"files",
"in",
"the",
"working",
"set",
"that",
"do",
"not",
"have",
"Documents",
"(",
"and",
"thus",
"were",
"not",
"scanned",
"by",
"findExternalChanges",
"()",
")",
".",
"If",
"any",
"were",
"deleted",
"on",
"disk",
"removes",
"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileSyncManager.js#L178-L208 | train | Syncs all working set files to disk | [
30522,
3853,
26351,
27819,
11837,
21398,
13462,
1006,
1007,
1063,
1013,
1013,
2057,
2069,
2729,
2055,
2551,
2275,
10445,
2008,
2031,
2196,
30524,
6254,
24805,
4590,
1012,
2131,
26915,
3527,
24894,
4765,
29278,
15069,
1006,
1059,
22747,
9463,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js | function(oControl) {
var oAppComponent = Utils.getAppComponentForControl(oControl);
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
var oRootControl = oAppComponent.getRootControl();
var oView = Utils.getViewForControl(oControl);
var oVariantModel = oAppComponent.getModel("$FlexVariants");
var mParams = {
rootControl : oRootControl,
view : oView,
variantModel : oVariantModel,
variantManagement : {},
flexController: oFlexController
};
var oVMControl;
var aForControlTypes;
jQuery.makeArray(mParams.rootControl.$().find(".sapUiFlVarMngmt")).map(function(oVariantManagementNode) {
oVMControl = sap.ui.getCore().byId(oVariantManagementNode.id);
if (oVMControl.getMetadata().getName() === "sap.ui.fl.variants.VariantManagement") {
aForControlTypes = oVMControl.getFor();
aForControlTypes.forEach(function(sControlType) {
mParams.variantManagement[sControlType] = mParams.variantModel.getLocalId(oVariantManagementNode.id, oAppComponent);
});
}
});
return mParams;
} | javascript | function(oControl) {
var oAppComponent = Utils.getAppComponentForControl(oControl);
var oFlexController = FlexControllerFactory.createForControl(oAppComponent);
var oRootControl = oAppComponent.getRootControl();
var oView = Utils.getViewForControl(oControl);
var oVariantModel = oAppComponent.getModel("$FlexVariants");
var mParams = {
rootControl : oRootControl,
view : oView,
variantModel : oVariantModel,
variantManagement : {},
flexController: oFlexController
};
var oVMControl;
var aForControlTypes;
jQuery.makeArray(mParams.rootControl.$().find(".sapUiFlVarMngmt")).map(function(oVariantManagementNode) {
oVMControl = sap.ui.getCore().byId(oVariantManagementNode.id);
if (oVMControl.getMetadata().getName() === "sap.ui.fl.variants.VariantManagement") {
aForControlTypes = oVMControl.getFor();
aForControlTypes.forEach(function(sControlType) {
mParams.variantManagement[sControlType] = mParams.variantModel.getLocalId(oVariantManagementNode.id, oAppComponent);
});
}
});
return mParams;
} | [
"function",
"(",
"oControl",
")",
"{",
"var",
"oAppComponent",
"=",
"Utils",
".",
"getAppComponentForControl",
"(",
"oControl",
")",
";",
"var",
"oFlexController",
"=",
"FlexControllerFactory",
".",
"createForControl",
"(",
"oAppComponent",
")",
";",
"var",
"oRoot... | Returns a map of parameters used in public functions.
@param {sap.ui.core.Element} oControl - The control for which a variant management control has to be evaluated
@returns {object} Returns a map with needed parameters
@private | [
"Returns",
"a",
"map",
"of",
"parameters",
"used",
"in",
"public",
"functions",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/ControlPersonalizationAPI.js#L66-L94 | train | Returns the parameters for the given control. | [
30522,
3853,
1006,
1051,
8663,
13181,
2140,
1007,
1063,
13075,
1051,
29098,
9006,
29513,
3372,
1027,
21183,
12146,
1012,
2131,
29098,
9006,
29513,
3372,
29278,
8663,
13181,
2140,
1006,
1051,
8663,
13181,
2140,
1007,
1025,
13075,
1997,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/software-update.js | softwareUpdate_assertUpdateApplied | function softwareUpdate_assertUpdateApplied(updateData) {
// Get the information from the last update
var info = updateData.updates[updateData.updateIndex];
// The upgraded version should be identical with the version given by
// the update and we shouldn't have run a downgrade
var check = this._vc.compare(info.build_post.version, info.build_pre.version);
this._controller.assert(function() {
return check >= 0;
}, "The version number of the upgraded build is higher or equal.");
// The build id should be identical with the one from the update
this._controller.assert(function() {
return info.build_post.buildid == info.patch.buildid;
}, "The build id is equal to the build id of the update.");
// An upgrade should not change the builds locale
this._controller.assert(function() {
return info.build_post.locale == info.build_pre.locale;
}, "The locale of the updated build is identical to the original locale.");
} | javascript | function softwareUpdate_assertUpdateApplied(updateData) {
// Get the information from the last update
var info = updateData.updates[updateData.updateIndex];
// The upgraded version should be identical with the version given by
// the update and we shouldn't have run a downgrade
var check = this._vc.compare(info.build_post.version, info.build_pre.version);
this._controller.assert(function() {
return check >= 0;
}, "The version number of the upgraded build is higher or equal.");
// The build id should be identical with the one from the update
this._controller.assert(function() {
return info.build_post.buildid == info.patch.buildid;
}, "The build id is equal to the build id of the update.");
// An upgrade should not change the builds locale
this._controller.assert(function() {
return info.build_post.locale == info.build_pre.locale;
}, "The locale of the updated build is identical to the original locale.");
} | [
"function",
"softwareUpdate_assertUpdateApplied",
"(",
"updateData",
")",
"{",
"// Get the information from the last update",
"var",
"info",
"=",
"updateData",
".",
"updates",
"[",
"updateData",
".",
"updateIndex",
"]",
";",
"// The upgraded version should be identical with the... | Checks if an update has been applied correctly
@param {object} updateData
All the data collected during the update process | [
"Checks",
"if",
"an",
"update",
"has",
"been",
"applied",
"correctly"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L242-L262 | train | Assert that the software update is applied | [
30522,
3853,
4007,
6279,
13701,
1035,
20865,
6279,
13701,
29098,
8751,
2094,
1006,
7172,
6790,
1007,
1063,
1013,
1013,
2131,
1996,
2592,
2013,
1996,
2197,
10651,
13075,
18558,
1027,
7172,
6790,
1012,
14409,
1031,
7172,
6790,
1012,
10651,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/ScopeManager.js | resetModule | function resetModule() {
function resetTernServer() {
if (_ternNodeDomain.ready()) {
_ternNodeDomain.exec('resetTernServer');
}
}
if (_ternNodeDomain) {
if (addFilesPromise) {
// If we're in the middle of added files, don't reset
// until we're done
addFilesPromise.done(resetTernServer).fail(resetTernServer);
} else {
resetTernServer();
}
}
} | javascript | function resetModule() {
function resetTernServer() {
if (_ternNodeDomain.ready()) {
_ternNodeDomain.exec('resetTernServer');
}
}
if (_ternNodeDomain) {
if (addFilesPromise) {
// If we're in the middle of added files, don't reset
// until we're done
addFilesPromise.done(resetTernServer).fail(resetTernServer);
} else {
resetTernServer();
}
}
} | [
"function",
"resetModule",
"(",
")",
"{",
"function",
"resetTernServer",
"(",
")",
"{",
"if",
"(",
"_ternNodeDomain",
".",
"ready",
"(",
")",
")",
"{",
"_ternNodeDomain",
".",
"exec",
"(",
"'resetTernServer'",
")",
";",
"}",
"}",
"if",
"(",
"_ternNodeDomai... | Do some cleanup when a project is closed.
We can clean up the node tern server we use to calculate hints now, since
we know we will need to re-init it in any new project that is opened. | [
"Do",
"some",
"cleanup",
"when",
"a",
"project",
"is",
"closed",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1335-L1351 | train | Reset the module | [
30522,
3853,
25141,
5302,
8566,
2571,
1006,
1007,
1063,
3853,
25141,
16451,
8043,
6299,
1006,
1007,
1063,
2065,
1006,
1035,
28774,
10695,
10244,
9527,
8113,
1012,
3201,
1006,
1007,
1007,
1063,
1035,
28774,
10695,
10244,
9527,
8113,
1012,
46... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | dist/extension/dataTool.js | function (rawData, opt) {
opt = opt || [];
var boxData = [];
var outliers = [];
var axisData = [];
var boundIQR = opt.boundIQR;
var useExtreme = boundIQR === 'none' || boundIQR === 0;
for (var i = 0; i < rawData.length; i++) {
axisData.push(i + '');
var ascList = asc(rawData[i].slice());
var Q1 = quantile(ascList, 0.25);
var Q2 = quantile(ascList, 0.5);
var Q3 = quantile(ascList, 0.75);
var min = ascList[0];
var max = ascList[ascList.length - 1];
var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
var low = useExtreme
? min
: Math.max(min, Q1 - bound);
var high = useExtreme
? max
: Math.min(max, Q3 + bound);
boxData.push([low, Q1, Q2, Q3, high]);
for (var j = 0; j < ascList.length; j++) {
var dataItem = ascList[j];
if (dataItem < low || dataItem > high) {
var outlier = [i, dataItem];
opt.layout === 'vertical' && outlier.reverse();
outliers.push(outlier);
}
}
}
return {
boxData: boxData,
outliers: outliers,
axisData: axisData
};
} | javascript | function (rawData, opt) {
opt = opt || [];
var boxData = [];
var outliers = [];
var axisData = [];
var boundIQR = opt.boundIQR;
var useExtreme = boundIQR === 'none' || boundIQR === 0;
for (var i = 0; i < rawData.length; i++) {
axisData.push(i + '');
var ascList = asc(rawData[i].slice());
var Q1 = quantile(ascList, 0.25);
var Q2 = quantile(ascList, 0.5);
var Q3 = quantile(ascList, 0.75);
var min = ascList[0];
var max = ascList[ascList.length - 1];
var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
var low = useExtreme
? min
: Math.max(min, Q1 - bound);
var high = useExtreme
? max
: Math.min(max, Q3 + bound);
boxData.push([low, Q1, Q2, Q3, high]);
for (var j = 0; j < ascList.length; j++) {
var dataItem = ascList[j];
if (dataItem < low || dataItem > high) {
var outlier = [i, dataItem];
opt.layout === 'vertical' && outlier.reverse();
outliers.push(outlier);
}
}
}
return {
boxData: boxData,
outliers: outliers,
axisData: axisData
};
} | [
"function",
"(",
"rawData",
",",
"opt",
")",
"{",
"opt",
"=",
"opt",
"||",
"[",
"]",
";",
"var",
"boxData",
"=",
"[",
"]",
";",
"var",
"outliers",
"=",
"[",
"]",
";",
"var",
"axisData",
"=",
"[",
"]",
";",
"var",
"boundIQR",
"=",
"opt",
".",
... | /*
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.
See:
<https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
<http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
Helper method for preparing data.
@param {Array.<number>} rawData like
[
[12,232,443], (raw data set for the first box)
[3843,5545,1232], (raw datat set for the second box)
...
]
@param {Object} [opt]
@param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.
default 1.5, means Q1 - 1.5 * (Q3 - Q1).
If 'none'/0 passed, min bound will not be used.
@param {(number|string)} [opt.layout='horizontal']
Box plot layout, can be 'horizontal' or 'vertical'
@return {Object} {
boxData: Array.<Array.<number>>
outliers: Array.<Array.<number>>
axisData: Array.<string>
} | [
"/",
"*",
"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/dist/extension/dataTool.js#L770-L813 | train | Returns an array of tuples containing the data in the correct order | [
30522,
3853,
1006,
6315,
2850,
2696,
1010,
23569,
1007,
1063,
23569,
1027,
23569,
1064,
1064,
1031,
1033,
1025,
13075,
3482,
2850,
2696,
1027,
1031,
1033,
1025,
13075,
2041,
14355,
2015,
1027,
1031,
1033,
1025,
13075,
8123,
2850,
2696,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/node/selenium-webdriver/lib/logging.js | getLevel | function getLevel(nameOrValue) {
if (typeof nameOrValue === 'string') {
return LEVELS_BY_NAME.get(nameOrValue) || Level.ALL;
}
if (typeof nameOrValue !== 'number') {
throw new TypeError('not a string or number');
}
for (let level of ALL_LEVELS) {
if (nameOrValue >= level.value) {
return level;
}
}
return Level.ALL;
} | javascript | function getLevel(nameOrValue) {
if (typeof nameOrValue === 'string') {
return LEVELS_BY_NAME.get(nameOrValue) || Level.ALL;
}
if (typeof nameOrValue !== 'number') {
throw new TypeError('not a string or number');
}
for (let level of ALL_LEVELS) {
if (nameOrValue >= level.value) {
return level;
}
}
return Level.ALL;
} | [
"function",
"getLevel",
"(",
"nameOrValue",
")",
"{",
"if",
"(",
"typeof",
"nameOrValue",
"===",
"'string'",
")",
"{",
"return",
"LEVELS_BY_NAME",
".",
"get",
"(",
"nameOrValue",
")",
"||",
"Level",
".",
"ALL",
";",
"}",
"if",
"(",
"typeof",
"nameOrValue",... | Converts a level name or value to a {@link Level} value. If the name/value
is not recognized, {@link Level.ALL} will be returned.
@param {(number|string)} nameOrValue The log level name, or value, to
convert.
@return {!Level} The converted level. | [
"Converts",
"a",
"level",
"name",
"or",
"value",
"to",
"a",
"{",
"@link",
"Level",
"}",
"value",
".",
"If",
"the",
"name",
"/",
"value",
"is",
"not",
"recognized",
"{",
"@link",
"Level",
".",
"ALL",
"}",
"will",
"be",
"returned",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/logging.js#L202-L215 | train | Get the level of a given name or value | [
30522,
3853,
2131,
20414,
2884,
1006,
2171,
2953,
10175,
5657,
1007,
1063,
2065,
1006,
2828,
11253,
2171,
2953,
10175,
5657,
1027,
1027,
1027,
1005,
5164,
1005,
1007,
1063,
2709,
3798,
1035,
2011,
1035,
2171,
1012,
2131,
1006,
2171,
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... |
ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (target, e) {
if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
switch (e.which) {
case 83: // W
case 65: // A
case 40: // DOWN
case 37: // LEFT
e.preventDefault();
this.moveByKey(false);
break;
case 87: // S
case 68: // D
case 38: // UP
case 39: // RIGHT
e.preventDefault();
this.moveByKey(true);
break;
}
return true;
} | javascript | function (target, e) {
if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
switch (e.which) {
case 83: // W
case 65: // A
case 40: // DOWN
case 37: // LEFT
e.preventDefault();
this.moveByKey(false);
break;
case 87: // S
case 68: // D
case 38: // UP
case 39: // RIGHT
e.preventDefault();
this.moveByKey(true);
break;
}
return true;
} | [
"function",
"(",
"target",
",",
"e",
")",
"{",
"if",
"(",
"this",
".",
"current_plugin",
"!==",
"this",
".",
"plugin_count",
"||",
"e",
".",
"altKey",
"||",
"e",
".",
"ctrlKey",
"||",
"e",
".",
"shiftKey",
"||",
"e",
".",
"metaKey",
")",
"{",
"retu... | Keyborard controls for focused slider
@param target {String}
@param e {Object} event object
@returns {boolean|undefined} | [
"Keyborard",
"controls",
"for",
"focused",
"slider"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L890-L914 | train | cisco cisco cisco | [
30522,
3853,
1006,
4539,
1010,
1041,
1007,
1063,
2065,
1006,
2023,
1012,
2783,
1035,
13354,
2378,
999,
1027,
1027,
2023,
1012,
13354,
2378,
1035,
4175,
1064,
1064,
1041,
1012,
12456,
14839,
1064,
1064,
1041,
1012,
14931,
12190,
14839,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/treemap/treemapLayout.js | squarify | function squarify(node, options, hideChildren, depth) {
var width;
var height;
if (node.isRemoved()) {
return;
}
var thisLayout = node.getLayout();
width = thisLayout.width;
height = thisLayout.height;
// Considering border and gap
var nodeModel = node.getModel();
var borderWidth = nodeModel.get(PATH_BORDER_WIDTH);
var halfGapWidth = nodeModel.get(PATH_GAP_WIDTH) / 2;
var upperLabelHeight = getUpperLabelHeight(nodeModel);
var upperHeight = Math.max(borderWidth, upperLabelHeight);
var layoutOffset = borderWidth - halfGapWidth;
var layoutOffsetUpper = upperHeight - halfGapWidth;
var nodeModel = node.getModel();
node.setLayout({
borderWidth: borderWidth,
upperHeight: upperHeight,
upperLabelHeight: upperLabelHeight
}, true);
width = mathMax(width - 2 * layoutOffset, 0);
height = mathMax(height - layoutOffset - layoutOffsetUpper, 0);
var totalArea = width * height;
var viewChildren = initChildren(
node, nodeModel, totalArea, options, hideChildren, depth
);
if (!viewChildren.length) {
return;
}
var rect = {x: layoutOffset, y: layoutOffsetUpper, width: width, height: height};
var rowFixedLength = mathMin(width, height);
var best = Infinity; // the best row score so far
var row = [];
row.area = 0;
for (var i = 0, len = viewChildren.length; i < len;) {
var child = viewChildren[i];
row.push(child);
row.area += child.getLayout().area;
var score = worst(row, rowFixedLength, options.squareRatio);
// continue with this orientation
if (score <= best) {
i++;
best = score;
}
// abort, and try a different orientation
else {
row.area -= row.pop().getLayout().area;
position(row, rowFixedLength, rect, halfGapWidth, false);
rowFixedLength = mathMin(rect.width, rect.height);
row.length = row.area = 0;
best = Infinity;
}
}
if (row.length) {
position(row, rowFixedLength, rect, halfGapWidth, true);
}
if (!hideChildren) {
var childrenVisibleMin = nodeModel.get('childrenVisibleMin');
if (childrenVisibleMin != null && totalArea < childrenVisibleMin) {
hideChildren = true;
}
}
for (var i = 0, len = viewChildren.length; i < len; i++) {
squarify(viewChildren[i], options, hideChildren, depth + 1);
}
} | javascript | function squarify(node, options, hideChildren, depth) {
var width;
var height;
if (node.isRemoved()) {
return;
}
var thisLayout = node.getLayout();
width = thisLayout.width;
height = thisLayout.height;
// Considering border and gap
var nodeModel = node.getModel();
var borderWidth = nodeModel.get(PATH_BORDER_WIDTH);
var halfGapWidth = nodeModel.get(PATH_GAP_WIDTH) / 2;
var upperLabelHeight = getUpperLabelHeight(nodeModel);
var upperHeight = Math.max(borderWidth, upperLabelHeight);
var layoutOffset = borderWidth - halfGapWidth;
var layoutOffsetUpper = upperHeight - halfGapWidth;
var nodeModel = node.getModel();
node.setLayout({
borderWidth: borderWidth,
upperHeight: upperHeight,
upperLabelHeight: upperLabelHeight
}, true);
width = mathMax(width - 2 * layoutOffset, 0);
height = mathMax(height - layoutOffset - layoutOffsetUpper, 0);
var totalArea = width * height;
var viewChildren = initChildren(
node, nodeModel, totalArea, options, hideChildren, depth
);
if (!viewChildren.length) {
return;
}
var rect = {x: layoutOffset, y: layoutOffsetUpper, width: width, height: height};
var rowFixedLength = mathMin(width, height);
var best = Infinity; // the best row score so far
var row = [];
row.area = 0;
for (var i = 0, len = viewChildren.length; i < len;) {
var child = viewChildren[i];
row.push(child);
row.area += child.getLayout().area;
var score = worst(row, rowFixedLength, options.squareRatio);
// continue with this orientation
if (score <= best) {
i++;
best = score;
}
// abort, and try a different orientation
else {
row.area -= row.pop().getLayout().area;
position(row, rowFixedLength, rect, halfGapWidth, false);
rowFixedLength = mathMin(rect.width, rect.height);
row.length = row.area = 0;
best = Infinity;
}
}
if (row.length) {
position(row, rowFixedLength, rect, halfGapWidth, true);
}
if (!hideChildren) {
var childrenVisibleMin = nodeModel.get('childrenVisibleMin');
if (childrenVisibleMin != null && totalArea < childrenVisibleMin) {
hideChildren = true;
}
}
for (var i = 0, len = viewChildren.length; i < len; i++) {
squarify(viewChildren[i], options, hideChildren, depth + 1);
}
} | [
"function",
"squarify",
"(",
"node",
",",
"options",
",",
"hideChildren",
",",
"depth",
")",
"{",
"var",
"width",
";",
"var",
"height",
";",
"if",
"(",
"node",
".",
"isRemoved",
"(",
")",
")",
"{",
"return",
";",
"}",
"var",
"thisLayout",
"=",
"node"... | Layout treemap with squarify algorithm.
The original presentation of this algorithm
was made by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
<https://graphics.ethz.ch/teaching/scivis_common/Literature/squarifiedTreeMaps.pdf>.
The implementation of this algorithm was originally copied from "d3.js"
<https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/layout/treemap.js>
with some modifications made for this program.
See the license statement at the head of this file.
@protected
@param {module:echarts/data/Tree~TreeNode} node
@param {Object} options
@param {string} options.sort 'asc' or 'desc'
@param {number} options.squareRatio
@param {boolean} hideChildren
@param {number} depth | [
"Layout",
"treemap",
"with",
"squarify",
"algorithm",
".",
"The",
"original",
"presentation",
"of",
"this",
"algorithm",
"was",
"made",
"by",
"Mark",
"Bruls",
"Kees",
"Huizing",
"and",
"Jarke",
"J",
".",
"van",
"Wijk",
"<https",
":",
"//",
"graphics",
".",
... | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L172-L254 | train | Squarifies a node by expanding it s children to the nearest row. | [
30522,
3853,
5490,
6692,
3089,
12031,
1006,
13045,
1010,
7047,
1010,
5342,
19339,
7389,
1010,
5995,
1007,
1063,
13075,
9381,
1025,
13075,
4578,
1025,
2065,
1006,
13045,
1012,
2003,
28578,
21818,
2094,
1006,
1007,
1007,
1063,
2709,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
baianat/vee-validate | src/components/provider.js | addListeners | function addListeners (node) {
const model = findModel(node);
// cache the input eventName.
this._inputEventName = this._inputEventName || getInputEventName(node, model);
onRenderUpdate.call(this, model);
const { onInput, onBlur, onValidate } = createCommonHandlers(this);
addVNodeListener(node, this._inputEventName, onInput);
addVNodeListener(node, 'blur', onBlur);
// add the validation listeners.
this.normalizedEvents.forEach(evt => {
addVNodeListener(node, evt, onValidate);
});
this.initialized = true;
} | javascript | function addListeners (node) {
const model = findModel(node);
// cache the input eventName.
this._inputEventName = this._inputEventName || getInputEventName(node, model);
onRenderUpdate.call(this, model);
const { onInput, onBlur, onValidate } = createCommonHandlers(this);
addVNodeListener(node, this._inputEventName, onInput);
addVNodeListener(node, 'blur', onBlur);
// add the validation listeners.
this.normalizedEvents.forEach(evt => {
addVNodeListener(node, evt, onValidate);
});
this.initialized = true;
} | [
"function",
"addListeners",
"(",
"node",
")",
"{",
"const",
"model",
"=",
"findModel",
"(",
"node",
")",
";",
"// cache the input eventName.",
"this",
".",
"_inputEventName",
"=",
"this",
".",
"_inputEventName",
"||",
"getInputEventName",
"(",
"node",
",",
"mode... | Adds all plugin listeners to the vnode. | [
"Adds",
"all",
"plugin",
"listeners",
"to",
"the",
"vnode",
"."
] | 31a7022569a7ea36857016e0f6e68c6539b0c935 | https://github.com/baianat/vee-validate/blob/31a7022569a7ea36857016e0f6e68c6539b0c935/src/components/provider.js#L136-L153 | train | Add the listeners to the node. | [
30522,
3853,
5587,
9863,
24454,
2015,
1006,
13045,
1007,
1063,
9530,
3367,
2944,
1027,
2424,
5302,
9247,
1006,
13045,
1007,
1025,
1013,
1013,
17053,
1996,
7953,
2724,
18442,
1012,
2023,
1012,
1035,
7953,
18697,
3372,
18442,
1027,
2023,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js | formatBuildInfo | function formatBuildInfo(timestamp, scmRevision) {
var info = [];
if ( timestamp ) {
var match = /^(\d{4})(\d{2})(\d{2})-?(\d{2})(\d{2})$/.exec(timestamp);
if ( match ) {
timestamp = match[1] + '-' + match[2] + '-' + match[3] + 'T' + match[4] + ":" + match[5];
}
info.push("built at " + encode(timestamp));
}
if ( scmRevision ) {
info.push("last change " + encode(scmRevision));
}
return info.length === 0 ? "" : " (" + info.join(", ") + ")";
} | javascript | function formatBuildInfo(timestamp, scmRevision) {
var info = [];
if ( timestamp ) {
var match = /^(\d{4})(\d{2})(\d{2})-?(\d{2})(\d{2})$/.exec(timestamp);
if ( match ) {
timestamp = match[1] + '-' + match[2] + '-' + match[3] + 'T' + match[4] + ":" + match[5];
}
info.push("built at " + encode(timestamp));
}
if ( scmRevision ) {
info.push("last change " + encode(scmRevision));
}
return info.length === 0 ? "" : " (" + info.join(", ") + ")";
} | [
"function",
"formatBuildInfo",
"(",
"timestamp",
",",
"scmRevision",
")",
"{",
"var",
"info",
"=",
"[",
"]",
";",
"if",
"(",
"timestamp",
")",
"{",
"var",
"match",
"=",
"/",
"^(\\d{4})(\\d{2})(\\d{2})-?(\\d{2})(\\d{2})$",
"/",
".",
"exec",
"(",
"timestamp",
... | version information | [
"version",
"information"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/plugins/TechInfo.js#L64-L77 | train | Format build info | [
30522,
3853,
4289,
8569,
4014,
8718,
14876,
1006,
2335,
15464,
2361,
1010,
8040,
2213,
2890,
17084,
1007,
1063,
13075,
18558,
1027,
1031,
1033,
1025,
2065,
1006,
2335,
15464,
2361,
1007,
1063,
13075,
2674,
1027,
1013,
1034,
1006,
1032,
1040... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | renderAttrs | function renderAttrs (node) {
var attrs = node.data.attrs;
var res = '';
var parent = node.parent;
while (isDef(parent)) {
if (isDef(parent.data) && isDef(parent.data.attrs)) {
attrs = Object.assign({}, attrs, parent.data.attrs);
}
parent = parent.parent;
}
if (isUndef(attrs)) {
return res
}
for (var key in attrs) {
if (key === 'style') {
// leave it to the style module
continue
}
res += renderAttr(key, attrs[key]);
}
return res
} | javascript | function renderAttrs (node) {
var attrs = node.data.attrs;
var res = '';
var parent = node.parent;
while (isDef(parent)) {
if (isDef(parent.data) && isDef(parent.data.attrs)) {
attrs = Object.assign({}, attrs, parent.data.attrs);
}
parent = parent.parent;
}
if (isUndef(attrs)) {
return res
}
for (var key in attrs) {
if (key === 'style') {
// leave it to the style module
continue
}
res += renderAttr(key, attrs[key]);
}
return res
} | [
"function",
"renderAttrs",
"(",
"node",
")",
"{",
"var",
"attrs",
"=",
"node",
".",
"data",
".",
"attrs",
";",
"var",
"res",
"=",
"''",
";",
"var",
"parent",
"=",
"node",
".",
"parent",
";",
"while",
"(",
"isDef",
"(",
"parent",
")",
")",
"{",
"i... | /* | [
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L245-L269 | train | render attrs | [
30522,
3853,
17552,
19321,
2869,
1006,
13045,
1007,
1063,
13075,
2012,
16344,
2015,
1027,
13045,
1012,
2951,
1012,
2012,
16344,
2015,
1025,
13075,
24501,
1027,
1005,
1005,
1025,
13075,
6687,
1027,
13045,
1012,
6687,
1025,
2096,
1006,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/services/layout/layout.js | warnAttrNotSupported | function warnAttrNotSupported(className) {
var parts = className.split("-");
return ["$log", function($log) {
$log.warn(className + "has been deprecated. Please use a `" + parts[0] + "-gt-<xxx>` variant.");
return angular.noop;
}];
} | javascript | function warnAttrNotSupported(className) {
var parts = className.split("-");
return ["$log", function($log) {
$log.warn(className + "has been deprecated. Please use a `" + parts[0] + "-gt-<xxx>` variant.");
return angular.noop;
}];
} | [
"function",
"warnAttrNotSupported",
"(",
"className",
")",
"{",
"var",
"parts",
"=",
"className",
".",
"split",
"(",
"\"-\"",
")",
";",
"return",
"[",
"\"$log\"",
",",
"function",
"(",
"$log",
")",
"{",
"$log",
".",
"warn",
"(",
"className",
"+",
"\"has ... | Provide console warning that this layout attribute has been deprecated | [
"Provide",
"console",
"warning",
"that",
"this",
"layout",
"attribute",
"has",
"been",
"deprecated"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L373-L379 | train | Warn if an attribute is not supported. | [
30522,
3853,
11582,
19321,
19139,
10422,
9397,
15613,
1006,
2465,
18442,
1007,
1063,
13075,
3033,
1027,
2465,
18442,
1012,
3975,
1006,
1000,
1011,
1000,
1007,
1025,
2709,
1031,
1000,
1002,
8833,
1000,
1010,
3853,
1006,
1002,
8833,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/command/KeyBindingManager.js | _quitAltGrMode | function _quitAltGrMode() {
_enabled = true;
_ctrlDown = CtrlDownStates.NOT_YET_DETECTED;
_altGrDown = false;
_lastTimeStamp = null;
_lastKeyIdentifier = null;
$(window).off("keyup", _onCtrlUp);
} | javascript | function _quitAltGrMode() {
_enabled = true;
_ctrlDown = CtrlDownStates.NOT_YET_DETECTED;
_altGrDown = false;
_lastTimeStamp = null;
_lastKeyIdentifier = null;
$(window).off("keyup", _onCtrlUp);
} | [
"function",
"_quitAltGrMode",
"(",
")",
"{",
"_enabled",
"=",
"true",
";",
"_ctrlDown",
"=",
"CtrlDownStates",
".",
"NOT_YET_DETECTED",
";",
"_altGrDown",
"=",
"false",
";",
"_lastTimeStamp",
"=",
"null",
";",
"_lastKeyIdentifier",
"=",
"null",
";",
"$",
"(",
... | @private
Resets all the flags and removes _onCtrlUp event listener. | [
"@private",
"Resets",
"all",
"the",
"flags",
"and",
"removes",
"_onCtrlUp",
"event",
"listener",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/command/KeyBindingManager.js#L200-L207 | train | Quit AltGr mode | [
30522,
3853,
1035,
8046,
2389,
2102,
16523,
5302,
3207,
1006,
1007,
1063,
1035,
9124,
1027,
2995,
1025,
1035,
14931,
12190,
7698,
1027,
14931,
12190,
7698,
9153,
4570,
1012,
2025,
1035,
2664,
1035,
11156,
1025,
1035,
12456,
16523,
7698,
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... |
GitbookIO/gitbook | lib/utils/timing.js | measure | function measure(type, p) {
timers[type] = timers[type] || {
type: type,
count: 0,
total: 0,
min: undefined,
max: 0
};
var start = Date.now();
return p
.fin(function() {
var end = Date.now();
var duration = (end - start);
timers[type].count ++;
timers[type].total += duration;
if (is.undefined(timers[type].min)) {
timers[type].min = duration;
} else {
timers[type].min = Math.min(timers[type].min, duration);
}
timers[type].max = Math.max(timers[type].max, duration);
});
} | javascript | function measure(type, p) {
timers[type] = timers[type] || {
type: type,
count: 0,
total: 0,
min: undefined,
max: 0
};
var start = Date.now();
return p
.fin(function() {
var end = Date.now();
var duration = (end - start);
timers[type].count ++;
timers[type].total += duration;
if (is.undefined(timers[type].min)) {
timers[type].min = duration;
} else {
timers[type].min = Math.min(timers[type].min, duration);
}
timers[type].max = Math.max(timers[type].max, duration);
});
} | [
"function",
"measure",
"(",
"type",
",",
"p",
")",
"{",
"timers",
"[",
"type",
"]",
"=",
"timers",
"[",
"type",
"]",
"||",
"{",
"type",
":",
"type",
",",
"count",
":",
"0",
",",
"total",
":",
"0",
",",
"min",
":",
"undefined",
",",
"max",
":",
... | Mesure an operation
@parqm {String} type
@param {Promise} p
@return {Promise} | [
"Mesure",
"an",
"operation"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/utils/timing.js#L14-L41 | train | Measure a time period | [
30522,
3853,
5468,
1006,
2828,
1010,
1052,
1007,
1063,
25309,
2015,
1031,
2828,
1033,
1027,
25309,
2015,
1031,
2828,
1033,
1064,
1064,
1063,
2828,
1024,
2828,
1010,
4175,
1024,
1014,
1010,
2561,
1024,
1014,
1010,
8117,
1024,
6151,
28344,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/report/IssueRenderer.js | renderIssuesForOPA | function renderIssuesForOPA(issues) {
if (!jQuery("#qunit") || !issues) {
return;
}
// TODO: Add rendered issues to a buffer and render all of them at the same time at the end of the OPA test.
var element = jQuery(this.render(issues));
jQuery("#qunit").append(element);
if (!_OPARenderingInitialized) {
var styles = [
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/styles.css'),
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/collapseExpand.css'),
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/filter.css')
];
var collapseExpandUrl = jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/collapseExpand.js');
var filterUrl = jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/filter.js');
jQuery.each(styles, function (index, value) {
jQuery('<link>').appendTo('head').attr({ type: 'text/css', rel: 'stylesheet', href: value });
});
jQuery.getScript(collapseExpandUrl, function () {
window.sapUiSupportReport.collapseExpand.init();
});
jQuery.getScript(filterUrl, function () {
window.sapUiSupportReport.filter.init();
});
_OPARenderingInitialized = true;
} else {
window.sapUiSupportReport.collapseExpand.init();
window.sapUiSupportReport.filter.init();
}
} | javascript | function renderIssuesForOPA(issues) {
if (!jQuery("#qunit") || !issues) {
return;
}
// TODO: Add rendered issues to a buffer and render all of them at the same time at the end of the OPA test.
var element = jQuery(this.render(issues));
jQuery("#qunit").append(element);
if (!_OPARenderingInitialized) {
var styles = [
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/styles.css'),
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/collapseExpand.css'),
jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/filter.css')
];
var collapseExpandUrl = jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/collapseExpand.js');
var filterUrl = jQuery.sap.getResourcePath('sap/ui/support/supportRules/report/resources/filter.js');
jQuery.each(styles, function (index, value) {
jQuery('<link>').appendTo('head').attr({ type: 'text/css', rel: 'stylesheet', href: value });
});
jQuery.getScript(collapseExpandUrl, function () {
window.sapUiSupportReport.collapseExpand.init();
});
jQuery.getScript(filterUrl, function () {
window.sapUiSupportReport.filter.init();
});
_OPARenderingInitialized = true;
} else {
window.sapUiSupportReport.collapseExpand.init();
window.sapUiSupportReport.filter.init();
}
} | [
"function",
"renderIssuesForOPA",
"(",
"issues",
")",
"{",
"if",
"(",
"!",
"jQuery",
"(",
"\"#qunit\"",
")",
"||",
"!",
"issues",
")",
"{",
"return",
";",
"}",
"// TODO: Add rendered issues to a buffer and render all of them at the same time at the end of the OPA test.",
... | /* eslint-disable no-undef
Creates an html string containing the issues and appends it to the OPA html page
@param {Object} issues - the issues in viewmodel format
@returns {String} | [
"/",
"*",
"eslint",
"-",
"disable",
"no",
"-",
"undef",
"Creates",
"an",
"html",
"string",
"containing",
"the",
"issues",
"and",
"appends",
"it",
"to",
"the",
"OPA",
"html",
"page"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/IssueRenderer.js#L186-L218 | train | Renders the given issues for the OPA test. | [
30522,
3853,
17552,
14643,
15808,
29278,
29477,
1006,
3314,
1007,
1063,
2065,
1006,
999,
1046,
4226,
2854,
1006,
1000,
1001,
24209,
3490,
2102,
1000,
1007,
1064,
1064,
999,
3314,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
28681,
2080,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/tabs/js/tabsController.js | updateInkBarStyles | function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) {
if (ctrl.noInkBar) {
return;
}
var elements = getElements();
if (!elements.tabs[ ctrl.selectedIndex ]) {
angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' });
return;
}
if (!ctrl.tabs.length) {
queue.push(ctrl.updateInkBarStyles);
return;
}
// If the element is not visible, we will not be able to calculate sizes until it becomes
// visible. We should treat that as a resize event rather than just updating the ink bar.
if (!$element.prop('offsetParent')) {
handleResizeWhenVisible();
return;
}
var index = ctrl.selectedIndex,
totalWidth = elements.paging.offsetWidth,
tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = totalWidth - left - tab.offsetWidth;
if (ctrl.shouldCenterTabs) {
// We need to use the same calculate process as in the pagination wrapper, to avoid rounding
// deviations.
var totalWidthOfTabItems = calcTabsWidth(elements.tabs);
if (totalWidth > totalWidthOfTabItems &&
previousTotalWidth !== totalWidth &&
previousWidthOfTabItems !== totalWidthOfTabItems) {
$timeout(updateInkBarStyles, 0, true, totalWidth, totalWidthOfTabItems);
}
}
updateInkBarClassName();
angular.element(elements.inkBar).css({ left: left + 'px', right: right + 'px' });
} | javascript | function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) {
if (ctrl.noInkBar) {
return;
}
var elements = getElements();
if (!elements.tabs[ ctrl.selectedIndex ]) {
angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' });
return;
}
if (!ctrl.tabs.length) {
queue.push(ctrl.updateInkBarStyles);
return;
}
// If the element is not visible, we will not be able to calculate sizes until it becomes
// visible. We should treat that as a resize event rather than just updating the ink bar.
if (!$element.prop('offsetParent')) {
handleResizeWhenVisible();
return;
}
var index = ctrl.selectedIndex,
totalWidth = elements.paging.offsetWidth,
tab = elements.tabs[ index ],
left = tab.offsetLeft,
right = totalWidth - left - tab.offsetWidth;
if (ctrl.shouldCenterTabs) {
// We need to use the same calculate process as in the pagination wrapper, to avoid rounding
// deviations.
var totalWidthOfTabItems = calcTabsWidth(elements.tabs);
if (totalWidth > totalWidthOfTabItems &&
previousTotalWidth !== totalWidth &&
previousWidthOfTabItems !== totalWidthOfTabItems) {
$timeout(updateInkBarStyles, 0, true, totalWidth, totalWidthOfTabItems);
}
}
updateInkBarClassName();
angular.element(elements.inkBar).css({ left: left + 'px', right: right + 'px' });
} | [
"function",
"updateInkBarStyles",
"(",
"previousTotalWidth",
",",
"previousWidthOfTabItems",
")",
"{",
"if",
"(",
"ctrl",
".",
"noInkBar",
")",
"{",
"return",
";",
"}",
"var",
"elements",
"=",
"getElements",
"(",
")",
";",
"if",
"(",
"!",
"elements",
".",
... | Repositions the ink bar to the selected tab.
Parameters are used when calling itself recursively when md-center-tabs is used as we need to
run two passes to properly center the tabs. These parameters ensure that we only run two passes
and that we don't run indefinitely.
@param {number=} previousTotalWidth previous width of pagination wrapper
@param {number=} previousWidthOfTabItems previous width of all tab items | [
"Repositions",
"the",
"ink",
"bar",
"to",
"the",
"selected",
"tab",
".",
"Parameters",
"are",
"used",
"when",
"calling",
"itself",
"recursively",
"when",
"md",
"-",
"center",
"-",
"tabs",
"is",
"used",
"as",
"we",
"need",
"to",
"run",
"two",
"passes",
"t... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L861-L902 | train | Updates the ink bar s style based on the current tab and tab items. | [
30522,
3853,
10651,
19839,
8237,
21756,
4244,
1006,
3025,
3406,
9080,
9148,
11927,
2232,
1010,
3025,
9148,
11927,
14586,
2696,
16313,
6633,
2015,
1007,
1063,
2065,
1006,
14931,
12190,
1012,
2053,
19839,
8237,
1007,
1063,
2709,
1025,
1065,
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... |
dequelabs/axe-core | lib/core/utils/queue.js | function(fn) {
if (typeof fn === 'object' && fn.then && fn.catch) {
var defer = fn;
fn = function(resolve, reject) {
defer.then(resolve).catch(reject);
};
}
funcGuard(fn);
if (err !== undefined) {
return;
} else if (complete) {
throw new Error('Queue already completed');
}
tasks.push(fn);
++remaining;
pop();
return q;
} | javascript | function(fn) {
if (typeof fn === 'object' && fn.then && fn.catch) {
var defer = fn;
fn = function(resolve, reject) {
defer.then(resolve).catch(reject);
};
}
funcGuard(fn);
if (err !== undefined) {
return;
} else if (complete) {
throw new Error('Queue already completed');
}
tasks.push(fn);
++remaining;
pop();
return q;
} | [
"function",
"(",
"fn",
")",
"{",
"if",
"(",
"typeof",
"fn",
"===",
"'object'",
"&&",
"fn",
".",
"then",
"&&",
"fn",
".",
"catch",
")",
"{",
"var",
"defer",
"=",
"fn",
";",
"fn",
"=",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"defer",
... | Defer a function that may or may not run asynchronously.
First parameter should be the function to execute with subsequent
parameters being passed as arguments to that function | [
"Defer",
"a",
"function",
"that",
"may",
"or",
"may",
"not",
"run",
"asynchronously",
"."
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/queue.js#L75-L93 | train | Add a task to the queue | [
30522,
3853,
1006,
1042,
2078,
1007,
1063,
2065,
1006,
2828,
11253,
1042,
2078,
1027,
1027,
1027,
1005,
4874,
1005,
1004,
1004,
1042,
2078,
1012,
2059,
1004,
1004,
1042,
2078,
1012,
4608,
1007,
1063,
13075,
13366,
2121,
1027,
1042,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
swimlane/ngx-datatable | release/utils/column-helper.js | setColumnDefaults | function setColumnDefaults(columns) {
if (!columns)
return;
// Only one column should hold the tree view
// Thus if multiple columns are provided with
// isTreeColumn as true we take only the first one
var treeColumnFound = false;
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var column = columns_1[_i];
if (!column.$$id) {
column.$$id = id_1.id();
}
// prop can be numeric; zero is valid not a missing prop
// translate name => prop
if (isNullOrUndefined(column.prop) && column.name) {
column.prop = camel_case_1.camelCase(column.name);
}
if (!column.$$valueGetter) {
column.$$valueGetter = column_prop_getters_1.getterForProp(column.prop);
}
// format props if no name passed
if (!isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) {
column.name = camel_case_1.deCamelCase(String(column.prop));
}
if (isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) {
column.name = ''; // Fixes IE and Edge displaying `null`
}
if (!column.hasOwnProperty('resizeable')) {
column.resizeable = true;
}
if (!column.hasOwnProperty('sortable')) {
column.sortable = true;
}
if (!column.hasOwnProperty('draggable')) {
column.draggable = true;
}
if (!column.hasOwnProperty('canAutoResize')) {
column.canAutoResize = true;
}
if (!column.hasOwnProperty('width')) {
column.width = 150;
}
if (!column.hasOwnProperty('isTreeColumn')) {
column.isTreeColumn = false;
}
else {
if (column.isTreeColumn && !treeColumnFound) {
// If the first column with isTreeColumn is true found
// we mark that treeCoulmn is found
treeColumnFound = true;
}
else {
// After that isTreeColumn property for any other column
// will be set as false
column.isTreeColumn = false;
}
}
}
} | javascript | function setColumnDefaults(columns) {
if (!columns)
return;
// Only one column should hold the tree view
// Thus if multiple columns are provided with
// isTreeColumn as true we take only the first one
var treeColumnFound = false;
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var column = columns_1[_i];
if (!column.$$id) {
column.$$id = id_1.id();
}
// prop can be numeric; zero is valid not a missing prop
// translate name => prop
if (isNullOrUndefined(column.prop) && column.name) {
column.prop = camel_case_1.camelCase(column.name);
}
if (!column.$$valueGetter) {
column.$$valueGetter = column_prop_getters_1.getterForProp(column.prop);
}
// format props if no name passed
if (!isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) {
column.name = camel_case_1.deCamelCase(String(column.prop));
}
if (isNullOrUndefined(column.prop) && isNullOrUndefined(column.name)) {
column.name = ''; // Fixes IE and Edge displaying `null`
}
if (!column.hasOwnProperty('resizeable')) {
column.resizeable = true;
}
if (!column.hasOwnProperty('sortable')) {
column.sortable = true;
}
if (!column.hasOwnProperty('draggable')) {
column.draggable = true;
}
if (!column.hasOwnProperty('canAutoResize')) {
column.canAutoResize = true;
}
if (!column.hasOwnProperty('width')) {
column.width = 150;
}
if (!column.hasOwnProperty('isTreeColumn')) {
column.isTreeColumn = false;
}
else {
if (column.isTreeColumn && !treeColumnFound) {
// If the first column with isTreeColumn is true found
// we mark that treeCoulmn is found
treeColumnFound = true;
}
else {
// After that isTreeColumn property for any other column
// will be set as false
column.isTreeColumn = false;
}
}
}
} | [
"function",
"setColumnDefaults",
"(",
"columns",
")",
"{",
"if",
"(",
"!",
"columns",
")",
"return",
";",
"// Only one column should hold the tree view",
"// Thus if multiple columns are provided with",
"// isTreeColumn as true we take only the first one",
"var",
"treeColumnFound",... | Sets the column defaults | [
"Sets",
"the",
"column",
"defaults"
] | d7df15a070282a169524dba51d9572008b74804c | https://github.com/swimlane/ngx-datatable/blob/d7df15a070282a169524dba51d9572008b74804c/release/utils/column-helper.js#L9-L67 | train | set column defaults | [
30522,
3853,
2275,
25778,
2819,
13629,
7011,
11314,
2015,
1006,
7753,
1007,
1063,
2065,
1006,
999,
7753,
1007,
2709,
1025,
1013,
1013,
2069,
2028,
5930,
2323,
2907,
1996,
3392,
3193,
1013,
1013,
2947,
2065,
3674,
7753,
2024,
3024,
2007,
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... |
dequelabs/axe-core | lib/core/utils/preload-cssom.js | getStylesheetsOfRootNode | function getStylesheetsOfRootNode(options) {
const { rootNode, shadowId } = options;
let sheets;
// nodeType === 11 -> DOCUMENT_FRAGMENT
if (rootNode.nodeType === 11 && shadowId) {
sheets = getStylesheetsFromDocumentFragment(options);
} else {
sheets = getStylesheetsFromDocument(rootNode);
}
return filterStylesheetsWithSameHref(sheets);
} | javascript | function getStylesheetsOfRootNode(options) {
const { rootNode, shadowId } = options;
let sheets;
// nodeType === 11 -> DOCUMENT_FRAGMENT
if (rootNode.nodeType === 11 && shadowId) {
sheets = getStylesheetsFromDocumentFragment(options);
} else {
sheets = getStylesheetsFromDocument(rootNode);
}
return filterStylesheetsWithSameHref(sheets);
} | [
"function",
"getStylesheetsOfRootNode",
"(",
"options",
")",
"{",
"const",
"{",
"rootNode",
",",
"shadowId",
"}",
"=",
"options",
";",
"let",
"sheets",
";",
"// nodeType === 11 -> DOCUMENT_FRAGMENT",
"if",
"(",
"rootNode",
".",
"nodeType",
"===",
"11",
"&&",
"s... | Get stylesheet(s) for root
@param {Object} options configuration options of `loadCssom`
@returns an array of stylesheets | [
"Get",
"stylesheet",
"(",
"s",
")",
"for",
"root"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/preload-cssom.js#L348-L360 | train | Get the stylesheets of a rootNode | [
30522,
3853,
4152,
27983,
4095,
15558,
6499,
19699,
17206,
3630,
3207,
1006,
7047,
1007,
1063,
9530,
3367,
1063,
7117,
3630,
3207,
1010,
5192,
3593,
1065,
1027,
7047,
1025,
2292,
8697,
1025,
1013,
1013,
13045,
13874,
1027,
1027,
1027,
2340,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moment/luxon | src/datetime.js | tsToObj | function tsToObj(ts, offset) {
ts += offset * 60 * 1000;
const d = new Date(ts);
return {
year: d.getUTCFullYear(),
month: d.getUTCMonth() + 1,
day: d.getUTCDate(),
hour: d.getUTCHours(),
minute: d.getUTCMinutes(),
second: d.getUTCSeconds(),
millisecond: d.getUTCMilliseconds()
};
} | javascript | function tsToObj(ts, offset) {
ts += offset * 60 * 1000;
const d = new Date(ts);
return {
year: d.getUTCFullYear(),
month: d.getUTCMonth() + 1,
day: d.getUTCDate(),
hour: d.getUTCHours(),
minute: d.getUTCMinutes(),
second: d.getUTCSeconds(),
millisecond: d.getUTCMilliseconds()
};
} | [
"function",
"tsToObj",
"(",
"ts",
",",
"offset",
")",
"{",
"ts",
"+=",
"offset",
"*",
"60",
"*",
"1000",
";",
"const",
"d",
"=",
"new",
"Date",
"(",
"ts",
")",
";",
"return",
"{",
"year",
":",
"d",
".",
"getUTCFullYear",
"(",
")",
",",
"month",
... | convert an epoch timestamp into a calendar object with the given offset | [
"convert",
"an",
"epoch",
"timestamp",
"into",
"a",
"calendar",
"object",
"with",
"the",
"given",
"offset"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L101-L115 | train | Convert a timestamp to an object | [
30522,
3853,
24529,
3406,
16429,
3501,
1006,
24529,
1010,
16396,
1007,
1063,
24529,
1009,
1027,
16396,
1008,
3438,
1008,
6694,
1025,
9530,
3367,
1040,
1027,
2047,
3058,
1006,
24529,
1007,
1025,
2709,
1063,
2095,
1024,
1040,
1012,
2131,
4904... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chartjs/Chart.js | rollup.plugins.js | stylesheet | function stylesheet(config = {}) {
const minifier = new cleancss();
const styles = [];
return {
name: 'stylesheet',
transform(code, id) {
// Note that 'id' can be mapped to a CJS proxy import, in which case
// 'id' will start with 'commonjs-proxy', so let's first check if we
// are importing an existing css file (i.e. startsWith()).
if (!id.startsWith(path.resolve('.')) || !id.endsWith('.css')) {
return;
}
if (config.minify) {
code = minifier.minify(code).styles;
}
// keep track of all imported stylesheets (already minified)
styles.push(code);
return {
code: 'export default ' + JSON.stringify(code)
};
},
generateBundle(opts, bundle) {
if (!config.extract) {
return;
}
const entry = Object.keys(bundle).find(v => bundle[v].isEntry);
const name = (entry || '').replace(/\.js$/i, '.css');
if (!name) {
this.error('failed to guess the output file name');
}
bundle[name] = {
code: styles.filter(v => !!v).join('')
};
}
};
} | javascript | function stylesheet(config = {}) {
const minifier = new cleancss();
const styles = [];
return {
name: 'stylesheet',
transform(code, id) {
// Note that 'id' can be mapped to a CJS proxy import, in which case
// 'id' will start with 'commonjs-proxy', so let's first check if we
// are importing an existing css file (i.e. startsWith()).
if (!id.startsWith(path.resolve('.')) || !id.endsWith('.css')) {
return;
}
if (config.minify) {
code = minifier.minify(code).styles;
}
// keep track of all imported stylesheets (already minified)
styles.push(code);
return {
code: 'export default ' + JSON.stringify(code)
};
},
generateBundle(opts, bundle) {
if (!config.extract) {
return;
}
const entry = Object.keys(bundle).find(v => bundle[v].isEntry);
const name = (entry || '').replace(/\.js$/i, '.css');
if (!name) {
this.error('failed to guess the output file name');
}
bundle[name] = {
code: styles.filter(v => !!v).join('')
};
}
};
} | [
"function",
"stylesheet",
"(",
"config",
"=",
"{",
"}",
")",
"{",
"const",
"minifier",
"=",
"new",
"cleancss",
"(",
")",
";",
"const",
"styles",
"=",
"[",
"]",
";",
"return",
"{",
"name",
":",
"'stylesheet'",
",",
"transform",
"(",
"code",
",",
"id",... | https://github.com/chartjs/Chart.js/issues/5208 | [
"https",
":",
"//",
"github",
".",
"com",
"/",
"chartjs",
"/",
"Chart",
".",
"js",
"/",
"issues",
"/",
"5208"
] | f093c36574d290330ed623e60fbd070421c730d5 | https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/rollup.plugins.js#L62-L103 | train | Generates a CSS file | [
30522,
3853,
6782,
21030,
2102,
1006,
9530,
8873,
2290,
1027,
1063,
1065,
1007,
1063,
9530,
3367,
7163,
8873,
2121,
1027,
2047,
4550,
6169,
2015,
1006,
1007,
1025,
9530,
3367,
6782,
1027,
1031,
1033,
1025,
2709,
1063,
2171,
1024,
1005,
67... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/angular | tools/symbol-extractor/symbol_extractor_spec/hello_world_min_debug.js | getNextLNodeWithProjection | function
getNextLNodeWithProjection(node) {
var pNextOrParent = node.pNextOrParent;
return pNextOrParent ? 1 == (3 & pNextOrParent.flags) ? null : pNextOrParent : node.next;
} | javascript | function
getNextLNodeWithProjection(node) {
var pNextOrParent = node.pNextOrParent;
return pNextOrParent ? 1 == (3 & pNextOrParent.flags) ? null : pNextOrParent : node.next;
} | [
"function",
"getNextLNodeWithProjection",
"(",
"node",
")",
"{",
"var",
"pNextOrParent",
"=",
"node",
".",
"pNextOrParent",
";",
"return",
"pNextOrParent",
"?",
"1",
"==",
"(",
"3",
"&",
"pNextOrParent",
".",
"flags",
")",
"?",
"null",
":",
"pNextOrParent",
... | @license
Copyright Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE file at https://angular.io/license
@license
Copyright Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE file at https://angular.io/license | [
"@license",
"Copyright",
"Google",
"Inc",
".",
"All",
"Rights",
"Reserved",
"."
] | c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c | https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/symbol-extractor/symbol_extractor_spec/hello_world_min_debug.js#L179-L183 | train | Returns the next node in the list of nodes | [
30522,
3853,
2131,
2638,
18413,
19666,
10244,
24415,
21572,
20614,
3258,
1006,
13045,
1007,
1063,
13075,
1052,
2638,
18413,
2953,
19362,
4765,
1027,
13045,
1012,
1052,
2638,
18413,
2953,
19362,
4765,
1025,
2709,
1052,
2638,
18413,
2953,
19362... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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, cells)
{
cells = cells || graph.getSelectionCells();
var result = graph.getExportableCells(graph.model.getTopmostCells(cells));
mxClipboard.insertCount = 1;
mxClipboard.setCells(graph.cloneCells(result));
return result;
} | javascript | function(graph, cells)
{
cells = cells || graph.getSelectionCells();
var result = graph.getExportableCells(graph.model.getTopmostCells(cells));
mxClipboard.insertCount = 1;
mxClipboard.setCells(graph.cloneCells(result));
return result;
} | [
"function",
"(",
"graph",
",",
"cells",
")",
"{",
"cells",
"=",
"cells",
"||",
"graph",
".",
"getSelectionCells",
"(",
")",
";",
"var",
"result",
"=",
"graph",
".",
"getExportableCells",
"(",
"graph",
".",
"model",
".",
"getTopmostCells",
"(",
"cells",
"... | Function: copy
Copies the given array of <mxCells> from the specified
graph to <cells>. Returns the original array of cells that has
been cloned. Descendants of cells in the array are ignored.
Parameters:
graph - <mxGraph> that contains the cells to be copied.
cells - Optional array of <mxCells> to be copied. | [
"Function",
":",
"copy"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L11425-L11433 | train | Returns the topmost cells of the graph | [
30522,
3853,
1006,
10629,
1010,
4442,
1007,
1063,
4442,
1027,
4442,
1064,
1064,
10629,
1012,
4152,
12260,
7542,
29109,
4877,
1006,
1007,
1025,
13075,
2765,
1027,
10629,
1012,
2131,
10288,
6442,
3085,
29109,
4877,
1006,
10629,
1012,
2944,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/base/BindingParser.js | setMode | function setMode(oBinding, iIndex) {
if (oBinding.parts) {
oBinding.parts.forEach(function (vPart, i) {
if (typeof vPart === "string") {
vPart = oBinding.parts[i] = {path : vPart};
}
setMode(vPart, i);
});
b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined;
} else {
oBinding.mode = oBindingMode;
}
} | javascript | function setMode(oBinding, iIndex) {
if (oBinding.parts) {
oBinding.parts.forEach(function (vPart, i) {
if (typeof vPart === "string") {
vPart = oBinding.parts[i] = {path : vPart};
}
setMode(vPart, i);
});
b2ndLevelMergedNeeded = b2ndLevelMergedNeeded || iIndex !== undefined;
} else {
oBinding.mode = oBindingMode;
}
} | [
"function",
"setMode",
"(",
"oBinding",
",",
"iIndex",
")",
"{",
"if",
"(",
"oBinding",
".",
"parts",
")",
"{",
"oBinding",
".",
"parts",
".",
"forEach",
"(",
"function",
"(",
"vPart",
",",
"i",
")",
"{",
"if",
"(",
"typeof",
"vPart",
"===",
"\"strin... | Recursively sets the mode <code>oBindingMode</code> on the given binding (or its
parts).
@param {object} oBinding
a binding which may be composite
@param {int} [iIndex]
index provided by <code>forEach</code> | [
"Recursively",
"sets",
"the",
"mode",
"<code",
">",
"oBindingMode<",
"/",
"code",
">",
"on",
"the",
"given",
"binding",
"(",
"or",
"its",
"parts",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L428-L440 | train | Sets the binding mode | [
30522,
3853,
2275,
5302,
3207,
1006,
27885,
22254,
2075,
1010,
2462,
13629,
2595,
1007,
1063,
2065,
1006,
27885,
22254,
2075,
1012,
3033,
1007,
1063,
27885,
22254,
2075,
1012,
3033,
1012,
18921,
6776,
1006,
3853,
1006,
21210,
8445,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
feathericons/feather | src/icon.js | attrsToString | function attrsToString(attrs) {
return Object.keys(attrs)
.map(key => `${key}="${attrs[key]}"`)
.join(' ');
} | javascript | function attrsToString(attrs) {
return Object.keys(attrs)
.map(key => `${key}="${attrs[key]}"`)
.join(' ');
} | [
"function",
"attrsToString",
"(",
"attrs",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"attrs",
")",
".",
"map",
"(",
"key",
"=>",
"`",
"${",
"key",
"}",
"${",
"attrs",
"[",
"key",
"]",
"}",
"`",
")",
".",
"join",
"(",
"' '",
")",
";",
"}"
... | Convert attributes object to string of HTML attributes.
@param {Object} attrs
@returns {string} | [
"Convert",
"attributes",
"object",
"to",
"string",
"of",
"HTML",
"attributes",
"."
] | 8f658193d25e943b196a2367319b5d9e85ee9f9f | https://github.com/feathericons/feather/blob/8f658193d25e943b196a2367319b5d9e85ee9f9f/src/icon.js#L49-L53 | train | Convert an object to a string | [
30522,
3853,
2012,
16344,
16033,
3367,
4892,
1006,
2012,
16344,
2015,
1007,
1063,
2709,
4874,
1012,
6309,
1006,
2012,
16344,
2015,
1007,
1012,
4949,
1006,
3145,
1027,
1028,
1036,
1002,
1063,
3145,
1065,
1027,
1000,
1002,
1063,
2012,
16344,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moment/luxon | src/duration.js | convert | function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
const conv = matrix[toUnit][fromUnit],
raw = fromMap[fromUnit] / conv,
sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),
// ok, so this is wild, but see the matrix in the tests
added =
!sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
toMap[toUnit] += added;
fromMap[fromUnit] -= added * conv;
} | javascript | function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
const conv = matrix[toUnit][fromUnit],
raw = fromMap[fromUnit] / conv,
sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),
// ok, so this is wild, but see the matrix in the tests
added =
!sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
toMap[toUnit] += added;
fromMap[fromUnit] -= added * conv;
} | [
"function",
"convert",
"(",
"matrix",
",",
"fromMap",
",",
"fromUnit",
",",
"toMap",
",",
"toUnit",
")",
"{",
"const",
"conv",
"=",
"matrix",
"[",
"toUnit",
"]",
"[",
"fromUnit",
"]",
",",
"raw",
"=",
"fromMap",
"[",
"fromUnit",
"]",
"/",
"conv",
","... | NB: mutates parameters | [
"NB",
":",
"mutates",
"parameters"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/duration.js#L125-L134 | train | Convert a matrix to a unit | [
30522,
3853,
10463,
1006,
8185,
1010,
2013,
2863,
2361,
1010,
2013,
19496,
2102,
1010,
3419,
9331,
1010,
2000,
19496,
2102,
1007,
1063,
9530,
3367,
9530,
2615,
1027,
8185,
1031,
2000,
19496,
2102,
1033,
1031,
2013,
19496,
2102,
1033,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/data/List.js | cloneListForMapAndSample | function cloneListForMapAndSample(original, excludeDimensions) {
var allDimensions = original.dimensions;
var list = new List(
zrUtil.map(allDimensions, original.getDimensionInfo, original),
original.hostModel
);
// FIXME If needs stackedOn, value may already been stacked
transferProperties(list, original);
var storage = list._storage = {};
var originalStorage = original._storage;
// Init storage
for (var i = 0; i < allDimensions.length; i++) {
var dim = allDimensions[i];
if (originalStorage[dim]) {
// Notice that we do not reset invertedIndicesMap here, becuase
// there is no scenario of mapping or sampling ordinal dimension.
if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {
storage[dim] = cloneDimStore(originalStorage[dim]);
list._rawExtent[dim] = getInitialExtent();
list._extent[dim] = null;
}
else {
// Direct reference for other dimensions
storage[dim] = originalStorage[dim];
}
}
}
return list;
} | javascript | function cloneListForMapAndSample(original, excludeDimensions) {
var allDimensions = original.dimensions;
var list = new List(
zrUtil.map(allDimensions, original.getDimensionInfo, original),
original.hostModel
);
// FIXME If needs stackedOn, value may already been stacked
transferProperties(list, original);
var storage = list._storage = {};
var originalStorage = original._storage;
// Init storage
for (var i = 0; i < allDimensions.length; i++) {
var dim = allDimensions[i];
if (originalStorage[dim]) {
// Notice that we do not reset invertedIndicesMap here, becuase
// there is no scenario of mapping or sampling ordinal dimension.
if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {
storage[dim] = cloneDimStore(originalStorage[dim]);
list._rawExtent[dim] = getInitialExtent();
list._extent[dim] = null;
}
else {
// Direct reference for other dimensions
storage[dim] = originalStorage[dim];
}
}
}
return list;
} | [
"function",
"cloneListForMapAndSample",
"(",
"original",
",",
"excludeDimensions",
")",
"{",
"var",
"allDimensions",
"=",
"original",
".",
"dimensions",
";",
"var",
"list",
"=",
"new",
"List",
"(",
"zrUtil",
".",
"map",
"(",
"allDimensions",
",",
"original",
"... | Data in excludeDimensions is copied, otherwise transfered. | [
"Data",
"in",
"excludeDimensions",
"is",
"copied",
"otherwise",
"transfered",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/List.js#L1556-L1586 | train | Clone list for mapping and sampling | [
30522,
3853,
17598,
9863,
14192,
22068,
18376,
16613,
2571,
1006,
2434,
1010,
12421,
14428,
3619,
8496,
1007,
1063,
13075,
2035,
22172,
6132,
8496,
1027,
2434,
1012,
9646,
1025,
13075,
2862,
1027,
2047,
2862,
1006,
1062,
22134,
4014,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js | checkNumericLike | function checkNumericLike(value, message) {
if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null.
throw message;
}
} | javascript | function checkNumericLike(value, message) {
if (value == undefined || value === Infinity || isNaN(value)) {//checks also for null.
throw message;
}
} | [
"function",
"checkNumericLike",
"(",
"value",
",",
"message",
")",
"{",
"if",
"(",
"value",
"==",
"undefined",
"||",
"value",
"===",
"Infinity",
"||",
"isNaN",
"(",
"value",
")",
")",
"{",
"//checks also for null.",
"throw",
"message",
";",
"}",
"}"
] | Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not.
@param {any} value The value of any type to check. If null or undefined, this method throws an error.
@param {string} message The message to be used if an error is to be thrown
@throws will throw an error if the value is null or undefined or is not like a number | [
"Verifies",
"the",
"given",
"value",
"is",
"numeric",
"like",
"i",
".",
"e",
".",
"3",
"3",
"and",
"throws",
"an",
"error",
"if",
"it",
"is",
"not",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.unified/src/sap/ui/unified/calendar/CalendarDate.js#L361-L365 | train | Check if value is numeric like | [
30522,
3853,
4638,
19172,
22420,
10359,
1006,
3643,
1010,
4471,
1007,
1063,
2065,
1006,
3643,
1027,
1027,
6151,
28344,
1064,
1064,
3643,
1027,
1027,
1027,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
LLK/scratch-blocks | blocks_vertical/sensing.js | function() {
this.jsonInit({
"message0": Blockly.Msg.SENSING_CURRENT,
"args0": [
{
"type": "field_dropdown",
"name": "CURRENTMENU",
"options": [
[Blockly.Msg.SENSING_CURRENT_YEAR, 'YEAR'],
[Blockly.Msg.SENSING_CURRENT_MONTH, 'MONTH'],
[Blockly.Msg.SENSING_CURRENT_DATE, 'DATE'],
[Blockly.Msg.SENSING_CURRENT_DAYOFWEEK, 'DAYOFWEEK'],
[Blockly.Msg.SENSING_CURRENT_HOUR, 'HOUR'],
[Blockly.Msg.SENSING_CURRENT_MINUTE, 'MINUTE'],
[Blockly.Msg.SENSING_CURRENT_SECOND, 'SECOND']
]
}
],
"category": Blockly.Categories.sensing,
"checkboxInFlyout": true,
"extensions": ["colours_sensing", "output_number"]
});
} | javascript | function() {
this.jsonInit({
"message0": Blockly.Msg.SENSING_CURRENT,
"args0": [
{
"type": "field_dropdown",
"name": "CURRENTMENU",
"options": [
[Blockly.Msg.SENSING_CURRENT_YEAR, 'YEAR'],
[Blockly.Msg.SENSING_CURRENT_MONTH, 'MONTH'],
[Blockly.Msg.SENSING_CURRENT_DATE, 'DATE'],
[Blockly.Msg.SENSING_CURRENT_DAYOFWEEK, 'DAYOFWEEK'],
[Blockly.Msg.SENSING_CURRENT_HOUR, 'HOUR'],
[Blockly.Msg.SENSING_CURRENT_MINUTE, 'MINUTE'],
[Blockly.Msg.SENSING_CURRENT_SECOND, 'SECOND']
]
}
],
"category": Blockly.Categories.sensing,
"checkboxInFlyout": true,
"extensions": ["colours_sensing", "output_number"]
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"jsonInit",
"(",
"{",
"\"message0\"",
":",
"Blockly",
".",
"Msg",
".",
"SENSING_CURRENT",
",",
"\"args0\"",
":",
"[",
"{",
"\"type\"",
":",
"\"field_dropdown\"",
",",
"\"name\"",
":",
"\"CURRENTMENU\"",
",",
"\"options... | Block to Report the current option.
@this Blockly.Block | [
"Block",
"to",
"Report",
"the",
"current",
"option",
"."
] | 455b2a854435c0a67da1da92320ddc3ec3e2b799 | https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/sensing.js#L471-L493 | train | Block for current sensing. | [
30522,
3853,
1006,
1007,
1063,
2023,
1012,
1046,
3385,
5498,
2102,
1006,
1063,
1000,
4471,
2692,
1000,
1024,
3796,
2135,
1012,
5796,
2290,
1012,
13851,
1035,
2783,
1010,
1000,
12098,
5620,
2692,
1000,
1024,
1031,
1063,
1000,
2828,
1000,
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... | |
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onGetRedirectResult | function onGetRedirectResult() {
auth.getRedirectResult().then(function(response) {
log('Redirect results:');
if (response.credential) {
log('Credential:');
log(response.credential);
} else {
log('No credential');
}
if (response.user) {
log('User\'s id:');
log(response.user.uid);
} else {
log('No user');
}
logAdditionalUserInfo(response);
console.log(response);
}, onAuthError);
} | javascript | function onGetRedirectResult() {
auth.getRedirectResult().then(function(response) {
log('Redirect results:');
if (response.credential) {
log('Credential:');
log(response.credential);
} else {
log('No credential');
}
if (response.user) {
log('User\'s id:');
log(response.user.uid);
} else {
log('No user');
}
logAdditionalUserInfo(response);
console.log(response);
}, onAuthError);
} | [
"function",
"onGetRedirectResult",
"(",
")",
"{",
"auth",
".",
"getRedirectResult",
"(",
")",
".",
"then",
"(",
"function",
"(",
"response",
")",
"{",
"log",
"(",
"'Redirect results:'",
")",
";",
"if",
"(",
"response",
".",
"credential",
")",
"{",
"log",
... | Displays redirect result. | [
"Displays",
"redirect",
"result",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L1052-L1070 | train | Get redirect result | [
30522,
3853,
2006,
18150,
5596,
7442,
6593,
6072,
11314,
1006,
1007,
1063,
8740,
2705,
1012,
2131,
5596,
7442,
6593,
6072,
11314,
1006,
1007,
1012,
2059,
1006,
3853,
1006,
3433,
1007,
1063,
8833,
1006,
1005,
2417,
7442,
6593,
3463,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.