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 sequencelengths 25 8.12k | docstring stringlengths 2 12.5k | docstring_tokens sequencelengths 1 449 | sha stringclasses 197 values | url stringlengths 88 186 | partition stringclasses 1 value | summary stringlengths 8 338 | input_ids sequencelengths 502 502 | token_type_ids sequencelengths 502 502 | attention_mask sequencelengths 502 502 | labels sequencelengths 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... |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 8