repo
stringclasses
192 values
path
stringlengths
4
115
func_name
stringlengths
0
45
original_string
stringlengths
74
24k
language
stringclasses
1 value
code
stringlengths
74
24k
code_tokens
listlengths
23
4.2k
docstring
stringlengths
2
23.7k
docstring_tokens
listlengths
1
810
sha
stringclasses
192 values
url
stringlengths
90
200
partition
stringclasses
1 value
summary
stringlengths
6
313
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function(sPropertyName) { var oResult = null; for (var i = -1, oCurrentSorter; (oCurrentSorter = this._aSortCondition[++i]) !== undefined;) { if (oCurrentSorter.property.name === sPropertyName) { oResult = { sorter : oCurrentSorter, index : i }; break; } } return oResult; }
javascript
function(sPropertyName) { var oResult = null; for (var i = -1, oCurrentSorter; (oCurrentSorter = this._aSortCondition[++i]) !== undefined;) { if (oCurrentSorter.property.name === sPropertyName) { oResult = { sorter : oCurrentSorter, index : i }; break; } } return oResult; }
[ "function", "(", "sPropertyName", ")", "{", "var", "oResult", "=", "null", ";", "for", "(", "var", "i", "=", "-", "1", ",", "oCurrentSorter", ";", "(", "oCurrentSorter", "=", "this", ".", "_aSortCondition", "[", "++", "i", "]", ")", "!==", "undefined",...
Checks if an order by expression for the given property is already defined and returns a reference to an object with property sorter and index of the object or null if the property is not yet defined in an order by expression. @private
[ "Checks", "if", "an", "order", "by", "expression", "for", "the", "given", "property", "is", "already", "defined", "and", "returns", "a", "reference", "to", "an", "object", "with", "property", "sorter", "and", "index", "of", "the", "object", "or", "null", "...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3635-L3647
train
Returns the highest priority sorting condition for the given property name.
[ 30522, 3853, 1006, 11867, 18981, 15010, 18442, 1007, 1063, 13075, 10848, 23722, 2102, 1027, 19701, 1025, 2005, 1006, 13075, 1045, 1027, 1011, 1015, 1010, 1051, 10841, 14343, 7666, 11589, 2121, 1025, 1006, 1051, 10841, 14343, 7666, 11589, 2121...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ExtensionUtils.js
getModulePath
function getModulePath(module, path) { var modulePath = module.uri.substr(0, module.uri.lastIndexOf("/") + 1); if (path) { modulePath += path; } return modulePath; }
javascript
function getModulePath(module, path) { var modulePath = module.uri.substr(0, module.uri.lastIndexOf("/") + 1); if (path) { modulePath += path; } return modulePath; }
[ "function", "getModulePath", "(", "module", ",", "path", ")", "{", "var", "modulePath", "=", "module", ".", "uri", ".", "substr", "(", "0", ",", "module", ".", "uri", ".", "lastIndexOf", "(", "\"/\"", ")", "+", "1", ")", ";", "if", "(", "path", ")"...
Returns a path to an extension module. @param {!module} module Module provided by RequireJS @param {?string} path Relative path from the extension folder to a file @return {!string} The path to the module's folder
[ "Returns", "a", "path", "to", "an", "extension", "module", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L137-L144
train
Get the module path
[ 30522, 3853, 2131, 5302, 8566, 2571, 15069, 1006, 11336, 1010, 4130, 1007, 1063, 13075, 11336, 15069, 1027, 11336, 1012, 24471, 30524, 4130, 1025, 1065, 2709, 11336, 15069, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
getCacheKey
function getCacheKey(request) { var service = request.service; var api = service.api || {}; var operations = api.operations; var identifiers = {}; if (service.config.region) { identifiers.region = service.config.region; } if (api.serviceId) { identifiers.serviceId = api.serviceId; } if (service.config.credentials.accessKeyId) { identifiers.accessKeyId = service.config.credentials.accessKeyId; } return identifiers; }
javascript
function getCacheKey(request) { var service = request.service; var api = service.api || {}; var operations = api.operations; var identifiers = {}; if (service.config.region) { identifiers.region = service.config.region; } if (api.serviceId) { identifiers.serviceId = api.serviceId; } if (service.config.credentials.accessKeyId) { identifiers.accessKeyId = service.config.credentials.accessKeyId; } return identifiers; }
[ "function", "getCacheKey", "(", "request", ")", "{", "var", "service", "=", "request", ".", "service", ";", "var", "api", "=", "service", ".", "api", "||", "{", "}", ";", "var", "operations", "=", "api", ".", "operations", ";", "var", "identifiers", "=...
Generate key (except resources and operation part) to index the endpoints in the cache If input shape has endpointdiscoveryid trait then use accessKey + operation + resources + region + service as cache key If input shape doesn't have endpointdiscoveryid trait then use accessKey + region + service as cache key @return [map<String,String>] object with keys to index endpoints. @api private
[ "Generate", "key", "(", "except", "resources", "and", "operation", "part", ")", "to", "index", "the", "endpoints", "in", "the", "cache", "If", "input", "shape", "has", "endpointdiscoveryid", "trait", "then", "use", "accessKey", "+", "operation", "+", "resource...
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/discover_endpoint.js#L14-L29
train
Get the cache key for a given service
[ 30522, 3853, 2131, 3540, 5403, 14839, 1006, 5227, 1007, 1063, 13075, 2326, 1027, 5227, 1012, 2326, 1025, 13075, 17928, 1027, 2326, 1012, 17928, 1064, 1064, 1063, 1065, 1025, 13075, 3136, 1027, 17928, 1012, 3136, 1025, 13075, 8909, 4765, 282...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
annotationAtParameter
function annotationAtParameter(sSegment, sWholeSegment) { var mAnnotationsXAllOverloads, sIndividualOverloadTarget, aOverloads, sSignature = "", sTerm = sWholeSegment.slice(sSegment.length); if (sTerm && maybeParameter(sSegment, vResult)) { // not looking for parameter itself, but for an annotation sName = sSegment; if (vBindingParameterType) { aOverloads = vResult.filter(isRightOverload); if (aOverloads.length !== 1) { return log(WARNING, "Expected a single overload, but found " + aOverloads.length); } if (vBindingParameterType !== UNBOUND) { sSignature = aOverloads[0].$Parameter[0].$isCollection ? "Collection(" + vBindingParameterType + ")" : vBindingParameterType; } sIndividualOverloadTarget = sTarget + "(" + sSignature + ")/" + sSegment; if (mScope.$Annotations[sIndividualOverloadTarget]) { if (sTerm === "@") { vResult = mScope.$Annotations[sIndividualOverloadTarget]; mAnnotationsXAllOverloads = mScope.$Annotations[sTarget + "/" + sSegment]; if (mAnnotationsXAllOverloads) { vResult = Object.assign({}, mAnnotationsXAllOverloads, vResult); } // sTarget does not matter because no further steps follow return false; // no further steps must happen } if (mScope.$Annotations[sIndividualOverloadTarget][sTerm]) { // "external targeting of individual action/function overload" sTarget = sIndividualOverloadTarget; return true; } } } // "the annotation applies to [...] all parameters of that name across all // overloads" sTarget += "/" + sSegment; return true; } }
javascript
function annotationAtParameter(sSegment, sWholeSegment) { var mAnnotationsXAllOverloads, sIndividualOverloadTarget, aOverloads, sSignature = "", sTerm = sWholeSegment.slice(sSegment.length); if (sTerm && maybeParameter(sSegment, vResult)) { // not looking for parameter itself, but for an annotation sName = sSegment; if (vBindingParameterType) { aOverloads = vResult.filter(isRightOverload); if (aOverloads.length !== 1) { return log(WARNING, "Expected a single overload, but found " + aOverloads.length); } if (vBindingParameterType !== UNBOUND) { sSignature = aOverloads[0].$Parameter[0].$isCollection ? "Collection(" + vBindingParameterType + ")" : vBindingParameterType; } sIndividualOverloadTarget = sTarget + "(" + sSignature + ")/" + sSegment; if (mScope.$Annotations[sIndividualOverloadTarget]) { if (sTerm === "@") { vResult = mScope.$Annotations[sIndividualOverloadTarget]; mAnnotationsXAllOverloads = mScope.$Annotations[sTarget + "/" + sSegment]; if (mAnnotationsXAllOverloads) { vResult = Object.assign({}, mAnnotationsXAllOverloads, vResult); } // sTarget does not matter because no further steps follow return false; // no further steps must happen } if (mScope.$Annotations[sIndividualOverloadTarget][sTerm]) { // "external targeting of individual action/function overload" sTarget = sIndividualOverloadTarget; return true; } } } // "the annotation applies to [...] all parameters of that name across all // overloads" sTarget += "/" + sSegment; return true; } }
[ "function", "annotationAtParameter", "(", "sSegment", ",", "sWholeSegment", ")", "{", "var", "mAnnotationsXAllOverloads", ",", "sIndividualOverloadTarget", ",", "aOverloads", ",", "sSignature", "=", "\"\"", ",", "sTerm", "=", "sWholeSegment", ".", "slice", "(", "sSe...
current object /* Handles annotation at action/function parameter, taking care of individual versus all overloads. @param {string} sSegment The current <code>sSegment</code> of <code>step</code> @param {string} sWholeSegment The current <code>aSegments[i]</code> of <code>step</code> @returns {boolean} <code>undefined</code> if no annotation at action/function parameter was recognized, <code>true</code> if further steps are needed, else <code>false</code>.
[ "current", "object", "/", "*", "Handles", "annotation", "at", "action", "/", "function", "parameter", "taking", "care", "of", "individual", "versus", "all", "overloads", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L977-L1023
train
This function is called when a parameter is found in the scope.
[ 30522, 3853, 5754, 17287, 3508, 4017, 28689, 22828, 1006, 7020, 13910, 3672, 1010, 25430, 19990, 13910, 3672, 1007, 1063, 13075, 10856, 17287, 9285, 18684, 7174, 6299, 11066, 2015, 1010, 8254, 4305, 17258, 8787, 7840, 11066, 7559, 18150, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/semi.js
maybeAsiHazardAfter
function maybeAsiHazardAfter(node) { const t = node.type; if (t === "DoWhileStatement" || t === "BreakStatement" || t === "ContinueStatement" || t === "DebuggerStatement" || t === "ImportDeclaration" || t === "ExportAllDeclaration" ) { return false; } if (t === "ReturnStatement") { return Boolean(node.argument); } if (t === "ExportNamedDeclaration") { return Boolean(node.declaration); } if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) { return false; } return true; }
javascript
function maybeAsiHazardAfter(node) { const t = node.type; if (t === "DoWhileStatement" || t === "BreakStatement" || t === "ContinueStatement" || t === "DebuggerStatement" || t === "ImportDeclaration" || t === "ExportAllDeclaration" ) { return false; } if (t === "ReturnStatement") { return Boolean(node.argument); } if (t === "ExportNamedDeclaration") { return Boolean(node.declaration); } if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) { return false; } return true; }
[ "function", "maybeAsiHazardAfter", "(", "node", ")", "{", "const", "t", "=", "node", ".", "type", ";", "if", "(", "t", "===", "\"DoWhileStatement\"", "||", "t", "===", "\"BreakStatement\"", "||", "t", "===", "\"ContinueStatement\"", "||", "t", "===", "\"Debu...
Check whether a given node can connect the next line if the next line is unreliable. @param {Node} node A statement node to check. @returns {boolean} `true` if the node can connect the next line.
[ "Check", "whether", "a", "given", "node", "can", "connect", "the", "next", "line", "if", "the", "next", "line", "is", "unreliable", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/semi.js#L178-L201
train
AlihazardAfter is a bug in the code
[ 30522, 3853, 2672, 21369, 3270, 26154, 10354, 3334, 1006, 13045, 1007, 1063, 9530, 3367, 1056, 1027, 13045, 1012, 2828, 1025, 2065, 1006, 1056, 1027, 1027, 1027, 1000, 23268, 19466, 4355, 3686, 3672, 1000, 1064, 1064, 1056, 1027, 1027, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
cypress-io/cypress
scripts/utils.js
getNameAndBinary
function getNameAndBinary (args = process.argv) { const options = minimist(args) la(is.unemptyString(options.npm), 'missing --npm option', options) la(is.unemptyString(options.binary), 'missing --binary option', options) let npm = options.npm if (fs.existsSync(options.npm)) { console.log('loading NPM url from', options.npm) npm = require(path.resolve(options.npm)).url la(is.url(npm), 'not an url', npm) } let binary = options.binary if (fs.existsSync(options.binary)) { console.log('loading binary url from', options.binary) binary = require(path.resolve(options.binary)).url la(is.url(binary), 'not an url', binary) } return { npm, binary, } }
javascript
function getNameAndBinary (args = process.argv) { const options = minimist(args) la(is.unemptyString(options.npm), 'missing --npm option', options) la(is.unemptyString(options.binary), 'missing --binary option', options) let npm = options.npm if (fs.existsSync(options.npm)) { console.log('loading NPM url from', options.npm) npm = require(path.resolve(options.npm)).url la(is.url(npm), 'not an url', npm) } let binary = options.binary if (fs.existsSync(options.binary)) { console.log('loading binary url from', options.binary) binary = require(path.resolve(options.binary)).url la(is.url(binary), 'not an url', binary) } return { npm, binary, } }
[ "function", "getNameAndBinary", "(", "args", "=", "process", ".", "argv", ")", "{", "const", "options", "=", "minimist", "(", "args", ")", "la", "(", "is", ".", "unemptyString", "(", "options", ".", "npm", ")", ",", "'missing --npm option'", ",", "options"...
/* eslint-disable no-console
[ "/", "*", "eslint", "-", "disable", "no", "-", "console" ]
bf1a942944f0e99684ff7fe0e18314332e46f83e
https://github.com/cypress-io/cypress/blob/bf1a942944f0e99684ff7fe0e18314332e46f83e/scripts/utils.js#L9-L37
train
get name and binary from args
[ 30522, 3853, 2131, 18442, 5685, 21114, 2854, 1006, 12098, 5620, 1027, 2832, 1012, 12098, 2290, 2615, 1007, 1063, 9530, 3367, 7047, 1027, 7163, 23738, 1006, 12098, 5620, 1007, 2474, 1006, 2003, 1012, 16655, 27718, 27268, 4892, 1006, 7047, 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/thirdparty/RequestRecorder.js
function(deleteRecordings) { var bDeleteRecordings = deleteRecordings || false; _private.oLog.info(sModuleName + " - Get Recordings"); return _private.getHarContent(bDeleteRecordings); }
javascript
function(deleteRecordings) { var bDeleteRecordings = deleteRecordings || false; _private.oLog.info(sModuleName + " - Get Recordings"); return _private.getHarContent(bDeleteRecordings); }
[ "function", "(", "deleteRecordings", ")", "{", "var", "bDeleteRecordings", "=", "deleteRecordings", "||", "false", ";", "_private", ".", "oLog", ".", "info", "(", "sModuleName", "+", "\" - Get Recordings\"", ")", ";", "return", "_private", ".", "getHarContent", ...
Delivers the current recordings in HAR format during record mode and the recording is not aborted. Requests which are not completed with readyState 4 are not included. @param {boolean} [deleteRecordings] True if the recordings should be deleted. @returns {Object} The har file as json.
[ "Delivers", "the", "current", "recordings", "in", "HAR", "format", "during", "record", "mode", "and", "the", "recording", "is", "not", "aborted", ".", "Requests", "which", "are", "not", "completed", "with", "readyState", "4", "are", "not", "included", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L773-L777
train
Get the HAR content
[ 30522, 3853, 1006, 3972, 15141, 8586, 8551, 8613, 1007, 1063, 13075, 1038, 9247, 15141, 8586, 8551, 8613, 1027, 3972, 15141, 8586, 8551, 8613, 1064, 1064, 6270, 1025, 1035, 2797, 1012, 19330, 8649, 1012, 18558, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/webdriver.js
executeCommand
function executeCommand(executor, command) { return toWireValue(command.getParameters()). then(function(parameters) { command.setParameters(parameters); return executor.execute(command); }); }
javascript
function executeCommand(executor, command) { return toWireValue(command.getParameters()). then(function(parameters) { command.setParameters(parameters); return executor.execute(command); }); }
[ "function", "executeCommand", "(", "executor", ",", "command", ")", "{", "return", "toWireValue", "(", "command", ".", "getParameters", "(", ")", ")", ".", "then", "(", "function", "(", "parameters", ")", "{", "command", ".", "setParameters", "(", "parameter...
//////////////////////////////////////////////////////////////////////////// WebDriver //////////////////////////////////////////////////////////////////////////// Translates a command to its wire-protocol representation before passing it to the given `executor` for execution. @param {!command.Executor} executor The executor to use. @param {!command.Command} command The command to execute. @return {!Promise} A promise that will resolve with the command response.
[ "////////////////////////////////////////////////////////////////////////////", "WebDriver", "////////////////////////////////////////////////////////////////////////////", "Translates", "a", "command", "to", "its", "wire", "-", "protocol", "representation", "before", "passing", "it", ...
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/lib/webdriver.js#L110-L116
train
Execute a command
[ 30522, 3853, 15389, 9006, 2386, 2094, 1006, 4654, 8586, 16161, 2099, 1010, 3094, 1007, 1063, 2709, 15805, 7442, 10175, 5657, 1006, 3094, 1012, 2131, 28689, 22828, 2015, 1006, 1007, 1007, 1012, 2059, 1006, 3853, 1006, 11709, 1007, 1063, 3094...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
fex-team/webuploader
_draft/music/webuploader.js
function( type/*, args...*/ ) { var args = [].slice.call( arguments, 1 ), opts = this.options, name = 'on' + type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ); if ( Mediator.trigger.apply( this, arguments ) === false ) { return false; } if ( $.isFunction( opts[ name ] ) && opts[ name ].apply( this, args ) === false ) { return false; } if ( $.isFunction( this[ name ] ) && this[ name ].apply( this, args ) === false ) { return false; } return true; }
javascript
function( type/*, args...*/ ) { var args = [].slice.call( arguments, 1 ), opts = this.options, name = 'on' + type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ); if ( Mediator.trigger.apply( this, arguments ) === false ) { return false; } if ( $.isFunction( opts[ name ] ) && opts[ name ].apply( this, args ) === false ) { return false; } if ( $.isFunction( this[ name ] ) && this[ name ].apply( this, args ) === false ) { return false; } return true; }
[ "function", "(", "type", "/*, args...*/", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ",", "opts", "=", "this", ".", "options", ",", "name", "=", "'on'", "+", "type", ".", "substring", "(", ...
需要重写此方法来来支持opts.onEvent和instance.onEvent的处理器
[ "需要重写此方法来来支持opts", ".", "onEvent和instance", ".", "onEvent的处理器" ]
7094e4476c5af3b06993d91dde2d223200b9feb7
https://github.com/fex-team/webuploader/blob/7094e4476c5af3b06993d91dde2d223200b9feb7/_draft/music/webuploader.js#L779-L800
train
trigger a event
[ 30522, 3853, 1006, 2828, 1013, 1008, 1010, 12098, 5620, 1012, 1012, 1012, 1008, 1013, 1007, 1063, 13075, 12098, 5620, 1027, 1031, 1033, 1012, 14704, 1012, 2655, 1006, 9918, 1010, 1015, 1007, 1010, 23569, 2015, 1027, 2023, 1012, 7047, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/main.js
handleValidationStatus
function handleValidationStatus(statusObj) { enableCheckForUpdateEntry(true); UpdateStatus.cleanUpdateStatus(); if (statusObj.valid) { // Installer is validated successfully var statusValidFn = function () { // Restart button click handler var restartBtnClicked = function () { HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART, "autoUpdate", "installNotification", "installNow ", "click" ); detachUpdateBarBtnHandlers(); initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath); }; // Later button click handler var laterBtnClicked = function () { HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER, "autoUpdate", "installNotification", "cancel", "click" ); detachUpdateBarBtnHandlers(); setUpdateStateInJSON('updateInitiatedInPrevSession', false); }; //attaching UpdateBar handlers UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked); UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked); UpdateInfoBar.showUpdateBar({ title: Strings.DOWNLOAD_COMPLETE, description: Strings.CLICK_RESTART_TO_UPDATE, needButtons: true }); setUpdateStateInJSON("autoUpdateInProgress", false); HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED, "autoUpdate", "installNotification", "render", "" ); }; if(!isAutoUpdateInitiated) { isAutoUpdateInitiated = true; updateJsonHandler.refresh() .done(function() { setUpdateStateInJSON('downloadCompleted', true) .done(statusValidFn); }); } else { setUpdateStateInJSON('downloadCompleted', true) .done(statusValidFn); } } else { // Installer validation failed if (updateJsonHandler.get("downloadCompleted")) { // If this was a cached download, retry downloading updateJsonHandler.reset(); var statusInvalidFn = function () { downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS; getLatestInstaller(); }; setUpdateStateInJSON('downloadCompleted', false) .done(statusInvalidFn); } else { // If this is a new download, prompt the message on update bar var descriptionMessage = "", analyticsDescriptionMessage = ""; switch (statusObj.err) { case _nodeErrorMessages.CHECKSUM_DID_NOT_MATCH: descriptionMessage = Strings.CHECKSUM_DID_NOT_MATCH; analyticsDescriptionMessage = "Checksum didn't match."; break; case _nodeErrorMessages.INSTALLER_NOT_FOUND: descriptionMessage = Strings.INSTALLER_NOT_FOUND; analyticsDescriptionMessage = "Installer not found."; break; } HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_FAILED, "autoUpdate", "download", "fail", analyticsDescriptionMessage ); UpdateInfoBar.showUpdateBar({ type: "error", title: Strings.VALIDATION_FAILED, description: descriptionMessage }); setUpdateStateInJSON("autoUpdateInProgress", false); } } }
javascript
function handleValidationStatus(statusObj) { enableCheckForUpdateEntry(true); UpdateStatus.cleanUpdateStatus(); if (statusObj.valid) { // Installer is validated successfully var statusValidFn = function () { // Restart button click handler var restartBtnClicked = function () { HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART, "autoUpdate", "installNotification", "installNow ", "click" ); detachUpdateBarBtnHandlers(); initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath); }; // Later button click handler var laterBtnClicked = function () { HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER, "autoUpdate", "installNotification", "cancel", "click" ); detachUpdateBarBtnHandlers(); setUpdateStateInJSON('updateInitiatedInPrevSession', false); }; //attaching UpdateBar handlers UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked); UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked); UpdateInfoBar.showUpdateBar({ title: Strings.DOWNLOAD_COMPLETE, description: Strings.CLICK_RESTART_TO_UPDATE, needButtons: true }); setUpdateStateInJSON("autoUpdateInProgress", false); HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED, "autoUpdate", "installNotification", "render", "" ); }; if(!isAutoUpdateInitiated) { isAutoUpdateInitiated = true; updateJsonHandler.refresh() .done(function() { setUpdateStateInJSON('downloadCompleted', true) .done(statusValidFn); }); } else { setUpdateStateInJSON('downloadCompleted', true) .done(statusValidFn); } } else { // Installer validation failed if (updateJsonHandler.get("downloadCompleted")) { // If this was a cached download, retry downloading updateJsonHandler.reset(); var statusInvalidFn = function () { downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS; getLatestInstaller(); }; setUpdateStateInJSON('downloadCompleted', false) .done(statusInvalidFn); } else { // If this is a new download, prompt the message on update bar var descriptionMessage = "", analyticsDescriptionMessage = ""; switch (statusObj.err) { case _nodeErrorMessages.CHECKSUM_DID_NOT_MATCH: descriptionMessage = Strings.CHECKSUM_DID_NOT_MATCH; analyticsDescriptionMessage = "Checksum didn't match."; break; case _nodeErrorMessages.INSTALLER_NOT_FOUND: descriptionMessage = Strings.INSTALLER_NOT_FOUND; analyticsDescriptionMessage = "Installer not found."; break; } HealthLogger.sendAnalyticsData( autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_FAILED, "autoUpdate", "download", "fail", analyticsDescriptionMessage ); UpdateInfoBar.showUpdateBar({ type: "error", title: Strings.VALIDATION_FAILED, description: descriptionMessage }); setUpdateStateInJSON("autoUpdateInProgress", false); } } }
[ "function", "handleValidationStatus", "(", "statusObj", ")", "{", "enableCheckForUpdateEntry", "(", "true", ")", ";", "UpdateStatus", ".", "cleanUpdateStatus", "(", ")", ";", "if", "(", "statusObj", ".", "valid", ")", "{", "// Installer is validated successfully", "...
Handles the installer validation callback from Node @param {object} statusObj - json containing - { valid - (boolean)true for a valid installer, false otherwise, installerPath, logFilePath, installStatusFilePath - for a valid installer, err - for an invalid installer }
[ "Handles", "the", "installer", "validation", "callback", "from", "Node" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/main.js#L904-L1018
train
Handle validation status
[ 30522, 3853, 5047, 10175, 8524, 9285, 29336, 2271, 1006, 3570, 16429, 3501, 1007, 1063, 9585, 5403, 3600, 29278, 6279, 13701, 4765, 2854, 1006, 2995, 1007, 1025, 14409, 29336, 2271, 1012, 27686, 27122, 29336, 2271, 1006, 1007, 1025, 2065, 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...
pagekit/vue-resource
dist/vue-resource.esm.js
plugin
function plugin(Vue) { if (plugin.installed) { return; } Util(Vue); Vue.url = Url; Vue.http = Http; Vue.resource = Resource; Vue.Promise = PromiseObj; Object.defineProperties(Vue.prototype, { $url: { get: function get() { return options(Vue.url, this, this.$options.url); } }, $http: { get: function get() { return options(Vue.http, this, this.$options.http); } }, $resource: { get: function get() { return Vue.resource.bind(this); } }, $promise: { get: function get() { var this$1 = this; return function (executor) { return new Vue.Promise(executor, this$1); }; } } }); }
javascript
function plugin(Vue) { if (plugin.installed) { return; } Util(Vue); Vue.url = Url; Vue.http = Http; Vue.resource = Resource; Vue.Promise = PromiseObj; Object.defineProperties(Vue.prototype, { $url: { get: function get() { return options(Vue.url, this, this.$options.url); } }, $http: { get: function get() { return options(Vue.http, this, this.$options.http); } }, $resource: { get: function get() { return Vue.resource.bind(this); } }, $promise: { get: function get() { var this$1 = this; return function (executor) { return new Vue.Promise(executor, this$1); }; } } }); }
[ "function", "plugin", "(", "Vue", ")", "{", "if", "(", "plugin", ".", "installed", ")", "{", "return", ";", "}", "Util", "(", "Vue", ")", ";", "Vue", ".", "url", "=", "Url", ";", "Vue", ".", "http", "=", "Http", ";", "Vue", ".", "resource", "="...
Install plugin.
[ "Install", "plugin", "." ]
fe268fa1d6053ede5f34aef9a11e1a424a70446c
https://github.com/pagekit/vue-resource/blob/fe268fa1d6053ede5f34aef9a11e1a424a70446c/dist/vue-resource.esm.js#L1507-L1549
train
Vue plugin for
[ 30522, 3853, 13354, 2378, 1006, 24728, 2063, 1007, 1063, 2065, 1006, 13354, 2378, 1012, 5361, 1007, 1063, 2709, 1025, 1065, 21183, 4014, 1006, 24728, 2063, 1007, 1025, 24728, 2063, 1012, 24471, 2140, 1027, 24471, 2140, 1025, 24728, 2063, 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...
chartjs/Chart.js
src/core/core.tooltip.js
createTooltipItem
function createTooltipItem(element) { var xScale = element._xScale; var yScale = element._yScale || element._scale; // handle radar || polarArea charts var index = element._index; var datasetIndex = element._datasetIndex; var controller = element._chart.getDatasetMeta(datasetIndex).controller; var indexScale = controller._getIndexScale(); var valueScale = controller._getValueScale(); return { xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '', yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '', label: indexScale ? '' + indexScale.getLabelForIndex(index, datasetIndex) : '', value: valueScale ? '' + valueScale.getLabelForIndex(index, datasetIndex) : '', index: index, datasetIndex: datasetIndex, x: element._model.x, y: element._model.y }; }
javascript
function createTooltipItem(element) { var xScale = element._xScale; var yScale = element._yScale || element._scale; // handle radar || polarArea charts var index = element._index; var datasetIndex = element._datasetIndex; var controller = element._chart.getDatasetMeta(datasetIndex).controller; var indexScale = controller._getIndexScale(); var valueScale = controller._getValueScale(); return { xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '', yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '', label: indexScale ? '' + indexScale.getLabelForIndex(index, datasetIndex) : '', value: valueScale ? '' + valueScale.getLabelForIndex(index, datasetIndex) : '', index: index, datasetIndex: datasetIndex, x: element._model.x, y: element._model.y }; }
[ "function", "createTooltipItem", "(", "element", ")", "{", "var", "xScale", "=", "element", ".", "_xScale", ";", "var", "yScale", "=", "element", ".", "_yScale", "||", "element", ".", "_scale", ";", "// handle radar || polarArea charts", "var", "index", "=", "...
Private helper to create a tooltip item model @param element - the chart element (point, arc, bar) to create the tooltip item for @return new tooltip item
[ "Private", "helper", "to", "create", "a", "tooltip", "item", "model" ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.tooltip.js#L210-L229
train
Create tooltip item for element
[ 30522, 3853, 3443, 3406, 27914, 11514, 4221, 2213, 1006, 5783, 1007, 1063, 13075, 1060, 15782, 2571, 1027, 5783, 1012, 1035, 1060, 15782, 2571, 1025, 13075, 1061, 15782, 2571, 1027, 5783, 1012, 1035, 1061, 15782, 2571, 1064, 1064, 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...
goldfire/howler.js
dist/howler.js
function() { var self = this || Howler; var audioTest = null; // Must wrap in a try/catch because IE11 in server mode throws an error. try { audioTest = (typeof Audio !== 'undefined') ? new Audio() : null; } catch (err) { return self; } if (!audioTest || typeof audioTest.canPlayType !== 'function') { return self; } var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, ''); // Opera version <33 has mixed MP3 support, so we need to check for and block it. var checkOpera = self._navigator && self._navigator.userAgent.match(/OPR\/([0-6].)/g); var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33); self._codecs = { mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))), mpeg: !!mpegTest, opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''), ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''), aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''), caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''), m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''), flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '') }; return self; }
javascript
function() { var self = this || Howler; var audioTest = null; // Must wrap in a try/catch because IE11 in server mode throws an error. try { audioTest = (typeof Audio !== 'undefined') ? new Audio() : null; } catch (err) { return self; } if (!audioTest || typeof audioTest.canPlayType !== 'function') { return self; } var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, ''); // Opera version <33 has mixed MP3 support, so we need to check for and block it. var checkOpera = self._navigator && self._navigator.userAgent.match(/OPR\/([0-6].)/g); var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33); self._codecs = { mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))), mpeg: !!mpegTest, opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''), ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''), wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''), aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''), caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''), m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''), weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''), dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''), flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '') }; return self; }
[ "function", "(", ")", "{", "var", "self", "=", "this", "||", "Howler", ";", "var", "audioTest", "=", "null", ";", "// Must wrap in a try/catch because IE11 in server mode throws an error.", "try", "{", "audioTest", "=", "(", "typeof", "Audio", "!==", "'undefined'", ...
Check for browser support for various codecs and cache the results. @return {Howler}
[ "Check", "for", "browser", "support", "for", "various", "codecs", "and", "cache", "the", "results", "." ]
030db918dd8ce640afd57e172418472497e8f113
https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/dist/howler.js#L235-L274
train
Get the current state of the current instance.
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1064, 1064, 22912, 2121, 1025, 13075, 5746, 22199, 1027, 19701, 1025, 1013, 1013, 2442, 10236, 1999, 1037, 3046, 1013, 4608, 2138, 29464, 14526, 1999, 8241, 5549, 11618, 2019, 7561, 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...
statsd/statsd
lib/mgmt_console.js
existing_stats
function existing_stats(stats_type, bucket){ matches = []; //typical case: one-off, fully qualified if (bucket in stats_type) { matches.push(bucket); } //special case: match a whole 'folder' (and subfolders) of stats if (bucket.slice(-2) == ".*") { var folder = bucket.slice(0,-1); for (var name in stats_type) { //check if stat is in bucket, ie~ name starts with folder if (name.substring(0, folder.length) == folder) { matches.push(name); } } } return matches; }
javascript
function existing_stats(stats_type, bucket){ matches = []; //typical case: one-off, fully qualified if (bucket in stats_type) { matches.push(bucket); } //special case: match a whole 'folder' (and subfolders) of stats if (bucket.slice(-2) == ".*") { var folder = bucket.slice(0,-1); for (var name in stats_type) { //check if stat is in bucket, ie~ name starts with folder if (name.substring(0, folder.length) == folder) { matches.push(name); } } } return matches; }
[ "function", "existing_stats", "(", "stats_type", ",", "bucket", ")", "{", "matches", "=", "[", "]", ";", "//typical case: one-off, fully qualified", "if", "(", "bucket", "in", "stats_type", ")", "{", "matches", ".", "push", "(", "bucket", ")", ";", "}", "//s...
existing_stats - find fully qualified matches for the requested stats bucket @param stats_type array of all statistics of this type (eg~ timers) to match @param bucket string to search on, which can be fully qualified, or end in a .* to search for a folder, like stats.temp.* @return array of fully qualified stats that match the specified bucket. if no matches, an empty array is a valid response
[ "existing_stats", "-", "find", "fully", "qualified", "matches", "for", "the", "requested", "stats", "bucket" ]
ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9
https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/lib/mgmt_console.js#L46-L67
train
Find existing stats in the stats_type
[ 30522, 3853, 4493, 1035, 26319, 1006, 26319, 1035, 2828, 1010, 13610, 1007, 1063, 3503, 1027, 1031, 1033, 1025, 1013, 1013, 5171, 2553, 1024, 2028, 1011, 2125, 1010, 3929, 4591, 2065, 1006, 13610, 1999, 26319, 1035, 2828, 1007, 1063, 3503, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getinsomnia/insomnia
packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js
replaceWithSurround
function replaceWithSurround(text, find, prefix, suffix) { const escapedString = escapeRegex(find); const re = new RegExp(escapedString, 'gi'); return text.replace(re, matched => prefix + matched + suffix); }
javascript
function replaceWithSurround(text, find, prefix, suffix) { const escapedString = escapeRegex(find); const re = new RegExp(escapedString, 'gi'); return text.replace(re, matched => prefix + matched + suffix); }
[ "function", "replaceWithSurround", "(", "text", ",", "find", ",", "prefix", ",", "suffix", ")", "{", "const", "escapedString", "=", "escapeRegex", "(", "find", ")", ";", "const", "re", "=", "new", "RegExp", "(", "escapedString", ",", "'gi'", ")", ";", "r...
Replace all occurrences of string @param text @param find @param prefix @param suffix @returns string
[ "Replace", "all", "occurrences", "of", "string" ]
e24ce7f7b41246e700c4b9bdb6b34b6652ad589b
https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js#L399-L403
train
Replace all occurrences of find with prefix and suffix
[ 30522, 3853, 5672, 24415, 26210, 22494, 4859, 1006, 3793, 1010, 2424, 1010, 17576, 1010, 16809, 1007, 1063, 9530, 3367, 6376, 3367, 4892, 1027, 4019, 2890, 3351, 2595, 1006, 2424, 1007, 1025, 9530, 3367, 2128, 1027, 2047, 19723, 10288, 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...
ColorlibHQ/AdminLTE
plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
function(needle) { if (arr.indexOf) { return arr.indexOf(needle); } else { for (var i=0, length=arr.length; i<length; i++) { if (arr[i] === needle) { return i; } } return -1; } }
javascript
function(needle) { if (arr.indexOf) { return arr.indexOf(needle); } else { for (var i=0, length=arr.length; i<length; i++) { if (arr[i] === needle) { return i; } } return -1; } }
[ "function", "(", "needle", ")", "{", "if", "(", "arr", ".", "indexOf", ")", "{", "return", "arr", ".", "indexOf", "(", "needle", ")", ";", "}", "else", "{", "for", "(", "var", "i", "=", "0", ",", "length", "=", "arr", ".", "length", ";", "i", ...
Check whether a given object exists in an array and return index If no elelemt found returns -1 @example wysihtml5.lang.array([1, 2]).indexOf(2); // => 1
[ "Check", "whether", "a", "given", "object", "exists", "in", "an", "array", "and", "return", "index", "If", "no", "elelemt", "found", "returns", "-", "1" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4609-L4618
train
Find the index of a given tag
[ 30522, 3853, 1006, 12201, 1007, 1063, 2065, 1006, 12098, 2099, 1012, 5950, 11253, 1007, 1063, 2709, 12098, 2099, 1012, 5950, 11253, 1006, 12201, 1007, 1025, 1065, 2842, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1010, 3091, 1027, 12098, 209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
gulpfile.js
buildCss
function buildCss(isRtl) { const mdlSrcs = gulp.src('stylesheet/mdl.scss') .pipe(sass.sync().on('error', sass.logError)) .pipe(cssInlineImages({ webRoot: 'node_modules/material-design-lite/src', })); const dialogPolyfillSrcs = gulp.src( 'node_modules/dialog-polyfill/dialog-polyfill.css'); let firebaseSrcs = gulp.src('stylesheet/*.css'); // Flip left/right, ltr/rtl for RTL languages. if (isRtl) { firebaseSrcs = firebaseSrcs.pipe(flip.gulp()); } const outFile = isRtl ? 'firebaseui-rtl.css' : 'firebaseui.css'; return streamqueue({objectMode: true}, mdlSrcs, dialogPolyfillSrcs, firebaseSrcs) .pipe(concatCSS(outFile)) .pipe(cleanCSS()) .pipe(gulp.dest(DEST_DIR)); }
javascript
function buildCss(isRtl) { const mdlSrcs = gulp.src('stylesheet/mdl.scss') .pipe(sass.sync().on('error', sass.logError)) .pipe(cssInlineImages({ webRoot: 'node_modules/material-design-lite/src', })); const dialogPolyfillSrcs = gulp.src( 'node_modules/dialog-polyfill/dialog-polyfill.css'); let firebaseSrcs = gulp.src('stylesheet/*.css'); // Flip left/right, ltr/rtl for RTL languages. if (isRtl) { firebaseSrcs = firebaseSrcs.pipe(flip.gulp()); } const outFile = isRtl ? 'firebaseui-rtl.css' : 'firebaseui.css'; return streamqueue({objectMode: true}, mdlSrcs, dialogPolyfillSrcs, firebaseSrcs) .pipe(concatCSS(outFile)) .pipe(cleanCSS()) .pipe(gulp.dest(DEST_DIR)); }
[ "function", "buildCss", "(", "isRtl", ")", "{", "const", "mdlSrcs", "=", "gulp", ".", "src", "(", "'stylesheet/mdl.scss'", ")", ".", "pipe", "(", "sass", ".", "sync", "(", ")", ".", "on", "(", "'error'", ",", "sass", ".", "logError", ")", ")", ".", ...
Builds the CSS for FirebaseUI. @param {boolean} isRtl Whether to build in right-to-left mode. @return {*} A stream that finishes when compilation finishes.
[ "Builds", "the", "CSS", "for", "FirebaseUI", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/gulpfile.js#L297-L318
train
Build CSS for the given language
[ 30522, 3853, 3857, 6169, 2015, 1006, 2003, 5339, 2140, 1007, 1063, 9530, 3367, 9108, 4877, 11890, 2015, 1027, 26546, 1012, 5034, 2278, 1006, 1005, 6782, 21030, 2102, 1013, 9108, 2140, 1012, 8040, 4757, 1005, 1007, 1012, 8667, 1006, 21871, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/_AggregationHelper.js
skipTop
function skipTop() { var sTransformation = ""; if (mQueryOptions.$skip) { sTransformation = "skip(" + mQueryOptions.$skip + ")"; } delete mQueryOptions.$skip; // delete 0 value even w/o skip(0) if (mQueryOptions.$top < Infinity) { // ignore +Infinity, undefined, NaN, ... if (sTransformation) { sTransformation += "/"; } sTransformation += "top(" + mQueryOptions.$top + ")"; } delete mQueryOptions.$top; return sTransformation; }
javascript
function skipTop() { var sTransformation = ""; if (mQueryOptions.$skip) { sTransformation = "skip(" + mQueryOptions.$skip + ")"; } delete mQueryOptions.$skip; // delete 0 value even w/o skip(0) if (mQueryOptions.$top < Infinity) { // ignore +Infinity, undefined, NaN, ... if (sTransformation) { sTransformation += "/"; } sTransformation += "top(" + mQueryOptions.$top + ")"; } delete mQueryOptions.$top; return sTransformation; }
[ "function", "skipTop", "(", ")", "{", "var", "sTransformation", "=", "\"\"", ";", "if", "(", "mQueryOptions", ".", "$skip", ")", "{", "sTransformation", "=", "\"skip(\"", "+", "mQueryOptions", ".", "$skip", "+", "\")\"", ";", "}", "delete", "mQueryOptions", ...
/* Takes care of the $skip/$top system query options and returns the corresponding transformation(s). @returns {string} The transformation(s) corresponding to $skip/$top or "".
[ "/", "*", "Takes", "care", "of", "the", "$skip", "/", "$top", "system", "query", "options", "and", "returns", "the", "corresponding", "transformation", "(", "s", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L263-L279
train
skip top
[ 30522, 3853, 13558, 14399, 1006, 1007, 1063, 13075, 2358, 5521, 22747, 2953, 28649, 1027, 1000, 1000, 1025, 2065, 1006, 1049, 4226, 2854, 7361, 9285, 1012, 1002, 13558, 1007, 1063, 2358, 5521, 22747, 2953, 28649, 1027, 1000, 13558, 1006, 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
javascript/selenium-core/lib/snapsie.js
Snapsie
function Snapsie() { // private methods function isQuirksMode(inDocument) { return (inDocument.compatMode == 'BackCompat'); } function getDrawableElement(inDocument) { if (isQuirksMode(inDocument)) { var body = inDocument.getElementsByTagName('body')[0]; return body; } else { // standards mode return inDocument.documentElement; } } /** * Returns the canonical Windows path for a given path. This means * basically replacing any forwards slashes with backslashes. * * @param path the path whose canonical form to return */ function getCanonicalPath(path) { path = path.replace(/\//g, '\\'); path = path.replace(/\\\\/g, '\\'); return path; } // public methods /** * Saves a screenshot of the current document to a file. If frameId is * specified, a screenshot of just the frame is captured instead. * * @param outputFile the file to which to save the screenshot * @param frameId the frame to capture; omit to capture entire document */ this.saveSnapshot = function(outputFile, frameId) { var drawableElement = getDrawableElement(document); var drawableInfo = { overflow : drawableElement.style.overflow , scrollLeft: drawableElement.scrollLeft , scrollTop : drawableElement.scrollTop }; drawableElement.style.overflow = 'hidden'; var capturableDocument; var frameBCR = { left: 0, top: 0 }; if (!frameId) { capturableDocument = document; } else { var frame = document.getElementById(frameId); capturableDocument = frame.document; // scroll as much of the frame into view as possible frameBCR = frame.getBoundingClientRect(); window.scroll(frameBCR.left, frameBCR.top); frameBCR = frame.getBoundingClientRect(); } var nativeObj = new ActiveXObject('Snapsie.CoSnapsie'); nativeObj.saveSnapshot( getCanonicalPath(outputFile), frameId, drawableElement.scrollWidth, drawableElement.scrollHeight, drawableElement.clientWidth, drawableElement.clientHeight, drawableElement.clientLeft, drawableElement.clientTop, frameBCR.left, frameBCR.top ); // revert drawableElement.style.overflow = drawableInfo.overflow; drawableElement.scrollLeft = drawableInfo.scrollLeft; drawableElement.scrollTop = drawableInfo.scrollTop; } }
javascript
function Snapsie() { // private methods function isQuirksMode(inDocument) { return (inDocument.compatMode == 'BackCompat'); } function getDrawableElement(inDocument) { if (isQuirksMode(inDocument)) { var body = inDocument.getElementsByTagName('body')[0]; return body; } else { // standards mode return inDocument.documentElement; } } /** * Returns the canonical Windows path for a given path. This means * basically replacing any forwards slashes with backslashes. * * @param path the path whose canonical form to return */ function getCanonicalPath(path) { path = path.replace(/\//g, '\\'); path = path.replace(/\\\\/g, '\\'); return path; } // public methods /** * Saves a screenshot of the current document to a file. If frameId is * specified, a screenshot of just the frame is captured instead. * * @param outputFile the file to which to save the screenshot * @param frameId the frame to capture; omit to capture entire document */ this.saveSnapshot = function(outputFile, frameId) { var drawableElement = getDrawableElement(document); var drawableInfo = { overflow : drawableElement.style.overflow , scrollLeft: drawableElement.scrollLeft , scrollTop : drawableElement.scrollTop }; drawableElement.style.overflow = 'hidden'; var capturableDocument; var frameBCR = { left: 0, top: 0 }; if (!frameId) { capturableDocument = document; } else { var frame = document.getElementById(frameId); capturableDocument = frame.document; // scroll as much of the frame into view as possible frameBCR = frame.getBoundingClientRect(); window.scroll(frameBCR.left, frameBCR.top); frameBCR = frame.getBoundingClientRect(); } var nativeObj = new ActiveXObject('Snapsie.CoSnapsie'); nativeObj.saveSnapshot( getCanonicalPath(outputFile), frameId, drawableElement.scrollWidth, drawableElement.scrollHeight, drawableElement.clientWidth, drawableElement.clientHeight, drawableElement.clientLeft, drawableElement.clientTop, frameBCR.left, frameBCR.top ); // revert drawableElement.style.overflow = drawableInfo.overflow; drawableElement.scrollLeft = drawableInfo.scrollLeft; drawableElement.scrollTop = drawableInfo.scrollTop; } }
[ "function", "Snapsie", "(", ")", "{", "// private methods", "function", "isQuirksMode", "(", "inDocument", ")", "{", "return", "(", "inDocument", ".", "compatMode", "==", "'BackCompat'", ")", ";", "}", "function", "getDrawableElement", "(", "inDocument", ")", "{...
This file wraps the Snapsie ActiveX object, exposing a single saveSnapshot() method on a the object. See http://snapsie.sourceforge.net/
[ "This", "file", "wraps", "the", "Snapsie", "ActiveX", "object", "exposing", "a", "single", "saveSnapshot", "()", "method", "on", "a", "the", "object", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/lib/snapsie.js#L8-L91
train
Snapsie Snapsie.
[ 30522, 3853, 20057, 2666, 1006, 1007, 1063, 1013, 1013, 2797, 4725, 3853, 2003, 15549, 19987, 5302, 3207, 1006, 11424, 24894, 4765, 1007, 1063, 2709, 1006, 11424, 24894, 4765, 1012, 4012, 4502, 21246, 10244, 1027, 1027, 1005, 2067, 9006, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
function (sDateString) { var iMillis = NativeDate_parse.apply(Date, arguments); if (sDateString && typeof sDateString === "string") { // if the year is gt/eq 2034 we need to increment the // date by one additional day since this is broken in // PhantomJS => this is a workaround for the upper BUG! var m = /^(\d{4})(?:-(\d+)?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/.exec(sDateString); if (m && parseInt(m[1]) >= 2034) { iMillis += 24 * 60 * 60 * 1000; } } return iMillis; }
javascript
function (sDateString) { var iMillis = NativeDate_parse.apply(Date, arguments); if (sDateString && typeof sDateString === "string") { // if the year is gt/eq 2034 we need to increment the // date by one additional day since this is broken in // PhantomJS => this is a workaround for the upper BUG! var m = /^(\d{4})(?:-(\d+)?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/.exec(sDateString); if (m && parseInt(m[1]) >= 2034) { iMillis += 24 * 60 * 60 * 1000; } } return iMillis; }
[ "function", "(", "sDateString", ")", "{", "var", "iMillis", "=", "NativeDate_parse", ".", "apply", "(", "Date", ",", "arguments", ")", ";", "if", "(", "sDateString", "&&", "typeof", "sDateString", "===", "\"string\"", ")", "{", "// if the year is gt/eq 2034 we n...
patch the parse function of the Date
[ "patch", "the", "parse", "function", "of", "the", "Date" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L142-L154
train
Parse the specified date string into milliseconds
[ 30522, 3853, 1006, 17371, 8520, 18886, 3070, 1007, 1063, 13075, 10047, 8591, 2483, 1027, 3128, 13701, 1035, 11968, 3366, 1012, 6611, 1006, 3058, 1010, 9918, 1007, 1025, 2065, 1006, 17371, 8520, 18886, 3070, 1004, 1004, 2828, 11253, 17371, 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...
GeekyAnts/vue-native-core
packages/vue-native-core/build.js
observer
function observer (componentClass) { if (typeof componentClass === 'function' && (!componentClass.prototype || !componentClass.prototype.render) && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass) ) { var ObserverComponent = (function (superclass) { function ObserverComponent () { superclass.apply(this, arguments); } if ( superclass ) ObserverComponent.__proto__ = superclass; ObserverComponent.prototype = Object.create( superclass && superclass.prototype ); ObserverComponent.prototype.constructor = ObserverComponent; ObserverComponent.prototype.render = function render () { return componentClass.call(this, this.props, this.context) }; return ObserverComponent; }(React.Component)); ObserverComponent.displayName = componentClass.displayName || componentClass.name; ObserverComponent.contextTypes = componentClass.contextTypes; ObserverComponent.propTypes = componentClass.propTypes; ObserverComponent.defaultProps = componentClass.defaultProps; return observer(ObserverComponent) } if (!componentClass) { throw new Error("Please pass a valid component to 'observer'") } var target = componentClass.prototype || componentClass; mixinLifecycleEvents(target); return componentClass }
javascript
function observer (componentClass) { if (typeof componentClass === 'function' && (!componentClass.prototype || !componentClass.prototype.render) && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass) ) { var ObserverComponent = (function (superclass) { function ObserverComponent () { superclass.apply(this, arguments); } if ( superclass ) ObserverComponent.__proto__ = superclass; ObserverComponent.prototype = Object.create( superclass && superclass.prototype ); ObserverComponent.prototype.constructor = ObserverComponent; ObserverComponent.prototype.render = function render () { return componentClass.call(this, this.props, this.context) }; return ObserverComponent; }(React.Component)); ObserverComponent.displayName = componentClass.displayName || componentClass.name; ObserverComponent.contextTypes = componentClass.contextTypes; ObserverComponent.propTypes = componentClass.propTypes; ObserverComponent.defaultProps = componentClass.defaultProps; return observer(ObserverComponent) } if (!componentClass) { throw new Error("Please pass a valid component to 'observer'") } var target = componentClass.prototype || componentClass; mixinLifecycleEvents(target); return componentClass }
[ "function", "observer", "(", "componentClass", ")", "{", "if", "(", "typeof", "componentClass", "===", "'function'", "&&", "(", "!", "componentClass", ".", "prototype", "||", "!", "componentClass", ".", "prototype", ".", "render", ")", "&&", "!", "componentCla...
Reference to mobx https://github.com/mobxjs/mobx-react-vue/blob/master/src/observer.js
[ "Reference", "to", "mobx", "https", ":", "//", "github", ".", "com", "/", "mobxjs", "/", "mobx", "-", "react", "-", "vue", "/", "blob", "/", "master", "/", "src", "/", "observer", ".", "js" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-core/build.js#L3968-L4001
train
Creates an observer component
[ 30522, 3853, 9718, 1006, 6922, 26266, 1007, 1063, 2065, 1006, 2828, 11253, 6922, 26266, 1027, 1027, 1027, 1005, 3853, 1005, 1004, 1004, 1006, 999, 6922, 26266, 1012, 8773, 1064, 1064, 999, 6922, 26266, 1012, 8773, 1012, 17552, 1007, 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...
eslint/eslint
lib/rules/function-paren-newline.js
validateParens
function validateParens(parens, elements) { const leftParen = parens.leftParen; const rightParen = parens.rightParen; const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); const tokenBeforeRightParen = sourceCode.getTokenBefore(rightParen); const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); const hasRightNewline = !astUtils.isTokenOnSameLine(tokenBeforeRightParen, rightParen); const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); if (hasLeftNewline && !needsNewlines) { context.report({ node: leftParen, messageId: "unexpectedAfter", fix(fixer) { return sourceCode.getText().slice(leftParen.range[1], tokenAfterLeftParen.range[0]).trim() // If there is a comment between the ( and the first element, don't do a fix. ? null : fixer.removeRange([leftParen.range[1], tokenAfterLeftParen.range[0]]); } }); } else if (!hasLeftNewline && needsNewlines) { context.report({ node: leftParen, messageId: "expectedAfter", fix: fixer => fixer.insertTextAfter(leftParen, "\n") }); } if (hasRightNewline && !needsNewlines) { context.report({ node: rightParen, messageId: "unexpectedBefore", fix(fixer) { return sourceCode.getText().slice(tokenBeforeRightParen.range[1], rightParen.range[0]).trim() // If there is a comment between the last element and the ), don't do a fix. ? null : fixer.removeRange([tokenBeforeRightParen.range[1], rightParen.range[0]]); } }); } else if (!hasRightNewline && needsNewlines) { context.report({ node: rightParen, messageId: "expectedBefore", fix: fixer => fixer.insertTextBefore(rightParen, "\n") }); } }
javascript
function validateParens(parens, elements) { const leftParen = parens.leftParen; const rightParen = parens.rightParen; const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParen); const tokenBeforeRightParen = sourceCode.getTokenBefore(rightParen); const hasLeftNewline = !astUtils.isTokenOnSameLine(leftParen, tokenAfterLeftParen); const hasRightNewline = !astUtils.isTokenOnSameLine(tokenBeforeRightParen, rightParen); const needsNewlines = shouldHaveNewlines(elements, hasLeftNewline); if (hasLeftNewline && !needsNewlines) { context.report({ node: leftParen, messageId: "unexpectedAfter", fix(fixer) { return sourceCode.getText().slice(leftParen.range[1], tokenAfterLeftParen.range[0]).trim() // If there is a comment between the ( and the first element, don't do a fix. ? null : fixer.removeRange([leftParen.range[1], tokenAfterLeftParen.range[0]]); } }); } else if (!hasLeftNewline && needsNewlines) { context.report({ node: leftParen, messageId: "expectedAfter", fix: fixer => fixer.insertTextAfter(leftParen, "\n") }); } if (hasRightNewline && !needsNewlines) { context.report({ node: rightParen, messageId: "unexpectedBefore", fix(fixer) { return sourceCode.getText().slice(tokenBeforeRightParen.range[1], rightParen.range[0]).trim() // If there is a comment between the last element and the ), don't do a fix. ? null : fixer.removeRange([tokenBeforeRightParen.range[1], rightParen.range[0]]); } }); } else if (!hasRightNewline && needsNewlines) { context.report({ node: rightParen, messageId: "expectedBefore", fix: fixer => fixer.insertTextBefore(rightParen, "\n") }); } }
[ "function", "validateParens", "(", "parens", ",", "elements", ")", "{", "const", "leftParen", "=", "parens", ".", "leftParen", ";", "const", "rightParen", "=", "parens", ".", "rightParen", ";", "const", "tokenAfterLeftParen", "=", "sourceCode", ".", "getTokenAft...
Validates parens @param {Object} parens An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token @param {ASTNode[]} elements The arguments or parameters in the list @returns {void}
[ "Validates", "parens" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/function-paren-newline.js#L106-L154
train
Validates parens.
[ 30522, 3853, 9398, 3686, 19362, 6132, 1006, 11968, 6132, 1010, 3787, 1007, 1063, 9530, 3367, 2187, 19362, 2368, 1027, 11968, 6132, 1012, 2187, 19362, 2368, 1025, 9530, 3367, 2157, 19362, 2368, 1027, 11968, 6132, 1012, 2157, 19362, 2368, 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...
electron/electron
script/bump-version.js
updateWinRC
async function updateWinRC (components) { const filePath = path.resolve(__dirname, '..', 'atom', 'browser', 'resources', 'win', 'atom.rc') const data = await readFile(filePath, 'utf8') const arr = data.split('\n') arr.forEach((line, idx) => { if (line.includes('FILEVERSION')) { arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}` arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}` } else if (line.includes('FileVersion')) { arr[idx] = ` VALUE "FileVersion", "${utils.makeVersion(components, '.')}"` arr[idx + 5] = ` VALUE "ProductVersion", "${utils.makeVersion(components, '.')}"` } }) await writeFile(filePath, arr.join('\n')) }
javascript
async function updateWinRC (components) { const filePath = path.resolve(__dirname, '..', 'atom', 'browser', 'resources', 'win', 'atom.rc') const data = await readFile(filePath, 'utf8') const arr = data.split('\n') arr.forEach((line, idx) => { if (line.includes('FILEVERSION')) { arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}` arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}` } else if (line.includes('FileVersion')) { arr[idx] = ` VALUE "FileVersion", "${utils.makeVersion(components, '.')}"` arr[idx + 5] = ` VALUE "ProductVersion", "${utils.makeVersion(components, '.')}"` } }) await writeFile(filePath, arr.join('\n')) }
[ "async", "function", "updateWinRC", "(", "components", ")", "{", "const", "filePath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'..'", ",", "'atom'", ",", "'browser'", ",", "'resources'", ",", "'win'", ",", "'atom.rc'", ")", "const", "data", "="...
updates atom.rc file with new semver values
[ "updates", "atom", ".", "rc", "file", "with", "new", "semver", "values" ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/script/bump-version.js#L161-L175
train
Updates atom. rc file with new version
[ 30522, 2004, 6038, 2278, 3853, 10651, 10105, 11890, 1006, 6177, 1007, 1063, 9530, 3367, 5371, 15069, 30524, 1010, 1005, 1012, 1012, 1005, 1010, 1005, 13787, 1005, 1010, 1005, 16602, 1005, 1010, 1005, 4219, 1005, 1010, 1005, 2663, 1005, 1010...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js
init
function init(domainManager) { if (!domainManager.hasDomain("AutoUpdate")) { domainManager.registerDomain("AutoUpdate", { major: 0, minor: 1 }); } _domainManager = domainManager; domainManager.registerCommand( "AutoUpdate", "initNode", initNode, true, "Initializes node for the auto update", [ { name: "initObj", type: "object", description: "json object containing init information" } ], [] ); domainManager.registerCommand( "AutoUpdate", "data", receiveMessageFromBrackets, true, "Receives messages from brackets", [ { name: "msgObj", type: "object", description: "json object containing message info" } ], [] ); domainManager.registerEvent( "AutoUpdate", "data", [ { name: "msgObj", type: "object", description: "json object containing message info to pass to brackets" } ] ); }
javascript
function init(domainManager) { if (!domainManager.hasDomain("AutoUpdate")) { domainManager.registerDomain("AutoUpdate", { major: 0, minor: 1 }); } _domainManager = domainManager; domainManager.registerCommand( "AutoUpdate", "initNode", initNode, true, "Initializes node for the auto update", [ { name: "initObj", type: "object", description: "json object containing init information" } ], [] ); domainManager.registerCommand( "AutoUpdate", "data", receiveMessageFromBrackets, true, "Receives messages from brackets", [ { name: "msgObj", type: "object", description: "json object containing message info" } ], [] ); domainManager.registerEvent( "AutoUpdate", "data", [ { name: "msgObj", type: "object", description: "json object containing message info to pass to brackets" } ] ); }
[ "function", "init", "(", "domainManager", ")", "{", "if", "(", "!", "domainManager", ".", "hasDomain", "(", "\"AutoUpdate\"", ")", ")", "{", "domainManager", ".", "registerDomain", "(", "\"AutoUpdate\"", ",", "{", "major", ":", "0", ",", "minor", ":", "1",...
Initialize the domain with commands and events related to AutoUpdate @param {DomainManager} domainManager - The DomainManager for AutoUpdateDomain
[ "Initialize", "the", "domain", "with", "commands", "and", "events", "related", "to", "AutoUpdate" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L455-L507
train
Initializes the auto update command
[ 30522, 3853, 1999, 4183, 1006, 5884, 24805, 4590, 1007, 1063, 2065, 1006, 999, 5884, 24805, 4590, 1012, 2038, 9527, 8113, 1006, 1000, 8285, 6279, 13701, 1000, 1007, 1007, 1063, 5884, 24805, 4590, 1012, 4236, 9527, 8113, 1006, 1000, 8285, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
src/core/core.scale.js
computeLabelSizes
function computeLabelSizes(ctx, tickFonts, ticks, caches) { var length = ticks.length; var widths = []; var heights = []; var offsets = []; var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest; for (i = 0; i < length; ++i) { label = ticks[i].label; tickFont = ticks[i].major ? tickFonts.major : tickFonts.minor; ctx.font = fontString = tickFont.string; cache = caches[fontString] = caches[fontString] || {data: {}, gc: []}; lineHeight = tickFont.lineHeight; width = height = 0; // Undefined labels and arrays should not be measured if (!helpers.isNullOrUndef(label) && !helpers.isArray(label)) { width = helpers.measureText(ctx, cache.data, cache.gc, width, label); height = lineHeight; } else if (helpers.isArray(label)) { // if it is an array let's measure each element for (j = 0, jlen = label.length; j < jlen; ++j) { nestedLabel = label[j]; // Undefined labels and arrays should not be measured if (!helpers.isNullOrUndef(nestedLabel) && !helpers.isArray(nestedLabel)) { width = helpers.measureText(ctx, cache.data, cache.gc, width, nestedLabel); height += lineHeight; } } } widths.push(width); heights.push(height); offsets.push(lineHeight / 2); } garbageCollect(caches, length); widest = widths.indexOf(Math.max.apply(null, widths)); highest = heights.indexOf(Math.max.apply(null, heights)); function valueAt(idx) { return { width: widths[idx] || 0, height: heights[idx] || 0, offset: offsets[idx] || 0 }; } return { first: valueAt(0), last: valueAt(length - 1), widest: valueAt(widest), highest: valueAt(highest) }; }
javascript
function computeLabelSizes(ctx, tickFonts, ticks, caches) { var length = ticks.length; var widths = []; var heights = []; var offsets = []; var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest; for (i = 0; i < length; ++i) { label = ticks[i].label; tickFont = ticks[i].major ? tickFonts.major : tickFonts.minor; ctx.font = fontString = tickFont.string; cache = caches[fontString] = caches[fontString] || {data: {}, gc: []}; lineHeight = tickFont.lineHeight; width = height = 0; // Undefined labels and arrays should not be measured if (!helpers.isNullOrUndef(label) && !helpers.isArray(label)) { width = helpers.measureText(ctx, cache.data, cache.gc, width, label); height = lineHeight; } else if (helpers.isArray(label)) { // if it is an array let's measure each element for (j = 0, jlen = label.length; j < jlen; ++j) { nestedLabel = label[j]; // Undefined labels and arrays should not be measured if (!helpers.isNullOrUndef(nestedLabel) && !helpers.isArray(nestedLabel)) { width = helpers.measureText(ctx, cache.data, cache.gc, width, nestedLabel); height += lineHeight; } } } widths.push(width); heights.push(height); offsets.push(lineHeight / 2); } garbageCollect(caches, length); widest = widths.indexOf(Math.max.apply(null, widths)); highest = heights.indexOf(Math.max.apply(null, heights)); function valueAt(idx) { return { width: widths[idx] || 0, height: heights[idx] || 0, offset: offsets[idx] || 0 }; } return { first: valueAt(0), last: valueAt(length - 1), widest: valueAt(widest), highest: valueAt(highest) }; }
[ "function", "computeLabelSizes", "(", "ctx", ",", "tickFonts", ",", "ticks", ",", "caches", ")", "{", "var", "length", "=", "ticks", ".", "length", ";", "var", "widths", "=", "[", "]", ";", "var", "heights", "=", "[", "]", ";", "var", "offsets", "=",...
Returns {width, height, offset} objects for the first, last, widest, highest tick labels where offset indicates the anchor point offset from the top in pixels.
[ "Returns", "{", "width", "height", "offset", "}", "objects", "for", "the", "first", "last", "widest", "highest", "tick", "labels", "where", "offset", "indicates", "the", "anchor", "point", "offset", "from", "the", "top", "in", "pixels", "." ]
f093c36574d290330ed623e60fbd070421c730d5
https://github.com/chartjs/Chart.js/blob/f093c36574d290330ed623e60fbd070421c730d5/src/core/core.scale.js#L103-L155
train
Compute the sizes of the labels
[ 30522, 3853, 24134, 20470, 9050, 10057, 1006, 14931, 2595, 1010, 16356, 14876, 7666, 1010, 16356, 2015, 1010, 17053, 2015, 1007, 1063, 13075, 3091, 1027, 16356, 2015, 1012, 3091, 1025, 13075, 9381, 2015, 1027, 1031, 1033, 1025, 13075, 7535, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
postcss/autoprefixer
lib/hacks/grid-utils.js
parseGridTemplatesData
function parseGridTemplatesData (css) { let parsed = [] // we walk through every grid-template(-areas) declaration and store // data with the same area names inside the item css.walkDecls(/grid-template(-areas)?$/, d => { let rule = d.parent let media = getParentMedia(rule) let gap = getGridGap(d) let inheritedGap = inheritGridGap(d, gap) let { areas } = parseTemplate({ decl: d, gap: inheritedGap || gap }) let areaNames = Object.keys(areas) // skip node if it doesn't have areas if (areaNames.length === 0) { return true } // check parsed array for item that include the same area names // return index of that item let index = parsed.reduce((acc, { allAreas }, idx) => { let hasAreas = allAreas && areaNames.some(area => allAreas.includes(area)) return hasAreas ? idx : acc }, null) if (index !== null) { // index is found, add the grid-template data to that item let { allAreas, rules } = parsed[index] // check if rule has no duplicate area names let hasNoDuplicates = rules.some(r => { return (r.hasDuplicates === false) && selectorsEqual(r, rule) }) let duplicatesFound = false // check need to gather all duplicate area names let duplicateAreaNames = rules.reduce((acc, r) => { if (!r.params && selectorsEqual(r, rule)) { duplicatesFound = true return r.duplicateAreaNames } if (!duplicatesFound) { areaNames.forEach(name => { if (r.areas[name]) { acc.push(name) } }) } return uniq(acc) }, []) // update grid-row/column-span values for areas with duplicate // area names. @see #1084 and #1146 rules.forEach(r => { areaNames.forEach(name => { let area = r.areas[name] if (area && area.row.span !== areas[name].row.span) { areas[name].row.updateSpan = true } if (area && area.column.span !== areas[name].column.span) { areas[name].column.updateSpan = true } }) }) parsed[index].allAreas = uniq([...allAreas, ...areaNames]) parsed[index].rules.push({ hasDuplicates: !hasNoDuplicates, params: media.params, selectors: rule.selectors, node: rule, duplicateAreaNames, areas }) } else { // index is NOT found, push the new item to the parsed array parsed.push({ allAreas: areaNames, areasCount: 0, rules: [{ hasDuplicates: false, duplicateRules: [], params: media.params, selectors: rule.selectors, node: rule, duplicateAreaNames: [], areas }] }) } return undefined }) return parsed }
javascript
function parseGridTemplatesData (css) { let parsed = [] // we walk through every grid-template(-areas) declaration and store // data with the same area names inside the item css.walkDecls(/grid-template(-areas)?$/, d => { let rule = d.parent let media = getParentMedia(rule) let gap = getGridGap(d) let inheritedGap = inheritGridGap(d, gap) let { areas } = parseTemplate({ decl: d, gap: inheritedGap || gap }) let areaNames = Object.keys(areas) // skip node if it doesn't have areas if (areaNames.length === 0) { return true } // check parsed array for item that include the same area names // return index of that item let index = parsed.reduce((acc, { allAreas }, idx) => { let hasAreas = allAreas && areaNames.some(area => allAreas.includes(area)) return hasAreas ? idx : acc }, null) if (index !== null) { // index is found, add the grid-template data to that item let { allAreas, rules } = parsed[index] // check if rule has no duplicate area names let hasNoDuplicates = rules.some(r => { return (r.hasDuplicates === false) && selectorsEqual(r, rule) }) let duplicatesFound = false // check need to gather all duplicate area names let duplicateAreaNames = rules.reduce((acc, r) => { if (!r.params && selectorsEqual(r, rule)) { duplicatesFound = true return r.duplicateAreaNames } if (!duplicatesFound) { areaNames.forEach(name => { if (r.areas[name]) { acc.push(name) } }) } return uniq(acc) }, []) // update grid-row/column-span values for areas with duplicate // area names. @see #1084 and #1146 rules.forEach(r => { areaNames.forEach(name => { let area = r.areas[name] if (area && area.row.span !== areas[name].row.span) { areas[name].row.updateSpan = true } if (area && area.column.span !== areas[name].column.span) { areas[name].column.updateSpan = true } }) }) parsed[index].allAreas = uniq([...allAreas, ...areaNames]) parsed[index].rules.push({ hasDuplicates: !hasNoDuplicates, params: media.params, selectors: rule.selectors, node: rule, duplicateAreaNames, areas }) } else { // index is NOT found, push the new item to the parsed array parsed.push({ allAreas: areaNames, areasCount: 0, rules: [{ hasDuplicates: false, duplicateRules: [], params: media.params, selectors: rule.selectors, node: rule, duplicateAreaNames: [], areas }] }) } return undefined }) return parsed }
[ "function", "parseGridTemplatesData", "(", "css", ")", "{", "let", "parsed", "=", "[", "]", "// we walk through every grid-template(-areas) declaration and store", "// data with the same area names inside the item", "css", ".", "walkDecls", "(", "/", "grid-template(-areas)?$", ...
Parse data from all grid-template(-areas) declarations @param {Root} css css root @return {Object} parsed data
[ "Parse", "data", "from", "all", "grid", "-", "template", "(", "-", "areas", ")", "declarations" ]
24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32
https://github.com/postcss/autoprefixer/blob/24b28b6dbdc34a5e5800986e76f48cbaf9bbbc32/lib/hacks/grid-utils.js#L351-L448
train
Parse grid - templates data
[ 30522, 3853, 11968, 3366, 16523, 3593, 18532, 15725, 16150, 6790, 1006, 20116, 2015, 1007, 1063, 2292, 11968, 6924, 1027, 1031, 1033, 1013, 1013, 2057, 3328, 2083, 2296, 8370, 1011, 23561, 1006, 1011, 2752, 1007, 8170, 1998, 3573, 1013, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/components/animation.js
function () { var propType; // Route config type. propType = getPropertyType(this.el, this.data.property); if (isRawProperty(this.data) && this.data.type === TYPE_COLOR) { this.updateConfigForRawColor(); } else if (propType === 'vec2' || propType === 'vec3' || propType === 'vec4') { this.updateConfigForVector(); } else { this.updateConfigForDefault(); } }
javascript
function () { var propType; // Route config type. propType = getPropertyType(this.el, this.data.property); if (isRawProperty(this.data) && this.data.type === TYPE_COLOR) { this.updateConfigForRawColor(); } else if (propType === 'vec2' || propType === 'vec3' || propType === 'vec4') { this.updateConfigForVector(); } else { this.updateConfigForDefault(); } }
[ "function", "(", ")", "{", "var", "propType", ";", "// Route config type.", "propType", "=", "getPropertyType", "(", "this", ".", "el", ",", "this", ".", "data", ".", "property", ")", ";", "if", "(", "isRawProperty", "(", "this", ".", "data", ")", "&&", ...
Update the config before each run.
[ "Update", "the", "config", "before", "each", "run", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/animation.js#L422-L434
train
Update the route config
[ 30522, 3853, 1006, 1007, 1063, 13075, 17678, 13874, 1025, 1013, 1013, 2799, 9530, 8873, 2290, 2828, 1012, 17678, 13874, 1027, 2131, 21572, 4842, 3723, 13874, 1006, 2023, 1012, 3449, 1010, 2023, 1012, 2951, 1012, 3200, 1007, 1025, 2065, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/menus/droplist.js
DropList
function DropList(menu, opt) { // droplist 所依附的菜单 const editor = menu.editor this.menu = menu this.opt = opt // 容器 const $container = $('<div class="w-e-droplist"></div>') // 标题 const $title = opt.$title let titleHtml if ($title) { // 替换多语言 titleHtml = $title.html() titleHtml = replaceLang(editor, titleHtml) $title.html(titleHtml) $title.addClass('w-e-dp-title') $container.append($title) } const list = opt.list || [] const type = opt.type || 'list' // 'list' 列表形式(如“标题”菜单) / 'inline-block' 块状形式(如“颜色”菜单) const onClick = opt.onClick || _emptyFn // 加入 DOM 并绑定事件 const $list = $('<ul class="' + (type === 'list' ? 'w-e-list' : 'w-e-block') + '"></ul>') $container.append($list) list.forEach(item => { const $elem = item.$elem // 替换多语言 let elemHtml = $elem.html() elemHtml = replaceLang(editor, elemHtml) $elem.html(elemHtml) const value = item.value const $li = $('<li class="w-e-item"></li>') if ($elem) { $li.append($elem) $list.append($li) $li.on('click', e => { onClick(value) // 隐藏 this.hideTimeoutId = setTimeout(() => { this.hide() }, 0) }) } }) // 绑定隐藏事件 $container.on('mouseleave', e => { this.hideTimeoutId = setTimeout(() => { this.hide() }, 0) }) // 记录属性 this.$container = $container // 基本属性 this._rendered = false this._show = false }
javascript
function DropList(menu, opt) { // droplist 所依附的菜单 const editor = menu.editor this.menu = menu this.opt = opt // 容器 const $container = $('<div class="w-e-droplist"></div>') // 标题 const $title = opt.$title let titleHtml if ($title) { // 替换多语言 titleHtml = $title.html() titleHtml = replaceLang(editor, titleHtml) $title.html(titleHtml) $title.addClass('w-e-dp-title') $container.append($title) } const list = opt.list || [] const type = opt.type || 'list' // 'list' 列表形式(如“标题”菜单) / 'inline-block' 块状形式(如“颜色”菜单) const onClick = opt.onClick || _emptyFn // 加入 DOM 并绑定事件 const $list = $('<ul class="' + (type === 'list' ? 'w-e-list' : 'w-e-block') + '"></ul>') $container.append($list) list.forEach(item => { const $elem = item.$elem // 替换多语言 let elemHtml = $elem.html() elemHtml = replaceLang(editor, elemHtml) $elem.html(elemHtml) const value = item.value const $li = $('<li class="w-e-item"></li>') if ($elem) { $li.append($elem) $list.append($li) $li.on('click', e => { onClick(value) // 隐藏 this.hideTimeoutId = setTimeout(() => { this.hide() }, 0) }) } }) // 绑定隐藏事件 $container.on('mouseleave', e => { this.hideTimeoutId = setTimeout(() => { this.hide() }, 0) }) // 记录属性 this.$container = $container // 基本属性 this._rendered = false this._show = false }
[ "function", "DropList", "(", "menu", ",", "opt", ")", "{", "// droplist 所依附的菜单", "const", "editor", "=", "menu", ".", "editor", "this", ".", "menu", "=", "menu", "this", ".", "opt", "=", "opt", "// 容器", "const", "$container", "=", "$", "(", "'<div class=...
构造函数
[ "构造函数" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/droplist.js#L10-L75
train
DropList 所依附的菜单
[ 30522, 3853, 4530, 9863, 1006, 12183, 1010, 23569, 1007, 1063, 1013, 1013, 4530, 9863, 100, 100, 100, 1916, 100, 100, 9530, 3367, 3559, 1027, 12183, 1012, 3559, 2023, 1012, 12183, 1027, 12183, 2023, 1012, 23569, 1027, 23569, 1013, 1013, 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...
aframevr/aframe
src/core/component.js
wrapPause
function wrapPause (pauseMethod) { return function pause () { var sceneEl = this.el.sceneEl; if (!this.isPlaying) { return; } pauseMethod.call(this); this.isPlaying = false; this.eventsDetach(); // Remove tick behavior. if (!hasBehavior(this)) { return; } sceneEl.removeBehavior(this); }; }
javascript
function wrapPause (pauseMethod) { return function pause () { var sceneEl = this.el.sceneEl; if (!this.isPlaying) { return; } pauseMethod.call(this); this.isPlaying = false; this.eventsDetach(); // Remove tick behavior. if (!hasBehavior(this)) { return; } sceneEl.removeBehavior(this); }; }
[ "function", "wrapPause", "(", "pauseMethod", ")", "{", "return", "function", "pause", "(", ")", "{", "var", "sceneEl", "=", "this", ".", "el", ".", "sceneEl", ";", "if", "(", "!", "this", ".", "isPlaying", ")", "{", "return", ";", "}", "pauseMethod", ...
Wrapper for defined pause method. Pause component by removing tick behavior and calling user's pause method. @param pauseMethod {function}
[ "Wrapper", "for", "defined", "pause", "method", ".", "Pause", "component", "by", "removing", "tick", "behavior", "and", "calling", "user", "s", "pause", "method", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L761-L772
train
Wrap pause method to prevent pause from being played
[ 30522, 3853, 10236, 4502, 8557, 1006, 8724, 11368, 6806, 2094, 1007, 1063, 2709, 3853, 8724, 1006, 1007, 1063, 13075, 3496, 2884, 1027, 2023, 1012, 3449, 1012, 3496, 2884, 1025, 2065, 1006, 999, 2023, 1012, 2003, 13068, 2075, 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...
mochajs/mocha
lib/reporters/json-stream.js
JSONStream
function JSONStream(runner, options) { Base.call(this, runner, options); var self = this; var total = runner.total; runner.once(EVENT_RUN_BEGIN, function() { writeEvent(['start', {total: total}]); }); runner.on(EVENT_TEST_PASS, function(test) { writeEvent(['pass', clean(test)]); }); runner.on(EVENT_TEST_FAIL, function(test, err) { test = clean(test); test.err = err.message; test.stack = err.stack || null; writeEvent(['fail', test]); }); runner.once(EVENT_RUN_END, function() { writeEvent(['end', self.stats]); }); }
javascript
function JSONStream(runner, options) { Base.call(this, runner, options); var self = this; var total = runner.total; runner.once(EVENT_RUN_BEGIN, function() { writeEvent(['start', {total: total}]); }); runner.on(EVENT_TEST_PASS, function(test) { writeEvent(['pass', clean(test)]); }); runner.on(EVENT_TEST_FAIL, function(test, err) { test = clean(test); test.err = err.message; test.stack = err.stack || null; writeEvent(['fail', test]); }); runner.once(EVENT_RUN_END, function() { writeEvent(['end', self.stats]); }); }
[ "function", "JSONStream", "(", "runner", ",", "options", ")", "{", "Base", ".", "call", "(", "this", ",", "runner", ",", "options", ")", ";", "var", "self", "=", "this", ";", "var", "total", "=", "runner", ".", "total", ";", "runner", ".", "once", ...
Constructs a new `JSONStream` reporter instance. @public @class @memberof Mocha.reporters @extends Mocha.reporters.Base @param {Runner} runner - Instance triggers reporter actions. @param {Object} [options] - runner options
[ "Constructs", "a", "new", "JSONStream", "reporter", "instance", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/reporters/json-stream.js#L32-L56
train
A JSON stream that can be used to write the results of a test.
[ 30522, 3853, 1046, 23345, 25379, 1006, 5479, 1010, 7047, 1007, 1063, 2918, 1012, 2655, 1006, 2023, 1010, 5479, 1010, 7047, 1007, 1025, 13075, 2969, 1027, 2023, 1025, 13075, 2561, 1027, 5479, 1012, 2561, 1025, 5479, 1012, 2320, 1006, 2724, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/components/connector.js
function(self, socket) { var app = self.app, sid = socket.id; var session = self.session.get(sid); if (session) { return session; } session = self.session.create(sid, app.getServerId(), socket); logger.debug('[%s] getSession session is created with session id: %s', app.getServerId(), sid); // bind events for session socket.on('disconnect', session.closed.bind(session)); socket.on('error', session.closed.bind(session)); session.on('closed', onSessionClose.bind(null, app)); session.on('bind', function(uid) { logger.debug('session on [%s] bind with uid: %s', self.app.serverId, uid); // update connection statistics if necessary if (self.connection) { self.connection.addLoginedUser(uid, { loginTime: Date.now(), uid: uid, address: socket.remoteAddress.ip + ':' + socket.remoteAddress.port }); } self.app.event.emit(events.BIND_SESSION, session); }); session.on('unbind', function(uid) { if (self.connection) { self.connection.removeLoginedUser(uid); } self.app.event.emit(events.UNBIND_SESSION, session); }); return session; }
javascript
function(self, socket) { var app = self.app, sid = socket.id; var session = self.session.get(sid); if (session) { return session; } session = self.session.create(sid, app.getServerId(), socket); logger.debug('[%s] getSession session is created with session id: %s', app.getServerId(), sid); // bind events for session socket.on('disconnect', session.closed.bind(session)); socket.on('error', session.closed.bind(session)); session.on('closed', onSessionClose.bind(null, app)); session.on('bind', function(uid) { logger.debug('session on [%s] bind with uid: %s', self.app.serverId, uid); // update connection statistics if necessary if (self.connection) { self.connection.addLoginedUser(uid, { loginTime: Date.now(), uid: uid, address: socket.remoteAddress.ip + ':' + socket.remoteAddress.port }); } self.app.event.emit(events.BIND_SESSION, session); }); session.on('unbind', function(uid) { if (self.connection) { self.connection.removeLoginedUser(uid); } self.app.event.emit(events.UNBIND_SESSION, session); }); return session; }
[ "function", "(", "self", ",", "socket", ")", "{", "var", "app", "=", "self", ".", "app", ",", "sid", "=", "socket", ".", "id", ";", "var", "session", "=", "self", ".", "session", ".", "get", "(", "sid", ")", ";", "if", "(", "session", ")", "{",...
get session for current connection
[ "get", "session", "for", "current", "connection" ]
defcf019631ed399cc4dad932d3b028a04a039a4
https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/connector.js#L331-L367
train
get session from pool
[ 30522, 3853, 1006, 2969, 1010, 22278, 1007, 1063, 13075, 10439, 1027, 2969, 1012, 10439, 1010, 15765, 1027, 22278, 1012, 8909, 1025, 13075, 5219, 1027, 2969, 1012, 5219, 1012, 2131, 1006, 15765, 1007, 1025, 2065, 1006, 5219, 1007, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HealthLogger.js
fileClosed
function fileClosed(file) { if (!file) { return; } var language = LanguageManager.getLanguageForPath(file._path), size = -1; function _sendData(fileSize) { var subType = ""; if(fileSize/1024 <= 1) { if(fileSize < 0) { subType = ""; } if(fileSize <= 10) { subType = "Size_0_10KB"; } else if (fileSize <= 50) { subType = "Size_10_50KB"; } else if (fileSize <= 100) { subType = "Size_50_100KB"; } else if (fileSize <= 500) { subType = "Size_100_500KB"; } else { subType = "Size_500KB_1MB"; } } else { fileSize = fileSize/1024; if(fileSize <= 2) { subType = "Size_1_2MB"; } else if(fileSize <= 5) { subType = "Size_2_5MB"; } else { subType = "Size_Above_5MB"; } } sendAnalyticsData(commonStrings.USAGE + commonStrings.FILE_CLOSE + language._name + subType, commonStrings.USAGE, commonStrings.FILE_CLOSE, language._name.toLowerCase(), subType ); } file.stat(function(err, fileStat) { if(!err) { size = fileStat.size.valueOf()/1024; } _sendData(size); }); }
javascript
function fileClosed(file) { if (!file) { return; } var language = LanguageManager.getLanguageForPath(file._path), size = -1; function _sendData(fileSize) { var subType = ""; if(fileSize/1024 <= 1) { if(fileSize < 0) { subType = ""; } if(fileSize <= 10) { subType = "Size_0_10KB"; } else if (fileSize <= 50) { subType = "Size_10_50KB"; } else if (fileSize <= 100) { subType = "Size_50_100KB"; } else if (fileSize <= 500) { subType = "Size_100_500KB"; } else { subType = "Size_500KB_1MB"; } } else { fileSize = fileSize/1024; if(fileSize <= 2) { subType = "Size_1_2MB"; } else if(fileSize <= 5) { subType = "Size_2_5MB"; } else { subType = "Size_Above_5MB"; } } sendAnalyticsData(commonStrings.USAGE + commonStrings.FILE_CLOSE + language._name + subType, commonStrings.USAGE, commonStrings.FILE_CLOSE, language._name.toLowerCase(), subType ); } file.stat(function(err, fileStat) { if(!err) { size = fileStat.size.valueOf()/1024; } _sendData(size); }); }
[ "function", "fileClosed", "(", "file", ")", "{", "if", "(", "!", "file", ")", "{", "return", ";", "}", "var", "language", "=", "LanguageManager", ".", "getLanguageForPath", "(", "file", ".", "_path", ")", ",", "size", "=", "-", "1", ";", "function", ...
Whenever a file is closed call this function. The function will send the analytics Data. We only log the standard filetypes and fileSize @param {String} filePath The path of the file to be registered
[ "Whenever", "a", "file", "is", "closed", "call", "this", "function", ".", "The", "function", "will", "send", "the", "analytics", "Data", ".", "We", "only", "log", "the", "standard", "filetypes", "and", "fileSize" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/HealthLogger.js#L216-L268
train
fileClosed - send analytics data
[ 30522, 3853, 5371, 20464, 24768, 1006, 5371, 1007, 1063, 2065, 1006, 999, 5371, 1007, 1063, 2709, 1025, 1065, 13075, 2653, 1027, 2653, 24805, 4590, 1012, 2131, 25023, 6692, 3351, 29278, 15069, 1006, 5371, 1012, 1035, 4130, 1007, 1010, 2946,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
shipshapecode/shepherd
src/js/utils/modal.js
_createMaskRect
function _createMaskRect() { const element = document.createElementNS(svgNS, 'rect'); _setAttributes(element, { fill: '#FFFFFF', height: '100%', id: elementIds.modalOverlayMaskRect, width: '100%', x: '0', y: '0' }); return element; }
javascript
function _createMaskRect() { const element = document.createElementNS(svgNS, 'rect'); _setAttributes(element, { fill: '#FFFFFF', height: '100%', id: elementIds.modalOverlayMaskRect, width: '100%', x: '0', y: '0' }); return element; }
[ "function", "_createMaskRect", "(", ")", "{", "const", "element", "=", "document", ".", "createElementNS", "(", "svgNS", ",", "'rect'", ")", ";", "_setAttributes", "(", "element", ",", "{", "fill", ":", "'#FFFFFF'", ",", "height", ":", "'100%'", ",", "id",...
<rect id="modalOverlayMaskRect" x="0" y="0" width="100%" height="100%" fill="#FFFFFF"/>
[ "<rect", "id", "=", "modalOverlayMaskRect", "x", "=", "0", "y", "=", "0", "width", "=", "100%", "height", "=", "100%", "fill", "=", "#FFFFFF", "/", ">" ]
0cb1c63fb07b58796358f6d33da5f6405e2b05f4
https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L46-L59
train
Creates mask rect
[ 30522, 3853, 1035, 3443, 9335, 21638, 22471, 1006, 1007, 1063, 9530, 3367, 5783, 1027, 6254, 1012, 3443, 12260, 3672, 3619, 1006, 17917, 16206, 2015, 1010, 1005, 28667, 2102, 1005, 1007, 1025, 1035, 2275, 19321, 3089, 8569, 4570, 1006, 5783...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/config/config-validator.js
validateEnvironment
function validateEnvironment(environment, envContext, source = null) { // not having an environment is ok if (!environment) { return; } Object.keys(environment).forEach(env => { if (!envContext.get(env)) { const message = `${source}:\n\tEnvironment key "${env}" is unknown\n`; throw new Error(message); } }); }
javascript
function validateEnvironment(environment, envContext, source = null) { // not having an environment is ok if (!environment) { return; } Object.keys(environment).forEach(env => { if (!envContext.get(env)) { const message = `${source}:\n\tEnvironment key "${env}" is unknown\n`; throw new Error(message); } }); }
[ "function", "validateEnvironment", "(", "environment", ",", "envContext", ",", "source", "=", "null", ")", "{", "// not having an environment is ok", "if", "(", "!", "environment", ")", "{", "return", ";", "}", "Object", ".", "keys", "(", "environment", ")", "...
Validates an environment object @param {Object} environment The environment config object to validate. @param {Environments} envContext Env context @param {string} source The name of the configuration source to report in any errors. @returns {void}
[ "Validates", "an", "environment", "object" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-validator.js#L148-L162
train
Validate an environment
[ 30522, 3853, 9398, 3686, 2368, 21663, 2239, 3672, 1006, 4044, 1010, 4372, 25465, 28040, 18413, 1010, 3120, 1027, 19701, 1007, 1063, 1013, 1013, 2025, 2383, 2019, 4044, 2003, 7929, 2065, 1006, 999, 4044, 1007, 1063, 2709, 1025, 1065, 4874, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/LiveDevelopment/LiveDevMultiBrowser.js
_onDirtyFlagChange
function _onDirtyFlagChange(event, doc) { if (!isActive() || !_server) { return; } var absolutePath = doc.file.fullPath; if (_liveDocument.isRelated(absolutePath)) { // Set status to out of sync if dirty. Otherwise, set it to active status. _setStatus(_docIsOutOfSync(doc) ? STATUS_OUT_OF_SYNC : STATUS_ACTIVE); } }
javascript
function _onDirtyFlagChange(event, doc) { if (!isActive() || !_server) { return; } var absolutePath = doc.file.fullPath; if (_liveDocument.isRelated(absolutePath)) { // Set status to out of sync if dirty. Otherwise, set it to active status. _setStatus(_docIsOutOfSync(doc) ? STATUS_OUT_OF_SYNC : STATUS_ACTIVE); } }
[ "function", "_onDirtyFlagChange", "(", "event", ",", "doc", ")", "{", "if", "(", "!", "isActive", "(", ")", "||", "!", "_server", ")", "{", "return", ";", "}", "var", "absolutePath", "=", "doc", ".", "file", ".", "fullPath", ";", "if", "(", "_liveDoc...
For files that don't support as-you-type live editing, but are loaded by live HTML documents (e.g. JS files), we want to show a dirty indicator on the live development icon when they have unsaved changes, so the user knows s/he needs to save in order to have the page reload. @param {$.Event} event @param {Document} doc
[ "For", "files", "that", "don", "t", "support", "as", "-", "you", "-", "type", "live", "editing", "but", "are", "loaded", "by", "live", "HTML", "documents", "(", "e", ".", "g", ".", "JS", "files", ")", "we", "want", "to", "show", "a", "dirty", "indi...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/LiveDevMultiBrowser.js#L756-L767
train
Called when a document is dirty
[ 30522, 3853, 1035, 2006, 30524, 9986, 1012, 5371, 1012, 2440, 15069, 1025, 2065, 1006, 1035, 2973, 10085, 27417, 2102, 1012, 2003, 16570, 4383, 1006, 7619, 15069, 1007, 1007, 1063, 1013, 1013, 2275, 3570, 2000, 2041, 1997, 26351, 2065, 6530...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/languageTools/LanguageClientWrapper.js
validateRequestParams
function validateRequestParams(type, params) { var validatedParams = null; params = params || {}; //Don't validate if the formatting is done by the caller if (params.format === MESSAGE_FORMAT.LSP) { return params; } switch (type) { case ToolingInfo.LANGUAGE_SERVICE.START: { if (hasValidProp(params, "rootPaths") || hasValidProp(params, "rootPath")) { validatedParams = params; validatedParams.capabilities = validatedParams.capabilities || false; } break; } case ToolingInfo.FEATURES.CODE_HINTS: case ToolingInfo.FEATURES.PARAMETER_HINTS: case ToolingInfo.FEATURES.JUMP_TO_DECLARATION: case ToolingInfo.FEATURES.JUMP_TO_DEFINITION: case ToolingInfo.FEATURES.JUMP_TO_IMPL: { if (hasValidProps(params, ["filePath", "cursorPos"])) { validatedParams = params; } break; } case ToolingInfo.FEATURES.CODE_HINT_INFO: { validatedParams = params; break; } case ToolingInfo.FEATURES.FIND_REFERENCES: { if (hasValidProps(params, ["filePath", "cursorPos"])) { validatedParams = params; validatedParams.includeDeclaration = validatedParams.includeDeclaration || false; } break; } case ToolingInfo.FEATURES.DOCUMENT_SYMBOLS: { if (hasValidProp(params, "filePath")) { validatedParams = params; } break; } case ToolingInfo.FEATURES.PROJECT_SYMBOLS: { if (hasValidProp(params, "query") && typeof params.query === "string") { validatedParams = params; } break; } case ToolingInfo.LANGUAGE_SERVICE.CUSTOM_REQUEST: { validatedParams = params; } } return validatedParams; }
javascript
function validateRequestParams(type, params) { var validatedParams = null; params = params || {}; //Don't validate if the formatting is done by the caller if (params.format === MESSAGE_FORMAT.LSP) { return params; } switch (type) { case ToolingInfo.LANGUAGE_SERVICE.START: { if (hasValidProp(params, "rootPaths") || hasValidProp(params, "rootPath")) { validatedParams = params; validatedParams.capabilities = validatedParams.capabilities || false; } break; } case ToolingInfo.FEATURES.CODE_HINTS: case ToolingInfo.FEATURES.PARAMETER_HINTS: case ToolingInfo.FEATURES.JUMP_TO_DECLARATION: case ToolingInfo.FEATURES.JUMP_TO_DEFINITION: case ToolingInfo.FEATURES.JUMP_TO_IMPL: { if (hasValidProps(params, ["filePath", "cursorPos"])) { validatedParams = params; } break; } case ToolingInfo.FEATURES.CODE_HINT_INFO: { validatedParams = params; break; } case ToolingInfo.FEATURES.FIND_REFERENCES: { if (hasValidProps(params, ["filePath", "cursorPos"])) { validatedParams = params; validatedParams.includeDeclaration = validatedParams.includeDeclaration || false; } break; } case ToolingInfo.FEATURES.DOCUMENT_SYMBOLS: { if (hasValidProp(params, "filePath")) { validatedParams = params; } break; } case ToolingInfo.FEATURES.PROJECT_SYMBOLS: { if (hasValidProp(params, "query") && typeof params.query === "string") { validatedParams = params; } break; } case ToolingInfo.LANGUAGE_SERVICE.CUSTOM_REQUEST: { validatedParams = params; } } return validatedParams; }
[ "function", "validateRequestParams", "(", "type", ",", "params", ")", "{", "var", "validatedParams", "=", "null", ";", "params", "=", "params", "||", "{", "}", ";", "//Don't validate if the formatting is done by the caller", "if", "(", "params", ".", "format", "==...
/* RequestParams creator - sendNotifications/request
[ "/", "*", "RequestParams", "creator", "-", "sendNotifications", "/", "request" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/languageTools/LanguageClientWrapper.js#L61-L125
train
Validates the parameters for a request
[ 30522, 3853, 9398, 24932, 2063, 15500, 28689, 5244, 1006, 2828, 1010, 11498, 5244, 1007, 1063, 13075, 9398, 4383, 28689, 5244, 1027, 19701, 1025, 11498, 5244, 1027, 11498, 5244, 1064, 1064, 1063, 1065, 1025, 1013, 1013, 2123, 1005, 1056, 93...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/ScrollTrackMarkers.js
_renderMarks
function _renderMarks(posArray) { var html = "", cm = editor._codeMirror, editorHt = cm.getScrollerElement().scrollHeight; // We've pretty much taken these vars and the getY function from CodeMirror's annotatescrollbar addon // https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/annotatescrollbar.js var wrapping = cm.getOption("lineWrapping"), singleLineH = wrapping && cm.defaultTextHeight() * 1.5, curLine = null, curLineObj = null; function getY(cm, pos) { if (curLine !== pos.line) { curLine = pos.line; curLineObj = cm.getLineHandle(curLine); } if (wrapping && curLineObj.height > singleLineH) { return cm.charCoords(pos, "local").top; } return cm.heightAtLine(curLineObj, "local"); } posArray.forEach(function (pos) { var cursorTop = getY(cm, pos), top = Math.round(cursorTop / editorHt * trackHt) + trackOffset; top--; // subtract ~1/2 the ht of a tickmark to center it on ideal pos html += "<div class='tickmark' style='top:" + top + "px'></div>"; }); $(".tickmark-track", editor.getRootElement()).append($(html)); }
javascript
function _renderMarks(posArray) { var html = "", cm = editor._codeMirror, editorHt = cm.getScrollerElement().scrollHeight; // We've pretty much taken these vars and the getY function from CodeMirror's annotatescrollbar addon // https://github.com/codemirror/CodeMirror/blob/master/addon/scroll/annotatescrollbar.js var wrapping = cm.getOption("lineWrapping"), singleLineH = wrapping && cm.defaultTextHeight() * 1.5, curLine = null, curLineObj = null; function getY(cm, pos) { if (curLine !== pos.line) { curLine = pos.line; curLineObj = cm.getLineHandle(curLine); } if (wrapping && curLineObj.height > singleLineH) { return cm.charCoords(pos, "local").top; } return cm.heightAtLine(curLineObj, "local"); } posArray.forEach(function (pos) { var cursorTop = getY(cm, pos), top = Math.round(cursorTop / editorHt * trackHt) + trackOffset; top--; // subtract ~1/2 the ht of a tickmark to center it on ideal pos html += "<div class='tickmark' style='top:" + top + "px'></div>"; }); $(".tickmark-track", editor.getRootElement()).append($(html)); }
[ "function", "_renderMarks", "(", "posArray", ")", "{", "var", "html", "=", "\"\"", ",", "cm", "=", "editor", ".", "_codeMirror", ",", "editorHt", "=", "cm", ".", "getScrollerElement", "(", ")", ".", "scrollHeight", ";", "// We've pretty much taken these vars and...
Add all the given tickmarks to the DOM in a batch
[ "Add", "all", "the", "given", "tickmarks", "to", "the", "DOM", "in", "a", "batch" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/ScrollTrackMarkers.js#L126-L157
train
Render marks for a given position
[ 30522, 3853, 1035, 17552, 27373, 1006, 13433, 10286, 9447, 1007, 1063, 13075, 16129, 1027, 1000, 1000, 1010, 4642, 1027, 3559, 1012, 1035, 3642, 14503, 29165, 1010, 3559, 11039, 1027, 4642, 1012, 4152, 26775, 14511, 7869, 16930, 4765, 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...
angular/angular
.circleci/get-commit-range.js
_main
async function _main([buildNumber, compareUrl = '', circleToken = '']) { try { if (!buildNumber || isNaN(buildNumber)) { throw new Error( 'Missing or invalid arguments.\n' + 'Expected: buildNumber (number), compareUrl? (string), circleToken? (string)'); } if (!compareUrl) { compareUrl = await getCompareUrl(buildNumber, circleToken); } const commitRangeMatch = COMPARE_URL_RE.exec(compareUrl) const commitRange = commitRangeMatch ? commitRangeMatch[1] : ''; console.log(commitRange); } catch (err) { console.error(err); process.exit(1); } }
javascript
async function _main([buildNumber, compareUrl = '', circleToken = '']) { try { if (!buildNumber || isNaN(buildNumber)) { throw new Error( 'Missing or invalid arguments.\n' + 'Expected: buildNumber (number), compareUrl? (string), circleToken? (string)'); } if (!compareUrl) { compareUrl = await getCompareUrl(buildNumber, circleToken); } const commitRangeMatch = COMPARE_URL_RE.exec(compareUrl) const commitRange = commitRangeMatch ? commitRangeMatch[1] : ''; console.log(commitRange); } catch (err) { console.error(err); process.exit(1); } }
[ "async", "function", "_main", "(", "[", "buildNumber", ",", "compareUrl", "=", "''", ",", "circleToken", "=", "''", "]", ")", "{", "try", "{", "if", "(", "!", "buildNumber", "||", "isNaN", "(", "buildNumber", ")", ")", "{", "throw", "new", "Error", "...
Helpers
[ "Helpers" ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/.circleci/get-commit-range.js#L100-L120
train
Main function.
[ 30522, 2004, 6038, 2278, 3853, 1035, 2364, 1006, 1031, 3857, 19172, 5677, 1010, 12826, 3126, 2140, 1027, 1005, 1005, 1010, 4418, 18715, 2368, 1027, 1005, 1005, 1033, 1007, 1063, 3046, 1063, 2065, 1006, 999, 3857, 19172, 5677, 1064, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(logger) { if (typeof logger != "object" || typeof logger.info != "function" || typeof logger.debug != "function" || typeof logger.warning != "function" || typeof logger.error != "function" ) { throw new Error("Logger is not valid. It should implement at least the functions: info, debug, warning, error."); } _private.oLog = logger; }
javascript
function(logger) { if (typeof logger != "object" || typeof logger.info != "function" || typeof logger.debug != "function" || typeof logger.warning != "function" || typeof logger.error != "function" ) { throw new Error("Logger is not valid. It should implement at least the functions: info, debug, warning, error."); } _private.oLog = logger; }
[ "function", "(", "logger", ")", "{", "if", "(", "typeof", "logger", "!=", "\"object\"", "||", "typeof", "logger", ".", "info", "!=", "\"function\"", "||", "typeof", "logger", ".", "debug", "!=", "\"function\"", "||", "typeof", "logger", ".", "warning", "!=...
Sets a custom logger for the log messages of the RequestRecorder. The logger objects needs to implement the following functions: info, debug, warning, error @param {object} logger The log object with the required functions.
[ "Sets", "a", "custom", "logger", "for", "the", "log", "messages", "of", "the", "RequestRecorder", ".", "The", "logger", "objects", "needs", "to", "implement", "the", "following", "functions", ":", "info", "debug", "warning", "error" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L842-L852
train
Sets the logger
[ 30522, 3853, 1006, 8833, 4590, 1007, 1063, 2065, 1006, 2828, 11253, 8833, 4590, 999, 1027, 1000, 4874, 1000, 1064, 1064, 2828, 11253, 8833, 4590, 1012, 18558, 999, 1027, 1000, 3853, 1000, 1064, 1064, 2828, 11253, 8833, 4590, 1012, 2139, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js
liftChildNodes
function liftChildNodes(oParent, oWithControl, oTarget) { return visitChildNodes(oParent, oWithControl).then(function () { var oChild; oTarget = oTarget || oParent; while ((oChild = oParent.firstChild)) { oTarget.parentNode.insertBefore(oChild, oTarget); } }); }
javascript
function liftChildNodes(oParent, oWithControl, oTarget) { return visitChildNodes(oParent, oWithControl).then(function () { var oChild; oTarget = oTarget || oParent; while ((oChild = oParent.firstChild)) { oTarget.parentNode.insertBefore(oChild, oTarget); } }); }
[ "function", "liftChildNodes", "(", "oParent", ",", "oWithControl", ",", "oTarget", ")", "{", "return", "visitChildNodes", "(", "oParent", ",", "oWithControl", ")", ".", "then", "(", "function", "(", ")", "{", "var", "oChild", ";", "oTarget", "=", "oTarget", ...
Visits the child nodes of the given parent element. Lifts them up by inserting them before the target element. @param {Element} oParent the XML DOM DOM element @param {sap.ui.core.util._with} oWithControl the "with" control @param {Element} [oTarget=oParent] the target DOM element @returns {sap.ui.base.SyncPromise} A sync promise which resolves with <code>undefined</code> as soon as visiting and lifting is done, or is rejected with a corresponding error if visiting fails.
[ "Visits", "the", "child", "nodes", "of", "the", "given", "parent", "element", ".", "Lifts", "them", "up", "by", "inserting", "them", "before", "the", "target", "element", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1207-L1216
train
Lifts all child nodes of a parent node to the target node.
[ 30522, 3853, 6336, 19339, 3630, 6155, 1006, 6728, 12069, 3372, 1010, 27593, 8939, 8663, 13181, 2140, 1010, 27178, 2906, 18150, 1007, 1063, 2709, 3942, 19339, 3630, 6155, 1006, 6728, 12069, 3372, 1010, 27593, 8939, 8663, 13181, 2140, 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...
adobe/brackets
src/project/FileViewController.js
setFileViewFocus
function setFileViewFocus(fileSelectionFocus) { if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) { console.error("Bad parameter passed to FileViewController.setFileViewFocus"); return; } if (_fileSelectionFocus !== fileSelectionFocus) { _fileSelectionFocus = fileSelectionFocus; exports.trigger("fileViewFocusChange"); } }
javascript
function setFileViewFocus(fileSelectionFocus) { if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) { console.error("Bad parameter passed to FileViewController.setFileViewFocus"); return; } if (_fileSelectionFocus !== fileSelectionFocus) { _fileSelectionFocus = fileSelectionFocus; exports.trigger("fileViewFocusChange"); } }
[ "function", "setFileViewFocus", "(", "fileSelectionFocus", ")", "{", "if", "(", "fileSelectionFocus", "!==", "PROJECT_MANAGER", "&&", "fileSelectionFocus", "!==", "WORKING_SET_VIEW", ")", "{", "console", ".", "error", "(", "\"Bad parameter passed to FileViewController.setFi...
Modifies the selection focus in the project side bar. A file can either be selected in the working set (the open files) or in the file tree, but not both. @param {String} fileSelectionFocus - either PROJECT_MANAGER or WORKING_SET_VIEW
[ "Modifies", "the", "selection", "focus", "in", "the", "project", "side", "bar", ".", "A", "file", "can", "either", "be", "selected", "in", "the", "working", "set", "(", "the", "open", "files", ")", "or", "in", "the", "file", "tree", "but", "not", "both...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileViewController.js#L125-L135
train
Set file selection focus
[ 30522, 3853, 2275, 8873, 20414, 2666, 2860, 14876, 7874, 1006, 6764, 12260, 7542, 14876, 7874, 1007, 1063, 2065, 1006, 6764, 12260, 7542, 14876, 7874, 999, 1027, 1027, 2622, 1035, 3208, 1004, 1004, 6764, 12260, 7542, 14876, 7874, 999, 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...
eslint/eslint
lib/rules/no-return-await.js
reportUnnecessaryAwait
function reportUnnecessaryAwait(node) { context.report({ node: context.getSourceCode().getFirstToken(node), loc: node.loc, message }); }
javascript
function reportUnnecessaryAwait(node) { context.report({ node: context.getSourceCode().getFirstToken(node), loc: node.loc, message }); }
[ "function", "reportUnnecessaryAwait", "(", "node", ")", "{", "context", ".", "report", "(", "{", "node", ":", "context", ".", "getSourceCode", "(", ")", ".", "getFirstToken", "(", "node", ")", ",", "loc", ":", "node", ".", "loc", ",", "message", "}", "...
Reports a found unnecessary `await` expression. @param {ASTNode} node The node representing the `await` expression to report @returns {void}
[ "Reports", "a", "found", "unnecessary", "await", "expression", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-return-await.js#L41-L47
train
Reports an uncle wait if the node is unnecessary.
[ 30522, 3853, 3189, 4609, 2638, 9623, 10286, 3148, 21547, 2102, 1006, 13045, 1007, 1063, 6123, 1012, 3189, 1006, 1063, 13045, 1024, 6123, 1012, 4152, 8162, 3401, 16044, 1006, 1007, 1012, 2131, 8873, 12096, 18715, 2368, 1006, 13045, 1007, 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...
airyland/vux
src/components/video/zy.media.js
_addClass
function _addClass(el, token) { if (el.classList) { el.classList.add(token) } else if (!_hasClass(el, token)) { el.className += '' + token } }
javascript
function _addClass(el, token) { if (el.classList) { el.classList.add(token) } else if (!_hasClass(el, token)) { el.className += '' + token } }
[ "function", "_addClass", "(", "el", ",", "token", ")", "{", "if", "(", "el", ".", "classList", ")", "{", "el", ".", "classList", ".", "add", "(", "token", ")", "}", "else", "if", "(", "!", "_hasClass", "(", "el", ",", "token", ")", ")", "{", "e...
Add class
[ "Add", "class" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/video/zy.media.js#L120-L126
train
Adds a class to an element
[ 30522, 3853, 1035, 5587, 26266, 1006, 3449, 1010, 19204, 1007, 1063, 2065, 1006, 3449, 1012, 2465, 9863, 1007, 1063, 3449, 1012, 2465, 9863, 1012, 5587, 1006, 19204, 1007, 1065, 2842, 2065, 1006, 999, 1035, 2038, 26266, 1006, 3449, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js
function(iStartIndex) { // check in the sections which where loaded for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) { var oSection = that._mLoadedSections[sNodeId][i]; // try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) { return true; } } // check requested sections where we still wait for an answer }
javascript
function(iStartIndex) { // check in the sections which where loaded for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) { var oSection = that._mLoadedSections[sNodeId][i]; // try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) { return true; } } // check requested sections where we still wait for an answer }
[ "function", "(", "iStartIndex", ")", "{", "// check in the sections which where loaded", "for", "(", "var", "i", "=", "0", ";", "i", "<", "that", ".", "_mLoadedSections", "[", "sNodeId", "]", ".", "length", ";", "i", "++", ")", "{", "var", "oSection", "=",...
check whether a start index was already requested
[ "check", "whether", "a", "start", "index", "was", "already", "requested" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v2/ODataTreeBinding.js#L609-L620
train
check if the requested index is within the loaded sections
[ 30522, 3853, 1006, 21541, 8445, 22254, 10288, 1007, 1063, 1013, 1013, 4638, 1999, 1996, 5433, 2029, 2073, 8209, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2008, 1012, 1035, 19875, 10441, 5732, 29015, 2015, 1031, 1055, 3630, 3207...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/coord/single/Single.js
function (point) { var rect = this.getRect(); var axis = this.getAxis(); var orient = axis.orient; if (orient === 'horizontal') { return axis.contain(axis.toLocalCoord(point[0])) && (point[1] >= rect.y && point[1] <= (rect.y + rect.height)); } else { return axis.contain(axis.toLocalCoord(point[1])) && (point[0] >= rect.y && point[0] <= (rect.y + rect.height)); } }
javascript
function (point) { var rect = this.getRect(); var axis = this.getAxis(); var orient = axis.orient; if (orient === 'horizontal') { return axis.contain(axis.toLocalCoord(point[0])) && (point[1] >= rect.y && point[1] <= (rect.y + rect.height)); } else { return axis.contain(axis.toLocalCoord(point[1])) && (point[0] >= rect.y && point[0] <= (rect.y + rect.height)); } }
[ "function", "(", "point", ")", "{", "var", "rect", "=", "this", ".", "getRect", "(", ")", ";", "var", "axis", "=", "this", ".", "getAxis", "(", ")", ";", "var", "orient", "=", "axis", ".", "orient", ";", "if", "(", "orient", "===", "'horizontal'", ...
If contain point. @param {Array.<number>} point @return {boolean}
[ "If", "contain", "point", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/single/Single.js#L243-L255
train
Returns true if the given point is inside the image
[ 30522, 3853, 1006, 2391, 1007, 1063, 13075, 28667, 2102, 1027, 2023, 1012, 2131, 2890, 6593, 1006, 1007, 1025, 13075, 8123, 1027, 2023, 1012, 2131, 8528, 2483, 1006, 1007, 1025, 13075, 30524, 1012, 1061, 1004, 1004, 2391, 1031, 1015, 1033, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_dos_date
function parse_dos_date(buf) { var hms = buf.read_shift(2) & 0xFFFF; var ymd = buf.read_shift(2) & 0xFFFF; var val = new Date(); var d = ymd & 0x1F; ymd >>>= 5; var m = ymd & 0x0F; ymd >>>= 4; val.setMilliseconds(0); val.setFullYear(ymd + 1980); val.setMonth(m-1); val.setDate(d); var S = hms & 0x1F; hms >>>= 5; var M = hms & 0x3F; hms >>>= 6; val.setHours(hms); val.setMinutes(M); val.setSeconds(S<<1); return val; }
javascript
function parse_dos_date(buf) { var hms = buf.read_shift(2) & 0xFFFF; var ymd = buf.read_shift(2) & 0xFFFF; var val = new Date(); var d = ymd & 0x1F; ymd >>>= 5; var m = ymd & 0x0F; ymd >>>= 4; val.setMilliseconds(0); val.setFullYear(ymd + 1980); val.setMonth(m-1); val.setDate(d); var S = hms & 0x1F; hms >>>= 5; var M = hms & 0x3F; hms >>>= 6; val.setHours(hms); val.setMinutes(M); val.setSeconds(S<<1); return val; }
[ "function", "parse_dos_date", "(", "buf", ")", "{", "var", "hms", "=", "buf", ".", "read_shift", "(", "2", ")", "&", "0xFFFF", ";", "var", "ymd", "=", "buf", ".", "read_shift", "(", "2", ")", "&", "0xFFFF", ";", "var", "val", "=", "new", "Date", ...
/* read four bytes from buf and interpret as a DOS date
[ "/", "*", "read", "four", "bytes", "from", "buf", "and", "interpret", "as", "a", "DOS", "date" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L1291-L1307
train
Parse a DOS date
[ 30522, 3853, 11968, 3366, 1035, 9998, 1035, 3058, 1006, 20934, 2546, 1007, 1063, 13075, 7220, 1027, 20934, 2546, 1012, 3191, 1035, 5670, 1006, 1016, 1007, 1004, 1014, 2595, 4246, 4246, 1025, 13075, 1061, 26876, 1027, 20934, 2546, 1012, 3191...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/event.js
function() { this.jsonInit({ "id": "event_whenkeypressed", "message0": Blockly.Msg.EVENT_WHENKEYPRESSED, "args0": [ { "type": "field_dropdown", "name": "KEY_OPTION", "options": [ [Blockly.Msg.EVENT_WHENKEYPRESSED_SPACE, 'space'], [Blockly.Msg.EVENT_WHENKEYPRESSED_UP, 'up arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_DOWN, 'down arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_RIGHT, 'right arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_LEFT, 'left arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_ANY, 'any'], ['a', 'a'], ['b', 'b'], ['c', 'c'], ['d', 'd'], ['e', 'e'], ['f', 'f'], ['g', 'g'], ['h', 'h'], ['i', 'i'], ['j', 'j'], ['k', 'k'], ['l', 'l'], ['m', 'm'], ['n', 'n'], ['o', 'o'], ['p', 'p'], ['q', 'q'], ['r', 'r'], ['s', 's'], ['t', 't'], ['u', 'u'], ['v', 'v'], ['w', 'w'], ['x', 'x'], ['y', 'y'], ['z', 'z'], ['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'], ['9', '9'] ] } ], "category": Blockly.Categories.event, "extensions": ["colours_event", "shape_hat"] }); }
javascript
function() { this.jsonInit({ "id": "event_whenkeypressed", "message0": Blockly.Msg.EVENT_WHENKEYPRESSED, "args0": [ { "type": "field_dropdown", "name": "KEY_OPTION", "options": [ [Blockly.Msg.EVENT_WHENKEYPRESSED_SPACE, 'space'], [Blockly.Msg.EVENT_WHENKEYPRESSED_UP, 'up arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_DOWN, 'down arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_RIGHT, 'right arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_LEFT, 'left arrow'], [Blockly.Msg.EVENT_WHENKEYPRESSED_ANY, 'any'], ['a', 'a'], ['b', 'b'], ['c', 'c'], ['d', 'd'], ['e', 'e'], ['f', 'f'], ['g', 'g'], ['h', 'h'], ['i', 'i'], ['j', 'j'], ['k', 'k'], ['l', 'l'], ['m', 'm'], ['n', 'n'], ['o', 'o'], ['p', 'p'], ['q', 'q'], ['r', 'r'], ['s', 's'], ['t', 't'], ['u', 'u'], ['v', 'v'], ['w', 'w'], ['x', 'x'], ['y', 'y'], ['z', 'z'], ['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'], ['9', '9'] ] } ], "category": Blockly.Categories.event, "extensions": ["colours_event", "shape_hat"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"id\"", ":", "\"event_whenkeypressed\"", ",", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "EVENT_WHENKEYPRESSED", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", ...
Block to send a broadcast. @this Blockly.Block
[ "Block", "to", "send", "a", "broadcast", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/event.js#L270-L327
train
Block for keypressed event.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 8909, 1000, 1024, 1000, 2724, 1035, 2043, 14839, 19811, 1000, 1010, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 2724, 1035, 2043, 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...
angular/material
src/core/util/color.js
rgbaToHex
function rgbaToHex(color) { color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); var hex = (color && color.length === 4) ? "#" + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; return hex.toUpperCase(); }
javascript
function rgbaToHex(color) { color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); var hex = (color && color.length === 4) ? "#" + ("0" + parseInt(color[1],10).toString(16)).slice(-2) + ("0" + parseInt(color[2],10).toString(16)).slice(-2) + ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; return hex.toUpperCase(); }
[ "function", "rgbaToHex", "(", "color", ")", "{", "color", "=", "color", ".", "match", "(", "/", "^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?", "/", "i", ")", ";", "var", "hex", "=", "(", "color", "&&", "color", ".", "length", "...
Converts rgba value to hex string @param {string} color @returns {string}
[ "Converts", "rgba", "value", "to", "hex", "string" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/color.js#L36-L45
train
Converts a rgba color to a hex string
[ 30522, 3853, 1054, 18259, 10610, 5369, 2595, 1006, 3609, 1007, 1063, 3609, 1027, 3609, 1012, 2674, 1006, 1013, 1034, 1054, 18259, 2050, 1029, 1031, 1032, 1055, 1009, 1033, 1029, 1032, 1006, 1031, 1032, 1055, 1009, 1033, 1029, 1006, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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_Label
function parse_Label(blob, length, opts) { var target = blob.l + length; var cell = parse_XLSCell(blob, 6); if(opts.biff == 2) blob.l++; var str = parse_XLUnicodeString(blob, target - blob.l, opts); cell.val = str; return cell; }
javascript
function parse_Label(blob, length, opts) { var target = blob.l + length; var cell = parse_XLSCell(blob, 6); if(opts.biff == 2) blob.l++; var str = parse_XLUnicodeString(blob, target - blob.l, opts); cell.val = str; return cell; }
[ "function", "parse_Label", "(", "blob", ",", "length", ",", "opts", ")", "{", "var", "target", "=", "blob", ".", "l", "+", "length", ";", "var", "cell", "=", "parse_XLSCell", "(", "blob", ",", "6", ")", ";", "if", "(", "opts", ".", "biff", "==", ...
/* [MS-XLS] 2.4.148
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "4", ".", "148" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5974-L5981
train
Parse a label
[ 30522, 3853, 11968, 3366, 1035, 3830, 1006, 1038, 4135, 2497, 1010, 3091, 1010, 23569, 2015, 1007, 1063, 13075, 4539, 1027, 1038, 4135, 2497, 1012, 1048, 1009, 3091, 1025, 13075, 3526, 1027, 11968, 3366, 1035, 28712, 11020, 5349, 1006, 1038...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/arrow-spacing.js
countSpaces
function countSpaces(tokens) { const before = tokens.arrow.range[0] - tokens.before.range[1]; const after = tokens.after.range[0] - tokens.arrow.range[1]; return { before, after }; }
javascript
function countSpaces(tokens) { const before = tokens.arrow.range[0] - tokens.before.range[1]; const after = tokens.after.range[0] - tokens.arrow.range[1]; return { before, after }; }
[ "function", "countSpaces", "(", "tokens", ")", "{", "const", "before", "=", "tokens", ".", "arrow", ".", "range", "[", "0", "]", "-", "tokens", ".", "before", ".", "range", "[", "1", "]", ";", "const", "after", "=", "tokens", ".", "after", ".", "ra...
Count spaces before/after arrow(`=>`) token. @param {Object} tokens Tokens before/after arrow. @returns {Object} count of space before/after arrow.
[ "Count", "spaces", "before", "/", "after", "arrow", "(", "=", ">", ")", "token", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/arrow-spacing.js#L86-L91
train
Count spaces in a token
[ 30522, 3853, 9294, 15327, 2015, 1006, 19204, 2015, 1007, 1063, 9530, 3367, 2077, 1027, 19204, 2015, 1012, 8612, 1012, 2846, 1031, 1014, 1033, 1011, 19204, 2015, 1012, 2077, 1012, 2846, 1031, 1015, 1033, 1025, 9530, 3367, 2044, 1027, 19204, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HighlightAgent.js
domElement
function domElement(ids) { var selector = ""; if (!Array.isArray(ids)) { ids = [ids]; } _.each(ids, function (id) { if (selector !== "") { selector += ","; } selector += "[data-brackets-id='" + id + "']"; }); rule(selector); }
javascript
function domElement(ids) { var selector = ""; if (!Array.isArray(ids)) { ids = [ids]; } _.each(ids, function (id) { if (selector !== "") { selector += ","; } selector += "[data-brackets-id='" + id + "']"; }); rule(selector); }
[ "function", "domElement", "(", "ids", ")", "{", "var", "selector", "=", "\"\"", ";", "if", "(", "!", "Array", ".", "isArray", "(", "ids", ")", ")", "{", "ids", "=", "[", "ids", "]", ";", "}", "_", ".", "each", "(", "ids", ",", "function", "(", ...
Highlight all nodes with 'data-brackets-id' value that matches id, or if id is an array, matches any of the given ids. @param {string|Array<string>} value of the 'data-brackets-id' to match, or an array of such.
[ "Highlight", "all", "nodes", "with", "data", "-", "brackets", "-", "id", "value", "that", "matches", "id", "or", "if", "id", "is", "an", "array", "matches", "any", "of", "the", "given", "ids", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/HighlightAgent.js#L113-L125
train
Returns the dom element for the specified tag
[ 30522, 3853, 8514, 16930, 4765, 1006, 8909, 2015, 1007, 1063, 13075, 27000, 1027, 1000, 1000, 1025, 2065, 1006, 999, 9140, 1012, 18061, 11335, 2100, 1006, 8909, 2015, 1007, 1007, 1063, 8909, 2015, 1027, 1031, 8909, 2015, 1033, 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...
adobe/brackets
src/extensibility/node/ExtensionManagerDomain.js
init
function init(domainManager) { if (!domainManager.hasDomain("extensionManager")) { domainManager.registerDomain("extensionManager", {major: 0, minor: 1}); } domainManager.registerCommand( "extensionManager", "validate", validate, true, "Verifies that the contents of the given ZIP file are a valid Brackets extension package", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "options", type: "{requirePackageJSON: ?boolean}", description: "options to control the behavior of the validator" }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }] ); domainManager.registerCommand( "extensionManager", "install", _cmdInstall, true, "Installs the given Brackets extension if it is valid (runs validation command automatically)", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "destinationDirectory", type: "string", description: "absolute filesystem path where this extension should be installed" }, { name: "options", type: "{disabledDirectory: !string, apiVersion: !string, nameHint: ?string, systemExtensionDirectory: !string, proxy: ?string}", description: "installation options: disabledDirectory should be set so that extensions can be installed disabled." }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }, { name: "disabledReason", type: "string", description: "reason this extension was installed disabled (one of Errors.*), none if it was enabled" }, { name: "installationStatus", type: "string", description: "Current status of the installation (an extension can be valid but not installed because it's an update" }, { name: "installedTo", type: "string", description: "absolute path where the extension was installed to" }, { name: "commonPrefix", type: "string", description: "top level directory in the package zip which contains all of the files" }] ); domainManager.registerCommand( "extensionManager", "update", _cmdUpdate, true, "Updates the given Brackets extension (for which install was generally previously attemped). Brackets must be quit after this.", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "destinationDirectory", type: "string", description: "absolute filesystem path where this extension should be installed" }, { name: "options", type: "{disabledDirectory: !string, apiVersion: !string, nameHint: ?string, systemExtensionDirectory: !string}", description: "installation options: disabledDirectory should be set so that extensions can be installed disabled." }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }, { name: "disabledReason", type: "string", description: "reason this extension was installed disabled (one of Errors.*), none if it was enabled" }, { name: "installationStatus", type: "string", description: "Current status of the installation (an extension can be valid but not installed because it's an update" }, { name: "installedTo", type: "string", description: "absolute path where the extension was installed to" }, { name: "commonPrefix", type: "string", description: "top level directory in the package zip which contains all of the files" }] ); domainManager.registerCommand( "extensionManager", "remove", _cmdRemove, true, "Removes the Brackets extension at the given path.", [{ name: "path", type: "string", description: "absolute filesystem path of the installed extension folder" }], {} ); domainManager.registerCommand( "extensionManager", "downloadFile", _cmdDownloadFile, true, "Downloads the file at the given URL, saving it to a temp location. Callback receives path to the downloaded file.", [{ name: "downloadId", type: "string", description: "Unique identifier for this download 'session'" }, { name: "url", type: "string", description: "URL to download from" }, { name: "proxy", type: "string", description: "optional proxy URL" }], { type: "string", description: "Local path to the downloaded file" } ); domainManager.registerCommand( "extensionManager", "abortDownload", _cmdAbortDownload, false, "Aborts any pending download with the given id. Ignored if no download pending (may be already complete).", [{ name: "downloadId", type: "string", description: "Unique identifier for this download 'session', previously pased to downloadFile" }], { type: "boolean", description: "True if the download was pending and able to be canceled; false otherwise" } ); }
javascript
function init(domainManager) { if (!domainManager.hasDomain("extensionManager")) { domainManager.registerDomain("extensionManager", {major: 0, minor: 1}); } domainManager.registerCommand( "extensionManager", "validate", validate, true, "Verifies that the contents of the given ZIP file are a valid Brackets extension package", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "options", type: "{requirePackageJSON: ?boolean}", description: "options to control the behavior of the validator" }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }] ); domainManager.registerCommand( "extensionManager", "install", _cmdInstall, true, "Installs the given Brackets extension if it is valid (runs validation command automatically)", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "destinationDirectory", type: "string", description: "absolute filesystem path where this extension should be installed" }, { name: "options", type: "{disabledDirectory: !string, apiVersion: !string, nameHint: ?string, systemExtensionDirectory: !string, proxy: ?string}", description: "installation options: disabledDirectory should be set so that extensions can be installed disabled." }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }, { name: "disabledReason", type: "string", description: "reason this extension was installed disabled (one of Errors.*), none if it was enabled" }, { name: "installationStatus", type: "string", description: "Current status of the installation (an extension can be valid but not installed because it's an update" }, { name: "installedTo", type: "string", description: "absolute path where the extension was installed to" }, { name: "commonPrefix", type: "string", description: "top level directory in the package zip which contains all of the files" }] ); domainManager.registerCommand( "extensionManager", "update", _cmdUpdate, true, "Updates the given Brackets extension (for which install was generally previously attemped). Brackets must be quit after this.", [{ name: "path", type: "string", description: "absolute filesystem path of the extension package" }, { name: "destinationDirectory", type: "string", description: "absolute filesystem path where this extension should be installed" }, { name: "options", type: "{disabledDirectory: !string, apiVersion: !string, nameHint: ?string, systemExtensionDirectory: !string}", description: "installation options: disabledDirectory should be set so that extensions can be installed disabled." }], [{ name: "errors", type: "string|Array.<string>", description: "download error, if any; first string is error code (one of Errors.*); subsequent strings are additional info" }, { name: "metadata", type: "{name: string, version: string}", description: "all package.json metadata (null if there's no package.json)" }, { name: "disabledReason", type: "string", description: "reason this extension was installed disabled (one of Errors.*), none if it was enabled" }, { name: "installationStatus", type: "string", description: "Current status of the installation (an extension can be valid but not installed because it's an update" }, { name: "installedTo", type: "string", description: "absolute path where the extension was installed to" }, { name: "commonPrefix", type: "string", description: "top level directory in the package zip which contains all of the files" }] ); domainManager.registerCommand( "extensionManager", "remove", _cmdRemove, true, "Removes the Brackets extension at the given path.", [{ name: "path", type: "string", description: "absolute filesystem path of the installed extension folder" }], {} ); domainManager.registerCommand( "extensionManager", "downloadFile", _cmdDownloadFile, true, "Downloads the file at the given URL, saving it to a temp location. Callback receives path to the downloaded file.", [{ name: "downloadId", type: "string", description: "Unique identifier for this download 'session'" }, { name: "url", type: "string", description: "URL to download from" }, { name: "proxy", type: "string", description: "optional proxy URL" }], { type: "string", description: "Local path to the downloaded file" } ); domainManager.registerCommand( "extensionManager", "abortDownload", _cmdAbortDownload, false, "Aborts any pending download with the given id. Ignored if no download pending (may be already complete).", [{ name: "downloadId", type: "string", description: "Unique identifier for this download 'session', previously pased to downloadFile" }], { type: "boolean", description: "True if the download was pending and able to be canceled; false otherwise" } ); }
[ "function", "init", "(", "domainManager", ")", "{", "if", "(", "!", "domainManager", ".", "hasDomain", "(", "\"extensionManager\"", ")", ")", "{", "domainManager", ".", "registerDomain", "(", "\"extensionManager\"", ",", "{", "major", ":", "0", ",", "minor", ...
Initialize the "extensions" domain. The extensions domain handles downloading, unpacking/verifying, and installing extensions.
[ "Initialize", "the", "extensions", "domain", ".", "The", "extensions", "domain", "handles", "downloading", "unpacking", "/", "verifying", "and", "installing", "extensions", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/ExtensionManagerDomain.js#L461-L633
train
Initializes the extension manager
[ 30522, 3853, 1999, 4183, 1006, 5884, 24805, 4590, 1007, 1063, 2065, 1006, 999, 5884, 24805, 4590, 1012, 2038, 9527, 8113, 1006, 1000, 5331, 24805, 4590, 1000, 1007, 1007, 1063, 5884, 24805, 4590, 1012, 4236, 9527, 8113, 1006, 1000, 5331, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/colors/colors.js
MdColorsService
function MdColorsService($mdTheming, $mdUtil, $log) { colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); // Publish service instance return { applyThemeColors: applyThemeColors, getThemeColor: getThemeColor, hasTheme: hasTheme }; // ******************************************** // Internal Methods // ******************************************** /** * @ngdoc method * @name $mdColors#applyThemeColors * * @description * Lookup a set of colors by hue, theme, and palette, then apply those colors * with the provided opacity (via `rgba()`) to the specified CSS property. * * @param {angular.element} element the element to apply the styles to * @param {Object} colorExpression Keys are CSS properties and values are strings representing * the `theme-palette-hue-opacity` of the desired color. For example: * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and * opacity are optional. */ function applyThemeColors(element, colorExpression) { try { if (colorExpression) { // Assign the calculate RGBA color values directly as inline CSS element.css(interpolateColors(colorExpression)); } } catch (e) { $log.error(e.message); } } /** * @ngdoc method * @name $mdColors#getThemeColor * * @description * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the * desired color. * * @param {string} expression color expression like `'red-A200-0.3'` or * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` */ function getThemeColor(expression) { var color = extractColorOptions(expression); return parseColor(color); } /** * Return the parsed color * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color * definitions * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. * @returns {string} rgba color string */ function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); } /** * Convert the color expression into an object with scope-interpolated values * Then calculate the rgba() values based on the theme color parts * @param {Object} themeColors json object, keys are css properties and values are string of * the wanted color, for example: `{color: 'red-A200-0.3'}`. * @return {Object} Hashmap of CSS properties with associated `rgba()` string values */ function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; } /** * Check if expression has defined theme * For instance: * 'myTheme-primary' => true * 'red-800' => false * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @return {boolean} true if the expression has a theme part, false otherwise. */ function hasTheme(expression) { return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); } /** * For the evaluated expression, extract the color parts into a hash map * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} */ function extractColorOptions(expression) { var parts = expression.split('-'); var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); return { theme: theme, palette: extractPalette(parts, theme), hue: extractHue(parts, theme), opacity: parts[2] || 1 }; } /** * Calculate the theme palette name * @param {Array} parts * @param {string} theme name * @return {string} */ function extractPalette(parts, theme) { // If the next section is one of the palettes we assume it's a two word palette // Two word palette can be also written in camelCase, forming camelCase to dash-case var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); if (colorPalettes.indexOf(palette) === -1) { // If the palette is not in the palette list it's one of primary/accent/warn/background var scheme = $mdTheming.THEMES[theme].colors[palette]; if (!scheme) { throw new Error($mdUtil.supplant( 'mdColors: couldn\'t find \'{palette}\' in the palettes.', {palette: palette})); } palette = scheme.name; } return palette; } /** * @param {Array} parts * @param {string} theme name * @return {*} */ function extractHue(parts, theme) { var themeColors = $mdTheming.THEMES[theme].colors; if (parts[1] === 'hue') { var hueNumber = parseInt(parts.splice(2, 1)[0], 10); if (hueNumber < 1 || hueNumber > 3) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', {hueNumber: hueNumber})); } parts[1] = 'hue-' + hueNumber; if (!(parts[0] in themeColors)) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', { availableThemes: Object.keys(themeColors).join(', '), usedTheme: parts[0] })); } return themeColors[parts[0]].hues[parts[1]]; } return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; } }
javascript
function MdColorsService($mdTheming, $mdUtil, $log) { colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); // Publish service instance return { applyThemeColors: applyThemeColors, getThemeColor: getThemeColor, hasTheme: hasTheme }; // ******************************************** // Internal Methods // ******************************************** /** * @ngdoc method * @name $mdColors#applyThemeColors * * @description * Lookup a set of colors by hue, theme, and palette, then apply those colors * with the provided opacity (via `rgba()`) to the specified CSS property. * * @param {angular.element} element the element to apply the styles to * @param {Object} colorExpression Keys are CSS properties and values are strings representing * the `theme-palette-hue-opacity` of the desired color. For example: * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and * opacity are optional. */ function applyThemeColors(element, colorExpression) { try { if (colorExpression) { // Assign the calculate RGBA color values directly as inline CSS element.css(interpolateColors(colorExpression)); } } catch (e) { $log.error(e.message); } } /** * @ngdoc method * @name $mdColors#getThemeColor * * @description * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the * desired color. * * @param {string} expression color expression like `'red-A200-0.3'` or * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` */ function getThemeColor(expression) { var color = extractColorOptions(expression); return parseColor(color); } /** * Return the parsed color * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color * definitions * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. * @returns {string} rgba color string */ function parseColor(color, contrast) { contrast = contrast || false; var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; rgbValues = contrast ? rgbValues.contrast : rgbValues.value; return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] ); } /** * Convert the color expression into an object with scope-interpolated values * Then calculate the rgba() values based on the theme color parts * @param {Object} themeColors json object, keys are css properties and values are string of * the wanted color, for example: `{color: 'red-A200-0.3'}`. * @return {Object} Hashmap of CSS properties with associated `rgba()` string values */ function interpolateColors(themeColors) { var rgbColors = {}; var hasColorProperty = themeColors.hasOwnProperty('color'); angular.forEach(themeColors, function (value, key) { var color = extractColorOptions(value); var hasBackground = key.indexOf('background') > -1; rgbColors[key] = parseColor(color); if (hasBackground && !hasColorProperty) { rgbColors.color = parseColor(color, true); } }); return rgbColors; } /** * Check if expression has defined theme * For instance: * 'myTheme-primary' => true * 'red-800' => false * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @return {boolean} true if the expression has a theme part, false otherwise. */ function hasTheme(expression) { return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); } /** * For the evaluated expression, extract the color parts into a hash map * @param {string} expression color expression like 'red-800', 'red-A200-0.3', * 'myTheme-primary', or 'myTheme-primary-400' * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} */ function extractColorOptions(expression) { var parts = expression.split('-'); var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); return { theme: theme, palette: extractPalette(parts, theme), hue: extractHue(parts, theme), opacity: parts[2] || 1 }; } /** * Calculate the theme palette name * @param {Array} parts * @param {string} theme name * @return {string} */ function extractPalette(parts, theme) { // If the next section is one of the palettes we assume it's a two word palette // Two word palette can be also written in camelCase, forming camelCase to dash-case var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); if (colorPalettes.indexOf(palette) === -1) { // If the palette is not in the palette list it's one of primary/accent/warn/background var scheme = $mdTheming.THEMES[theme].colors[palette]; if (!scheme) { throw new Error($mdUtil.supplant( 'mdColors: couldn\'t find \'{palette}\' in the palettes.', {palette: palette})); } palette = scheme.name; } return palette; } /** * @param {Array} parts * @param {string} theme name * @return {*} */ function extractHue(parts, theme) { var themeColors = $mdTheming.THEMES[theme].colors; if (parts[1] === 'hue') { var hueNumber = parseInt(parts.splice(2, 1)[0], 10); if (hueNumber < 1 || hueNumber > 3) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', {hueNumber: hueNumber})); } parts[1] = 'hue-' + hueNumber; if (!(parts[0] in themeColors)) { throw new Error($mdUtil.supplant( 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', { availableThemes: Object.keys(themeColors).join(', '), usedTheme: parts[0] })); } return themeColors[parts[0]].hues[parts[1]]; } return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; } }
[ "function", "MdColorsService", "(", "$mdTheming", ",", "$mdUtil", ",", "$log", ")", "{", "colorPalettes", "=", "colorPalettes", "||", "Object", ".", "keys", "(", "$mdTheming", ".", "PALETTES", ")", ";", "// Publish service instance", "return", "{", "applyThemeColo...
@ngdoc service @name $mdColors @module material.components.colors @description By default, defining a theme does not make its colors available for applying to non AngularJS Material elements. The `$mdColors` service is used by the `md-color` directive to convert a set of color expressions to RGBA values and then apply those values to the element as CSS property values. @usage Getting a color based on a theme <hljs lang="js"> angular.controller('myCtrl', function ($mdColors) { var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); ... }); </hljs> Applying a color from a palette to an element <hljs lang="js"> app.directive('myDirective', function($mdColors) { return { ... link: function (scope, elem) { $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); } } }); </hljs>
[ "@ngdoc", "service", "@name", "$mdColors", "@module", "material", ".", "components", ".", "colors" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/colors/colors.js#L56-L249
train
The MdColorsService provides a service that can be used to apply theme colors to an element.
[ 30522, 3853, 9108, 18717, 18116, 7903, 2063, 1006, 1002, 9108, 10760, 6562, 1010, 1002, 9108, 21823, 2140, 1010, 1002, 8833, 1007, 1063, 3609, 12952, 26592, 1027, 3609, 12952, 26592, 1064, 1064, 4874, 1012, 6309, 1006, 1002, 9108, 10760, 65...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airyland/vux
packages/loader/src/index.js
getBabelLoader
function getBabelLoader(projectRoot, name, isDev) { name = name || 'vux' if (!projectRoot) { projectRoot = path.resolve(__dirname, '../../../') if (/\.npm/.test(projectRoot)) { projectRoot = path.resolve(projectRoot, '../../../') } } let componentPath let regex if (!isDev) { componentPath = fs.realpathSync(projectRoot + `/node_modules/${name}/`) // https://github.com/webpack/webpack/issues/1643 regex = new RegExp(`node_modules.*${name}.src.*?js$`) } else { componentPath = projectRoot regex = new RegExp(`${projectRoot}.src.*?js$`) } return { test: regex, loader: 'babel-loader', include: componentPath } }
javascript
function getBabelLoader(projectRoot, name, isDev) { name = name || 'vux' if (!projectRoot) { projectRoot = path.resolve(__dirname, '../../../') if (/\.npm/.test(projectRoot)) { projectRoot = path.resolve(projectRoot, '../../../') } } let componentPath let regex if (!isDev) { componentPath = fs.realpathSync(projectRoot + `/node_modules/${name}/`) // https://github.com/webpack/webpack/issues/1643 regex = new RegExp(`node_modules.*${name}.src.*?js$`) } else { componentPath = projectRoot regex = new RegExp(`${projectRoot}.src.*?js$`) } return { test: regex, loader: 'babel-loader', include: componentPath } }
[ "function", "getBabelLoader", "(", "projectRoot", ",", "name", ",", "isDev", ")", "{", "name", "=", "name", "||", "'vux'", "if", "(", "!", "projectRoot", ")", "{", "projectRoot", "=", "path", ".", "resolve", "(", "__dirname", ",", "'../../../'", ")", "if...
use babel so component's js can be compiled
[ "use", "babel", "so", "component", "s", "js", "can", "be", "compiled" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/packages/loader/src/index.js#L589-L613
train
Returns a babel - loader object
[ 30522, 3853, 2131, 3676, 17327, 10441, 4063, 1006, 2622, 3217, 4140, 1010, 2171, 1010, 2003, 24844, 1007, 1063, 2171, 1027, 2171, 1064, 1064, 1005, 24728, 2595, 1005, 2065, 1006, 999, 2622, 3217, 4140, 1007, 1063, 2622, 3217, 4140, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/ScopeManager.js
getTernHints
function getTernHints(fileInfo, offset, isProperty) { /** * If the document is large and we have modified a small portions of it that * we are asking hints for, then send a partial document. */ postMessage({ type: MessageIds.TERN_COMPLETIONS_MSG, fileInfo: fileInfo, offset: offset, isProperty: isProperty }); return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_COMPLETIONS_MSG); }
javascript
function getTernHints(fileInfo, offset, isProperty) { /** * If the document is large and we have modified a small portions of it that * we are asking hints for, then send a partial document. */ postMessage({ type: MessageIds.TERN_COMPLETIONS_MSG, fileInfo: fileInfo, offset: offset, isProperty: isProperty }); return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_COMPLETIONS_MSG); }
[ "function", "getTernHints", "(", "fileInfo", ",", "offset", ",", "isProperty", ")", "{", "/**\n * If the document is large and we have modified a small portions of it that\n * we are asking hints for, then send a partial document.\n */", "postMessage", "(", "{", ...
Get a Promise for the completions from TernJS, for the file & offset passed in. @param {{type: string, name: string, offsetLines: number, text: string}} fileInfo - type of update, name of file, and the text of the update. For "full" updates, the whole text of the file is present. For "part" updates, the changed portion of the text. For "empty" updates, the file has not been modified and the text is empty. @param {{line: number, ch: number}} offset - the offset in the file the hints should be calculate at @param {boolean} isProperty - true if getting a property hint, otherwise getting an identifier hint. @return {jQuery.Promise} - a promise that will resolve to an array of completions when it is done
[ "Get", "a", "Promise", "for", "the", "completions", "from", "TernJS", "for", "the", "file", "&", "offset", "passed", "in", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L476-L490
train
This function is called when the tern process is complete
[ 30522, 3853, 2131, 16451, 10606, 3215, 1006, 5371, 2378, 14876, 1010, 16396, 1010, 2003, 21572, 4842, 3723, 1007, 1063, 1013, 1008, 1008, 1008, 2065, 1996, 6254, 2003, 2312, 1998, 2057, 2031, 6310, 1037, 2235, 8810, 1997, 2009, 2008, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function(aUI5Filter) { if (!Array.isArray(aUI5Filter)) { throw "Argument is not an array"; } if (aUI5Filter.length == 0) { return this; } // check if a multi filter is included; otherwise every element simply represents a single condition var bHasMultiFilter = false; for (var i = 0; i < aUI5Filter.length; i++) { if (aUI5Filter[i].aFilters != undefined) { bHasMultiFilter = true; break; } } if (bHasMultiFilter) { this._addUI5FilterArray(aUI5Filter); } else { for (var j = 0; j < aUI5Filter.length; j++) { this.addCondition(aUI5Filter[j].sPath, aUI5Filter[j].sOperator, aUI5Filter[j].oValue1, aUI5Filter[j].oValue2); } } return this; }
javascript
function(aUI5Filter) { if (!Array.isArray(aUI5Filter)) { throw "Argument is not an array"; } if (aUI5Filter.length == 0) { return this; } // check if a multi filter is included; otherwise every element simply represents a single condition var bHasMultiFilter = false; for (var i = 0; i < aUI5Filter.length; i++) { if (aUI5Filter[i].aFilters != undefined) { bHasMultiFilter = true; break; } } if (bHasMultiFilter) { this._addUI5FilterArray(aUI5Filter); } else { for (var j = 0; j < aUI5Filter.length; j++) { this.addCondition(aUI5Filter[j].sPath, aUI5Filter[j].sOperator, aUI5Filter[j].oValue1, aUI5Filter[j].oValue2); } } return this; }
[ "function", "(", "aUI5Filter", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "aUI5Filter", ")", ")", "{", "throw", "\"Argument is not an array\"", ";", "}", "if", "(", "aUI5Filter", ".", "length", "==", "0", ")", "{", "return", "this", ";", "...
Add an array of UI5 filter conditions to the filter expression. The UI5 filter condition is combined with the other given conditions using a logical AND. This method is particularly useful for passing forward already created UI5 filter arrays. @param {sap.ui.model.Filter[]} aUI5Filter Array of UI5 filter objects @returns {sap.ui.model.analytics.odata4analytics.FilterExpression} This object for method chaining @public @function @name sap.ui.model.analytics.odata4analytics.FilterExpression#addUI5FilterConditions
[ "Add", "an", "array", "of", "UI5", "filter", "conditions", "to", "the", "filter", "expression", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L3239-L3263
train
Add a filter to the filter list
[ 30522, 3853, 1006, 8740, 2072, 2629, 8873, 21928, 1007, 1063, 2065, 1006, 999, 9140, 1012, 18061, 11335, 2100, 1006, 8740, 2072, 2629, 8873, 21928, 1007, 1007, 1063, 5466, 1000, 6685, 2003, 2025, 2019, 9140, 1000, 1025, 1065, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/worker-xml.js
function(namespaceURI,localName){ var attr = this.getNamedItemNS(namespaceURI,localName); _removeNamedNode(this._ownerElement,this,attr); return attr; }
javascript
function(namespaceURI,localName){ var attr = this.getNamedItemNS(namespaceURI,localName); _removeNamedNode(this._ownerElement,this,attr); return attr; }
[ "function", "(", "namespaceURI", ",", "localName", ")", "{", "var", "attr", "=", "this", ".", "getNamedItemNS", "(", "namespaceURI", ",", "localName", ")", ";", "_removeNamedNode", "(", "this", ".", "_ownerElement", ",", "this", ",", "attr", ")", ";", "ret...
raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
[ "raises", ":", "NOT_FOUND_ERR", "NO_MODIFICATION_ALLOWED_ERR" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/worker-xml.js#L2100-L2104
train
Removes an attribute from the element.
[ 30522, 3853, 1006, 3415, 15327, 9496, 1010, 2334, 18442, 1007, 1063, 13075, 2012, 16344, 1027, 2023, 1012, 2131, 18442, 23194, 6633, 3619, 1006, 3415, 15327, 9496, 1010, 2334, 18442, 1007, 1025, 1035, 6366, 18442, 2094, 3630, 3207, 1006, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/icon/js/iconService.js
loadByDataUrl
function loadByDataUrl(url) { var results = dataUrlRegex.exec(url); var isBase64 = /base64/i.test(url); var data = isBase64 ? window.atob(results[2]) : results[2]; return $q.when(angular.element(data)[0]); }
javascript
function loadByDataUrl(url) { var results = dataUrlRegex.exec(url); var isBase64 = /base64/i.test(url); var data = isBase64 ? window.atob(results[2]) : results[2]; return $q.when(angular.element(data)[0]); }
[ "function", "loadByDataUrl", "(", "url", ")", "{", "var", "results", "=", "dataUrlRegex", ".", "exec", "(", "url", ")", ";", "var", "isBase64", "=", "/", "base64", "/", "i", ".", "test", "(", "url", ")", ";", "var", "data", "=", "isBase64", "?", "w...
/* Load the icon from embedded data URL.
[ "/", "*", "Load", "the", "icon", "from", "embedded", "data", "URL", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L630-L636
train
Load the data from a data url
[ 30522, 3853, 7170, 3762, 2850, 2696, 3126, 2140, 1006, 24471, 2140, 1007, 1063, 13075, 3463, 1027, 2951, 3126, 20974, 24746, 2595, 1012, 4654, 8586, 1006, 24471, 2140, 1007, 1025, 13075, 2003, 15058, 21084, 1027, 1013, 2918, 21084, 1013, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
bits/46_stycommon.js
process_col
function process_col(coll/*:ColInfo*/) { if(coll.width) { coll.wpx = width2px(coll.width); coll.wch = px2char(coll.wpx); coll.MDW = MDW; } else if(coll.wpx) { coll.wch = px2char(coll.wpx); coll.width = char2width(coll.wch); coll.MDW = MDW; } else if(typeof coll.wch == 'number') { coll.width = char2width(coll.wch); coll.wpx = width2px(coll.width); coll.MDW = MDW; } if(coll.customWidth) delete coll.customWidth; }
javascript
function process_col(coll/*:ColInfo*/) { if(coll.width) { coll.wpx = width2px(coll.width); coll.wch = px2char(coll.wpx); coll.MDW = MDW; } else if(coll.wpx) { coll.wch = px2char(coll.wpx); coll.width = char2width(coll.wch); coll.MDW = MDW; } else if(typeof coll.wch == 'number') { coll.width = char2width(coll.wch); coll.wpx = width2px(coll.width); coll.MDW = MDW; } if(coll.customWidth) delete coll.customWidth; }
[ "function", "process_col", "(", "coll", "/*:ColInfo*/", ")", "{", "if", "(", "coll", ".", "width", ")", "{", "coll", ".", "wpx", "=", "width2px", "(", "coll", ".", "width", ")", ";", "coll", ".", "wch", "=", "px2char", "(", "coll", ".", "wpx", ")",...
/* XLML specifies width in terms of pixels /*function find_mdw_wpx(wpx) { var delta = Infinity, guess = 0, _MDW = MIN_MDW; for(MDW=MIN_MDW; MDW<MAX_MDW; ++MDW) { guess = char2width_(px2char_(wpx))*256; guess = (guess) % 1; if(guess > 0.5) guess--; if(Math.abs(guess) < delta) { delta = Math.abs(guess); _MDW = MDW; } } MDW = _MDW; }
[ "/", "*", "XLML", "specifies", "width", "in", "terms", "of", "pixels", "/", "*", "function", "find_mdw_wpx", "(", "wpx", ")", "{", "var", "delta", "=", "Infinity", "guess", "=", "0", "_MDW", "=", "MIN_MDW", ";", "for", "(", "MDW", "=", "MIN_MDW", ";"...
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/46_stycommon.js#L79-L94
train
Process a col
[ 30522, 3853, 2832, 1035, 8902, 1006, 8902, 2140, 1013, 1008, 1024, 6972, 14876, 1008, 1013, 1007, 1063, 2065, 1006, 8902, 2140, 1012, 9381, 1007, 1063, 8902, 2140, 1012, 1059, 2361, 2595, 1027, 9381, 2475, 2361, 2595, 1006, 8902, 2140, 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...
angular/material
src/core/util/util.js
function(element, nodeName, scanDeep, warnNotFound) { var found = scanTree(element); if (!found && !!warnNotFound) { $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); } return angular.element(found || element); /** * Breadth-First tree scan for element with matching `nodeName` */ function scanTree(element) { return scanLevel(element) || (scanDeep ? scanChildren(element) : null); } /** * Case-insensitive scan of current elements only (do not descend). */ function scanLevel(element) { if (element) { for (var i = 0, len = element.length; i < len; i++) { if (element[i].nodeName.toLowerCase() === nodeName) { return element[i]; } } } return null; } /** * Scan children of specified node */ function scanChildren(element) { var found; if (element) { for (var i = 0, len = element.length; i < len; i++) { var target = element[i]; if (!found) { for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { found = found || scanTree([target.childNodes[j]]); } } } } return found; } }
javascript
function(element, nodeName, scanDeep, warnNotFound) { var found = scanTree(element); if (!found && !!warnNotFound) { $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); } return angular.element(found || element); /** * Breadth-First tree scan for element with matching `nodeName` */ function scanTree(element) { return scanLevel(element) || (scanDeep ? scanChildren(element) : null); } /** * Case-insensitive scan of current elements only (do not descend). */ function scanLevel(element) { if (element) { for (var i = 0, len = element.length; i < len; i++) { if (element[i].nodeName.toLowerCase() === nodeName) { return element[i]; } } } return null; } /** * Scan children of specified node */ function scanChildren(element) { var found; if (element) { for (var i = 0, len = element.length; i < len; i++) { var target = element[i]; if (!found) { for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { found = found || scanTree([target.childNodes[j]]); } } } } return found; } }
[ "function", "(", "element", ",", "nodeName", ",", "scanDeep", ",", "warnNotFound", ")", "{", "var", "found", "=", "scanTree", "(", "element", ")", ";", "if", "(", "!", "found", "&&", "!", "!", "warnNotFound", ")", "{", "$log", ".", "warn", "(", "$mdU...
Functional equivalent for $element.filter(‘md-bottom-sheet’) useful with interimElements where the element and its container are important... @param {angular.JQLite} element to scan @param {string} nodeName of node to find (e.g. 'md-dialog') @param {boolean=} scanDeep optional flag to allow deep scans; defaults to 'false'. @param {boolean=} warnNotFound optional flag to enable log warnings; defaults to false
[ "Functional", "equivalent", "for", "$element", ".", "filter", "(", "‘md", "-", "bottom", "-", "sheet’", ")", "useful", "with", "interimElements", "where", "the", "element", "and", "its", "container", "are", "important", "..." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L597-L644
train
Returns the first node that matches nodeName
[ 30522, 3853, 1006, 5783, 1010, 13045, 18442, 1010, 13594, 26095, 2361, 1010, 11582, 17048, 14876, 8630, 1007, 1063, 13075, 2179, 1027, 13594, 13334, 1006, 5783, 1007, 1025, 2065, 1006, 999, 2179, 1004, 1004, 999, 999, 11582, 17048, 14876, 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...
electron/electron
lib/browser/guest-view-manager.js
function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { const embedder = event.sender // Destroy the old guest when attaching. const key = `${embedder.id}-${elementInstanceId}` const oldGuestInstanceId = embedderElementsMap[key] if (oldGuestInstanceId != null) { // Reattachment to the same guest is just a no-op. if (oldGuestInstanceId === guestInstanceId) { return } const oldGuestInstance = guestInstances[oldGuestInstanceId] if (oldGuestInstance) { oldGuestInstance.guest.detachFromOuterFrame() } } const guestInstance = guestInstances[guestInstanceId] // If this isn't a valid guest instance then do nothing. if (!guestInstance) { throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`) } const { guest } = guestInstance if (guest.hostWebContents !== event.sender) { throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`) } // If this guest is already attached to an element then remove it if (guestInstance.elementInstanceId) { const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}` delete embedderElementsMap[oldKey] // Remove guest from embedder if moving across web views if (guest.viewInstanceId !== params.instanceId) { webViewManager.removeGuest(guestInstance.embedder, guestInstanceId) guestInstance.embedder._sendInternal(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${guest.viewInstanceId}`) } } const webPreferences = { guestInstanceId: guestInstanceId, nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false, nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false, enableRemoteModule: params.enableremotemodule, plugins: params.plugins, zoomFactor: embedder.getZoomFactor(), webSecurity: !params.disablewebsecurity, enableBlinkFeatures: params.blinkfeatures, disableBlinkFeatures: params.disableblinkfeatures } // parse the 'webpreferences' attribute string, if set // this uses the same parsing rules as window.open uses for its features if (typeof params.webpreferences === 'string') { parseFeaturesString(params.webpreferences, function (key, value) { if (value === undefined) { // no value was specified, default it to true value = true } webPreferences[key] = value }) } if (params.preload) { webPreferences.preloadURL = params.preload } // Return null from native window.open if allowpopups is unset if (webPreferences.nativeWindowOpen === true && !params.allowpopups) { webPreferences.disablePopups = true } // Security options that guest will always inherit from embedder const inheritedWebPreferences = new Map([ ['contextIsolation', true], ['javascript', false], ['nativeWindowOpen', true], ['nodeIntegration', false], ['enableRemoteModule', false], ['sandbox', true], ['nodeIntegrationInSubFrames', false] ]) // Inherit certain option values from embedder const lastWebPreferences = embedder.getLastWebPreferences() for (const [name, value] of inheritedWebPreferences) { if (lastWebPreferences[name] === value) { webPreferences[name] = value } } embedder.emit('will-attach-webview', event, webPreferences, params) if (event.defaultPrevented) { if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId guest.destroy() return } guest.attachParams = params embedderElementsMap[key] = guestInstanceId guest.setEmbedder(embedder) guestInstance.embedder = embedder guestInstance.elementInstanceId = elementInstanceId watchEmbedder(embedder) webViewManager.addGuest(guestInstanceId, elementInstanceId, embedder, guest, webPreferences) guest.attachToIframe(embedder, embedderFrameId) }
javascript
function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) { const embedder = event.sender // Destroy the old guest when attaching. const key = `${embedder.id}-${elementInstanceId}` const oldGuestInstanceId = embedderElementsMap[key] if (oldGuestInstanceId != null) { // Reattachment to the same guest is just a no-op. if (oldGuestInstanceId === guestInstanceId) { return } const oldGuestInstance = guestInstances[oldGuestInstanceId] if (oldGuestInstance) { oldGuestInstance.guest.detachFromOuterFrame() } } const guestInstance = guestInstances[guestInstanceId] // If this isn't a valid guest instance then do nothing. if (!guestInstance) { throw new Error(`Invalid guestInstanceId: ${guestInstanceId}`) } const { guest } = guestInstance if (guest.hostWebContents !== event.sender) { throw new Error(`Access denied to guestInstanceId: ${guestInstanceId}`) } // If this guest is already attached to an element then remove it if (guestInstance.elementInstanceId) { const oldKey = `${guestInstance.embedder.id}-${guestInstance.elementInstanceId}` delete embedderElementsMap[oldKey] // Remove guest from embedder if moving across web views if (guest.viewInstanceId !== params.instanceId) { webViewManager.removeGuest(guestInstance.embedder, guestInstanceId) guestInstance.embedder._sendInternal(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${guest.viewInstanceId}`) } } const webPreferences = { guestInstanceId: guestInstanceId, nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false, nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false, enableRemoteModule: params.enableremotemodule, plugins: params.plugins, zoomFactor: embedder.getZoomFactor(), webSecurity: !params.disablewebsecurity, enableBlinkFeatures: params.blinkfeatures, disableBlinkFeatures: params.disableblinkfeatures } // parse the 'webpreferences' attribute string, if set // this uses the same parsing rules as window.open uses for its features if (typeof params.webpreferences === 'string') { parseFeaturesString(params.webpreferences, function (key, value) { if (value === undefined) { // no value was specified, default it to true value = true } webPreferences[key] = value }) } if (params.preload) { webPreferences.preloadURL = params.preload } // Return null from native window.open if allowpopups is unset if (webPreferences.nativeWindowOpen === true && !params.allowpopups) { webPreferences.disablePopups = true } // Security options that guest will always inherit from embedder const inheritedWebPreferences = new Map([ ['contextIsolation', true], ['javascript', false], ['nativeWindowOpen', true], ['nodeIntegration', false], ['enableRemoteModule', false], ['sandbox', true], ['nodeIntegrationInSubFrames', false] ]) // Inherit certain option values from embedder const lastWebPreferences = embedder.getLastWebPreferences() for (const [name, value] of inheritedWebPreferences) { if (lastWebPreferences[name] === value) { webPreferences[name] = value } } embedder.emit('will-attach-webview', event, webPreferences, params) if (event.defaultPrevented) { if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId guest.destroy() return } guest.attachParams = params embedderElementsMap[key] = guestInstanceId guest.setEmbedder(embedder) guestInstance.embedder = embedder guestInstance.elementInstanceId = elementInstanceId watchEmbedder(embedder) webViewManager.addGuest(guestInstanceId, elementInstanceId, embedder, guest, webPreferences) guest.attachToIframe(embedder, embedderFrameId) }
[ "function", "(", "event", ",", "embedderFrameId", ",", "elementInstanceId", ",", "guestInstanceId", ",", "params", ")", "{", "const", "embedder", "=", "event", ".", "sender", "// Destroy the old guest when attaching.", "const", "key", "=", "`", "${", "embedder", "...
Attach the guest to an element of embedder.
[ "Attach", "the", "guest", "to", "an", "element", "of", "embedder", "." ]
6e29611788277729647acf465f10db1ea6f15788
https://github.com/electron/electron/blob/6e29611788277729647acf465f10db1ea6f15788/lib/browser/guest-view-manager.js#L164-L273
train
This function is called when the guest is attached to an element.
[ 30522, 3853, 1006, 2724, 1010, 7861, 8270, 4063, 15643, 3593, 1010, 5783, 7076, 26897, 3593, 1010, 4113, 7076, 26897, 3593, 1010, 11498, 5244, 1007, 1063, 9530, 3367, 7861, 8270, 4063, 1027, 2724, 1012, 4604, 2121, 1013, 1013, 6033, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/gulp-tasks/cldr/closure.js
generateAllLocalesFile
function generateAllLocalesFile(LOCALES, ALIASES) { const existingLocalesAliases = {}; const existingLocalesData = {}; // for each locale, get the data and the list of equivalent locales LOCALES.forEach(locale => { const eqLocales = new Set(); eqLocales.add(locale); if (locale.match(/-/)) { eqLocales.add(locale.replace(/-/g, '_')); } // check for aliases const alias = ALIASES[locale]; if (alias) { eqLocales.add(alias); if (alias.match(/-/)) { eqLocales.add(alias.replace(/-/g, '_')); } // to avoid duplicated "case" we regroup all locales in the same "case" // the simplest way to do that is to have alias aliases // e.g. 'no' --> 'nb', 'nb' --> 'no-NO' // which means that we'll have 'no', 'nb' and 'no-NO' in the same "case" const aliasKeys = Object.keys(ALIASES); for (let i = 0; i < aliasKeys.length; i++) { const aliasValue = ALIASES[alias]; if (aliasKeys.indexOf(alias) !== -1 && !eqLocales.has(aliasValue)) { eqLocales.add(aliasValue); if (aliasValue.match(/-/)) { eqLocales.add(aliasValue.replace(/-/g, '_')); } } } } for (let l of eqLocales) { // find the existing content file const path = `${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`; if (fs.existsSync(`${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`)) { const localeName = formatLocale(locale); existingLocalesData[locale] = fs.readFileSync(path, 'utf8') .replace(`${HEADER}\n`, '') .replace('export default ', `export const locale_${localeName} = `) .replace('function plural', `function plural_${localeName}`) .replace(/,(\n | )plural/, `, plural_${localeName}`) .replace('const u = undefined;\n\n', ''); } } existingLocalesAliases[locale] = eqLocales; }); function generateCases(locale) { let str = ''; let locales = []; const eqLocales = existingLocalesAliases[locale]; for (let l of eqLocales) { str += `case '${l}':\n`; locales.push(`'${l}'`); } let localesStr = '[' + locales.join(',') + ']'; str += ` l = locale_${formatLocale(locale)}; locales = ${localesStr}; break;\n`; return str; } function formatLocale(locale) { return locale.replace(/-/g, '_'); } // clang-format off return `${HEADER} import {registerLocaleData} from '../src/i18n/locale_data'; const u = undefined; ${LOCALES.map(locale => `${existingLocalesData[locale]}`).join('\n')} let l: any; let locales: string[] = []; switch (goog.LOCALE) { ${LOCALES.map(locale => generateCases(locale)).join('')}} if(l) { locales.forEach(locale => registerLocaleData(l, locale)); } `; // clang-format on }
javascript
function generateAllLocalesFile(LOCALES, ALIASES) { const existingLocalesAliases = {}; const existingLocalesData = {}; // for each locale, get the data and the list of equivalent locales LOCALES.forEach(locale => { const eqLocales = new Set(); eqLocales.add(locale); if (locale.match(/-/)) { eqLocales.add(locale.replace(/-/g, '_')); } // check for aliases const alias = ALIASES[locale]; if (alias) { eqLocales.add(alias); if (alias.match(/-/)) { eqLocales.add(alias.replace(/-/g, '_')); } // to avoid duplicated "case" we regroup all locales in the same "case" // the simplest way to do that is to have alias aliases // e.g. 'no' --> 'nb', 'nb' --> 'no-NO' // which means that we'll have 'no', 'nb' and 'no-NO' in the same "case" const aliasKeys = Object.keys(ALIASES); for (let i = 0; i < aliasKeys.length; i++) { const aliasValue = ALIASES[alias]; if (aliasKeys.indexOf(alias) !== -1 && !eqLocales.has(aliasValue)) { eqLocales.add(aliasValue); if (aliasValue.match(/-/)) { eqLocales.add(aliasValue.replace(/-/g, '_')); } } } } for (let l of eqLocales) { // find the existing content file const path = `${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`; if (fs.existsSync(`${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`)) { const localeName = formatLocale(locale); existingLocalesData[locale] = fs.readFileSync(path, 'utf8') .replace(`${HEADER}\n`, '') .replace('export default ', `export const locale_${localeName} = `) .replace('function plural', `function plural_${localeName}`) .replace(/,(\n | )plural/, `, plural_${localeName}`) .replace('const u = undefined;\n\n', ''); } } existingLocalesAliases[locale] = eqLocales; }); function generateCases(locale) { let str = ''; let locales = []; const eqLocales = existingLocalesAliases[locale]; for (let l of eqLocales) { str += `case '${l}':\n`; locales.push(`'${l}'`); } let localesStr = '[' + locales.join(',') + ']'; str += ` l = locale_${formatLocale(locale)}; locales = ${localesStr}; break;\n`; return str; } function formatLocale(locale) { return locale.replace(/-/g, '_'); } // clang-format off return `${HEADER} import {registerLocaleData} from '../src/i18n/locale_data'; const u = undefined; ${LOCALES.map(locale => `${existingLocalesData[locale]}`).join('\n')} let l: any; let locales: string[] = []; switch (goog.LOCALE) { ${LOCALES.map(locale => generateCases(locale)).join('')}} if(l) { locales.forEach(locale => registerLocaleData(l, locale)); } `; // clang-format on }
[ "function", "generateAllLocalesFile", "(", "LOCALES", ",", "ALIASES", ")", "{", "const", "existingLocalesAliases", "=", "{", "}", ";", "const", "existingLocalesData", "=", "{", "}", ";", "// for each locale, get the data and the list of equivalent locales", "LOCALES", "."...
Generate a file that contains all locale to import for closure. Tree shaking will only keep the data for the `goog.LOCALE` locale.
[ "Generate", "a", "file", "that", "contains", "all", "locale", "to", "import", "for", "closure", ".", "Tree", "shaking", "will", "only", "keep", "the", "data", "for", "the", "goog", ".", "LOCALE", "locale", "." ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/tools/gulp-tasks/cldr/closure.js#L71-L163
train
Generate all locales file
[ 30522, 3853, 9699, 8095, 4135, 9289, 2229, 8873, 2571, 1006, 2334, 2229, 1010, 14593, 2229, 1007, 1063, 9530, 3367, 4493, 4135, 9289, 22447, 6632, 8583, 1027, 1063, 1065, 1025, 9530, 3367, 4493, 4135, 9289, 2229, 2850, 2696, 1027, 1063, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }
javascript
function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }
[ "function", "(", "aMethods", ")", "{", "var", "fnCreateTypesArr", "=", "function", "(", "sTypes", ")", "{", "return", "sTypes", ".", "split", "(", "\"|\"", ")", ".", "map", "(", "function", "(", "sType", ")", "{", "return", "{", "value", ":", "sType", ...
Adjusts methods info so that it can be easily displayed in a table @param aMethods - the methods array initially coming from the server
[ "Adjusts", "methods", "info", "so", "that", "it", "can", "be", "easily", "displayed", "in", "a", "table" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L1796-L1865
train
Function to create the parameters array
[ 30522, 3853, 1006, 2572, 11031, 20620, 1007, 1063, 13075, 1042, 12273, 29313, 13874, 10286, 2099, 1027, 3853, 1006, 2358, 18863, 2015, 1007, 1063, 2709, 2358, 18863, 2015, 1012, 3975, 1006, 1000, 1064, 1000, 1007, 1012, 4949, 1006, 3853, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(vObject, vCall, oThis) { var oObject = typeof vObject === "function" ? vObject() : vObject; if (!oObject || !vCall) { return undefined; } oThis = oThis || oObject; if (typeof vCall === "function") { vCall.call(oThis, oObject); return undefined; } else { var aParameters; var aReturnValues = []; for (var sFunctionName in vCall) { if (typeof oObject[sFunctionName] === "function") { aParameters = vCall[sFunctionName]; aReturnValues.push(oObject[sFunctionName].apply(oThis, aParameters)); } else { aReturnValues.push(undefined); } } if (aReturnValues.length === 1) { return aReturnValues[0]; } else { return aReturnValues; } } }
javascript
function(vObject, vCall, oThis) { var oObject = typeof vObject === "function" ? vObject() : vObject; if (!oObject || !vCall) { return undefined; } oThis = oThis || oObject; if (typeof vCall === "function") { vCall.call(oThis, oObject); return undefined; } else { var aParameters; var aReturnValues = []; for (var sFunctionName in vCall) { if (typeof oObject[sFunctionName] === "function") { aParameters = vCall[sFunctionName]; aReturnValues.push(oObject[sFunctionName].apply(oThis, aParameters)); } else { aReturnValues.push(undefined); } } if (aReturnValues.length === 1) { return aReturnValues[0]; } else { return aReturnValues; } } }
[ "function", "(", "vObject", ",", "vCall", ",", "oThis", ")", "{", "var", "oObject", "=", "typeof", "vObject", "===", "\"function\"", "?", "vObject", "(", ")", ":", "vObject", ";", "if", "(", "!", "oObject", "||", "!", "vCall", ")", "{", "return", "un...
Facilitates dynamic calling. @param {function():T | T} vObject The object, or a function returning the object, on which methods will be called. @param {function(this:U, T) | Object<string, Array.<*>>} vCall Called if <code>vObject</code> is, or returns an object. @param {U} [oThis] Context in the function calls, or in the callback if <code>vCall</code>is a function. Default is <code>vObject</code>. @returns {undefined | Array.<*>} If <code>vCall</code> is a map, the return values of the calls are returned. In case of multiple calls, an array of return values is returned. @template T, U
[ "Facilitates", "dynamic", "calling", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L1197-L1226
train
Returns the return value of a function
[ 30522, 3853, 1006, 29536, 2497, 20614, 1010, 18315, 8095, 1010, 27178, 24158, 1007, 1063, 13075, 1051, 16429, 20614, 1027, 2828, 11253, 29536, 2497, 20614, 1027, 1027, 1027, 1000, 3853, 1000, 1029, 29536, 2497, 20614, 1006, 1007, 1024, 29536,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.fl/src/sap/ui/fl/Utils.js
function (oComponent) { var sComponentName = ""; if (oComponent) { sComponentName = oComponent.getMetadata().getName(); } if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; }
javascript
function (oComponent) { var sComponentName = ""; if (oComponent) { sComponentName = oComponent.getMetadata().getName(); } if (sComponentName.length > 0 && sComponentName.indexOf(".Component") < 0) { sComponentName += ".Component"; } return sComponentName; }
[ "function", "(", "oComponent", ")", "{", "var", "sComponentName", "=", "\"\"", ";", "if", "(", "oComponent", ")", "{", "sComponentName", "=", "oComponent", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "}", "if", "(", "sComponentName", "."...
Gets the component name for a component instance. @param {sap.ui.core.Component} oComponent component instance @returns {String} component name @public
[ "Gets", "the", "component", "name", "for", "a", "component", "instance", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L478-L487
train
Returns the name of the component
[ 30522, 30524, 1012, 2131, 11368, 8447, 2696, 1006, 1007, 1012, 2131, 18442, 1006, 1007, 1025, 1065, 2065, 1006, 8040, 25377, 5643, 3372, 18442, 1012, 3091, 1028, 1014, 1004, 1004, 8040, 25377, 5643, 3372, 18442, 1012, 5950, 11253, 1006, 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...
apache/incubator-echarts
src/chart/line/lineAnimationDiff.js
diffData
function diffData(oldData, newData) { var diffResult = []; newData.diff(oldData) .add(function (idx) { diffResult.push({cmd: '+', idx: idx}); }) .update(function (newIdx, oldIdx) { diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx}); }) .remove(function (idx) { diffResult.push({cmd: '-', idx: idx}); }) .execute(); return diffResult; }
javascript
function diffData(oldData, newData) { var diffResult = []; newData.diff(oldData) .add(function (idx) { diffResult.push({cmd: '+', idx: idx}); }) .update(function (newIdx, oldIdx) { diffResult.push({cmd: '=', idx: oldIdx, idx1: newIdx}); }) .remove(function (idx) { diffResult.push({cmd: '-', idx: idx}); }) .execute(); return diffResult; }
[ "function", "diffData", "(", "oldData", ",", "newData", ")", "{", "var", "diffResult", "=", "[", "]", ";", "newData", ".", "diff", "(", "oldData", ")", ".", "add", "(", "function", "(", "idx", ")", "{", "diffResult", ".", "push", "(", "{", "cmd", "...
// Assume id in idList are all unique var idIndicesMap = {}; var idx = 0; for (var i = 0; i < newIdList.length; i++) { idIndicesMap[newIdList[i]] = idx; newIdList[i] = idx++; } for (var i = 0; i < oldIdList.length; i++) { var oldId = oldIdList[i]; // Same with newIdList if (idIndicesMap[oldId]) { oldIdList[i] = idIndicesMap[oldId]; } else { oldIdList[i] = idx++; } } }
[ "//", "Assume", "id", "in", "idList", "are", "all", "unique", "var", "idIndicesMap", "=", "{}", ";", "var", "idx", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "newIdList", ".", "length", ";", "i", "++", ")", "{", "idIndicesMap...
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/line/lineAnimationDiff.js#L49-L65
train
diffData - diff data
[ 30522, 3853, 4487, 4246, 2850, 2696, 1006, 2214, 2850, 2696, 1010, 2047, 2850, 2696, 1007, 1063, 13075, 4487, 4246, 6072, 11314, 1027, 1031, 1033, 1025, 2047, 2850, 2696, 1012, 4487, 4246, 1006, 2214, 2850, 2696, 1007, 1012, 5587, 1006, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/View.js
initPreprocessorQueues
function initPreprocessorQueues(oView, mSettings) { var oViewClass = oView.getMetadata().getClass(); function resolvePreprocessors(oPreprocessor) { oPreprocessor.preprocessor = initPreprocessor(oPreprocessor, mSettings.async); } // shallow copy to avoid issues when manipulating the internal object structure oView.mPreprocessors = jQuery.extend({}, mSettings.preprocessors); for (var _sType in oViewClass.PreprocessorType) { // build the array structure var sType = oViewClass.PreprocessorType[_sType]; if (oView.mPreprocessors[sType] && !Array.isArray(oView.mPreprocessors[sType])) { oView.mPreprocessors[sType] = [oView.mPreprocessors[sType]]; } else if (!oView.mPreprocessors[sType]) { oView.mPreprocessors[sType] = []; } oView.mPreprocessors[sType].forEach(alignPreprocessorStructure); oView.mPreprocessors[sType] = getPreprocessorQueue.call(oView, oViewClass._sType, sType); oView.mPreprocessors[sType].forEach(resolvePreprocessors); } }
javascript
function initPreprocessorQueues(oView, mSettings) { var oViewClass = oView.getMetadata().getClass(); function resolvePreprocessors(oPreprocessor) { oPreprocessor.preprocessor = initPreprocessor(oPreprocessor, mSettings.async); } // shallow copy to avoid issues when manipulating the internal object structure oView.mPreprocessors = jQuery.extend({}, mSettings.preprocessors); for (var _sType in oViewClass.PreprocessorType) { // build the array structure var sType = oViewClass.PreprocessorType[_sType]; if (oView.mPreprocessors[sType] && !Array.isArray(oView.mPreprocessors[sType])) { oView.mPreprocessors[sType] = [oView.mPreprocessors[sType]]; } else if (!oView.mPreprocessors[sType]) { oView.mPreprocessors[sType] = []; } oView.mPreprocessors[sType].forEach(alignPreprocessorStructure); oView.mPreprocessors[sType] = getPreprocessorQueue.call(oView, oViewClass._sType, sType); oView.mPreprocessors[sType].forEach(resolvePreprocessors); } }
[ "function", "initPreprocessorQueues", "(", "oView", ",", "mSettings", ")", "{", "var", "oViewClass", "=", "oView", ".", "getMetadata", "(", ")", ".", "getClass", "(", ")", ";", "function", "resolvePreprocessors", "(", "oPreprocessor", ")", "{", "oPreprocessor", ...
init internal registry and convert single declarations to array, for compatibility @param {sap.ui.core.mvc.View} oView This view instance @param {object} mSettings Settings for the view @private
[ "init", "internal", "registry", "and", "convert", "single", "declarations", "to", "array", "for", "compatibility" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/View.js#L308-L329
train
Initializes the preprocessors for the given view
[ 30522, 3853, 1999, 4183, 28139, 21572, 9623, 21748, 4226, 15808, 1006, 1051, 8584, 1010, 5796, 18319, 3070, 2015, 1007, 1063, 13075, 1051, 8584, 26266, 1027, 1051, 8584, 1012, 2131, 11368, 8447, 2696, 1006, 1007, 1012, 2131, 26266, 1006, 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/modal-dialog.js
modalDialog_start
function modalDialog_start(aCallback) { if (!aCallback) throw new Error(arguments.callee.name + ": Callback not specified."); this._observer = new mdObserver(this._window, aCallback); this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); this._timer.init(this._observer, DELAY_CHECK, Ci.nsITimer.TYPE_ONE_SHOT); }
javascript
function modalDialog_start(aCallback) { if (!aCallback) throw new Error(arguments.callee.name + ": Callback not specified."); this._observer = new mdObserver(this._window, aCallback); this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); this._timer.init(this._observer, DELAY_CHECK, Ci.nsITimer.TYPE_ONE_SHOT); }
[ "function", "modalDialog_start", "(", "aCallback", ")", "{", "if", "(", "!", "aCallback", ")", "throw", "new", "Error", "(", "arguments", ".", "callee", ".", "name", "+", "\": Callback not specified.\"", ")", ";", "this", ".", "_observer", "=", "new", "mdObs...
Start timer to wait for the modal dialog. @param {function} aCallback The callback handler to use to interact with the modal dialog
[ "Start", "timer", "to", "wait", "for", "the", "modal", "dialog", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/modal-dialog.js#L177-L185
train
Start modal dialog
[ 30522, 3853, 16913, 24657, 23067, 2290, 1035, 2707, 1006, 9353, 8095, 5963, 1007, 1063, 2065, 1006, 999, 9353, 8095, 5963, 1007, 5466, 2047, 7561, 1006, 9918, 1012, 2655, 4402, 1012, 2171, 1009, 1000, 1024, 2655, 5963, 2025, 9675, 1012, 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...
angular/material
src/components/menuBar/js/menuItemDirective.js
MenuItemDirective
function MenuItemDirective($mdUtil, $mdConstant, $$mdSvgRegistry) { return { controller: 'MenuItemController', require: ['mdMenuItem', '?ngModel'], priority: $mdConstant.BEFORE_NG_ARIA, compile: function(templateEl, templateAttrs) { var type = templateAttrs.type; var inMenuBarClass = 'md-in-menu-bar'; // Note: This allows us to show the `check` icon for the md-menu-bar items. // The `md-in-menu-bar` class is set by the mdMenuBar directive. if ((type == 'checkbox' || type == 'radio') && templateEl.hasClass(inMenuBarClass)) { var text = templateEl[0].textContent; var buttonEl = angular.element('<md-button type="button"></md-button>'); var iconTemplate = '<md-icon md-svg-src="' + $$mdSvgRegistry.mdChecked + '"></md-icon>'; buttonEl.html(text); buttonEl.attr('tabindex', '0'); templateEl.html(''); templateEl.append(angular.element(iconTemplate)); templateEl.append(buttonEl); templateEl.addClass('md-indent').removeClass(inMenuBarClass); setDefault('role', type == 'checkbox' ? 'menuitemcheckbox' : 'menuitemradio', buttonEl); moveAttrToButton('ng-disabled'); } else { setDefault('role', 'menuitem', templateEl[0].querySelector('md-button, button, a')); } return function(scope, el, attrs, ctrls) { var ctrl = ctrls[0]; var ngModel = ctrls[1]; ctrl.init(ngModel); }; function setDefault(attr, val, el) { el = el || templateEl; if (el instanceof angular.element) { el = el[0]; } if (!el.hasAttribute(attr)) { el.setAttribute(attr, val); } } function moveAttrToButton(attribute) { var attributes = $mdUtil.prefixer(attribute); angular.forEach(attributes, function(attr) { if (templateEl[0].hasAttribute(attr)) { var val = templateEl[0].getAttribute(attr); buttonEl[0].setAttribute(attr, val); templateEl[0].removeAttribute(attr); } }); } } }; }
javascript
function MenuItemDirective($mdUtil, $mdConstant, $$mdSvgRegistry) { return { controller: 'MenuItemController', require: ['mdMenuItem', '?ngModel'], priority: $mdConstant.BEFORE_NG_ARIA, compile: function(templateEl, templateAttrs) { var type = templateAttrs.type; var inMenuBarClass = 'md-in-menu-bar'; // Note: This allows us to show the `check` icon for the md-menu-bar items. // The `md-in-menu-bar` class is set by the mdMenuBar directive. if ((type == 'checkbox' || type == 'radio') && templateEl.hasClass(inMenuBarClass)) { var text = templateEl[0].textContent; var buttonEl = angular.element('<md-button type="button"></md-button>'); var iconTemplate = '<md-icon md-svg-src="' + $$mdSvgRegistry.mdChecked + '"></md-icon>'; buttonEl.html(text); buttonEl.attr('tabindex', '0'); templateEl.html(''); templateEl.append(angular.element(iconTemplate)); templateEl.append(buttonEl); templateEl.addClass('md-indent').removeClass(inMenuBarClass); setDefault('role', type == 'checkbox' ? 'menuitemcheckbox' : 'menuitemradio', buttonEl); moveAttrToButton('ng-disabled'); } else { setDefault('role', 'menuitem', templateEl[0].querySelector('md-button, button, a')); } return function(scope, el, attrs, ctrls) { var ctrl = ctrls[0]; var ngModel = ctrls[1]; ctrl.init(ngModel); }; function setDefault(attr, val, el) { el = el || templateEl; if (el instanceof angular.element) { el = el[0]; } if (!el.hasAttribute(attr)) { el.setAttribute(attr, val); } } function moveAttrToButton(attribute) { var attributes = $mdUtil.prefixer(attribute); angular.forEach(attributes, function(attr) { if (templateEl[0].hasAttribute(attr)) { var val = templateEl[0].getAttribute(attr); buttonEl[0].setAttribute(attr, val); templateEl[0].removeAttribute(attr); } }); } } }; }
[ "function", "MenuItemDirective", "(", "$mdUtil", ",", "$mdConstant", ",", "$$mdSvgRegistry", ")", "{", "return", "{", "controller", ":", "'MenuItemController'", ",", "require", ":", "[", "'mdMenuItem'", ",", "'?ngModel'", "]", ",", "priority", ":", "$mdConstant", ...
/* @ngInject
[ "/", "*" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menuBar/js/menuItemDirective.js#L7-L68
train
MenuItem directive.
[ 30522, 3853, 12183, 4221, 26876, 7442, 15277, 1006, 1002, 9108, 21823, 2140, 1010, 1002, 9108, 8663, 12693, 2102, 1010, 1002, 1002, 9108, 2015, 2615, 17603, 24063, 2854, 1007, 1063, 2709, 1063, 11486, 1024, 1005, 12183, 4221, 12458, 12162, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
getsentry/sentry-javascript
packages/raven-js/scripts/build.js
build
async function build(inputOptions, outputOptions) { const input = Object.assign( { plugins: [ commonjs(), // We can remove this plugin if there are no more CommonJS modules resolve(), // We need this plugin only to build the test script babel({ exclude: 'node_modules/**' }) ] }, inputOptions ); const output = Object.assign( { format: 'umd' }, outputOptions ); const bundle = await rollup(input); await bundle.write(output); }
javascript
async function build(inputOptions, outputOptions) { const input = Object.assign( { plugins: [ commonjs(), // We can remove this plugin if there are no more CommonJS modules resolve(), // We need this plugin only to build the test script babel({ exclude: 'node_modules/**' }) ] }, inputOptions ); const output = Object.assign( { format: 'umd' }, outputOptions ); const bundle = await rollup(input); await bundle.write(output); }
[ "async", "function", "build", "(", "inputOptions", ",", "outputOptions", ")", "{", "const", "input", "=", "Object", ".", "assign", "(", "{", "plugins", ":", "[", "commonjs", "(", ")", ",", "// We can remove this plugin if there are no more CommonJS modules", "resolv...
Only needed for test build Build using rollup.js @see https://rollupjs.org/#javascript-api @param inputOptions @param outputOptions @returns Promise
[ "Only", "needed", "for", "test", "build", "Build", "using", "rollup", ".", "js" ]
a872223343fecf7364473b78bede937f1eb57bd0
https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/scripts/build.js#L15-L38
train
Build the test script
[ 30522, 2004, 6038, 2278, 3853, 3857, 1006, 7953, 7361, 9285, 1010, 6434, 7361, 9285, 1007, 1063, 9530, 3367, 7953, 1027, 4874, 1012, 23911, 1006, 1063, 13354, 7076, 1024, 1031, 2691, 22578, 1006, 1007, 1010, 1013, 1013, 2057, 2064, 6366, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/jquery-mobile-custom.js
function( event ) { var newEvent = new $.Event( "navigate" ), beforeNavigate = new $.Event( "beforenavigate" ), state = event.originalEvent.state || {}, href = location.href; $win.trigger( beforeNavigate ); if( beforeNavigate.isDefaultPrevented() ){ return; } if( event.historyState ){ $.extend(state, event.historyState); } // Make sure the original event is tracked for the end // user to inspect incase they want to do something special newEvent.originalEvent = event; // NOTE we let the current stack unwind because any assignment to // location.hash will stop the world and run this event handler. By // doing this we create a similar behavior to hashchange on hash // assignment setTimeout(function() { $win.trigger( newEvent, { state: state }); }, 0); }
javascript
function( event ) { var newEvent = new $.Event( "navigate" ), beforeNavigate = new $.Event( "beforenavigate" ), state = event.originalEvent.state || {}, href = location.href; $win.trigger( beforeNavigate ); if( beforeNavigate.isDefaultPrevented() ){ return; } if( event.historyState ){ $.extend(state, event.historyState); } // Make sure the original event is tracked for the end // user to inspect incase they want to do something special newEvent.originalEvent = event; // NOTE we let the current stack unwind because any assignment to // location.hash will stop the world and run this event handler. By // doing this we create a similar behavior to hashchange on hash // assignment setTimeout(function() { $win.trigger( newEvent, { state: state }); }, 0); }
[ "function", "(", "event", ")", "{", "var", "newEvent", "=", "new", "$", ".", "Event", "(", "\"navigate\"", ")", ",", "beforeNavigate", "=", "new", "$", ".", "Event", "(", "\"beforenavigate\"", ")", ",", "state", "=", "event", ".", "originalEvent", ".", ...
TODO a lot of duplication between popstate and hashchange
[ "TODO", "a", "lot", "of", "duplication", "between", "popstate", "and", "hashchange" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jquery-mobile-custom.js#L1011-L1040
train
This function is called when the user clicks on the page
[ 30522, 3853, 1006, 2724, 1007, 1063, 13075, 2047, 18697, 3372, 1027, 2047, 1002, 1012, 2724, 1006, 1000, 22149, 1000, 1007, 1010, 2077, 2532, 5737, 5867, 1027, 2047, 1002, 1012, 2724, 1006, 1000, 2077, 2532, 5737, 5867, 1000, 1007, 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...
TryGhost/Ghost
core/server/api/v0.1/webhooks.js
doQuery
function doQuery(options) { return models.Webhook.getByEventAndTarget(options.data.webhooks[0].event, options.data.webhooks[0].target_url, _.omit(options, ['data'])) .then((webhook) => { if (webhook) { return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.webhooks.webhookAlreadyExists')})); } return models.Webhook.add(options.data.webhooks[0], _.omit(options, ['data'])); }) .then((model) => { return { webhooks: [model.toJSON(options)] }; }); }
javascript
function doQuery(options) { return models.Webhook.getByEventAndTarget(options.data.webhooks[0].event, options.data.webhooks[0].target_url, _.omit(options, ['data'])) .then((webhook) => { if (webhook) { return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.webhooks.webhookAlreadyExists')})); } return models.Webhook.add(options.data.webhooks[0], _.omit(options, ['data'])); }) .then((model) => { return { webhooks: [model.toJSON(options)] }; }); }
[ "function", "doQuery", "(", "options", ")", "{", "return", "models", ".", "Webhook", ".", "getByEventAndTarget", "(", "options", ".", "data", ".", "webhooks", "[", "0", "]", ".", "event", ",", "options", ".", "data", ".", "webhooks", "[", "0", "]", "."...
### Model Query Make the call to the Model layer @param {Object} options @returns {Object} options
[ "###", "Model", "Query", "Make", "the", "call", "to", "the", "Model", "layer" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/webhooks.js#L35-L49
train
Query for webhooks
[ 30522, 3853, 2079, 4226, 2854, 1006, 7047, 1007, 1063, 2709, 4275, 1012, 4773, 6806, 6559, 1012, 2131, 3762, 18697, 12380, 26379, 2906, 18150, 1006, 7047, 1012, 2951, 1012, 4773, 6806, 6559, 2015, 1031, 1014, 1033, 1012, 2724, 1010, 7047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
vuejs/vue-devtools
src/backend/index.js
processRouteContext
function processRouteContext (instance) { try { const route = instance.$route if (route) { const { path, query, params } = route const value = { path, query, params } if (route.fullPath) value.fullPath = route.fullPath if (route.hash) value.hash = route.hash if (route.name) value.name = route.name if (route.meta) value.meta = route.meta return [{ key: '$route', value: { _custom: { type: 'router', abstract: true, value } } }] } } catch (e) { // Invalid $router } return [] }
javascript
function processRouteContext (instance) { try { const route = instance.$route if (route) { const { path, query, params } = route const value = { path, query, params } if (route.fullPath) value.fullPath = route.fullPath if (route.hash) value.hash = route.hash if (route.name) value.name = route.name if (route.meta) value.meta = route.meta return [{ key: '$route', value: { _custom: { type: 'router', abstract: true, value } } }] } } catch (e) { // Invalid $router } return [] }
[ "function", "processRouteContext", "(", "instance", ")", "{", "try", "{", "const", "route", "=", "instance", ".", "$route", "if", "(", "route", ")", "{", "const", "{", "path", ",", "query", ",", "params", "}", "=", "route", "const", "value", "=", "{", ...
Process possible vue-router $route context @param {Vue} instance @return {Array}
[ "Process", "possible", "vue", "-", "router", "$route", "context" ]
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L784-L809
train
Process the route context
[ 30522, 3853, 2832, 22494, 26557, 28040, 18413, 1006, 6013, 1007, 1063, 3046, 1063, 9530, 3367, 2799, 1027, 6013, 1012, 1002, 2799, 2065, 1006, 2799, 1007, 1063, 9530, 3367, 1063, 4130, 1010, 23032, 1010, 11498, 5244, 1065, 1027, 2799, 9530,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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() { var self = this; self.plus.addEventListener(tapEventName, function(event) { var val = parseInt(self.input.value) + self.options.step; self.input.value = val.toString(); $.trigger(self.input, changeEventName, null); }); self.minus.addEventListener(tapEventName, function(event) { var val = parseInt(self.input.value) - self.options.step; self.input.value = val.toString(); $.trigger(self.input, changeEventName, null); }); self.input.addEventListener(changeEventName, function(event) { self.checkValue(); var val = parseInt(self.input.value); //触发顶层容器 $.trigger(self.holder, changeEventName, { value: val }); }); }
javascript
function() { var self = this; self.plus.addEventListener(tapEventName, function(event) { var val = parseInt(self.input.value) + self.options.step; self.input.value = val.toString(); $.trigger(self.input, changeEventName, null); }); self.minus.addEventListener(tapEventName, function(event) { var val = parseInt(self.input.value) - self.options.step; self.input.value = val.toString(); $.trigger(self.input, changeEventName, null); }); self.input.addEventListener(changeEventName, function(event) { self.checkValue(); var val = parseInt(self.input.value); //触发顶层容器 $.trigger(self.holder, changeEventName, { value: val }); }); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "self", ".", "plus", ".", "addEventListener", "(", "tapEventName", ",", "function", "(", "event", ")", "{", "var", "val", "=", "parseInt", "(", "self", ".", "input", ".", "value", ")", "+", ...
初始化事件绑定
[ "初始化事件绑定" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/hello-mui/js/mui.js#L8196-L8216
train
add event listeners
[ 30522, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2969, 1012, 4606, 1012, 5587, 18697, 3372, 9863, 24454, 1006, 6823, 15338, 18442, 1010, 3853, 1006, 2724, 1007, 1063, 13075, 11748, 1027, 11968, 20240, 3372, 1006, 2969, 1012, 79...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
codemirror/CodeMirror
src/model/changes.js
makeChangeSingleDocInEditor
function makeChangeSingleDocInEditor(cm, change, spans) { let doc = cm.doc, display = cm.display, from = change.from, to = change.to let recomputeMaxLength = false, checkWidthStart = from.line if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) doc.iter(checkWidthStart, to.line + 1, line => { if (line == display.maxLine) { recomputeMaxLength = true return true } }) } if (doc.sel.contains(change.from, change.to) > -1) signalCursorActivity(cm) updateDoc(doc, change, spans, estimateHeight(cm)) if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, line => { let len = lineLength(line) if (len > display.maxLineLength) { display.maxLine = line display.maxLineLength = len display.maxLineChanged = true recomputeMaxLength = false } }) if (recomputeMaxLength) cm.curOp.updateMaxLine = true } retreatFrontier(doc, from.line) startWorker(cm, 400) let lendiff = change.text.length - (to.line - from.line) - 1 // Remember that these lines changed, for updating the display if (change.full) regChange(cm) else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) regLineChange(cm, from.line, "text") else regChange(cm, from.line, to.line + 1, lendiff) let changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change") if (changeHandler || changesHandler) { let obj = { from: from, to: to, text: change.text, removed: change.removed, origin: change.origin } if (changeHandler) signalLater(cm, "change", cm, obj) if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) } cm.display.selForContextMenu = null }
javascript
function makeChangeSingleDocInEditor(cm, change, spans) { let doc = cm.doc, display = cm.display, from = change.from, to = change.to let recomputeMaxLength = false, checkWidthStart = from.line if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) doc.iter(checkWidthStart, to.line + 1, line => { if (line == display.maxLine) { recomputeMaxLength = true return true } }) } if (doc.sel.contains(change.from, change.to) > -1) signalCursorActivity(cm) updateDoc(doc, change, spans, estimateHeight(cm)) if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, line => { let len = lineLength(line) if (len > display.maxLineLength) { display.maxLine = line display.maxLineLength = len display.maxLineChanged = true recomputeMaxLength = false } }) if (recomputeMaxLength) cm.curOp.updateMaxLine = true } retreatFrontier(doc, from.line) startWorker(cm, 400) let lendiff = change.text.length - (to.line - from.line) - 1 // Remember that these lines changed, for updating the display if (change.full) regChange(cm) else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) regLineChange(cm, from.line, "text") else regChange(cm, from.line, to.line + 1, lendiff) let changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change") if (changeHandler || changesHandler) { let obj = { from: from, to: to, text: change.text, removed: change.removed, origin: change.origin } if (changeHandler) signalLater(cm, "change", cm, obj) if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) } cm.display.selForContextMenu = null }
[ "function", "makeChangeSingleDocInEditor", "(", "cm", ",", "change", ",", "spans", ")", "{", "let", "doc", "=", "cm", ".", "doc", ",", "display", "=", "cm", ".", "display", ",", "from", "=", "change", ".", "from", ",", "to", "=", "change", ".", "to",...
Handle the interaction of a change to a document with the editor that this document is part of.
[ "Handle", "the", "interaction", "of", "a", "change", "to", "a", "document", "with", "the", "editor", "that", "this", "document", "is", "part", "of", "." ]
dab6f676107c10ba8d16c654a42f66cae3f27db1
https://github.com/codemirror/CodeMirror/blob/dab6f676107c10ba8d16c654a42f66cae3f27db1/src/model/changes.js#L209-L265
train
Make a change in the editor
[ 30522, 3853, 2191, 22305, 2229, 2075, 3709, 10085, 21280, 15660, 1006, 4642, 1010, 2689, 1010, 14798, 1007, 1063, 2292, 9986, 1027, 4642, 1012, 9986, 1010, 4653, 1027, 4642, 1012, 4653, 1010, 2013, 1027, 2689, 1012, 2013, 1010, 2000, 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...
ecomfe/zrender
build/babel-plugin-transform-modules-commonjs-ec.js
getModuleMetadata
function getModuleMetadata(programPath) { const localData = getLocalExportMetadata(programPath); const sourceData = new Map(); const getData = sourceNode => { const source = sourceNode.value; let data = sourceData.get(source); if (!data) { data = { name: programPath.scope.generateUidIdentifier( basename(source, extname(source)) ).name, interop: 'none', loc: null, // Data about the requested sources and names. imports: new Map(), // importsNamespace: import * as util from './a/b/util'; importsNamespace: new Set(), // Metadata about data that is passed directly from source to export. reexports: new Map(), reexportNamespace: new Set(), reexportAll: null, }; sourceData.set(source, data); } return data; }; programPath.get('body').forEach(child => { if (child.isImportDeclaration()) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } child.get('specifiers').forEach(spec => { if (spec.isImportDefaultSpecifier()) { const localName = spec.get('local').node.name; data.imports.set(localName, 'default'); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, 'default'); }); } } else if (spec.isImportNamespaceSpecifier()) { const localName = spec.get('local').node.name; assert( data.importsNamespace.size === 0, `Duplicate import namespace: ${localName}` ); data.importsNamespace.add(localName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexportNamespace.add(name); }); } } else if (spec.isImportSpecifier()) { const importName = spec.get('imported').node.name; const localName = spec.get('local').node.name; data.imports.set(localName, importName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, importName); }); } } }); } else if (child.isExportAllDeclaration()) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } data.reexportAll = { loc: child.node.loc, }; } else if (child.isExportNamedDeclaration() && child.node.source) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } child.get('specifiers').forEach(spec => { if (!spec.isExportSpecifier()) { throw spec.buildCodeFrameError('Unexpected export specifier type'); } const importName = spec.get('local').node.name; const exportName = spec.get('exported').node.name; data.reexports.set(exportName, importName); if (exportName === '__esModule') { throw exportName.buildCodeFrameError('Illegal export "__esModule".'); } }); } }); for (const metadata of sourceData.values()) { if (metadata.importsNamespace.size > 0) { metadata.interop = 'namespace'; continue; } let needsDefault = false; let needsNamed = false; for (const importName of metadata.imports.values()) { if (importName === 'default') { needsDefault = true; } else { needsNamed = true; } } for (const importName of metadata.reexports.values()) { if (importName === 'default') { needsDefault = true; } else { needsNamed = true; } } if (needsDefault && needsNamed) { // TODO(logan): Using the namespace interop here is unfortunate. Revisit. metadata.interop = 'namespace'; } else if (needsDefault) { metadata.interop = 'default'; } } return { local: localData, source: sourceData, }; }
javascript
function getModuleMetadata(programPath) { const localData = getLocalExportMetadata(programPath); const sourceData = new Map(); const getData = sourceNode => { const source = sourceNode.value; let data = sourceData.get(source); if (!data) { data = { name: programPath.scope.generateUidIdentifier( basename(source, extname(source)) ).name, interop: 'none', loc: null, // Data about the requested sources and names. imports: new Map(), // importsNamespace: import * as util from './a/b/util'; importsNamespace: new Set(), // Metadata about data that is passed directly from source to export. reexports: new Map(), reexportNamespace: new Set(), reexportAll: null, }; sourceData.set(source, data); } return data; }; programPath.get('body').forEach(child => { if (child.isImportDeclaration()) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } child.get('specifiers').forEach(spec => { if (spec.isImportDefaultSpecifier()) { const localName = spec.get('local').node.name; data.imports.set(localName, 'default'); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, 'default'); }); } } else if (spec.isImportNamespaceSpecifier()) { const localName = spec.get('local').node.name; assert( data.importsNamespace.size === 0, `Duplicate import namespace: ${localName}` ); data.importsNamespace.add(localName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexportNamespace.add(name); }); } } else if (spec.isImportSpecifier()) { const importName = spec.get('imported').node.name; const localName = spec.get('local').node.name; data.imports.set(localName, importName); const reexport = localData.get(localName); if (reexport) { localData.delete(localName); reexport.names.forEach(name => { data.reexports.set(name, importName); }); } } }); } else if (child.isExportAllDeclaration()) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } data.reexportAll = { loc: child.node.loc, }; } else if (child.isExportNamedDeclaration() && child.node.source) { const data = getData(child.node.source); if (!data.loc) { data.loc = child.node.loc; } child.get('specifiers').forEach(spec => { if (!spec.isExportSpecifier()) { throw spec.buildCodeFrameError('Unexpected export specifier type'); } const importName = spec.get('local').node.name; const exportName = spec.get('exported').node.name; data.reexports.set(exportName, importName); if (exportName === '__esModule') { throw exportName.buildCodeFrameError('Illegal export "__esModule".'); } }); } }); for (const metadata of sourceData.values()) { if (metadata.importsNamespace.size > 0) { metadata.interop = 'namespace'; continue; } let needsDefault = false; let needsNamed = false; for (const importName of metadata.imports.values()) { if (importName === 'default') { needsDefault = true; } else { needsNamed = true; } } for (const importName of metadata.reexports.values()) { if (importName === 'default') { needsDefault = true; } else { needsNamed = true; } } if (needsDefault && needsNamed) { // TODO(logan): Using the namespace interop here is unfortunate. Revisit. metadata.interop = 'namespace'; } else if (needsDefault) { metadata.interop = 'default'; } } return { local: localData, source: sourceData, }; }
[ "function", "getModuleMetadata", "(", "programPath", ")", "{", "const", "localData", "=", "getLocalExportMetadata", "(", "programPath", ")", ";", "const", "sourceData", "=", "new", "Map", "(", ")", ";", "const", "getData", "=", "sourceNode", "=>", "{", "const"...
Get metadata about the imports and exports present in this module.
[ "Get", "metadata", "about", "the", "imports", "and", "exports", "present", "in", "this", "module", "." ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/build/babel-plugin-transform-modules-commonjs-ec.js#L98-L257
train
Get module metadata
[ 30522, 3853, 2131, 5302, 8566, 16930, 12928, 2850, 2696, 1006, 2565, 15069, 1007, 1063, 9530, 3367, 2334, 2850, 2696, 1027, 2131, 4135, 9289, 10288, 6442, 11368, 8447, 2696, 1006, 2565, 15069, 1007, 1025, 9530, 3367, 23184, 6790, 1027, 2047...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FindUtils.js
_doReplaceOnDisk
function _doReplaceOnDisk(fullPath, matchInfo, replaceText, isRegexp) { var file = FileSystem.getFileForPath(fullPath); return DocumentManager.getDocumentText(file, true).then(function (contents, timestamp, lineEndings) { if (timestamp.getTime() !== matchInfo.timestamp.getTime()) { // Return a promise that we'll reject immediately. (We can't just return the // error since this is the success handler.) return new $.Deferred().reject(exports.ERROR_FILE_CHANGED).promise(); } // Note that this assumes that the matches are sorted. // TODO: is there a more efficient way to do this in a large string? var result = [], lastIndex = 0; matchInfo.matches.forEach(function (match) { if (match.isChecked) { result.push(contents.slice(lastIndex, match.startOffset)); result.push(isRegexp ? parseDollars(replaceText, match.result) : replaceText); lastIndex = match.endOffset; } }); result.push(contents.slice(lastIndex)); var newContents = result.join(""); // TODO: duplicated logic from Document - should refactor this? if (lineEndings === FileUtils.LINE_ENDINGS_CRLF) { newContents = newContents.replace(/\n/g, "\r\n"); } return Async.promisify(file, "write", newContents); }); }
javascript
function _doReplaceOnDisk(fullPath, matchInfo, replaceText, isRegexp) { var file = FileSystem.getFileForPath(fullPath); return DocumentManager.getDocumentText(file, true).then(function (contents, timestamp, lineEndings) { if (timestamp.getTime() !== matchInfo.timestamp.getTime()) { // Return a promise that we'll reject immediately. (We can't just return the // error since this is the success handler.) return new $.Deferred().reject(exports.ERROR_FILE_CHANGED).promise(); } // Note that this assumes that the matches are sorted. // TODO: is there a more efficient way to do this in a large string? var result = [], lastIndex = 0; matchInfo.matches.forEach(function (match) { if (match.isChecked) { result.push(contents.slice(lastIndex, match.startOffset)); result.push(isRegexp ? parseDollars(replaceText, match.result) : replaceText); lastIndex = match.endOffset; } }); result.push(contents.slice(lastIndex)); var newContents = result.join(""); // TODO: duplicated logic from Document - should refactor this? if (lineEndings === FileUtils.LINE_ENDINGS_CRLF) { newContents = newContents.replace(/\n/g, "\r\n"); } return Async.promisify(file, "write", newContents); }); }
[ "function", "_doReplaceOnDisk", "(", "fullPath", ",", "matchInfo", ",", "replaceText", ",", "isRegexp", ")", "{", "var", "file", "=", "FileSystem", ".", "getFileForPath", "(", "fullPath", ")", ";", "return", "DocumentManager", ".", "getDocumentText", "(", "file"...
Does a set of replacements in a single file on disk. @param {string} fullPath The full path to the file. @param {Object} matchInfo The match info for this file, as returned by `_addSearchMatches()`. @param {string} replaceText The text to replace each result with. @param {boolean=} isRegexp Whether the original query was a regexp. @return {$.Promise} A promise that's resolved when the replacement is finished or rejected with an error if there were one or more errors.
[ "Does", "a", "set", "of", "replacements", "in", "a", "single", "file", "on", "disk", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindUtils.js#L145-L175
train
Replace the text in the file at the given path.
[ 30522, 3853, 1035, 2079, 2890, 24759, 10732, 15422, 20573, 1006, 2440, 15069, 1010, 2674, 2378, 14876, 1010, 5672, 18209, 1010, 2003, 2890, 3351, 2595, 2361, 1007, 1063, 13075, 5371, 1027, 6764, 27268, 6633, 1012, 2131, 8873, 2571, 29278, 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...
Dogfalo/materialize
extras/noUiSlider/nouislider.js
Spectrum
function Spectrum ( entry, snap, direction, singleStep ) { this.xPct = []; this.xVal = []; this.xSteps = [ singleStep || false ]; this.xNumSteps = [ false ]; this.xHighestCompleteStep = []; this.snap = snap; this.direction = direction; var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ]; // Map the object keys to an array. for ( index in entry ) { if ( entry.hasOwnProperty(index) ) { ordered.push([entry[index], index]); } } // Sort all entries by value (numeric sort). if ( ordered.length && typeof ordered[0][0] === "object" ) { ordered.sort(function(a, b) { return a[0][0] - b[0][0]; }); } else { ordered.sort(function(a, b) { return a[0] - b[0]; }); } // Convert all entries to subranges. for ( index = 0; index < ordered.length; index++ ) { handleEntryPoint(ordered[index][1], ordered[index][0], this); } // Store the actual step values. // xSteps is sorted in the same order as xPct and xVal. this.xNumSteps = this.xSteps.slice(0); // Convert all numeric steps to the percentage of the subrange they represent. for ( index = 0; index < this.xNumSteps.length; index++ ) { handleStepPoint(index, this.xNumSteps[index], this); } }
javascript
function Spectrum ( entry, snap, direction, singleStep ) { this.xPct = []; this.xVal = []; this.xSteps = [ singleStep || false ]; this.xNumSteps = [ false ]; this.xHighestCompleteStep = []; this.snap = snap; this.direction = direction; var index, ordered = [ /* [0, 'min'], [1, '50%'], [2, 'max'] */ ]; // Map the object keys to an array. for ( index in entry ) { if ( entry.hasOwnProperty(index) ) { ordered.push([entry[index], index]); } } // Sort all entries by value (numeric sort). if ( ordered.length && typeof ordered[0][0] === "object" ) { ordered.sort(function(a, b) { return a[0][0] - b[0][0]; }); } else { ordered.sort(function(a, b) { return a[0] - b[0]; }); } // Convert all entries to subranges. for ( index = 0; index < ordered.length; index++ ) { handleEntryPoint(ordered[index][1], ordered[index][0], this); } // Store the actual step values. // xSteps is sorted in the same order as xPct and xVal. this.xNumSteps = this.xSteps.slice(0); // Convert all numeric steps to the percentage of the subrange they represent. for ( index = 0; index < this.xNumSteps.length; index++ ) { handleStepPoint(index, this.xNumSteps[index], this); } }
[ "function", "Spectrum", "(", "entry", ",", "snap", ",", "direction", ",", "singleStep", ")", "{", "this", ".", "xPct", "=", "[", "]", ";", "this", ".", "xVal", "=", "[", "]", ";", "this", ".", "xSteps", "=", "[", "singleStep", "||", "false", "]", ...
The interface to Spectrum handles all direction-based conversions, so the above values are unaware.
[ "The", "interface", "to", "Spectrum", "handles", "all", "direction", "-", "based", "conversions", "so", "the", "above", "values", "are", "unaware", "." ]
1122efadad8f1433d404696f7613e3cc13fb83a4
https://github.com/Dogfalo/materialize/blob/1122efadad8f1433d404696f7613e3cc13fb83a4/extras/noUiSlider/nouislider.js#L352-L393
train
Spectrum constructor.
[ 30522, 3853, 8674, 1006, 4443, 1010, 10245, 1010, 3257, 1010, 3895, 2618, 2361, 1007, 1063, 2023, 1012, 26726, 6593, 1027, 1031, 1033, 1025, 2023, 1012, 15566, 2389, 1027, 1031, 1033, 1025, 2023, 1012, 1060, 13473, 4523, 1027, 1031, 3895, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/sidenav/sidenav.js
updateIsLocked
function updateIsLocked(isLocked, oldValue) { scope.isLockedOpen = isLocked; if (isLocked === oldValue) { element.toggleClass('md-locked-open', !!isLocked); } else { $animate[isLocked ? 'addClass' : 'removeClass'](element, 'md-locked-open'); } if (backdrop) { backdrop.toggleClass('md-locked-open', !!isLocked); } }
javascript
function updateIsLocked(isLocked, oldValue) { scope.isLockedOpen = isLocked; if (isLocked === oldValue) { element.toggleClass('md-locked-open', !!isLocked); } else { $animate[isLocked ? 'addClass' : 'removeClass'](element, 'md-locked-open'); } if (backdrop) { backdrop.toggleClass('md-locked-open', !!isLocked); } }
[ "function", "updateIsLocked", "(", "isLocked", ",", "oldValue", ")", "{", "scope", ".", "isLockedOpen", "=", "isLocked", ";", "if", "(", "isLocked", "===", "oldValue", ")", "{", "element", ".", "toggleClass", "(", "'md-locked-open'", ",", "!", "!", "isLocked...
Toggle the DOM classes to indicate `locked` @param isLocked @param oldValue
[ "Toggle", "the", "DOM", "classes", "to", "indicate", "locked" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L351-L361
train
Update the isLocked state of the
[ 30522, 3853, 10651, 2483, 7878, 2098, 1006, 2003, 7878, 2098, 1010, 2214, 10175, 5657, 1007, 1063, 9531, 1012, 2003, 7878, 26010, 11837, 1027, 2003, 7878, 2098, 1025, 2065, 1006, 2003, 7878, 2098, 1027, 1027, 1027, 2214, 10175, 5657, 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...
babel/babel
packages/babel-traverse/src/path/conversion.js
getSuperPropBinding
function getSuperPropBinding(thisEnvFn, isAssignment, propName) { const op = isAssignment ? "set" : "get"; return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => { const argsList = []; let fnBody; if (propName) { // () => super.foo fnBody = t.memberExpression(t.super(), t.identifier(propName)); } else { const method = thisEnvFn.scope.generateUidIdentifier("prop"); // (method) => super[method] argsList.unshift(method); fnBody = t.memberExpression( t.super(), t.identifier(method.name), true /* computed */, ); } if (isAssignment) { const valueIdent = thisEnvFn.scope.generateUidIdentifier("value"); argsList.push(valueIdent); fnBody = t.assignmentExpression( "=", fnBody, t.identifier(valueIdent.name), ); } return t.arrowFunctionExpression(argsList, fnBody); }); }
javascript
function getSuperPropBinding(thisEnvFn, isAssignment, propName) { const op = isAssignment ? "set" : "get"; return getBinding(thisEnvFn, `superprop_${op}:${propName || ""}`, () => { const argsList = []; let fnBody; if (propName) { // () => super.foo fnBody = t.memberExpression(t.super(), t.identifier(propName)); } else { const method = thisEnvFn.scope.generateUidIdentifier("prop"); // (method) => super[method] argsList.unshift(method); fnBody = t.memberExpression( t.super(), t.identifier(method.name), true /* computed */, ); } if (isAssignment) { const valueIdent = thisEnvFn.scope.generateUidIdentifier("value"); argsList.push(valueIdent); fnBody = t.assignmentExpression( "=", fnBody, t.identifier(valueIdent.name), ); } return t.arrowFunctionExpression(argsList, fnBody); }); }
[ "function", "getSuperPropBinding", "(", "thisEnvFn", ",", "isAssignment", ",", "propName", ")", "{", "const", "op", "=", "isAssignment", "?", "\"set\"", ":", "\"get\"", ";", "return", "getBinding", "(", "thisEnvFn", ",", "`", "${", "op", "}", "${", "propName...
Create a binding for a function that will call "super.foo" or "super[foo]".
[ "Create", "a", "binding", "for", "a", "function", "that", "will", "call", "super", ".", "foo", "or", "super", "[", "foo", "]", "." ]
1969e6b6aa7d90be3fbb3aca98ea96849656a55a
https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-traverse/src/path/conversion.js#L520-L554
train
Get the binding for the super property
[ 30522, 3853, 4152, 6279, 2121, 21572, 2361, 8428, 4667, 1006, 2023, 2368, 2615, 2546, 2078, 1010, 18061, 18719, 16206, 3672, 1010, 17678, 18442, 1007, 1063, 9530, 3367, 6728, 1027, 18061, 18719, 16206, 3672, 1029, 1000, 2275, 1000, 1024, 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...
facebook/create-react-app
packages/create-react-app/createReactApp.js
isSafeToCreateProjectIn
function isSafeToCreateProjectIn(root, name) { const validFiles = [ '.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE', '.hg', '.hgignore', '.hgcheck', '.npmignore', 'mkdocs.yml', 'docs', '.travis.yml', '.gitlab-ci.yml', '.gitattributes', ]; console.log(); const conflicts = fs .readdirSync(root) .filter(file => !validFiles.includes(file)) // IntelliJ IDEA creates module files before CRA is launched .filter(file => !/\.iml$/.test(file)) // Don't treat log files from previous installation as conflicts .filter( file => !errorLogFilePatterns.some(pattern => file.indexOf(pattern) === 0) ); if (conflicts.length > 0) { console.log( `The directory ${chalk.green(name)} contains files that could conflict:` ); console.log(); for (const file of conflicts) { console.log(` ${file}`); } console.log(); console.log( 'Either try using a new directory name, or remove the files listed above.' ); return false; } // Remove any remnant files from a previous installation const currentFiles = fs.readdirSync(path.join(root)); currentFiles.forEach(file => { errorLogFilePatterns.forEach(errorLogFilePattern => { // This will catch `(npm-debug|yarn-error|yarn-debug).log*` files if (file.indexOf(errorLogFilePattern) === 0) { fs.removeSync(path.join(root, file)); } }); }); return true; }
javascript
function isSafeToCreateProjectIn(root, name) { const validFiles = [ '.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE', '.hg', '.hgignore', '.hgcheck', '.npmignore', 'mkdocs.yml', 'docs', '.travis.yml', '.gitlab-ci.yml', '.gitattributes', ]; console.log(); const conflicts = fs .readdirSync(root) .filter(file => !validFiles.includes(file)) // IntelliJ IDEA creates module files before CRA is launched .filter(file => !/\.iml$/.test(file)) // Don't treat log files from previous installation as conflicts .filter( file => !errorLogFilePatterns.some(pattern => file.indexOf(pattern) === 0) ); if (conflicts.length > 0) { console.log( `The directory ${chalk.green(name)} contains files that could conflict:` ); console.log(); for (const file of conflicts) { console.log(` ${file}`); } console.log(); console.log( 'Either try using a new directory name, or remove the files listed above.' ); return false; } // Remove any remnant files from a previous installation const currentFiles = fs.readdirSync(path.join(root)); currentFiles.forEach(file => { errorLogFilePatterns.forEach(errorLogFilePattern => { // This will catch `(npm-debug|yarn-error|yarn-debug).log*` files if (file.indexOf(errorLogFilePattern) === 0) { fs.removeSync(path.join(root, file)); } }); }); return true; }
[ "function", "isSafeToCreateProjectIn", "(", "root", ",", "name", ")", "{", "const", "validFiles", "=", "[", "'.DS_Store'", ",", "'Thumbs.db'", ",", "'.git'", ",", "'.gitignore'", ",", "'.idea'", ",", "'README.md'", ",", "'LICENSE'", ",", "'.hg'", ",", "'.hgign...
If project only contains files generated by GH, it’s safe. Also, if project contains remnant error logs from a previous installation, lets remove them now. We also special case IJ-based products .idea because it integrates with CRA: https://github.com/facebook/create-react-app/pull/368#issuecomment-243446094
[ "If", "project", "only", "contains", "files", "generated", "by", "GH", "it’s", "safe", ".", "Also", "if", "project", "contains", "remnant", "error", "logs", "from", "a", "previous", "installation", "lets", "remove", "them", "now", ".", "We", "also", "special...
57ef103440c24e41b0d7dc82b7ad7fc1dc817eca
https://github.com/facebook/create-react-app/blob/57ef103440c24e41b0d7dc82b7ad7fc1dc817eca/packages/create-react-app/createReactApp.js#L791-L849
train
Checks if the project is safe to create
[ 30522, 3853, 26354, 10354, 18903, 16748, 3686, 21572, 20614, 2378, 1006, 7117, 1010, 2171, 1007, 1063, 9530, 3367, 9398, 8873, 4244, 1027, 1031, 1005, 1012, 16233, 1035, 3573, 1005, 1010, 1005, 16784, 1012, 16962, 1005, 1010, 1005, 1012, 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...
vuejs/vue-devtools
src/backend/index.js
processState
function processState (instance) { const props = isLegacy ? instance._props : instance.$options.props const getters = instance.$options.vuex && instance.$options.vuex.getters return Object.keys(instance._data) .filter(key => ( !(props && key in props) && !(getters && key in getters) )) .map(key => ({ key, value: instance._data[key], editable: true })) }
javascript
function processState (instance) { const props = isLegacy ? instance._props : instance.$options.props const getters = instance.$options.vuex && instance.$options.vuex.getters return Object.keys(instance._data) .filter(key => ( !(props && key in props) && !(getters && key in getters) )) .map(key => ({ key, value: instance._data[key], editable: true })) }
[ "function", "processState", "(", "instance", ")", "{", "const", "props", "=", "isLegacy", "?", "instance", ".", "_props", ":", "instance", ".", "$options", ".", "props", "const", "getters", "=", "instance", ".", "$options", ".", "vuex", "&&", "instance", "...
Process state, filtering out props and "clean" the result with a JSON dance. This removes functions which can cause errors during structured clone used by window.postMessage. @param {Vue} instance @return {Array}
[ "Process", "state", "filtering", "out", "props", "and", "clean", "the", "result", "with", "a", "JSON", "dance", ".", "This", "removes", "functions", "which", "can", "cause", "errors", "during", "structured", "clone", "used", "by", "window", ".", "postMessage",...
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L680-L697
train
Process state of the object
[ 30522, 3853, 2832, 9153, 2618, 1006, 6013, 1007, 1063, 9530, 3367, 24387, 1027, 8842, 3654, 5666, 1029, 6013, 1012, 1035, 24387, 1024, 6013, 1012, 1002, 7047, 1012, 24387, 9530, 3367, 2131, 7747, 1027, 6013, 1012, 1002, 7047, 1012, 24728, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/FileFilters.js
editFilter
function editFilter(filter, index) { var lastFocus = window.document.activeElement; var templateVars = { instruction: StringUtils.format(Strings.FILE_FILTER_INSTRUCTIONS, brackets.config.glob_help_url), Strings: Strings }; var dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(EditFilterTemplate, templateVars)), $nameField = dialog.getElement().find(".exclusions-name"), $editField = dialog.getElement().find(".exclusions-editor"), $remainingField = dialog.getElement().find(".exclusions-name-characters-remaining"); $nameField.val(filter.name); $editField.val(filter.patterns.join("\n")).focus(); function getValue() { var newFilter = $editField.val().split("\n"); // Remove blank lines return newFilter.filter(function (glob) { return glob.trim().length; }); } $nameField.bind('input', function () { var remainingCharacters = FILTER_NAME_CHARACTER_MAX - $(this).val().length; if (remainingCharacters < 0.25*FILTER_NAME_CHARACTER_MAX) { $remainingField.show(); $remainingField.text(StringUtils.format( Strings.FILTER_NAME_REMAINING, remainingCharacters )); if (remainingCharacters < 0) { $remainingField.addClass("exclusions-name-characters-limit-reached"); } else { $remainingField.removeClass("exclusions-name-characters-limit-reached"); } } else { $remainingField.hide(); } updatePrimaryButton(); }); dialog.done(function (buttonId) { if (buttonId === Dialogs.DIALOG_BTN_OK) { // Update saved filter preference setActiveFilter({ name: $nameField.val(), patterns: getValue() }, index); _updatePicker(); _doPopulate(); } lastFocus.focus(); // restore focus to old pos }); // Code to update the file count readout at bottom of dialog (if context provided) var $fileCount = dialog.getElement().find(".exclusions-filecount"); function updateFileCount() { _context.promise.done(function (files) { var filter = getValue(); if (filter.length) { var filtered = filterFileList(compile(filter), files); $fileCount.html(StringUtils.format(Strings.FILTER_FILE_COUNT, filtered.length, files.length, _context.label)); } else { $fileCount.html(StringUtils.format(Strings.FILTER_FILE_COUNT_ALL, files.length, _context.label)); } }); } // Code to enable/disable the OK button at the bottom of dialog (whether filter is empty or not) var $primaryBtn = dialog.getElement().find(".primary"); function updatePrimaryButton() { var trimmedValue = $editField.val().trim(); var exclusionNameLength = $nameField.val().length; $primaryBtn.prop("disabled", !trimmedValue.length || (exclusionNameLength > FILTER_NAME_CHARACTER_MAX)); } $editField.on("input", updatePrimaryButton); updatePrimaryButton(); if (_context) { $editField.on("input", _.debounce(updateFileCount, 400)); updateFileCount(); } else { $fileCount.hide(); } return dialog.getPromise(); }
javascript
function editFilter(filter, index) { var lastFocus = window.document.activeElement; var templateVars = { instruction: StringUtils.format(Strings.FILE_FILTER_INSTRUCTIONS, brackets.config.glob_help_url), Strings: Strings }; var dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(EditFilterTemplate, templateVars)), $nameField = dialog.getElement().find(".exclusions-name"), $editField = dialog.getElement().find(".exclusions-editor"), $remainingField = dialog.getElement().find(".exclusions-name-characters-remaining"); $nameField.val(filter.name); $editField.val(filter.patterns.join("\n")).focus(); function getValue() { var newFilter = $editField.val().split("\n"); // Remove blank lines return newFilter.filter(function (glob) { return glob.trim().length; }); } $nameField.bind('input', function () { var remainingCharacters = FILTER_NAME_CHARACTER_MAX - $(this).val().length; if (remainingCharacters < 0.25*FILTER_NAME_CHARACTER_MAX) { $remainingField.show(); $remainingField.text(StringUtils.format( Strings.FILTER_NAME_REMAINING, remainingCharacters )); if (remainingCharacters < 0) { $remainingField.addClass("exclusions-name-characters-limit-reached"); } else { $remainingField.removeClass("exclusions-name-characters-limit-reached"); } } else { $remainingField.hide(); } updatePrimaryButton(); }); dialog.done(function (buttonId) { if (buttonId === Dialogs.DIALOG_BTN_OK) { // Update saved filter preference setActiveFilter({ name: $nameField.val(), patterns: getValue() }, index); _updatePicker(); _doPopulate(); } lastFocus.focus(); // restore focus to old pos }); // Code to update the file count readout at bottom of dialog (if context provided) var $fileCount = dialog.getElement().find(".exclusions-filecount"); function updateFileCount() { _context.promise.done(function (files) { var filter = getValue(); if (filter.length) { var filtered = filterFileList(compile(filter), files); $fileCount.html(StringUtils.format(Strings.FILTER_FILE_COUNT, filtered.length, files.length, _context.label)); } else { $fileCount.html(StringUtils.format(Strings.FILTER_FILE_COUNT_ALL, files.length, _context.label)); } }); } // Code to enable/disable the OK button at the bottom of dialog (whether filter is empty or not) var $primaryBtn = dialog.getElement().find(".primary"); function updatePrimaryButton() { var trimmedValue = $editField.val().trim(); var exclusionNameLength = $nameField.val().length; $primaryBtn.prop("disabled", !trimmedValue.length || (exclusionNameLength > FILTER_NAME_CHARACTER_MAX)); } $editField.on("input", updatePrimaryButton); updatePrimaryButton(); if (_context) { $editField.on("input", _.debounce(updateFileCount, 400)); updateFileCount(); } else { $fileCount.hide(); } return dialog.getPromise(); }
[ "function", "editFilter", "(", "filter", ",", "index", ")", "{", "var", "lastFocus", "=", "window", ".", "document", ".", "activeElement", ";", "var", "templateVars", "=", "{", "instruction", ":", "StringUtils", ".", "format", "(", "Strings", ".", "FILE_FILT...
Opens a dialog box to edit the given filter. When editing is finished, the value of getActiveFilter() changes to reflect the edits. If the dialog was canceled, the preference is left unchanged. @param {!{name: string, patterns: Array.<string>}} filter @param {number} index The index of the filter set to be edited or created. The value is -1 if it is for a new one to be created. @return {!$.Promise} Dialog box promise
[ "Opens", "a", "dialog", "box", "to", "edit", "the", "given", "filter", ".", "When", "editing", "is", "finished", "the", "value", "of", "getActiveFilter", "()", "changes", "to", "reflect", "the", "edits", ".", "If", "the", "dialog", "was", "canceled", "the"...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FileFilters.js#L323-L415
train
Edit filter
[ 30522, 3853, 10086, 8873, 21928, 1006, 11307, 1010, 5950, 1007, 1063, 13075, 2197, 14876, 7874, 1027, 3332, 1012, 6254, 1012, 3161, 12260, 3672, 1025, 13075, 23561, 10755, 2015, 1027, 1063, 7899, 1024, 5164, 21823, 4877, 1012, 4289, 1006, 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...
benweet/stackedit
src/libs/pagedown.js
function (wholeMatch, before, inner, afterInner, id, end) { inner = inner.replace(regex, getLink); if (defsToAdd[id]) { addDefNumber(defsToAdd[id]); return before + inner + afterInner + refNumber + end; } return wholeMatch; }
javascript
function (wholeMatch, before, inner, afterInner, id, end) { inner = inner.replace(regex, getLink); if (defsToAdd[id]) { addDefNumber(defsToAdd[id]); return before + inner + afterInner + refNumber + end; } return wholeMatch; }
[ "function", "(", "wholeMatch", ",", "before", ",", "inner", ",", "afterInner", ",", "id", ",", "end", ")", "{", "inner", "=", "inner", ".", "replace", "(", "regex", ",", "getLink", ")", ";", "if", "(", "defsToAdd", "[", "id", "]", ")", "{", "addDef...
note that a) the recursive call to getLink cannot go infinite, because by definition of regex, inner is always a proper substring of wholeMatch, and b) more than one level of nesting is neither supported by the regex nor making a lot of sense (the only use case for nesting is a linked image)
[ "note", "that", "a", ")", "the", "recursive", "call", "to", "getLink", "cannot", "go", "infinite", "because", "by", "definition", "of", "regex", "inner", "is", "always", "a", "proper", "substring", "of", "wholeMatch", "and", "b", ")", "more", "than", "one"...
91f8cf3c10b75df65b69f9181cee8151d65a788d
https://github.com/benweet/stackedit/blob/91f8cf3c10b75df65b69f9181cee8151d65a788d/src/libs/pagedown.js#L657-L664
train
add reference number
[ 30522, 3853, 1006, 2878, 18900, 2818, 1010, 2077, 1010, 5110, 1010, 2044, 23111, 2121, 1010, 8909, 1010, 2203, 1007, 1063, 5110, 1027, 5110, 1012, 5672, 1006, 19723, 10288, 1010, 2131, 13767, 1007, 1025, 2065, 1006, 13366, 16033, 4215, 2094...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
_poolCreate
function _poolCreate() { // implementation is copy-pasted from https://github.com/tediousjs/node-mssql/pull/614 return new base.Promise((resolve, reject) => { const cfg = { userName: this.config.user, password: this.config.password, server: this.config.server, options: Object.assign({}, this.config.options), domain: this.config.domain, }; cfg.options.database = this.config.database; cfg.options.port = this.config.port; cfg.options.connectTimeout = this.config.connectionTimeout || this.config.timeout || 15000; cfg.options.requestTimeout = this.config.requestTimeout != null ? this.config.requestTimeout : 15000; cfg.options.tdsVersion = cfg.options.tdsVersion || '7_4'; cfg.options.rowCollectionOnDone = false; cfg.options.rowCollectionOnRequestCompletion = false; cfg.options.useColumnNames = false; cfg.options.appName = cfg.options.appName || 'node-mssql'; // tedious always connect via tcp when port is specified if (cfg.options.instanceName) delete cfg.options.port; if (isNaN(cfg.options.requestTimeout)) cfg.options.requestTimeout = 15000; if (cfg.options.requestTimeout === Infinity) cfg.options.requestTimeout = 0; if (cfg.options.requestTimeout < 0) cfg.options.requestTimeout = 0; if (this.config.debug) { cfg.options.debug = { packet: true, token: true, data: true, payload: true, }; } const tedious = new tds.Connection(cfg); // prevent calling resolve again on end event let alreadyResolved = false; function safeResolve(err) { if (!alreadyResolved) { alreadyResolved = true; resolve(err); } } function safeReject(err) { if (!alreadyResolved) { alreadyResolved = true; reject(err); } } tedious.once('end', (evt) => { safeReject( new base.ConnectionError( 'Connection ended unexpectedly during connecting' ) ); }); tedious.once('connect', (err) => { if (err) { err = new base.ConnectionError(err); return safeReject(err); } safeResolve(tedious); }); tedious.on('error', (err) => { if (err.code === 'ESOCKET') { tedious.hasError = true; return; } this.emit('error', err); }); if (this.config.debug) { tedious.on('debug', this.emit.bind(this, 'debug', tedious)); } }); }
javascript
function _poolCreate() { // implementation is copy-pasted from https://github.com/tediousjs/node-mssql/pull/614 return new base.Promise((resolve, reject) => { const cfg = { userName: this.config.user, password: this.config.password, server: this.config.server, options: Object.assign({}, this.config.options), domain: this.config.domain, }; cfg.options.database = this.config.database; cfg.options.port = this.config.port; cfg.options.connectTimeout = this.config.connectionTimeout || this.config.timeout || 15000; cfg.options.requestTimeout = this.config.requestTimeout != null ? this.config.requestTimeout : 15000; cfg.options.tdsVersion = cfg.options.tdsVersion || '7_4'; cfg.options.rowCollectionOnDone = false; cfg.options.rowCollectionOnRequestCompletion = false; cfg.options.useColumnNames = false; cfg.options.appName = cfg.options.appName || 'node-mssql'; // tedious always connect via tcp when port is specified if (cfg.options.instanceName) delete cfg.options.port; if (isNaN(cfg.options.requestTimeout)) cfg.options.requestTimeout = 15000; if (cfg.options.requestTimeout === Infinity) cfg.options.requestTimeout = 0; if (cfg.options.requestTimeout < 0) cfg.options.requestTimeout = 0; if (this.config.debug) { cfg.options.debug = { packet: true, token: true, data: true, payload: true, }; } const tedious = new tds.Connection(cfg); // prevent calling resolve again on end event let alreadyResolved = false; function safeResolve(err) { if (!alreadyResolved) { alreadyResolved = true; resolve(err); } } function safeReject(err) { if (!alreadyResolved) { alreadyResolved = true; reject(err); } } tedious.once('end', (evt) => { safeReject( new base.ConnectionError( 'Connection ended unexpectedly during connecting' ) ); }); tedious.once('connect', (err) => { if (err) { err = new base.ConnectionError(err); return safeReject(err); } safeResolve(tedious); }); tedious.on('error', (err) => { if (err.code === 'ESOCKET') { tedious.hasError = true; return; } this.emit('error', err); }); if (this.config.debug) { tedious.on('debug', this.emit.bind(this, 'debug', tedious)); } }); }
[ "function", "_poolCreate", "(", ")", "{", "// implementation is copy-pasted from https://github.com/tediousjs/node-mssql/pull/614", "return", "new", "base", ".", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "cfg", "=", "{", "userName", ":", ...
/* istanbul ignore next
[ "/", "*", "istanbul", "ignore", "next" ]
6a4fecfe7822442ee5c43d924958eadfe6e17a93
https://github.com/tgriesser/knex/blob/6a4fecfe7822442ee5c43d924958eadfe6e17a93/src/dialects/mssql/index.js#L89-L179
train
Creates a connection to the database using the specified parameters
[ 30522, 3853, 1035, 4770, 16748, 3686, 1006, 1007, 1063, 1013, 1013, 7375, 2003, 6100, 1011, 19351, 2094, 2013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 6945, 6313, 22578, 1013, 13045, 1011, 5796, 2015, 4160, 2140, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/services/s3.js
extractData
function extractData(resp) { var req = resp.request; if (req.operation === 'getBucketLocation') { var match = resp.httpResponse.body.toString().match(/>(.+)<\/Location/); delete resp.data['_']; if (match) { resp.data.LocationConstraint = match[1]; } else { resp.data.LocationConstraint = ''; } } var bucket = req.params.Bucket || null; if (req.operation === 'deleteBucket' && typeof bucket === 'string' && !resp.error) { req.service.clearBucketRegionCache(bucket); } else { var headers = resp.httpResponse.headers || {}; var region = headers['x-amz-bucket-region'] || null; if (!region && req.operation === 'createBucket' && !resp.error) { var createBucketConfiguration = req.params.CreateBucketConfiguration; if (!createBucketConfiguration) { region = 'us-east-1'; } else if (createBucketConfiguration.LocationConstraint === 'EU') { region = 'eu-west-1'; } else { region = createBucketConfiguration.LocationConstraint; } } if (region) { if (bucket && region !== req.service.bucketRegionCache[bucket]) { req.service.bucketRegionCache[bucket] = region; } } } req.service.extractRequestIds(resp); }
javascript
function extractData(resp) { var req = resp.request; if (req.operation === 'getBucketLocation') { var match = resp.httpResponse.body.toString().match(/>(.+)<\/Location/); delete resp.data['_']; if (match) { resp.data.LocationConstraint = match[1]; } else { resp.data.LocationConstraint = ''; } } var bucket = req.params.Bucket || null; if (req.operation === 'deleteBucket' && typeof bucket === 'string' && !resp.error) { req.service.clearBucketRegionCache(bucket); } else { var headers = resp.httpResponse.headers || {}; var region = headers['x-amz-bucket-region'] || null; if (!region && req.operation === 'createBucket' && !resp.error) { var createBucketConfiguration = req.params.CreateBucketConfiguration; if (!createBucketConfiguration) { region = 'us-east-1'; } else if (createBucketConfiguration.LocationConstraint === 'EU') { region = 'eu-west-1'; } else { region = createBucketConfiguration.LocationConstraint; } } if (region) { if (bucket && region !== req.service.bucketRegionCache[bucket]) { req.service.bucketRegionCache[bucket] = region; } } } req.service.extractRequestIds(resp); }
[ "function", "extractData", "(", "resp", ")", "{", "var", "req", "=", "resp", ".", "request", ";", "if", "(", "req", ".", "operation", "===", "'getBucketLocation'", ")", "{", "var", "match", "=", "resp", ".", "httpResponse", ".", "body", ".", "toString", ...
Provides a specialized parser for getBucketLocation -- all other operations are parsed by the super class. @api private
[ "Provides", "a", "specialized", "parser", "for", "getBucketLocation", "--", "all", "other", "operations", "are", "parsed", "by", "the", "super", "class", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/services/s3.js#L496-L530
train
Extract data from the response
[ 30522, 3853, 14817, 2850, 2696, 1006, 24501, 2361, 1007, 1063, 13075, 2128, 4160, 1027, 24501, 2361, 1012, 5227, 1025, 2065, 1006, 2128, 4160, 1012, 3169, 1027, 1027, 1027, 1005, 2131, 24204, 3388, 4135, 10719, 1005, 1007, 1063, 13075, 2674...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/PerfUtils.js
getHealthReport
function getHealthReport() { var healthReport = { projectLoadTimes : "", fileOpenTimes : "" }; _.forEach(perfData, function (entry, testName) { if (StringUtils.startsWith(testName, "Application Startup")) { healthReport.AppStartupTime = getValueAsString(entry); } else if (StringUtils.startsWith(testName, "brackets module dependencies resolved")) { healthReport.ModuleDepsResolved = getValueAsString(entry); } else if (StringUtils.startsWith(testName, "Load Project")) { healthReport.projectLoadTimes += ":" + getValueAsString(entry, true); } else if (StringUtils.startsWith(testName, "Open File")) { healthReport.fileOpenTimes += ":" + getValueAsString(entry, true); } }); return healthReport; }
javascript
function getHealthReport() { var healthReport = { projectLoadTimes : "", fileOpenTimes : "" }; _.forEach(perfData, function (entry, testName) { if (StringUtils.startsWith(testName, "Application Startup")) { healthReport.AppStartupTime = getValueAsString(entry); } else if (StringUtils.startsWith(testName, "brackets module dependencies resolved")) { healthReport.ModuleDepsResolved = getValueAsString(entry); } else if (StringUtils.startsWith(testName, "Load Project")) { healthReport.projectLoadTimes += ":" + getValueAsString(entry, true); } else if (StringUtils.startsWith(testName, "Open File")) { healthReport.fileOpenTimes += ":" + getValueAsString(entry, true); } }); return healthReport; }
[ "function", "getHealthReport", "(", ")", "{", "var", "healthReport", "=", "{", "projectLoadTimes", ":", "\"\"", ",", "fileOpenTimes", ":", "\"\"", "}", ";", "_", ".", "forEach", "(", "perfData", ",", "function", "(", "entry", ",", "testName", ")", "{", "...
Returns the Performance metrics to be logged for health report @return {Object} An object with the health data logs to be sent
[ "Returns", "the", "Performance", "metrics", "to", "be", "logged", "for", "health", "report" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/PerfUtils.js#L368-L387
train
Get health report
[ 30522, 3853, 2131, 20192, 24658, 2890, 6442, 1006, 1007, 1063, 13075, 2740, 2890, 6442, 1027, 1063, 2622, 11066, 7292, 2015, 1024, 1000, 1000, 1010, 5371, 26915, 7292, 2015, 1024, 1000, 1000, 1065, 1025, 1035, 1012, 18921, 6776, 1006, 2566,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
summernote/summernote
src/js/base/core/lists.js
contains
function contains(array, item) { if (array && array.length && item) { return array.indexOf(item) !== -1; } return false; }
javascript
function contains(array, item) { if (array && array.length && item) { return array.indexOf(item) !== -1; } return false; }
[ "function", "contains", "(", "array", ",", "item", ")", "{", "if", "(", "array", "&&", "array", ".", "length", "&&", "item", ")", "{", "return", "array", ".", "indexOf", "(", "item", ")", "!==", "-", "1", ";", "}", "return", "false", ";", "}" ]
returns true if the value is present in the list.
[ "returns", "true", "if", "the", "value", "is", "present", "in", "the", "list", "." ]
8dcafb8107453006b905ef697a529c42e76beb3f
https://github.com/summernote/summernote/blob/8dcafb8107453006b905ef697a529c42e76beb3f/src/js/base/core/lists.js#L66-L71
train
Returns true if the given item is in the array
[ 30522, 3853, 3397, 1006, 9140, 1010, 8875, 1007, 1063, 2065, 1006, 9140, 1004, 1004, 9140, 1012, 3091, 1004, 1004, 8875, 1007, 1063, 2709, 9140, 1012, 5950, 11253, 1006, 8875, 1007, 999, 1027, 1027, 1011, 1015, 1025, 1065, 2709, 6270, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js
getBindings
function getBindings(oElement, oParentDefaultModel, bTemplate, sAggregationName) { var aBindings = ( bTemplate ? getBindingsFromTemplateProperties(oElement) : getBindingsFromProperties(oElement, oParentDefaultModel) ); var aAggregationNames = sAggregationName ? [ sAggregationName ] : Object.keys(oElement.getMetadata().getAllAggregations()); aAggregationNames.forEach(function (sAggregationNameInLoop) { aBindings = aBindings.concat(getBindingsForAggregation(oElement, oParentDefaultModel, bTemplate, sAggregationNameInLoop)); }); return aBindings; }
javascript
function getBindings(oElement, oParentDefaultModel, bTemplate, sAggregationName) { var aBindings = ( bTemplate ? getBindingsFromTemplateProperties(oElement) : getBindingsFromProperties(oElement, oParentDefaultModel) ); var aAggregationNames = sAggregationName ? [ sAggregationName ] : Object.keys(oElement.getMetadata().getAllAggregations()); aAggregationNames.forEach(function (sAggregationNameInLoop) { aBindings = aBindings.concat(getBindingsForAggregation(oElement, oParentDefaultModel, bTemplate, sAggregationNameInLoop)); }); return aBindings; }
[ "function", "getBindings", "(", "oElement", ",", "oParentDefaultModel", ",", "bTemplate", ",", "sAggregationName", ")", "{", "var", "aBindings", "=", "(", "bTemplate", "?", "getBindingsFromTemplateProperties", "(", "oElement", ")", ":", "getBindingsFromProperties", "(...
Gets bindings for the whole hierarchy of children for a specified Element and filters out bindings which are not relevant (based on the parent model) @param {sap.ui.core.Control} oElement - Starting point of the search @param {sap.ui.model.Model} oParentDefaultModel - Model for filtering irrelevant binding paths @param {boolean} [bTemplate] - Whether we should consider provided element as a template @param {string} [sAggregationName] - if aggregation name is given then only for this aggregation bindings are returned, if not then all aggregations are considered @returns {Array} - returns array with all relevant bindings for all properties of the element @private
[ "Gets", "bindings", "for", "the", "whole", "hierarchy", "of", "children", "for", "a", "specified", "Element", "and", "filters", "out", "bindings", "which", "are", "not", "relevant", "(", "based", "on", "the", "parent", "model", ")" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/util/BindingsExtractor.js#L90-L103
train
Get bindings for the given element
[ 30522, 3853, 2131, 8428, 4667, 2015, 1006, 1051, 12260, 3672, 1010, 6728, 12069, 3372, 3207, 7011, 11314, 5302, 9247, 1010, 18411, 6633, 15725, 1010, 7842, 13871, 2890, 12540, 18442, 1007, 1063, 13075, 11113, 22254, 8613, 1027, 1006, 18411, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js
relayRefetchableFragmentTransform
function relayRefetchableFragmentTransform( context: GraphQLCompilerContext, ): GraphQLCompilerContext { const schema = context.serverSchema; const queryType = schema.getQueryType(); if (queryType == null) { throw createUserError('Expected the schema to define a query type.'); } const refetchOperations = buildRefetchMap(context); let nextContext = context; const errors = eachWithErrors( refetchOperations, ([refetchName, fragment]) => { // Build a refetch operation according to the fragment's type: // the logic here is purely name-based, the actual transform // functions provide detailed validation as well as case-specific // error messages. let refetchDescriptor; if (isEquivalentType(fragment.type, queryType)) { refetchDescriptor = buildRefetchOperationOnQueryType( schema, fragment, refetchName, ); } else if (String(fragment.type) === VIEWER_TYPE_NAME) { // Validate that the schema conforms to the informal Viewer spec // and build the refetch query accordingly. refetchDescriptor = buildRefetchOperationOnViewerType( schema, fragment, refetchName, ); } else if ( String(fragment.type) === NODE_TYPE_NAME || (fragment.type instanceof GraphQLObjectType && fragment.type .getInterfaces() .some(interfaceType => String(interfaceType) === NODE_TYPE_NAME)) ) { // Validate that the schema conforms to the Object Identity (Node) spec // and build the refetch query accordingly. refetchDescriptor = buildRefetchOperationOnNodeType( schema, fragment, refetchName, ); } else { throw createUserError( `Invalid use of @refetchable on fragment '${ fragment.name }', only fragments on the Query type, Viewer type, Node type, or types implementing Node are supported.`, [fragment.loc], ); } if (refetchDescriptor != null) { const {path, node} = refetchDescriptor; const connectionMetadata = extractConnectionMetadata(fragment); nextContext = nextContext.replace({ ...fragment, metadata: { ...(fragment.metadata || {}), refetch: { connection: connectionMetadata ?? null, operation: refetchName, fragmentPathInResult: path, }, }, }); nextContext = nextContext.add({ ...node, metadata: { ...(node.metadata || {}), derivedFrom: fragment.name, }, }); } }, ); if (errors != null && errors.length) { throw createCombinedError(errors, 'RelayRefetchableFragmentTransform'); } return nextContext; }
javascript
function relayRefetchableFragmentTransform( context: GraphQLCompilerContext, ): GraphQLCompilerContext { const schema = context.serverSchema; const queryType = schema.getQueryType(); if (queryType == null) { throw createUserError('Expected the schema to define a query type.'); } const refetchOperations = buildRefetchMap(context); let nextContext = context; const errors = eachWithErrors( refetchOperations, ([refetchName, fragment]) => { // Build a refetch operation according to the fragment's type: // the logic here is purely name-based, the actual transform // functions provide detailed validation as well as case-specific // error messages. let refetchDescriptor; if (isEquivalentType(fragment.type, queryType)) { refetchDescriptor = buildRefetchOperationOnQueryType( schema, fragment, refetchName, ); } else if (String(fragment.type) === VIEWER_TYPE_NAME) { // Validate that the schema conforms to the informal Viewer spec // and build the refetch query accordingly. refetchDescriptor = buildRefetchOperationOnViewerType( schema, fragment, refetchName, ); } else if ( String(fragment.type) === NODE_TYPE_NAME || (fragment.type instanceof GraphQLObjectType && fragment.type .getInterfaces() .some(interfaceType => String(interfaceType) === NODE_TYPE_NAME)) ) { // Validate that the schema conforms to the Object Identity (Node) spec // and build the refetch query accordingly. refetchDescriptor = buildRefetchOperationOnNodeType( schema, fragment, refetchName, ); } else { throw createUserError( `Invalid use of @refetchable on fragment '${ fragment.name }', only fragments on the Query type, Viewer type, Node type, or types implementing Node are supported.`, [fragment.loc], ); } if (refetchDescriptor != null) { const {path, node} = refetchDescriptor; const connectionMetadata = extractConnectionMetadata(fragment); nextContext = nextContext.replace({ ...fragment, metadata: { ...(fragment.metadata || {}), refetch: { connection: connectionMetadata ?? null, operation: refetchName, fragmentPathInResult: path, }, }, }); nextContext = nextContext.add({ ...node, metadata: { ...(node.metadata || {}), derivedFrom: fragment.name, }, }); } }, ); if (errors != null && errors.length) { throw createCombinedError(errors, 'RelayRefetchableFragmentTransform'); } return nextContext; }
[ "function", "relayRefetchableFragmentTransform", "(", "context", ":", "GraphQLCompilerContext", ",", ")", ":", "GraphQLCompilerContext", "{", "const", "schema", "=", "context", ".", "serverSchema", ";", "const", "queryType", "=", "schema", ".", "getQueryType", "(", ...
This transform synthesizes "refetch" queries for fragments that are trivially refetchable. This is comprised of three main stages: 1. Validating that fragments marked with @refetchable qualify for refetch query generation; mainly this means that the fragment type is able to be refetched in some canonical way. 2. Determining the variable definitions to use for each generated query. GraphQL does not have a notion of fragment-local variables at all, and although Relay adds this concept developers are still allowed to reference global variables. This necessitates a visiting all reachable fragments for each @refetchable fragment, and finding the union of all global variables expceted to be defined. 3. Building the refetch queries, a straightforward copying transform from Fragment to Root IR nodes.
[ "This", "transform", "synthesizes", "refetch", "queries", "for", "fragments", "that", "are", "trivially", "refetchable", ".", "This", "is", "comprised", "of", "three", "main", "stages", ":" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/transforms/RelayRefetchableFragmentTransform.js#L80-L162
train
Relays a refetchable fragment to the next context.
[ 30522, 3853, 8846, 2890, 7959, 10649, 3085, 27843, 21693, 4765, 6494, 3619, 14192, 1006, 6123, 1024, 10629, 4160, 22499, 8737, 9463, 29566, 10111, 18413, 1010, 1007, 1024, 10629, 4160, 22499, 8737, 9463, 29566, 10111, 18413, 1063, 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...
adobe/brackets
src/JSUtils/ScopeManager.js
getPendingRequest
function getPendingRequest(file, offset, type) { var key = file + "@" + offset.line + "@" + offset.ch; if (_.has(pendingTernRequests, key)) { var requests = pendingTernRequests[key], requestType = requests[type]; delete pendingTernRequests[key][type]; if (!Object.keys(requests).length) { delete pendingTernRequests[key]; } return requestType; } }
javascript
function getPendingRequest(file, offset, type) { var key = file + "@" + offset.line + "@" + offset.ch; if (_.has(pendingTernRequests, key)) { var requests = pendingTernRequests[key], requestType = requests[type]; delete pendingTernRequests[key][type]; if (!Object.keys(requests).length) { delete pendingTernRequests[key]; } return requestType; } }
[ "function", "getPendingRequest", "(", "file", ",", "offset", ",", "type", ")", "{", "var", "key", "=", "file", "+", "\"@\"", "+", "offset", ".", "line", "+", "\"@\"", "+", "offset", ".", "ch", ";", "if", "(", "_", ".", "has", "(", "pendingTernRequest...
Get any pending $.Deferred object waiting on the specified file and request type @param {string} file - the file @param {{line: number, ch: number}} offset - the offset into the file the request is for @param {string} type - the type of request @return {jQuery.Deferred} - the $.Deferred for the request
[ "Get", "any", "pending", "$", ".", "Deferred", "object", "waiting", "on", "the", "specified", "file", "and", "request", "type" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L310-L324
train
Get the request type of a file offset
[ 30522, 3853, 2131, 11837, 4667, 2890, 15500, 1006, 5371, 1010, 16396, 1010, 2828, 1007, 1063, 13075, 3145, 1027, 5371, 1009, 1000, 1030, 1000, 1009, 16396, 1012, 2240, 1009, 1000, 1030, 1000, 1009, 16396, 1012, 10381, 1025, 2065, 1006, 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...
facebook/relay
packages/relay-compiler/core/getFieldDefinition.js
getFieldDefinitionLegacy
function getFieldDefinitionLegacy( schema: GraphQLSchema, parentType: GraphQLOutputType, fieldName: string, fieldAST: FieldNode, ): ?GraphQLField<mixed, mixed> { let schemaFieldDef = getFieldDefinitionStrict( schema, parentType, fieldName, fieldAST, ); if (!schemaFieldDef) { const type = getRawType(parentType); schemaFieldDef = getFieldDefinitionLegacyImpl( schema, type, fieldName, fieldAST, ); } return schemaFieldDef || null; }
javascript
function getFieldDefinitionLegacy( schema: GraphQLSchema, parentType: GraphQLOutputType, fieldName: string, fieldAST: FieldNode, ): ?GraphQLField<mixed, mixed> { let schemaFieldDef = getFieldDefinitionStrict( schema, parentType, fieldName, fieldAST, ); if (!schemaFieldDef) { const type = getRawType(parentType); schemaFieldDef = getFieldDefinitionLegacyImpl( schema, type, fieldName, fieldAST, ); } return schemaFieldDef || null; }
[ "function", "getFieldDefinitionLegacy", "(", "schema", ":", "GraphQLSchema", ",", "parentType", ":", "GraphQLOutputType", ",", "fieldName", ":", "string", ",", "fieldAST", ":", "FieldNode", ",", ")", ":", "?", "GraphQLField", "<", "mixed", ",", "mixed", ">", "...
Find the definition of a field of the specified type, first trying the standard spec-compliant resolution process and falling back to legacy mode that supports fat interfaces.
[ "Find", "the", "definition", "of", "a", "field", "of", "the", "specified", "type", "first", "trying", "the", "standard", "spec", "-", "compliant", "resolution", "process", "and", "falling", "back", "to", "legacy", "mode", "that", "supports", "fat", "interfaces...
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/core/getFieldDefinition.js#L79-L101
train
Returns a GraphQLField instance from a field node
[ 30522, 3853, 2131, 3790, 3207, 16294, 22753, 23115, 15719, 1006, 8040, 28433, 1024, 10629, 4160, 4877, 5403, 2863, 1010, 6687, 13874, 1024, 10629, 4160, 23743, 25856, 4904, 13874, 1010, 2492, 18442, 1024, 5164, 1010, 2492, 14083, 1024, 2492, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/formatters/codeframe.js
formatMessage
function formatMessage(message, parentResult) { const type = (message.fatal || message.severity === 2) ? chalk.red("error") : chalk.yellow("warning"); const msg = `${chalk.bold(message.message.replace(/([^ ])\.$/u, "$1"))}`; const ruleId = message.fatal ? "" : chalk.dim(`(${message.ruleId})`); const filePath = formatFilePath(parentResult.filePath, message.line, message.column); const sourceCode = parentResult.output ? parentResult.output : parentResult.source; const firstLine = [ `${type}:`, `${msg}`, ruleId ? `${ruleId}` : "", sourceCode ? `at ${filePath}:` : `at ${filePath}` ].filter(String).join(" "); const result = [firstLine]; if (sourceCode) { result.push( codeFrameColumns(sourceCode, { start: { line: message.line, column: message.column } }, { highlightCode: false }) ); } return result.join("\n"); }
javascript
function formatMessage(message, parentResult) { const type = (message.fatal || message.severity === 2) ? chalk.red("error") : chalk.yellow("warning"); const msg = `${chalk.bold(message.message.replace(/([^ ])\.$/u, "$1"))}`; const ruleId = message.fatal ? "" : chalk.dim(`(${message.ruleId})`); const filePath = formatFilePath(parentResult.filePath, message.line, message.column); const sourceCode = parentResult.output ? parentResult.output : parentResult.source; const firstLine = [ `${type}:`, `${msg}`, ruleId ? `${ruleId}` : "", sourceCode ? `at ${filePath}:` : `at ${filePath}` ].filter(String).join(" "); const result = [firstLine]; if (sourceCode) { result.push( codeFrameColumns(sourceCode, { start: { line: message.line, column: message.column } }, { highlightCode: false }) ); } return result.join("\n"); }
[ "function", "formatMessage", "(", "message", ",", "parentResult", ")", "{", "const", "type", "=", "(", "message", ".", "fatal", "||", "message", ".", "severity", "===", "2", ")", "?", "chalk", ".", "red", "(", "\"error\"", ")", ":", "chalk", ".", "yell...
Gets the formatted output for a given message. @param {Object} message The object that represents this message. @param {Object} parentResult The result object that this message belongs to. @returns {string} The formatted output.
[ "Gets", "the", "formatted", "output", "for", "a", "given", "message", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/formatters/codeframe.js#L48-L71
train
Format a message to be printed to the console
[ 30522, 3853, 4289, 7834, 3736, 3351, 1006, 4471, 1010, 6687, 6072, 11314, 1007, 1063, 9530, 3367, 2828, 1027, 1006, 4471, 1012, 10611, 1064, 1064, 4471, 1012, 18976, 1027, 1027, 1027, 1016, 1007, 1029, 16833, 1012, 2417, 1006, 1000, 7561, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js
function (viewName, viewType, master, data) { var app = sap.ui.getCore().byId("splitApp"); var view = this.getView(viewName, viewType); app.addPage(view, master); app.toDetail(view.getId(), "show", data); }
javascript
function (viewName, viewType, master, data) { var app = sap.ui.getCore().byId("splitApp"); var view = this.getView(viewName, viewType); app.addPage(view, master); app.toDetail(view.getId(), "show", data); }
[ "function", "(", "viewName", ",", "viewType", ",", "master", ",", "data", ")", "{", "var", "app", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "byId", "(", "\"splitApp\"", ")", ";", "var", "view", "=", "this", ".", "getView", "(", "viewNam...
a nav to method that does not write hashes but load the views properly
[ "a", "nav", "to", "method", "that", "does", "not", "write", "hashes", "but", "load", "the", "views", "properly" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/util/MyRouter.js#L31-L36
train
Add a new page to the detail
[ 30522, 3853, 1006, 3193, 18442, 1010, 3193, 13874, 1010, 3040, 1010, 2951, 1007, 1063, 13075, 10439, 1027, 20066, 1012, 21318, 1012, 2131, 17345, 1006, 1007, 1012, 2011, 3593, 1006, 1000, 3975, 29098, 1000, 1007, 1025, 13075, 3193, 1027, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
parse_SerAr
function parse_SerAr(blob, biff) { var val = [blob.read_shift(1)]; if(biff == 12) switch(val[0]) { case 0x02: val[0] = 0x04; break; /* SerBool */ case 0x04: val[0] = 0x10; break; /* SerErr */ case 0x00: val[0] = 0x01; break; /* SerNum */ case 0x01: val[0] = 0x02; break; /* SerStr */ } switch(val[0]) { case 0x04: /* SerBool -- boolean */ val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; if(biff != 12) blob.l += 7; break; case 0x25: /* appears to be an alias */ case 0x10: /* SerErr -- error */ val[1] = BErr[blob[blob.l]]; blob.l += ((biff == 12) ? 4 : 8); break; case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ blob.l += 8; break; case 0x01: /* SerNum -- Xnum */ val[1] = parse_Xnum(blob, 8); break; case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ val[1] = parse_XLUnicodeString2(blob, 0, {biff:biff > 0 && biff < 8 ? 2 : biff}); break; default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ } return val; }
javascript
function parse_SerAr(blob, biff) { var val = [blob.read_shift(1)]; if(biff == 12) switch(val[0]) { case 0x02: val[0] = 0x04; break; /* SerBool */ case 0x04: val[0] = 0x10; break; /* SerErr */ case 0x00: val[0] = 0x01; break; /* SerNum */ case 0x01: val[0] = 0x02; break; /* SerStr */ } switch(val[0]) { case 0x04: /* SerBool -- boolean */ val[1] = parsebool(blob, 1) ? 'TRUE' : 'FALSE'; if(biff != 12) blob.l += 7; break; case 0x25: /* appears to be an alias */ case 0x10: /* SerErr -- error */ val[1] = BErr[blob[blob.l]]; blob.l += ((biff == 12) ? 4 : 8); break; case 0x00: /* SerNil -- honestly, I'm not sure how to reproduce this */ blob.l += 8; break; case 0x01: /* SerNum -- Xnum */ val[1] = parse_Xnum(blob, 8); break; case 0x02: /* SerStr -- XLUnicodeString (<256 chars) */ val[1] = parse_XLUnicodeString2(blob, 0, {biff:biff > 0 && biff < 8 ? 2 : biff}); break; default: throw new Error("Bad SerAr: " + val[0]); /* Unreachable */ } return val; }
[ "function", "parse_SerAr", "(", "blob", ",", "biff", ")", "{", "var", "val", "=", "[", "blob", ".", "read_shift", "(", "1", ")", "]", ";", "if", "(", "biff", "==", "12", ")", "switch", "(", "val", "[", "0", "]", ")", "{", "case", "0x02", ":", ...
/* [MS-XLS] 2.5.192.112 + 2.5.192.11{3,4,5,6,7} /* [MS-XLSB] 2.5.97.93 + 2.5.97.9{4,5,6,7}
[ "/", "*", "[", "MS", "-", "XLS", "]", "2", ".", "5", ".", "192", ".", "112", "+", "2", ".", "5", ".", "192", ".", "11", "{", "3", "4", "5", "6", "7", "}", "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "5", ".", "97", ".", "93", ...
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10499-L10524
train
Parse an SerAr
[ 30522, 3853, 11968, 3366, 1035, 26358, 2099, 1006, 1038, 4135, 2497, 1010, 12170, 4246, 1007, 1063, 13075, 11748, 1027, 1031, 1038, 4135, 2497, 1012, 3191, 1035, 5670, 1006, 1015, 1007, 1033, 1025, 2065, 1006, 12170, 4246, 1027, 1027, 2260,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
verdaccio/verdaccio
src/lib/logger.js
print
function print(type, msg, obj, colors) { if (typeof type === 'number') { type = calculateLevel(type); } const finalMessage = fillInMsgTemplate(msg, obj, colors); const subsystems = [ { in: green('<--'), out: yellow('-->'), fs: black('-=-'), default: blue('---'), }, { in: '<--', out: '-->', fs: '-=-', default: '---', }, ]; const sub = subsystems[colors ? 0 : 1][obj.sub] || subsystems[+!colors].default; if (colors) { return ` ${levels[type](pad(type))}${white(`${sub} ${finalMessage}`)}`; } else { return ` ${pad(type)}${sub} ${finalMessage}`; } }
javascript
function print(type, msg, obj, colors) { if (typeof type === 'number') { type = calculateLevel(type); } const finalMessage = fillInMsgTemplate(msg, obj, colors); const subsystems = [ { in: green('<--'), out: yellow('-->'), fs: black('-=-'), default: blue('---'), }, { in: '<--', out: '-->', fs: '-=-', default: '---', }, ]; const sub = subsystems[colors ? 0 : 1][obj.sub] || subsystems[+!colors].default; if (colors) { return ` ${levels[type](pad(type))}${white(`${sub} ${finalMessage}`)}`; } else { return ` ${pad(type)}${sub} ${finalMessage}`; } }
[ "function", "print", "(", "type", ",", "msg", ",", "obj", ",", "colors", ")", "{", "if", "(", "typeof", "type", "===", "'number'", ")", "{", "type", "=", "calculateLevel", "(", "type", ")", ";", "}", "const", "finalMessage", "=", "fillInMsgTemplate", "...
Apply colors to a string based on level parameters. @param {*} type @param {*} msg @param {*} obj @param {*} colors @return {String}
[ "Apply", "colors", "to", "a", "string", "based", "on", "level", "parameters", "." ]
daa7e897b6d093bf8282ff12df3f450bcd73476c
https://github.com/verdaccio/verdaccio/blob/daa7e897b6d093bf8282ff12df3f450bcd73476c/src/lib/logger.js#L227-L254
train
Print a message to the console
[ 30522, 3853, 6140, 1006, 2828, 1010, 5796, 2290, 1010, 27885, 3501, 1010, 6087, 1007, 1063, 2065, 1006, 2828, 11253, 2828, 1027, 1027, 1027, 1005, 2193, 1005, 1007, 1063, 2828, 1027, 18422, 20414, 2884, 1006, 2828, 1007, 1025, 1065, 9530, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
semantic-release/semantic-release
lib/git.js
getTags
async function getTags(execaOpts) { return (await execa.stdout('git', ['tag'], execaOpts)) .split('\n') .map(tag => tag.trim()) .filter(Boolean); }
javascript
async function getTags(execaOpts) { return (await execa.stdout('git', ['tag'], execaOpts)) .split('\n') .map(tag => tag.trim()) .filter(Boolean); }
[ "async", "function", "getTags", "(", "execaOpts", ")", "{", "return", "(", "await", "execa", ".", "stdout", "(", "'git'", ",", "[", "'tag'", "]", ",", "execaOpts", ")", ")", ".", "split", "(", "'\\n'", ")", ".", "map", "(", "tag", "=>", "tag", ".",...
Get all the repository tags. @param {Object} [execaOpts] Options to pass to `execa`. @return {Array<String>} List of git tags. @throws {Error} If the `git` command fails.
[ "Get", "all", "the", "repository", "tags", "." ]
edf382f88838ed543c0b76cb6c914cca1fc1ddd1
https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L28-L33
train
Get all tags from the branch
[ 30522, 2004, 6038, 2278, 3853, 2131, 15900, 2015, 1006, 4654, 19281, 7361, 3215, 1007, 1063, 2709, 1006, 26751, 4654, 19281, 1012, 2358, 26797, 2102, 1006, 1005, 21025, 2102, 1005, 1010, 1031, 1005, 6415, 1005, 1033, 1010, 4654, 19281, 7361...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js
function(mAttributes, oNode) { var mIgnoredAttributes = { "Property" : true, "Qualifier": true, "Term": true, "xmlns" : true }; for (var i = 0; i < oNode.attributes.length; i += 1) { var sName = oNode.attributes[i].name; if (!mIgnoredAttributes[sName] && (sName.indexOf("xmlns:") !== 0)) { var sValue = oNode.attributes[i].value; // Special case: EnumMember can contain a space separated list of properties that must all have their // aliases replaced if (sName === "EnumMember" && sValue.indexOf(" ") > -1) { var aValues = sValue.split(" "); mAttributes[sName] = aValues.map(AnnotationParser.replaceWithAlias).join(" "); } else { mAttributes[sName] = AnnotationParser.replaceWithAlias(sValue); } } } return mAttributes; }
javascript
function(mAttributes, oNode) { var mIgnoredAttributes = { "Property" : true, "Qualifier": true, "Term": true, "xmlns" : true }; for (var i = 0; i < oNode.attributes.length; i += 1) { var sName = oNode.attributes[i].name; if (!mIgnoredAttributes[sName] && (sName.indexOf("xmlns:") !== 0)) { var sValue = oNode.attributes[i].value; // Special case: EnumMember can contain a space separated list of properties that must all have their // aliases replaced if (sName === "EnumMember" && sValue.indexOf(" ") > -1) { var aValues = sValue.split(" "); mAttributes[sName] = aValues.map(AnnotationParser.replaceWithAlias).join(" "); } else { mAttributes[sName] = AnnotationParser.replaceWithAlias(sValue); } } } return mAttributes; }
[ "function", "(", "mAttributes", ",", "oNode", ")", "{", "var", "mIgnoredAttributes", "=", "{", "\"Property\"", ":", "true", ",", "\"Qualifier\"", ":", "true", ",", "\"Term\"", ":", "true", ",", "\"xmlns\"", ":", "true", "}", ";", "for", "(", "var", "i", ...
/* Returns a map of key value pairs corresponding to the attributes of the given Node - attributes named "Property", "Term" and "Qualifier" are ignored. @param {map} mAttributes - A map that may already contain attributes, this map will be filled and returned by this method @param {Node} oNode - The node with the attributes @return {map} A map containing the attributes as key/value pairs @static @private
[ "/", "*", "Returns", "a", "map", "of", "key", "value", "pairs", "corresponding", "to", "the", "attributes", "of", "the", "given", "Node", "-", "attributes", "named", "Property", "Term", "and", "Qualifier", "are", "ignored", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/AnnotationParser.js#L821-L846
train
Parses the attributes of a node
[ 30522, 3853, 1006, 4717, 3089, 8569, 4570, 1010, 21058, 3207, 1007, 1063, 13075, 19117, 12131, 11960, 4779, 3089, 8569, 4570, 1027, 1063, 1000, 3200, 1000, 1024, 2995, 1010, 1000, 10981, 1000, 1024, 2995, 1010, 1000, 2744, 1000, 1024, 2995,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
javascript/utils/googleyolo.js
function() { // UI initialized, it is OK to cancel last operation. self.initialized_ = true; // retrieve is only called if auto sign-in is enabled. Otherwise, it will // get skipped. var retrieveCredential = Promise.resolve(null); if (!autoSignInDisabled) { retrieveCredential = self.googleyolo_.retrieve( /** @type {!SmartLockRequestOptions} */ (config)) .catch(function(error) { // For user cancellation or concurrent request pass down. // Otherwise suppress and run hint. if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED || error.type === firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) { throw error; } // Ignore all other errors to give hint a chance to run next. return null; }); } // Check if a credential is already available (previously signed in with). return retrieveCredential .then(function(credential) { if (!credential) { // Auto sign-in not complete. // Show account selector. return self.googleyolo_.hint( /** @type {!SmartLockHintOptions} */ (config)); } // Credential already available from the retrieve call. Pass it // through. return credential; }) .catch(function(error) { // When user cancels the flow, reset the lastCancel promise and // resolve with false. if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED) { self.lastCancel_ = Promise.resolve(); } else if (error.type === firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) { // Only one UI can be rendered at a time, cancel existing UI // and try again. self.cancel(); return self.show(config, autoSignInDisabled); } // Return null as no credential is available. return null; }); }
javascript
function() { // UI initialized, it is OK to cancel last operation. self.initialized_ = true; // retrieve is only called if auto sign-in is enabled. Otherwise, it will // get skipped. var retrieveCredential = Promise.resolve(null); if (!autoSignInDisabled) { retrieveCredential = self.googleyolo_.retrieve( /** @type {!SmartLockRequestOptions} */ (config)) .catch(function(error) { // For user cancellation or concurrent request pass down. // Otherwise suppress and run hint. if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED || error.type === firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) { throw error; } // Ignore all other errors to give hint a chance to run next. return null; }); } // Check if a credential is already available (previously signed in with). return retrieveCredential .then(function(credential) { if (!credential) { // Auto sign-in not complete. // Show account selector. return self.googleyolo_.hint( /** @type {!SmartLockHintOptions} */ (config)); } // Credential already available from the retrieve call. Pass it // through. return credential; }) .catch(function(error) { // When user cancels the flow, reset the lastCancel promise and // resolve with false. if (error.type === firebaseui.auth.GoogleYolo.Error.USER_CANCELED) { self.lastCancel_ = Promise.resolve(); } else if (error.type === firebaseui.auth.GoogleYolo.Error.CONCURRENT_REQUEST) { // Only one UI can be rendered at a time, cancel existing UI // and try again. self.cancel(); return self.show(config, autoSignInDisabled); } // Return null as no credential is available. return null; }); }
[ "function", "(", ")", "{", "// UI initialized, it is OK to cancel last operation.", "self", ".", "initialized_", "=", "true", ";", "// retrieve is only called if auto sign-in is enabled. Otherwise, it will", "// get skipped.", "var", "retrieveCredential", "=", "Promise", ".", "re...
One-Tap UI renderer.
[ "One", "-", "Tap", "UI", "renderer", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/utils/googleyolo.js#L131-L182
train
Returns the credential that is available in the database.
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 21318, 3988, 3550, 1010, 2009, 2003, 7929, 2000, 17542, 2197, 3169, 1012, 2969, 1012, 3988, 3550, 1035, 1027, 2995, 1025, 1013, 1013, 12850, 2003, 2069, 2170, 2065, 8285, 3696, 1011, 1999, 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...
adobe/brackets
src/extensions/default/InlineTimingFunctionEditor/InlineTimingFunctionEditor.js
InlineTimingFunctionEditor
function InlineTimingFunctionEditor(timingFunction, startBookmark, endBookmark) { this._timingFunction = timingFunction; this._startBookmark = startBookmark; this._endBookmark = endBookmark; this._isOwnChange = false; this._isHostChange = false; this._origin = "+InlineTimingFunctionEditor_" + (lastOriginId++); this._handleTimingFunctionChange = this._handleTimingFunctionChange.bind(this); this._handleHostDocumentChange = this._handleHostDocumentChange.bind(this); InlineWidget.call(this); }
javascript
function InlineTimingFunctionEditor(timingFunction, startBookmark, endBookmark) { this._timingFunction = timingFunction; this._startBookmark = startBookmark; this._endBookmark = endBookmark; this._isOwnChange = false; this._isHostChange = false; this._origin = "+InlineTimingFunctionEditor_" + (lastOriginId++); this._handleTimingFunctionChange = this._handleTimingFunctionChange.bind(this); this._handleHostDocumentChange = this._handleHostDocumentChange.bind(this); InlineWidget.call(this); }
[ "function", "InlineTimingFunctionEditor", "(", "timingFunction", ",", "startBookmark", ",", "endBookmark", ")", "{", "this", ".", "_timingFunction", "=", "timingFunction", ";", "this", ".", "_startBookmark", "=", "startBookmark", ";", "this", ".", "_endBookmark", "=...
Constructor for inline widget containing a BezierCurveEditor control @param {!RegExpMatch} timingFunction RegExp match object of initially selected timingFunction @param {!CodeMirror.Bookmark} startBookmark @param {!CodeMirror.Bookmark} endBookmark
[ "Constructor", "for", "inline", "widget", "containing", "a", "BezierCurveEditor", "control" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/InlineTimingFunctionEditor/InlineTimingFunctionEditor.js#L43-L55
train
InlineTimingFunctionEditor constructor.
[ 30522, 3853, 23881, 3775, 6562, 11263, 27989, 2098, 15660, 1006, 10984, 11263, 27989, 1010, 2707, 8654, 10665, 1010, 2203, 8654, 10665, 1007, 1063, 2023, 1012, 1035, 10984, 11263, 27989, 1027, 10984, 11263, 27989, 1025, 2023, 1012, 1035, 2707...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...