repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
adobe/brackets
src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js
checkInstallerStatus
function checkInstallerStatus(requester, searchParams) { var installErrorStr = searchParams.installErrorStr, bracketsErrorStr = searchParams.bracketsErrorStr, updateDirectory = searchParams.updateDir, encoding = searchParams.encoding || "utf8", statusObj = {installError: ": BA_UN"}, logFileAvailable = false, currentRequester = requester || ""; var notifyBrackets = function notifyBrackets(errorline) { statusObj.installError = errorline || ": BA_UN"; postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); }; var parseLog = function (files) { files.forEach(function (file) { var fileExt = path.extname(path.basename(file)); if (fileExt === ".logs") { var fileName = path.basename(file), fileFullPath = updateDirectory + '/' + file; if (fileName.search("installStatus.logs") !== -1) { logFileAvailable = true; parseInstallerLog(fileFullPath, bracketsErrorStr, "utf8", notifyBrackets); } else if (fileName.search("update.logs") !== -1) { logFileAvailable = true; parseInstallerLog(fileFullPath, installErrorStr, encoding, notifyBrackets); } } }); if (!logFileAvailable) { postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); } }; fs.readdir(updateDirectory) .then(function (files) { return parseLog(files); }).catch(function () { postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); }); }
javascript
function checkInstallerStatus(requester, searchParams) { var installErrorStr = searchParams.installErrorStr, bracketsErrorStr = searchParams.bracketsErrorStr, updateDirectory = searchParams.updateDir, encoding = searchParams.encoding || "utf8", statusObj = {installError: ": BA_UN"}, logFileAvailable = false, currentRequester = requester || ""; var notifyBrackets = function notifyBrackets(errorline) { statusObj.installError = errorline || ": BA_UN"; postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); }; var parseLog = function (files) { files.forEach(function (file) { var fileExt = path.extname(path.basename(file)); if (fileExt === ".logs") { var fileName = path.basename(file), fileFullPath = updateDirectory + '/' + file; if (fileName.search("installStatus.logs") !== -1) { logFileAvailable = true; parseInstallerLog(fileFullPath, bracketsErrorStr, "utf8", notifyBrackets); } else if (fileName.search("update.logs") !== -1) { logFileAvailable = true; parseInstallerLog(fileFullPath, installErrorStr, encoding, notifyBrackets); } } }); if (!logFileAvailable) { postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); } }; fs.readdir(updateDirectory) .then(function (files) { return parseLog(files); }).catch(function () { postMessageToBrackets(MessageIds.NOTIFY_INSTALLATION_STATUS, currentRequester, statusObj); }); }
[ "function", "checkInstallerStatus", "(", "requester", ",", "searchParams", ")", "{", "var", "installErrorStr", "=", "searchParams", ".", "installErrorStr", ",", "bracketsErrorStr", "=", "searchParams", ".", "bracketsErrorStr", ",", "updateDirectory", "=", "searchParams"...
one it finds the line which has any of error String after parsing the Log it notifies the bracket. @param{Object} searchParams is object contains Information Error String Encoding of Log File Update Diectory Path.
[ "one", "it", "finds", "the", "line", "which", "has", "any", "of", "error", "String", "after", "parsing", "the", "Log", "it", "notifies", "the", "bracket", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js#L224-L264
train
check installer status
[ 30522, 3853, 4638, 7076, 9080, 12910, 29336, 2271, 1006, 5227, 2121, 1010, 3945, 28689, 5244, 1007, 1063, 13075, 16500, 2121, 29165, 3367, 2099, 1027, 3945, 28689, 5244, 1012, 16500, 2121, 29165, 3367, 2099, 1010, 19719, 2121, 29165, 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...
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/model/formatter.js
function (sText) { return JSDocUtil.formatTextBlock(sText, { linkFormatter: function (target, text) { var iHashIndex; // If the link has a protocol, do not modify, but open in a new window if (target.match("://")) { return '<a target="_blank" href="' + target + '">' + (text || target) + '</a>'; } target = target.trim().replace(/\.prototype\./g, "#"); iHashIndex = target.indexOf("#"); text = text || target; // keep the full target in the fallback text if (iHashIndex < 0) { var iLastDotIndex = target.lastIndexOf("."), sClassName = target.substring(0, iLastDotIndex), sMethodName = target.substring(iLastDotIndex + 1), targetMethod = sMethodName; if (targetMethod) { if (targetMethod.static === true) { target = sClassName + '/methods/' + sClassName + '.' + sMethodName; } else { target = sClassName + '/methods/' + sMethodName; } } } if (iHashIndex === 0) { // a relative reference - we can't support that return "<code>" + target.slice(1) + "</code>"; } if (iHashIndex > 0) { target = target.slice(0, iHashIndex) + '/methods/' + target.slice(iHashIndex + 1); } return "<a class=\"jsdoclink\" href=\"#/api/" + target + "\" target=\"_self\">" + text + "</a>"; } }); }
javascript
function (sText) { return JSDocUtil.formatTextBlock(sText, { linkFormatter: function (target, text) { var iHashIndex; // If the link has a protocol, do not modify, but open in a new window if (target.match("://")) { return '<a target="_blank" href="' + target + '">' + (text || target) + '</a>'; } target = target.trim().replace(/\.prototype\./g, "#"); iHashIndex = target.indexOf("#"); text = text || target; // keep the full target in the fallback text if (iHashIndex < 0) { var iLastDotIndex = target.lastIndexOf("."), sClassName = target.substring(0, iLastDotIndex), sMethodName = target.substring(iLastDotIndex + 1), targetMethod = sMethodName; if (targetMethod) { if (targetMethod.static === true) { target = sClassName + '/methods/' + sClassName + '.' + sMethodName; } else { target = sClassName + '/methods/' + sMethodName; } } } if (iHashIndex === 0) { // a relative reference - we can't support that return "<code>" + target.slice(1) + "</code>"; } if (iHashIndex > 0) { target = target.slice(0, iHashIndex) + '/methods/' + target.slice(iHashIndex + 1); } return "<a class=\"jsdoclink\" href=\"#/api/" + target + "\" target=\"_self\">" + text + "</a>"; } }); }
[ "function", "(", "sText", ")", "{", "return", "JSDocUtil", ".", "formatTextBlock", "(", "sText", ",", "{", "linkFormatter", ":", "function", "(", "target", ",", "text", ")", "{", "var", "iHashIndex", ";", "// If the link has a protocol, do not modify, but open in a ...
This function wraps a text in a span tag so that it can be represented in an HTML control. @param {string} sText @returns {string} @private
[ "This", "function", "wraps", "a", "text", "in", "a", "span", "tag", "so", "that", "it", "can", "be", "represented", "in", "an", "HTML", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/model/formatter.js#L134-L178
train
Format the text of a link
[ 30522, 3853, 1006, 26261, 18413, 1007, 1063, 2709, 1046, 16150, 10085, 21823, 2140, 1012, 4289, 18209, 23467, 1006, 26261, 18413, 1010, 1063, 4957, 14192, 20097, 1024, 3853, 1006, 4539, 1010, 3793, 1007, 1063, 13075, 1045, 14949, 10606, 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...
Shopify/draggable
src/Plugins/SwapAnimation/SwapAnimation.js
animate
function animate(from, to, {duration, easingFunction, horizontal}) { for (const element of [from, to]) { element.style.pointerEvents = 'none'; } if (horizontal) { const width = from.offsetWidth; from.style.transform = `translate3d(${width}px, 0, 0)`; to.style.transform = `translate3d(-${width}px, 0, 0)`; } else { const height = from.offsetHeight; from.style.transform = `translate3d(0, ${height}px, 0)`; to.style.transform = `translate3d(0, -${height}px, 0)`; } requestAnimationFrame(() => { for (const element of [from, to]) { element.addEventListener('transitionend', resetElementOnTransitionEnd); element.style.transition = `transform ${duration}ms ${easingFunction}`; element.style.transform = ''; } }); }
javascript
function animate(from, to, {duration, easingFunction, horizontal}) { for (const element of [from, to]) { element.style.pointerEvents = 'none'; } if (horizontal) { const width = from.offsetWidth; from.style.transform = `translate3d(${width}px, 0, 0)`; to.style.transform = `translate3d(-${width}px, 0, 0)`; } else { const height = from.offsetHeight; from.style.transform = `translate3d(0, ${height}px, 0)`; to.style.transform = `translate3d(0, -${height}px, 0)`; } requestAnimationFrame(() => { for (const element of [from, to]) { element.addEventListener('transitionend', resetElementOnTransitionEnd); element.style.transition = `transform ${duration}ms ${easingFunction}`; element.style.transform = ''; } }); }
[ "function", "animate", "(", "from", ",", "to", ",", "{", "duration", ",", "easingFunction", ",", "horizontal", "}", ")", "{", "for", "(", "const", "element", "of", "[", "from", ",", "to", "]", ")", "{", "element", ".", "style", ".", "pointerEvents", ...
Animates two elements @param {HTMLElement} from @param {HTMLElement} to @param {Object} options @param {Number} options.duration @param {String} options.easingFunction @param {String} options.horizontal @private
[ "Animates", "two", "elements" ]
ecc04b2cdb8b5009664862472ff8cb237c38cfeb
https://github.com/Shopify/draggable/blob/ecc04b2cdb8b5009664862472ff8cb237c38cfeb/src/Plugins/SwapAnimation/SwapAnimation.js#L109-L131
train
Animate from element to element
[ 30522, 3853, 2019, 21499, 1006, 2013, 1010, 2000, 1010, 1063, 9367, 1010, 24070, 11263, 27989, 1010, 9876, 1065, 1007, 1063, 2005, 1006, 9530, 3367, 5783, 1997, 1031, 2013, 1010, 2000, 1033, 1007, 1063, 5783, 1012, 2806, 1012, 20884, 18697,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-amplify/amplify-js
packages/amazon-cognito-identity-js/src/BigInteger.js
bnpLShiftTo
function bnpLShiftTo(n, r) { var bs = n % this.DB; var cbs = this.DB - bs; var bm = (1 << cbs) - 1; var ds = Math.floor(n / this.DB), c = this.s << bs & this.DM, i; for (i = this.t - 1; i >= 0; --i) { r[i + ds + 1] = this[i] >> cbs | c; c = (this[i] & bm) << bs; } for (i = ds - 1; i >= 0; --i) r[i] = 0; r[ds] = c; r.t = this.t + ds + 1; r.s = this.s; r.clamp(); }
javascript
function bnpLShiftTo(n, r) { var bs = n % this.DB; var cbs = this.DB - bs; var bm = (1 << cbs) - 1; var ds = Math.floor(n / this.DB), c = this.s << bs & this.DM, i; for (i = this.t - 1; i >= 0; --i) { r[i + ds + 1] = this[i] >> cbs | c; c = (this[i] & bm) << bs; } for (i = ds - 1; i >= 0; --i) r[i] = 0; r[ds] = c; r.t = this.t + ds + 1; r.s = this.s; r.clamp(); }
[ "function", "bnpLShiftTo", "(", "n", ",", "r", ")", "{", "var", "bs", "=", "n", "%", "this", ".", "DB", ";", "var", "cbs", "=", "this", ".", "DB", "-", "bs", ";", "var", "bm", "=", "(", "1", "<<", "cbs", ")", "-", "1", ";", "var", "ds", "...
(protected) r = this << n
[ "(", "protected", ")", "r", "=", "this", "<<", "n" ]
db55ff3dff31c64a246180f39eb0a04a89fd16e1
https://github.com/aws-amplify/amplify-js/blob/db55ff3dff31c64a246180f39eb0a04a89fd16e1/packages/amazon-cognito-identity-js/src/BigInteger.js#L335-L350
train
Shifts this sequence by n to the right of the given sequence.
[ 30522, 3853, 24869, 24759, 6182, 6199, 3406, 1006, 1050, 1010, 1054, 1007, 1063, 13075, 18667, 1027, 1050, 1003, 2023, 1012, 16962, 1025, 13075, 6568, 1027, 2023, 1012, 16962, 1011, 18667, 1025, 13075, 1038, 2213, 1027, 1006, 1015, 1026, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js
checkKeys
function checkKeys(oDetails, mAllowedKeys2Type, sName) { var sKey; function error(sMessage) { if (sName) { sMessage += " at property: " + sName; } throw new Error(sMessage); } function typeOf(vValue) { return Array.isArray(vValue) ? "array" : typeof vValue; } for (sKey in oDetails) { if (!(mAllowedKeys2Type && sKey in mAllowedKeys2Type)) { error("Unsupported '" + sKey + "'"); } else if (typeOf(oDetails[sKey]) !== mAllowedKeys2Type[sKey]) { error("Not a " + mAllowedKeys2Type[sKey] + " value for '" + sKey + "'"); } } }
javascript
function checkKeys(oDetails, mAllowedKeys2Type, sName) { var sKey; function error(sMessage) { if (sName) { sMessage += " at property: " + sName; } throw new Error(sMessage); } function typeOf(vValue) { return Array.isArray(vValue) ? "array" : typeof vValue; } for (sKey in oDetails) { if (!(mAllowedKeys2Type && sKey in mAllowedKeys2Type)) { error("Unsupported '" + sKey + "'"); } else if (typeOf(oDetails[sKey]) !== mAllowedKeys2Type[sKey]) { error("Not a " + mAllowedKeys2Type[sKey] + " value for '" + sKey + "'"); } } }
[ "function", "checkKeys", "(", "oDetails", ",", "mAllowedKeys2Type", ",", "sName", ")", "{", "var", "sKey", ";", "function", "error", "(", "sMessage", ")", "{", "if", "(", "sName", ")", "{", "sMessage", "+=", "\" at property: \"", "+", "sName", ";", "}", ...
/* Checks that the given details object has only allowed keys. @param {object} oDetails The details object @param {string[]} [mAllowedKeys2Type] Maps keys which are allowed for the details objects to the expected type name @param {string} [sName] The name of the property to which the details object belongs @throws {Error} In case an unsupported key is found
[ "/", "*", "Checks", "that", "the", "given", "details", "object", "has", "only", "allowed", "keys", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationHelper.js#L36-L57
train
Checks that the keys are valid
[ 30522, 3853, 4638, 14839, 2015, 1006, 24040, 22081, 1010, 6670, 15096, 14839, 2015, 2475, 13874, 1010, 1055, 18442, 1007, 1063, 13075, 15315, 3240, 1025, 3853, 7561, 1006, 15488, 7971, 4270, 1007, 1063, 2065, 1006, 1055, 18442, 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...
TryGhost/Ghost
core/server/services/routing/helpers/secure.js
setRequestIsSecure
function setRequestIsSecure(req, data) { (Array.isArray(data) ? data : [data]).forEach(function forEach(d) { d.secure = req.secure; }); }
javascript
function setRequestIsSecure(req, data) { (Array.isArray(data) ? data : [data]).forEach(function forEach(d) { d.secure = req.secure; }); }
[ "function", "setRequestIsSecure", "(", "req", ",", "data", ")", "{", "(", "Array", ".", "isArray", "(", "data", ")", "?", "data", ":", "[", "data", "]", ")", ".", "forEach", "(", "function", "forEach", "(", "d", ")", "{", "d", ".", "secure", "=", ...
@description Tiny/Weird helper to attach the information if the request is HTTPS or HTTP. It's used in services/url/utils (search for ".secure"). We forward the resource into handlebars and if you use the URL helper, we want to know if the original request was https or not to generate the correct URL...but that is only true, if your blog url is set to HTTP, but NGINX supports HTTPS. @TODO: Drop in Ghost 3.0, because we will only support https. @param {Object} req @param {Object} data
[ "@description", "Tiny", "/", "Weird", "helper", "to", "attach", "the", "information", "if", "the", "request", "is", "HTTPS", "or", "HTTP", "." ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/routing/helpers/secure.js#L13-L17
train
Set req. secure to true if request is secure
[ 30522, 3853, 2275, 2890, 15500, 23491, 23887, 1006, 2128, 4160, 1010, 2951, 1007, 1063, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 2951, 1007, 1029, 2951, 1024, 1031, 2951, 1033, 1007, 1012, 18921, 6776, 1006, 3853, 18921, 6776, 1006, 1040...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-empty-function.js
reportIfEmpty
function reportIfEmpty(node) { const kind = getKind(node); const name = astUtils.getFunctionNameWithKind(node); const innerComments = sourceCode.getTokens(node.body, { includeComments: true, filter: astUtils.isCommentToken }); if (allowed.indexOf(kind) === -1 && node.body.type === "BlockStatement" && node.body.body.length === 0 && innerComments.length === 0 ) { context.report({ node, loc: node.body.loc.start, messageId: "unexpected", data: { name } }); } }
javascript
function reportIfEmpty(node) { const kind = getKind(node); const name = astUtils.getFunctionNameWithKind(node); const innerComments = sourceCode.getTokens(node.body, { includeComments: true, filter: astUtils.isCommentToken }); if (allowed.indexOf(kind) === -1 && node.body.type === "BlockStatement" && node.body.body.length === 0 && innerComments.length === 0 ) { context.report({ node, loc: node.body.loc.start, messageId: "unexpected", data: { name } }); } }
[ "function", "reportIfEmpty", "(", "node", ")", "{", "const", "kind", "=", "getKind", "(", "node", ")", ";", "const", "name", "=", "astUtils", ".", "getFunctionNameWithKind", "(", "node", ")", ";", "const", "innerComments", "=", "sourceCode", ".", "getTokens"...
Reports a given function node if the node matches the following patterns. - Not allowed by options. - The body is empty. - The body doesn't have any comments. @param {ASTNode} node - A function node to report. This is one of an ArrowFunctionExpression, a FunctionDeclaration, or a FunctionExpression. @returns {void}
[ "Reports", "a", "given", "function", "node", "if", "the", "node", "matches", "the", "following", "patterns", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-empty-function.js#L139-L159
train
Reports if a node is empty
[ 30522, 3853, 3189, 29323, 27718, 2100, 1006, 13045, 1007, 1063, 9530, 3367, 2785, 1027, 2131, 18824, 1006, 13045, 1007, 1025, 9530, 3367, 2171, 1027, 2004, 8525, 3775, 4877, 1012, 2131, 11263, 27989, 18442, 24415, 18824, 1006, 13045, 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...
ecomfe/zrender
src/core/PathProxy.js
function (x1, y1, x2, y2, radius) { if (this._ctx) { this._ctx.arcTo(x1, y1, x2, y2, radius); } return this; }
javascript
function (x1, y1, x2, y2, radius) { if (this._ctx) { this._ctx.arcTo(x1, y1, x2, y2, radius); } return this; }
[ "function", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "radius", ")", "{", "if", "(", "this", ".", "_ctx", ")", "{", "this", ".", "_ctx", ".", "arcTo", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "radius", ")", ";", "}", "return"...
TODO
[ "TODO" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L243-L248
train
arcTo - Arc to the current arc
[ 30522, 3853, 1006, 1060, 2487, 1010, 1061, 2487, 1010, 1060, 2475, 1010, 1061, 2475, 1010, 12177, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 14931, 2595, 1007, 1063, 2023, 1012, 1035, 14931, 2595, 1012, 8115, 3406, 1006, 1060, 2487, 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/keyword-spacing.js
checkSpacingForModuleDeclaration
function checkSpacingForModuleDeclaration(node) { const firstToken = sourceCode.getFirstToken(node); checkSpacingBefore(firstToken, PREV_TOKEN_M); checkSpacingAfter(firstToken, NEXT_TOKEN_M); if (node.type === "ExportDefaultDeclaration") { checkSpacingAround(sourceCode.getTokenAfter(firstToken)); } if (node.source) { const fromToken = sourceCode.getTokenBefore(node.source); checkSpacingBefore(fromToken, PREV_TOKEN_M); checkSpacingAfter(fromToken, NEXT_TOKEN_M); } }
javascript
function checkSpacingForModuleDeclaration(node) { const firstToken = sourceCode.getFirstToken(node); checkSpacingBefore(firstToken, PREV_TOKEN_M); checkSpacingAfter(firstToken, NEXT_TOKEN_M); if (node.type === "ExportDefaultDeclaration") { checkSpacingAround(sourceCode.getTokenAfter(firstToken)); } if (node.source) { const fromToken = sourceCode.getTokenBefore(node.source); checkSpacingBefore(fromToken, PREV_TOKEN_M); checkSpacingAfter(fromToken, NEXT_TOKEN_M); } }
[ "function", "checkSpacingForModuleDeclaration", "(", "node", ")", "{", "const", "firstToken", "=", "sourceCode", ".", "getFirstToken", "(", "node", ")", ";", "checkSpacingBefore", "(", "firstToken", ",", "PREV_TOKEN_M", ")", ";", "checkSpacingAfter", "(", "firstToke...
Reports `import`, `export`, `as`, and `from` keywords of a given node if usage of spacing around those keywords is invalid. This rule handles the `*` token in module declarations. import*as A from "./a"; /*error Expected space(s) after "import". error Expected space(s) before "as". @param {ASTNode} node - A node to report. @returns {void}
[ "Reports", "import", "export", "as", "and", "from", "keywords", "of", "a", "given", "node", "if", "usage", "of", "spacing", "around", "those", "keywords", "is", "invalid", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/keyword-spacing.js#L456-L472
train
Check spacing for module declaration
[ 30522, 3853, 14148, 19498, 2075, 14192, 7716, 18696, 8586, 8017, 3370, 1006, 13045, 1007, 1063, 9530, 3367, 2034, 18715, 2368, 1027, 3120, 16044, 1012, 2131, 8873, 12096, 18715, 2368, 1006, 13045, 1007, 1025, 14148, 19498, 2075, 4783, 29278, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/schema.js
stringifyProperty
function stringifyProperty (value, propDefinition) { // This function stringifies but it's used in a context where // there's always second stringification pass. By returning the original // value when it's not an object we save one unnecessary call // to JSON.stringify. if (typeof value !== 'object') { return value; } // if there's no schema for the property we use standar JSON stringify if (!propDefinition || value === null) { return JSON.stringify(value); } return propDefinition.stringify(value); }
javascript
function stringifyProperty (value, propDefinition) { // This function stringifies but it's used in a context where // there's always second stringification pass. By returning the original // value when it's not an object we save one unnecessary call // to JSON.stringify. if (typeof value !== 'object') { return value; } // if there's no schema for the property we use standar JSON stringify if (!propDefinition || value === null) { return JSON.stringify(value); } return propDefinition.stringify(value); }
[ "function", "stringifyProperty", "(", "value", ",", "propDefinition", ")", "{", "// This function stringifies but it's used in a context where", "// there's always second stringification pass. By returning the original", "// value when it's not an object we save one unnecessary call", "// to J...
Serialize a single property.
[ "Serialize", "a", "single", "property", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/schema.js#L192-L201
train
Stringifies a property value.
[ 30522, 3853, 5164, 8757, 21572, 4842, 3723, 1006, 3643, 1010, 17678, 3207, 16294, 22753, 1007, 1063, 1013, 1013, 2023, 3853, 5164, 14144, 2021, 2009, 1005, 1055, 2109, 1999, 1037, 6123, 2073, 1013, 1013, 2045, 1005, 1055, 2467, 2117, 5164, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/CodeFolding/main.js
expandAll
function expandAll() { var editor = EditorManager.getFocusedEditor(); if (editor) { var cm = editor._codeMirror; CodeMirror.commands.unfoldAll(cm); } }
javascript
function expandAll() { var editor = EditorManager.getFocusedEditor(); if (editor) { var cm = editor._codeMirror; CodeMirror.commands.unfoldAll(cm); } }
[ "function", "expandAll", "(", ")", "{", "var", "editor", "=", "EditorManager", ".", "getFocusedEditor", "(", ")", ";", "if", "(", "editor", ")", "{", "var", "cm", "=", "editor", ".", "_codeMirror", ";", "CodeMirror", ".", "commands", ".", "unfoldAll", "(...
Expands all folded regions in the current document
[ "Expands", "all", "folded", "regions", "in", "the", "current", "document" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/main.js#L262-L268
train
Expand all the lang files
[ 30522, 3853, 7818, 8095, 1006, 1007, 1063, 13075, 3559, 1027, 3559, 24805, 4590, 1012, 2131, 14876, 7874, 19082, 15660, 1006, 1007, 1025, 2065, 1006, 3559, 1007, 1063, 13075, 4642, 1027, 3559, 1012, 1035, 3642, 14503, 29165, 1025, 3642, 145...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
logWithLocation
function logWithLocation() { vLocation = vLocation || sTarget && sPropertyName && sTarget + "/" + sPropertyName; return log.apply(this, arguments); }
javascript
function logWithLocation() { vLocation = vLocation || sTarget && sPropertyName && sTarget + "/" + sPropertyName; return log.apply(this, arguments); }
[ "function", "logWithLocation", "(", ")", "{", "vLocation", "=", "vLocation", "||", "sTarget", "&&", "sPropertyName", "&&", "sTarget", "+", "\"/\"", "+", "sPropertyName", ";", "return", "log", ".", "apply", "(", "this", ",", "arguments", ")", ";", "}" ]
/* Sets <code>vLocation</code> and delegates to {@link log}.
[ "/", "*", "Sets", "<code", ">", "vLocation<", "/", "code", ">", "and", "delegates", "to", "{" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1174-L1178
train
Log with a location
[ 30522, 3853, 8833, 24415, 4135, 10719, 1006, 1007, 1063, 1058, 4135, 10719, 1027, 1058, 4135, 10719, 1064, 1064, 2732, 18150, 1004, 1004, 11867, 18981, 15010, 18442, 1004, 1004, 2732, 18150, 1009, 1000, 1013, 1000, 1009, 11867, 18981, 15010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/tabs.js
tabBrowser_waitForTabPanel
function tabBrowser_waitForTabPanel(tabIndex, elemString) { // Get the specified tab panel element var tabPanel = this.getTabPanelElement(tabIndex, elemString); // Get the style information for the tab panel element var style = this._controller.window.getComputedStyle(tabPanel.getNode(), null); // Wait for the top margin to be 0px - ie. has stopped animating // XXX: A notification bar starts at a negative pixel margin and drops down // to 0px. This creates a race condition where a test may click // before the notification bar appears at it's anticipated screen location this._controller.waitFor(function () { return style.marginTop == '0px'; }, "Expected notification bar to be visible: '" + elemString + "' "); }
javascript
function tabBrowser_waitForTabPanel(tabIndex, elemString) { // Get the specified tab panel element var tabPanel = this.getTabPanelElement(tabIndex, elemString); // Get the style information for the tab panel element var style = this._controller.window.getComputedStyle(tabPanel.getNode(), null); // Wait for the top margin to be 0px - ie. has stopped animating // XXX: A notification bar starts at a negative pixel margin and drops down // to 0px. This creates a race condition where a test may click // before the notification bar appears at it's anticipated screen location this._controller.waitFor(function () { return style.marginTop == '0px'; }, "Expected notification bar to be visible: '" + elemString + "' "); }
[ "function", "tabBrowser_waitForTabPanel", "(", "tabIndex", ",", "elemString", ")", "{", "// Get the specified tab panel element", "var", "tabPanel", "=", "this", ".", "getTabPanelElement", "(", "tabIndex", ",", "elemString", ")", ";", "// Get the style information for the t...
Waits for a particular tab panel element to display and stop animating @param {number} tabIndex Index of the tab to check @param {string} elemString Lookup string of the tab panel element
[ "Waits", "for", "a", "particular", "tab", "panel", "element", "to", "display", "and", "stop", "animating" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L478-L492
train
Wait for a tab panel to be visible
[ 30522, 3853, 21628, 12618, 9333, 2121, 1035, 3524, 13028, 7875, 9739, 2884, 1006, 21628, 22254, 10288, 1010, 3449, 6633, 3367, 4892, 1007, 1063, 1013, 1013, 2131, 1996, 9675, 21628, 5997, 5783, 13075, 21628, 9739, 2884, 1027, 2023, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/plugins/Performance.js
_render
function _render() { var HTML = '<ol>'; var barInfoHTML = '<ol>'; //get all data from the filter ui elements var filterOptions = _getFilterOptions(); //filtered and modified data var data = _applyFilters(_rawdata, filterOptions); //no data bar if (data.length === 0) { HTML += '<li class="line nodata" data-uid="' + -1 + '"></li>'; barInfoHTML += '<li class="line nodata" data-uid="' + -1 + '"><div class="info line">No data</div></li>'; } data.forEach(function (item) { var rawItem = _getBarById(item.uid); HTML += '<li data-uid="' + item.uid + '" class="line" title="' + _getBarTitle(rawItem) + '"' + _getBarDataAttributes(rawItem) + ' >'; HTML += '<div class="bar ' + _getBarColor(rawItem.duration) + '" style="width: ' + _calculateBarWidth(item.duration) + ' margin-left: ' + _calculateBarOffset(item, filterOptions.filterByTime.start) + '">'; HTML += '<div class="sub-bar ' + _getBarColor(rawItem.time) + '" style="width: ' + _calculateBarWidth(item.time) + '"></div>'; HTML += '</div>'; HTML += '</li>'; //render bar info ================================================================================== barInfoHTML += '<li data-uid="' + item.uid + '" title="' + _getBarTitle(rawItem) + '" class="line ' + _getBarClassType(rawItem.categories[0]) + '" ' + _getBarDataAttributes(rawItem) + '>'; barInfoHTML += '<div class="info line">' + _formatInfo(rawItem) + ' (' + (rawItem.time).toFixed(0) + ' ms)</div>'; barInfoHTML += '</li>'; }); HTML += '</ol>'; barInfoHTML += '</ol>'; document.querySelector('#sapUiSupportPerfHeaderTimelineBarWrapper').innerHTML = HTML; document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').innerHTML = barInfoHTML; _createTimelineGrid(filterOptions); _filterByCategory(); // Don't change the order, this is applying css styles on the rendered content }
javascript
function _render() { var HTML = '<ol>'; var barInfoHTML = '<ol>'; //get all data from the filter ui elements var filterOptions = _getFilterOptions(); //filtered and modified data var data = _applyFilters(_rawdata, filterOptions); //no data bar if (data.length === 0) { HTML += '<li class="line nodata" data-uid="' + -1 + '"></li>'; barInfoHTML += '<li class="line nodata" data-uid="' + -1 + '"><div class="info line">No data</div></li>'; } data.forEach(function (item) { var rawItem = _getBarById(item.uid); HTML += '<li data-uid="' + item.uid + '" class="line" title="' + _getBarTitle(rawItem) + '"' + _getBarDataAttributes(rawItem) + ' >'; HTML += '<div class="bar ' + _getBarColor(rawItem.duration) + '" style="width: ' + _calculateBarWidth(item.duration) + ' margin-left: ' + _calculateBarOffset(item, filterOptions.filterByTime.start) + '">'; HTML += '<div class="sub-bar ' + _getBarColor(rawItem.time) + '" style="width: ' + _calculateBarWidth(item.time) + '"></div>'; HTML += '</div>'; HTML += '</li>'; //render bar info ================================================================================== barInfoHTML += '<li data-uid="' + item.uid + '" title="' + _getBarTitle(rawItem) + '" class="line ' + _getBarClassType(rawItem.categories[0]) + '" ' + _getBarDataAttributes(rawItem) + '>'; barInfoHTML += '<div class="info line">' + _formatInfo(rawItem) + ' (' + (rawItem.time).toFixed(0) + ' ms)</div>'; barInfoHTML += '</li>'; }); HTML += '</ol>'; barInfoHTML += '</ol>'; document.querySelector('#sapUiSupportPerfHeaderTimelineBarWrapper').innerHTML = HTML; document.querySelector('#sapUiSupportPerfHeaderTimelineBarInfoWrapper').innerHTML = barInfoHTML; _createTimelineGrid(filterOptions); _filterByCategory(); // Don't change the order, this is applying css styles on the rendered content }
[ "function", "_render", "(", ")", "{", "var", "HTML", "=", "'<ol>'", ";", "var", "barInfoHTML", "=", "'<ol>'", ";", "//get all data from the filter ui elements", "var", "filterOptions", "=", "_getFilterOptions", "(", ")", ";", "//filtered and modified data", "var", "...
/* ============================================================================================================= Render and render helpers =============================================================================================================
[ "/", "*", "=============================================================================================================", "Render", "and", "render", "helpers", "=============================================================================================================" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/plugins/Performance.js#L526-L563
train
Render the data bar
[ 30522, 3853, 1035, 17552, 1006, 1007, 1063, 13075, 16129, 1027, 1005, 1026, 19330, 1028, 1005, 1025, 13075, 22466, 2078, 14876, 11039, 19968, 1027, 1005, 1026, 19330, 1028, 1005, 1025, 1013, 1013, 2131, 2035, 2951, 30524, 2053, 2951, 3347, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/view/MainViewManager.js
cacheScrollState
function cacheScrollState(paneId) { _forEachPaneOrPanes(paneId, function (pane) { _paneScrollStates[pane.id] = pane.getScrollState(); }); }
javascript
function cacheScrollState(paneId) { _forEachPaneOrPanes(paneId, function (pane) { _paneScrollStates[pane.id] = pane.getScrollState(); }); }
[ "function", "cacheScrollState", "(", "paneId", ")", "{", "_forEachPaneOrPanes", "(", "paneId", ",", "function", "(", "pane", ")", "{", "_paneScrollStates", "[", "pane", ".", "id", "]", "=", "pane", ".", "getScrollState", "(", ")", ";", "}", ")", ";", "}"...
Caches the specified pane's current scroll state If there was already cached state for the specified pane, it is discarded and overwritten @param {!string} paneId - id of the pane in which to cache the scroll state, ALL_PANES or ACTIVE_PANE
[ "Caches", "the", "specified", "pane", "s", "current", "scroll", "state", "If", "there", "was", "already", "cached", "state", "for", "the", "specified", "pane", "it", "is", "discarded", "and", "overwritten" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L500-L504
train
Cache the scroll state of a pane or panes
[ 30522, 3853, 17053, 11020, 28402, 9153, 2618, 1006, 6090, 7416, 2094, 1007, 1063, 1035, 18921, 6776, 9739, 8780, 14536, 7231, 2015, 1006, 6090, 7416, 2094, 1010, 3853, 1006, 6090, 2063, 1007, 1063, 1035, 6090, 2229, 26775, 14511, 9153, 4570...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.m/src/sap/m/MessageItem.js
function (sName, oItem) { if (oItem._oMessagePopoverItem.getId() === this.getId() && oItem.getMetadata().getProperty(sName)) { oItem.setProperty(sName, oValue); } }
javascript
function (sName, oItem) { if (oItem._oMessagePopoverItem.getId() === this.getId() && oItem.getMetadata().getProperty(sName)) { oItem.setProperty(sName, oValue); } }
[ "function", "(", "sName", ",", "oItem", ")", "{", "if", "(", "oItem", ".", "_oMessagePopoverItem", ".", "getId", "(", ")", "===", "this", ".", "getId", "(", ")", "&&", "oItem", ".", "getMetadata", "(", ")", ".", "getProperty", "(", "sName", ")", ")",...
BCP: 1670235674 MessageItem acts as a proxy to StandardListItem So, we should ensure if something is changed in MessageItem, it would be propagated to the StandardListItem
[ "BCP", ":", "1670235674", "MessageItem", "acts", "as", "a", "proxy", "to", "StandardListItem", "So", "we", "should", "ensure", "if", "something", "is", "changed", "in", "MessageItem", "it", "would", "be", "propagated", "to", "the", "StandardListItem" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/MessageItem.js#L117-L121
train
Sets the property of the given item.
[ 30522, 3853, 1006, 1055, 18442, 1010, 1051, 4221, 2213, 1007, 1063, 2065, 1006, 1051, 4221, 2213, 1012, 1035, 18168, 7971, 4270, 16340, 7840, 4221, 2213, 1012, 2131, 3593, 1006, 1007, 1027, 1027, 1027, 2023, 1012, 2131, 3593, 1006, 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...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
relativePosition
function relativePosition(dim, val) { var ele = this[0]; var cy = this.cy(); var ppos = plainObject(dim) ? dim : undefined; var setting = ppos !== undefined || val !== undefined && string(dim); var hasCompoundNodes = cy.hasCompoundNodes(); if (ele && ele.isNode()) { // must have an element and must be a node to return position if (setting) { for (var i = 0; i < this.length; i++) { var _ele2 = this[i]; var parent = hasCompoundNodes ? _ele2.parent() : null; var hasParent = parent && parent.length > 0; var relativeToParent = hasParent; if (hasParent) { parent = parent[0]; } var origin = relativeToParent ? parent.position() : { x: 0, y: 0 }; if (val !== undefined) { // set one dimension _ele2.position(dim, val + origin[dim]); } else if (ppos !== undefined) { // set whole position _ele2.position({ x: ppos.x + origin.x, y: ppos.y + origin.y }); } } } else { // getting var pos = ele.position(); var _parent = hasCompoundNodes ? ele.parent() : null; var _hasParent = _parent && _parent.length > 0; var _relativeToParent = _hasParent; if (_hasParent) { _parent = _parent[0]; } var _origin = _relativeToParent ? _parent.position() : { x: 0, y: 0 }; ppos = { x: pos.x - _origin.x, y: pos.y - _origin.y }; if (dim === undefined) { // then return the whole rendered position return ppos; } else { // then return the specified dimension return ppos[dim]; } } } else if (!setting) { return undefined; // for empty collection case } return this; // chaining }
javascript
function relativePosition(dim, val) { var ele = this[0]; var cy = this.cy(); var ppos = plainObject(dim) ? dim : undefined; var setting = ppos !== undefined || val !== undefined && string(dim); var hasCompoundNodes = cy.hasCompoundNodes(); if (ele && ele.isNode()) { // must have an element and must be a node to return position if (setting) { for (var i = 0; i < this.length; i++) { var _ele2 = this[i]; var parent = hasCompoundNodes ? _ele2.parent() : null; var hasParent = parent && parent.length > 0; var relativeToParent = hasParent; if (hasParent) { parent = parent[0]; } var origin = relativeToParent ? parent.position() : { x: 0, y: 0 }; if (val !== undefined) { // set one dimension _ele2.position(dim, val + origin[dim]); } else if (ppos !== undefined) { // set whole position _ele2.position({ x: ppos.x + origin.x, y: ppos.y + origin.y }); } } } else { // getting var pos = ele.position(); var _parent = hasCompoundNodes ? ele.parent() : null; var _hasParent = _parent && _parent.length > 0; var _relativeToParent = _hasParent; if (_hasParent) { _parent = _parent[0]; } var _origin = _relativeToParent ? _parent.position() : { x: 0, y: 0 }; ppos = { x: pos.x - _origin.x, y: pos.y - _origin.y }; if (dim === undefined) { // then return the whole rendered position return ppos; } else { // then return the specified dimension return ppos[dim]; } } } else if (!setting) { return undefined; // for empty collection case } return this; // chaining }
[ "function", "relativePosition", "(", "dim", ",", "val", ")", "{", "var", "ele", "=", "this", "[", "0", "]", ";", "var", "cy", "=", "this", ".", "cy", "(", ")", ";", "var", "ppos", "=", "plainObject", "(", "dim", ")", "?", "dim", ":", "undefined",...
get/set the position relative to the parent
[ "get", "/", "set", "the", "position", "relative", "to", "the", "parent" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L8382-L8455
train
Returns the relative position of an element to a specified dimension
[ 30522, 3853, 5816, 26994, 1006, 11737, 1010, 11748, 1007, 1063, 13075, 3449, 2063, 1027, 2023, 1031, 1014, 1033, 1025, 13075, 22330, 1027, 2023, 1012, 22330, 1006, 1007, 1025, 13075, 4903, 2891, 1027, 5810, 16429, 20614, 1006, 11737, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/addons.js
addonsManager_handleUtilsButton
function addonsManager_handleUtilsButton(aSpec) { var spec = aSpec || { }; var item = spec.item; if (!item) throw new Error(arguments.callee.name + ": Menu item not specified."); var button = this.getElement({type: "utilsButton"}); var menu = this.getElement({type: "utilsButton_menu"}); try { this._controller.click(button); // Click the button and wait until menu has been opened // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function() { // return menu.getNode() && menu.getNode().state == "open"; // }, TIMEOUT, 100, "Menu of utils button has been opened."); mozmill.utils.waitForEval("subject && subject.state == 'open'", TIMEOUT, 100, menu.getNode()); // Click the given menu entry and make sure the var menuItem = this.getElement({ type: "utilsButton_menuItem", value: "#utils-" + item }); this._controller.click(menuItem); } finally { // Make sure the menu has been closed this._controller.keypress(menu, "VK_ESCAPE", {}); // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function() { // return menu.getNode() && menu.getNode().state == "closed"; // }, TIMEOUT, 100, "Menu of utils button has been closed."); mozmill.utils.waitForEval("subject && subject.state == 'closed'", TIMEOUT, 100, menu.getNode()); } }
javascript
function addonsManager_handleUtilsButton(aSpec) { var spec = aSpec || { }; var item = spec.item; if (!item) throw new Error(arguments.callee.name + ": Menu item not specified."); var button = this.getElement({type: "utilsButton"}); var menu = this.getElement({type: "utilsButton_menu"}); try { this._controller.click(button); // Click the button and wait until menu has been opened // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function() { // return menu.getNode() && menu.getNode().state == "open"; // }, TIMEOUT, 100, "Menu of utils button has been opened."); mozmill.utils.waitForEval("subject && subject.state == 'open'", TIMEOUT, 100, menu.getNode()); // Click the given menu entry and make sure the var menuItem = this.getElement({ type: "utilsButton_menuItem", value: "#utils-" + item }); this._controller.click(menuItem); } finally { // Make sure the menu has been closed this._controller.keypress(menu, "VK_ESCAPE", {}); // TODO: restore after 1.5.1 has landed // mozmill.utils.waitFor(function() { // return menu.getNode() && menu.getNode().state == "closed"; // }, TIMEOUT, 100, "Menu of utils button has been closed."); mozmill.utils.waitForEval("subject && subject.state == 'closed'", TIMEOUT, 100, menu.getNode()); } }
[ "function", "addonsManager_handleUtilsButton", "(", "aSpec", ")", "{", "var", "spec", "=", "aSpec", "||", "{", "}", ";", "var", "item", "=", "spec", ".", "item", ";", "if", "(", "!", "item", ")", "throw", "new", "Error", "(", "arguments", ".", "callee"...
Opens the utils button menu and clicks the specified menu entry @param {object} aSpec Information about the menu Elements: item - menu item to click (updateNow, viewUpdates, installFromFile, autoUpdateDefault, resetAddonUpdatesToAutomatic, resetAddonUpdatesToManual)
[ "Opens", "the", "utils", "button", "menu", "and", "clicks", "the", "specified", "menu", "entry" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/addons.js#L227-L269
train
Handles the utils button
[ 30522, 3853, 5587, 5644, 24805, 4590, 1035, 5047, 21823, 4877, 8569, 15474, 1006, 2004, 5051, 2278, 1007, 1063, 13075, 28699, 1027, 2004, 5051, 2278, 1064, 1064, 1063, 1065, 1025, 13075, 8875, 1027, 28699, 1012, 8875, 1025, 2065, 1006, 999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js
function() { if (this._oSortExpression == null) { this._oSortExpression = new odata4analytics.SortExpression(this._oEntityType.getModel(), this._oEntityType .getSchema(), this._oEntityType); } return this._oSortExpression; }
javascript
function() { if (this._oSortExpression == null) { this._oSortExpression = new odata4analytics.SortExpression(this._oEntityType.getModel(), this._oEntityType .getSchema(), this._oEntityType); } return this._oSortExpression; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "_oSortExpression", "==", "null", ")", "{", "this", ".", "_oSortExpression", "=", "new", "odata4analytics", ".", "SortExpression", "(", "this", ".", "_oEntityType", ".", "getModel", "(", ")", ",", "this", ...
Get the sort expression for this request. Expressions are represented by separate objects. If none exists so far, a new expression object gets created. @returns {sap.ui.model.analytics.odata4analytics.SortExpression} The sort object associated to this request. @public @function @name sap.ui.model.analytics.odata4analytics.DimensionMemberSetRequest#getSortExpression
[ "Get", "the", "sort", "expression", "for", "this", "request", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L5301-L5307
train
Returns the sort expression for this entity type
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 1035, 9808, 11589, 10288, 20110, 3258, 1027, 1027, 19701, 1007, 1063, 2023, 1012, 1035, 9808, 11589, 10288, 20110, 3258, 1027, 2047, 1051, 2850, 2696, 2549, 27953, 21252, 2015, 1012, 40...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GitbookIO/gitbook
lib/output/createTemplateEngine.js
createTemplateEngine
function createTemplateEngine(output) { var plugins = output.getPlugins(); var book = output.getBook(); var rootFolder = book.getContentRoot(); var logger = book.getLogger(); var filters = Plugins.listFilters(plugins); var blocks = Plugins.listBlocks(plugins); // Extend with default blocks = defaultBlocks.merge(blocks); filters = defaultFilters.merge(filters); // Create loader var transformFn = Templating.replaceShortcuts.bind(null, blocks); var loader = new Templating.ConrefsLoader(rootFolder, transformFn, logger); // Create API context var context = Api.encodeGlobal(output); return new TemplateEngine({ filters: filters, blocks: blocks, loader: loader, context: context }); }
javascript
function createTemplateEngine(output) { var plugins = output.getPlugins(); var book = output.getBook(); var rootFolder = book.getContentRoot(); var logger = book.getLogger(); var filters = Plugins.listFilters(plugins); var blocks = Plugins.listBlocks(plugins); // Extend with default blocks = defaultBlocks.merge(blocks); filters = defaultFilters.merge(filters); // Create loader var transformFn = Templating.replaceShortcuts.bind(null, blocks); var loader = new Templating.ConrefsLoader(rootFolder, transformFn, logger); // Create API context var context = Api.encodeGlobal(output); return new TemplateEngine({ filters: filters, blocks: blocks, loader: loader, context: context }); }
[ "function", "createTemplateEngine", "(", "output", ")", "{", "var", "plugins", "=", "output", ".", "getPlugins", "(", ")", ";", "var", "book", "=", "output", ".", "getBook", "(", ")", ";", "var", "rootFolder", "=", "book", ".", "getContentRoot", "(", ")"...
Create template engine for an output. It adds default filters/blocks, then add the ones from plugins @param {Output} output @return {TemplateEngine}
[ "Create", "template", "engine", "for", "an", "output", ".", "It", "adds", "default", "filters", "/", "blocks", "then", "add", "the", "ones", "from", "plugins" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/output/createTemplateEngine.js#L17-L43
train
Create a TemplateEngine
[ 30522, 3853, 3443, 18532, 15725, 13159, 3170, 1006, 6434, 1007, 1063, 13075, 13354, 7076, 1027, 6434, 1012, 2131, 24759, 15916, 7076, 1006, 1007, 1025, 13075, 2338, 1027, 6434, 1012, 2131, 8654, 1006, 1007, 1025, 13075, 7117, 10371, 2121, 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...
GitbookIO/gitbook
lib/gitbook.js
satisfies
function satisfies(condition) { // Test with real version if (semver.satisfies(VERSION, condition)) return true; // Test with future stable release return semver.satisfies(VERSION_STABLE, condition); }
javascript
function satisfies(condition) { // Test with real version if (semver.satisfies(VERSION, condition)) return true; // Test with future stable release return semver.satisfies(VERSION_STABLE, condition); }
[ "function", "satisfies", "(", "condition", ")", "{", "// Test with real version", "if", "(", "semver", ".", "satisfies", "(", "VERSION", ",", "condition", ")", ")", "return", "true", ";", "// Test with future stable release", "return", "semver", ".", "satisfies", ...
Verify that this gitbook version satisfies a requirement We can't directly use samver.satisfies since it will break all plugins when gitbook version is a prerelease (beta, alpha) @param {String} condition @return {Boolean}
[ "Verify", "that", "this", "gitbook", "version", "satisfies", "a", "requirement", "We", "can", "t", "directly", "use", "samver", ".", "satisfies", "since", "it", "will", "break", "all", "plugins", "when", "gitbook", "version", "is", "a", "prerelease", "(", "b...
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/gitbook.js#L16-L22
train
Test if the version satisfies the condition
[ 30522, 3853, 2938, 2483, 14213, 1006, 4650, 1007, 1063, 1013, 1013, 3231, 2007, 2613, 2544, 2065, 1006, 7367, 2213, 6299, 1012, 2938, 2483, 14213, 1006, 2544, 1010, 4650, 1007, 1007, 2709, 2995, 1025, 1013, 1013, 3231, 2007, 2925, 6540, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/utils/ControlIterator.js
function(sControlName, aControlsToTest, aExcludedControls, bIncludeNonRenderable, bIncludeNonInstantiable) { if (!sControlName) { return false; } if (aControlsToTest.length) { // only test specific controls if (aControlsToTest.indexOf(sControlName) === -1) { // not one of the chosen ones return false; } } else if (aExcludedControls.indexOf(sControlName) > -1) { return false; } if (!bIncludeNonRenderable && !ControlIterator.controlCanBeRendered(sControlName)) { return false; } if (!bIncludeNonInstantiable && !ControlIterator.controlCanBeInstantiated(sControlName)) { return false; } return true; }
javascript
function(sControlName, aControlsToTest, aExcludedControls, bIncludeNonRenderable, bIncludeNonInstantiable) { if (!sControlName) { return false; } if (aControlsToTest.length) { // only test specific controls if (aControlsToTest.indexOf(sControlName) === -1) { // not one of the chosen ones return false; } } else if (aExcludedControls.indexOf(sControlName) > -1) { return false; } if (!bIncludeNonRenderable && !ControlIterator.controlCanBeRendered(sControlName)) { return false; } if (!bIncludeNonInstantiable && !ControlIterator.controlCanBeInstantiated(sControlName)) { return false; } return true; }
[ "function", "(", "sControlName", ",", "aControlsToTest", ",", "aExcludedControls", ",", "bIncludeNonRenderable", ",", "bIncludeNonInstantiable", ")", "{", "if", "(", "!", "sControlName", ")", "{", "return", "false", ";", "}", "if", "(", "aControlsToTest", ".", "...
Returns true if the control is not among the explicitly excluded controls and is not excluded due to its rendering/instantiation capabilities.
[ "Returns", "true", "if", "the", "control", "is", "not", "among", "the", "explicitly", "excluded", "controls", "and", "is", "not", "excluded", "due", "to", "its", "rendering", "/", "instantiation", "capabilities", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/utils/ControlIterator.js#L353-L375
train
Test if a control is not in the list of excluded controls
[ 30522, 3853, 1006, 8040, 12162, 13153, 18442, 1010, 9353, 12162, 13153, 16033, 22199, 1010, 29347, 2595, 20464, 13936, 8663, 13181, 4877, 1010, 8026, 20464, 12672, 8540, 7389, 4063, 3085, 1010, 8026, 20464, 12672, 8540, 7076, 5794, 10711, 346...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
MithrilJS/mithril.js
docs/lint.js
lint
function lint(file, data) { ensureCodeIsHighlightable(file, data) ensureCodeIsSyntaticallyValid(file, data) ensureCodeIsRunnable(file, data) ensureCommentStyle(file, data) ensureLinkIsValid(file, data) }
javascript
function lint(file, data) { ensureCodeIsHighlightable(file, data) ensureCodeIsSyntaticallyValid(file, data) ensureCodeIsRunnable(file, data) ensureCommentStyle(file, data) ensureLinkIsValid(file, data) }
[ "function", "lint", "(", "file", ",", "data", ")", "{", "ensureCodeIsHighlightable", "(", "file", ",", "data", ")", "ensureCodeIsSyntaticallyValid", "(", "file", ",", "data", ")", "ensureCodeIsRunnable", "(", "file", ",", "data", ")", "ensureCommentStyle", "(", ...
lint rules
[ "lint", "rules" ]
6d36fe09d129928c6b460720e08d9ed321fcd62b
https://github.com/MithrilJS/mithril.js/blob/6d36fe09d129928c6b460720e08d9ed321fcd62b/docs/lint.js#L10-L16
train
Lint a file.
[ 30522, 3853, 11409, 2102, 1006, 5371, 1010, 2951, 1007, 1063, 5676, 16044, 4509, 18377, 7138, 3085, 1006, 5371, 1010, 2951, 1007, 5676, 16044, 14643, 6038, 29336, 15004, 10175, 3593, 1006, 5371, 1010, 2951, 1007, 5676, 16044, 2483, 15532, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2MetadataConverter.js
Annotatable
function Annotatable(oConverter, sTarget) { var oParent = oConverter.oAnnotatable; if (oParent) { sTarget = _Helper.buildPath(oParent.sPath, sTarget); } this.oConverter = oConverter; this.sPath = sTarget; this.oParent = oParent; this.mSapAttributes = oConverter.mSapAttributes; this.mAnnotationsForTarget = null; }
javascript
function Annotatable(oConverter, sTarget) { var oParent = oConverter.oAnnotatable; if (oParent) { sTarget = _Helper.buildPath(oParent.sPath, sTarget); } this.oConverter = oConverter; this.sPath = sTarget; this.oParent = oParent; this.mSapAttributes = oConverter.mSapAttributes; this.mAnnotationsForTarget = null; }
[ "function", "Annotatable", "(", "oConverter", ",", "sTarget", ")", "{", "var", "oParent", "=", "oConverter", ".", "oAnnotatable", ";", "if", "(", "oParent", ")", "{", "sTarget", "=", "_Helper", ".", "buildPath", "(", "oParent", ".", "sPath", ",", "sTarget"...
********************************************************************************************* Annotatable ********************************************************************************************* Creates an annotatable that is able to consume V2 annotations and set V4 annotations for the correct target. It ensures that the target for the annotations is only created when needed. @param {V2MetadataConverter} oConverter The converter @param {string} sTarget The target name to which the V4 annotations shall be added. The target path is constructed from the path of the top annotatable of the stack in oConverter (if there is one yet) and the given name. @constructor
[ "*********************************************************************************************", "Annotatable", "*********************************************************************************************", "Creates", "an", "annotatable", "that", "is", "able", "to", "consume", "V2", "annot...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2MetadataConverter.js#L270-L281
train
Creates an annotation object for the given target.
[ 30522, 3853, 5754, 17287, 10880, 1006, 1051, 8663, 16874, 2121, 1010, 2732, 18150, 1007, 1063, 13075, 6728, 12069, 3372, 1027, 1051, 8663, 16874, 2121, 1012, 1051, 11639, 17287, 10880, 1025, 2065, 1006, 6728, 12069, 3372, 1007, 1063, 2732, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/preferences/PreferencesBase.js
function (shadowEntry) { var shadowScopeOrder = this._defaults._shadowScopeOrder, index = _.findIndex(shadowScopeOrder, function (entry) { return entry === shadowEntry; }), i = index + 1; // Find an appropriate scope of lower priority to add it before while (i < shadowScopeOrder.length) { if (shadowScopeOrder[i].promise.state() === "pending" || shadowScopeOrder[i].promise.state() === "resolved") { break; } i++; } switch (shadowScopeOrder[i].promise.state()) { case "pending": // cannot decide now, lookup once pending promise is settled shadowScopeOrder[i].promise.always(function () { this._tryAddToScopeOrder(shadowEntry); }.bind(this)); break; case "resolved": this._pushToScopeOrder(shadowEntry.id, shadowScopeOrder[i].id); this.trigger(SCOPEORDER_CHANGE, { id: shadowEntry.id, action: "added" }); this._triggerChange({ ids: shadowEntry.scope.getKeys() }); break; default: throw new Error("Internal error: no scope found to add before. \"default\" is missing?.."); } }
javascript
function (shadowEntry) { var shadowScopeOrder = this._defaults._shadowScopeOrder, index = _.findIndex(shadowScopeOrder, function (entry) { return entry === shadowEntry; }), i = index + 1; // Find an appropriate scope of lower priority to add it before while (i < shadowScopeOrder.length) { if (shadowScopeOrder[i].promise.state() === "pending" || shadowScopeOrder[i].promise.state() === "resolved") { break; } i++; } switch (shadowScopeOrder[i].promise.state()) { case "pending": // cannot decide now, lookup once pending promise is settled shadowScopeOrder[i].promise.always(function () { this._tryAddToScopeOrder(shadowEntry); }.bind(this)); break; case "resolved": this._pushToScopeOrder(shadowEntry.id, shadowScopeOrder[i].id); this.trigger(SCOPEORDER_CHANGE, { id: shadowEntry.id, action: "added" }); this._triggerChange({ ids: shadowEntry.scope.getKeys() }); break; default: throw new Error("Internal error: no scope found to add before. \"default\" is missing?.."); } }
[ "function", "(", "shadowEntry", ")", "{", "var", "shadowScopeOrder", "=", "this", ".", "_defaults", ".", "_shadowScopeOrder", ",", "index", "=", "_", ".", "findIndex", "(", "shadowScopeOrder", ",", "function", "(", "entry", ")", "{", "return", "entry", "==="...
@private Tries to add scope to the scopeOrder once it's resolved. It looks up context's _shadowScopeOrder to find an appropriate context to add it before. @param {Object} shadowEntry Shadow entry of the resolved scope
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1386-L1422
train
Add shadow entry to the scope order
[ 30522, 3853, 1006, 5192, 4765, 2854, 1007, 1063, 13075, 6281, 16186, 8551, 2121, 1027, 2023, 1012, 1035, 12398, 2015, 1012, 1035, 6281, 16186, 8551, 2121, 1010, 5950, 1027, 1035, 1012, 2424, 22254, 10288, 1006, 30524, 1006, 4443, 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...
adobe/brackets
src/search/FindReplace.js
_findAllAndSelect
function _findAllAndSelect(editor) { editor = editor || EditorManager.getActiveEditor(); if (!editor) { return; } var sel = editor.getSelection(), newSelections = []; if (CodeMirror.cmpPos(sel.start, sel.end) === 0) { sel = _getWordAt(editor, sel.start); } if (CodeMirror.cmpPos(sel.start, sel.end) !== 0) { var searchStart = {line: 0, ch: 0}, state = getSearchState(editor._codeMirror), nextMatch; setQueryInfo(state, { query: editor.document.getRange(sel.start, sel.end), isCaseSensitive: false, isRegexp: false }); while ((nextMatch = _getNextMatch(editor, false, searchStart, false)) !== null) { if (_selEq(sel, nextMatch)) { nextMatch.primary = true; } newSelections.push(nextMatch); searchStart = nextMatch.end; } // This should find at least the original selection, but just in case... if (newSelections.length) { // Don't change the scroll position. editor.setSelections(newSelections, false); } } }
javascript
function _findAllAndSelect(editor) { editor = editor || EditorManager.getActiveEditor(); if (!editor) { return; } var sel = editor.getSelection(), newSelections = []; if (CodeMirror.cmpPos(sel.start, sel.end) === 0) { sel = _getWordAt(editor, sel.start); } if (CodeMirror.cmpPos(sel.start, sel.end) !== 0) { var searchStart = {line: 0, ch: 0}, state = getSearchState(editor._codeMirror), nextMatch; setQueryInfo(state, { query: editor.document.getRange(sel.start, sel.end), isCaseSensitive: false, isRegexp: false }); while ((nextMatch = _getNextMatch(editor, false, searchStart, false)) !== null) { if (_selEq(sel, nextMatch)) { nextMatch.primary = true; } newSelections.push(nextMatch); searchStart = nextMatch.end; } // This should find at least the original selection, but just in case... if (newSelections.length) { // Don't change the scroll position. editor.setSelections(newSelections, false); } } }
[ "function", "_findAllAndSelect", "(", "editor", ")", "{", "editor", "=", "editor", "||", "EditorManager", ".", "getActiveEditor", "(", ")", ";", "if", "(", "!", "editor", ")", "{", "return", ";", "}", "var", "sel", "=", "editor", ".", "getSelection", "("...
Takes the primary selection, expands it to a word range if necessary, then sets the selection to include all instances of that range. Removes all other selections. Does nothing if the selection is not a range after expansion.
[ "Takes", "the", "primary", "selection", "expands", "it", "to", "a", "word", "range", "if", "necessary", "then", "sets", "the", "selection", "to", "include", "all", "instances", "of", "that", "range", ".", "Removes", "all", "other", "selections", ".", "Does",...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindReplace.js#L364-L395
train
Find all the words that match the selection
[ 30522, 3853, 1035, 2424, 25425, 18376, 12260, 6593, 1006, 3559, 1007, 1063, 3559, 1027, 3559, 1064, 1064, 3559, 24805, 4590, 1012, 2131, 19620, 2098, 15660, 1006, 1007, 1025, 2065, 1006, 999, 3559, 1007, 1063, 2709, 1025, 1065, 13075, 7367,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TableGrouping.js
function(oTable, iLevel, bChildren, bSum) { var iIndent = 0; var i; if (oTable.isA("sap.ui.table.TreeTable")) { for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } else if (oTable.isA("sap.ui.table.AnalyticalTable")) { iLevel = iLevel - 1; iLevel = !bChildren && !bSum ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { if (iIndent == 0) { iIndent = 12; } iIndent = iIndent + (i < 2 ? 12 : 8); } } else { iLevel = !bChildren ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } return iIndent; }
javascript
function(oTable, iLevel, bChildren, bSum) { var iIndent = 0; var i; if (oTable.isA("sap.ui.table.TreeTable")) { for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } else if (oTable.isA("sap.ui.table.AnalyticalTable")) { iLevel = iLevel - 1; iLevel = !bChildren && !bSum ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { if (iIndent == 0) { iIndent = 12; } iIndent = iIndent + (i < 2 ? 12 : 8); } } else { iLevel = !bChildren ? iLevel - 1 : iLevel; iLevel = Math.max(iLevel, 0); for (i = 0; i < iLevel; i++) { iIndent = iIndent + (i < 2 ? 12 : 8); } } return iIndent; }
[ "function", "(", "oTable", ",", "iLevel", ",", "bChildren", ",", "bSum", ")", "{", "var", "iIndent", "=", "0", ";", "var", "i", ";", "if", "(", "oTable", ".", "isA", "(", "\"sap.ui.table.TreeTable\"", ")", ")", "{", "for", "(", "i", "=", "0", ";", ...
Computes the indents of the rows. @param {sap.ui.table.Table} oTable Instance of the table. @param {number} iLevel The hierarchy level. @param {boolean} bChildren Whether the row is a group (has children). @param {boolean} bSum Whether the row is a summary row. @returns {int} The indentation level. @private
[ "Computes", "the", "indents", "of", "the", "rows", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L284-L311
train
Returns indent of the table
[ 30522, 3853, 1006, 27178, 3085, 1010, 17869, 15985, 1010, 4647, 19466, 16200, 2078, 1010, 18667, 2819, 1007, 1063, 13075, 2462, 25915, 2102, 1027, 1014, 1025, 13075, 1045, 1025, 2065, 1006, 27178, 3085, 1012, 18061, 1006, 1000, 20066, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
transloadit/uppy
packages/@uppy/aws-s3-multipart/src/index.js
createEventTracker
function createEventTracker (emitter) { const events = [] return { on (event, fn) { events.push([ event, fn ]) return emitter.on(event, fn) }, remove () { events.forEach(([ event, fn ]) => { emitter.off(event, fn) }) } } }
javascript
function createEventTracker (emitter) { const events = [] return { on (event, fn) { events.push([ event, fn ]) return emitter.on(event, fn) }, remove () { events.forEach(([ event, fn ]) => { emitter.off(event, fn) }) } } }
[ "function", "createEventTracker", "(", "emitter", ")", "{", "const", "events", "=", "[", "]", "return", "{", "on", "(", "event", ",", "fn", ")", "{", "events", ".", "push", "(", "[", "event", ",", "fn", "]", ")", "return", "emitter", ".", "on", "("...
Create a wrapper around an event emitter with a `remove` method to remove all events that were added using the wrapped emitter.
[ "Create", "a", "wrapper", "around", "an", "event", "emitter", "with", "a", "remove", "method", "to", "remove", "all", "events", "that", "were", "added", "using", "the", "wrapped", "emitter", "." ]
7ae18bf992d544a64da998f033258ec09a3de275
https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/packages/@uppy/aws-s3-multipart/src/index.js#L12-L25
train
Create an event tracker
[ 30522, 3853, 3443, 18697, 3372, 6494, 9102, 1006, 12495, 12079, 1007, 1063, 9530, 3367, 2824, 1027, 1031, 1033, 2709, 1063, 2006, 1006, 2724, 1010, 1042, 2078, 1007, 1063, 2824, 1012, 5245, 1006, 1031, 2724, 1010, 1042, 2078, 1033, 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...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function (q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q),safe_add(x, t)), s),b); }
javascript
function (q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q),safe_add(x, t)), s),b); }
[ "function", "(", "q", ",", "a", ",", "b", ",", "x", ",", "s", ",", "t", ")", "{", "return", "safe_add", "(", "bit_rol", "(", "safe_add", "(", "safe_add", "(", "a", ",", "q", ")", ",", "safe_add", "(", "x", ",", "t", ")", ")", ",", "s", ")",...
/* These functions implement the four basic operations the algorithm uses.
[ "/", "*", "These", "functions", "implement", "the", "four", "basic", "operations", "the", "algorithm", "uses", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L342-L344
train
A function that adds two terms of the terms
[ 30522, 3853, 1006, 1053, 1010, 1037, 1010, 1038, 1010, 1060, 1010, 1055, 1010, 1056, 1007, 1063, 2709, 3647, 1035, 5587, 1006, 2978, 1035, 20996, 2140, 1006, 3647, 1035, 5587, 1006, 3647, 1035, 5587, 1006, 1037, 1010, 1053, 1007, 1010, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (Array.isArray(needle)) { for (var i = needle.length; i--;) { if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) { return true; } } return false; } else { return wysihtml5.lang.array(arr).indexOf(needle) !== -1; } }
javascript
function(needle) { if (Array.isArray(needle)) { for (var i = needle.length; i--;) { if (wysihtml5.lang.array(arr).indexOf(needle[i]) !== -1) { return true; } } return false; } else { return wysihtml5.lang.array(arr).indexOf(needle) !== -1; } }
[ "function", "(", "needle", ")", "{", "if", "(", "Array", ".", "isArray", "(", "needle", ")", ")", "{", "for", "(", "var", "i", "=", "needle", ".", "length", ";", "i", "--", ";", ")", "{", "if", "(", "wysihtml5", ".", "lang", ".", "array", "(", ...
Check whether a given object exists in an array @example wysihtml5.lang.array([1, 2]).contains(1); // => true Can be used to match array with array. If intersection is found true is returned
[ "Check", "whether", "a", "given", "object", "exists", "in", "an", "array" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4588-L4599
train
returns true if the array contains the given element
[ 30522, 3853, 1006, 12201, 1007, 1063, 2065, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 12201, 1007, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 12201, 1012, 3091, 1025, 1045, 1011, 1011, 1025, 1007, 1063, 2065, 1006, 1059, 7274, 19190, 2124...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function () { if (typeof this._idleTimeout == "number") { clearTimeout(this._idleTimeout); } // Cancel Disconnect Timeout if (this._disconnectTimeout !== null) { this.deleteTimedHandler(this._disconnectTimeout); this._disconnectTimeout = null; } Strophe.info("_doDisconnect was called"); this._proto._doDisconnect(); this.authenticated = false; this.disconnecting = false; // delete handlers this.handlers = []; this.timedHandlers = []; this.removeTimeds = []; this.removeHandlers = []; this.addTimeds = []; this.addHandlers = []; // tell the parent we disconnected this._changeConnectStatus(Strophe.Status.DISCONNECTED, null); this.connected = false; }
javascript
function () { if (typeof this._idleTimeout == "number") { clearTimeout(this._idleTimeout); } // Cancel Disconnect Timeout if (this._disconnectTimeout !== null) { this.deleteTimedHandler(this._disconnectTimeout); this._disconnectTimeout = null; } Strophe.info("_doDisconnect was called"); this._proto._doDisconnect(); this.authenticated = false; this.disconnecting = false; // delete handlers this.handlers = []; this.timedHandlers = []; this.removeTimeds = []; this.removeHandlers = []; this.addTimeds = []; this.addHandlers = []; // tell the parent we disconnected this._changeConnectStatus(Strophe.Status.DISCONNECTED, null); this.connected = false; }
[ "function", "(", ")", "{", "if", "(", "typeof", "this", ".", "_idleTimeout", "==", "\"number\"", ")", "{", "clearTimeout", "(", "this", ".", "_idleTimeout", ")", ";", "}", "// Cancel Disconnect Timeout\r", "if", "(", "this", ".", "_disconnectTimeout", "!==", ...
PrivateFunction: _doDisconnect _Private_ function to disconnect. This is the last piece of the disconnection logic. This resets the connection and alerts the user's connection callback.
[ "PrivateFunction", ":", "_doDisconnect", "_Private_", "function", "to", "disconnect", "." ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L2761-L2790
train
Disconnects from the device
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 2828, 11253, 2023, 1012, 1035, 18373, 7292, 5833, 1027, 1027, 1000, 2193, 1000, 1007, 1063, 3154, 7292, 5833, 1006, 2023, 1012, 1035, 18373, 7292, 5833, 1007, 1025, 1065, 1013, 1013, 17542, 12532, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
exceljs/exceljs
lib/doc/worksheet.js
function(options) { options = options || {}; // in a workbook, each sheet will have a number this.id = options.id; this.orderNo = options.orderNo; // and a name this.name = options.name || `Sheet${this.id}`; // add a state this.state = options.state || 'visible'; // rows allows access organised by row. Sparse array of arrays indexed by row-1, col // Note: _rows is zero based. Must subtract 1 to go from cell.row to index this._rows = []; // column definitions this._columns = null; // column keys (addRow convenience): key ==> this._collumns index this._keys = {}; // keep record of all merges this._merges = {}; // record of all row and column pageBreaks this.rowBreaks = []; this._workbook = options.workbook; // for tabColor, default row height, outline levels, etc this.properties = Object.assign( {}, { defaultRowHeight: 15, dyDescent: 55, outlineLevelCol: 0, outlineLevelRow: 0, }, options.properties ); // for all things printing this.pageSetup = Object.assign( {}, { margins: { left: 0.7, right: 0.7, top: 0.75, bottom: 0.75, header: 0.3, footer: 0.3 }, orientation: 'portrait', horizontalDpi: 4294967295, verticalDpi: 4294967295, fitToPage: !!(options.pageSetup && ((options.pageSetup.fitToWidth || options.pageSetup.fitToHeight) && !options.pageSetup.scale)), pageOrder: 'downThenOver', blackAndWhite: false, draft: false, cellComments: 'None', errors: 'displayed', scale: 100, fitToWidth: 1, fitToHeight: 1, paperSize: undefined, showRowColHeaders: false, showGridLines: false, firstPageNumber: undefined, horizontalCentered: false, verticalCentered: false, rowBreaks: null, colBreaks: null, }, options.pageSetup ); this.dataValidations = new DataValidations(); // for freezepanes, split, zoom, gridlines, etc this.views = options.views || []; this.autoFilter = options.autoFilter || null; // for images, etc this._media = []; }
javascript
function(options) { options = options || {}; // in a workbook, each sheet will have a number this.id = options.id; this.orderNo = options.orderNo; // and a name this.name = options.name || `Sheet${this.id}`; // add a state this.state = options.state || 'visible'; // rows allows access organised by row. Sparse array of arrays indexed by row-1, col // Note: _rows is zero based. Must subtract 1 to go from cell.row to index this._rows = []; // column definitions this._columns = null; // column keys (addRow convenience): key ==> this._collumns index this._keys = {}; // keep record of all merges this._merges = {}; // record of all row and column pageBreaks this.rowBreaks = []; this._workbook = options.workbook; // for tabColor, default row height, outline levels, etc this.properties = Object.assign( {}, { defaultRowHeight: 15, dyDescent: 55, outlineLevelCol: 0, outlineLevelRow: 0, }, options.properties ); // for all things printing this.pageSetup = Object.assign( {}, { margins: { left: 0.7, right: 0.7, top: 0.75, bottom: 0.75, header: 0.3, footer: 0.3 }, orientation: 'portrait', horizontalDpi: 4294967295, verticalDpi: 4294967295, fitToPage: !!(options.pageSetup && ((options.pageSetup.fitToWidth || options.pageSetup.fitToHeight) && !options.pageSetup.scale)), pageOrder: 'downThenOver', blackAndWhite: false, draft: false, cellComments: 'None', errors: 'displayed', scale: 100, fitToWidth: 1, fitToHeight: 1, paperSize: undefined, showRowColHeaders: false, showGridLines: false, firstPageNumber: undefined, horizontalCentered: false, verticalCentered: false, rowBreaks: null, colBreaks: null, }, options.pageSetup ); this.dataValidations = new DataValidations(); // for freezepanes, split, zoom, gridlines, etc this.views = options.views || []; this.autoFilter = options.autoFilter || null; // for images, etc this._media = []; }
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "// in a workbook, each sheet will have a number", "this", ".", "id", "=", "options", ".", "id", ";", "this", ".", "orderNo", "=", "options", ".", "orderNo", ";", "// and a...
Worksheet requirements Operate as sheet inside workbook or standalone Load and Save from file and stream Access/Add/Delete individual cells Manage column widths and row heights
[ "Worksheet", "requirements", "Operate", "as", "sheet", "inside", "workbook", "or", "standalone", "Load", "and", "Save", "from", "file", "and", "stream", "Access", "/", "Add", "/", "Delete", "individual", "cells", "Manage", "column", "widths", "and", "row", "he...
c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2
https://github.com/exceljs/exceljs/blob/c6ee7a14d5e0e5a07bf0e475aa4dd7b9a1e907f2/lib/doc/worksheet.js#L19-L100
train
A sheet is a cell with a single row
[ 30522, 3853, 1006, 7047, 1007, 1063, 7047, 1027, 7047, 1064, 1064, 1063, 1065, 1025, 1013, 1013, 1999, 1037, 2147, 8654, 1010, 2169, 7123, 2097, 2031, 1037, 2193, 2023, 1012, 8909, 1027, 7047, 1012, 8909, 1025, 2023, 1012, 2344, 3630, 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...
dimsemenov/PhotoSwipe
src/js/gestures.js
function(e) { // clean up previous points, without recreating array while(_tempPointsArr.length > 0) { _tempPointsArr.pop(); } if(!_pointerEventEnabled) { if(e.type.indexOf('touch') > -1) { if(e.touches && e.touches.length > 0) { _tempPointsArr[0] = _convertTouchToPoint(e.touches[0], _ePoint1); if(e.touches.length > 1) { _tempPointsArr[1] = _convertTouchToPoint(e.touches[1], _ePoint2); } } } else { _ePoint1.x = e.pageX; _ePoint1.y = e.pageY; _ePoint1.id = ''; _tempPointsArr[0] = _ePoint1;//_ePoint1; } } else { _tempCounter = 0; // we can use forEach, as pointer events are supported only in modern browsers _currPointers.forEach(function(p) { if(_tempCounter === 0) { _tempPointsArr[0] = p; } else if(_tempCounter === 1) { _tempPointsArr[1] = p; } _tempCounter++; }); } return _tempPointsArr; }
javascript
function(e) { // clean up previous points, without recreating array while(_tempPointsArr.length > 0) { _tempPointsArr.pop(); } if(!_pointerEventEnabled) { if(e.type.indexOf('touch') > -1) { if(e.touches && e.touches.length > 0) { _tempPointsArr[0] = _convertTouchToPoint(e.touches[0], _ePoint1); if(e.touches.length > 1) { _tempPointsArr[1] = _convertTouchToPoint(e.touches[1], _ePoint2); } } } else { _ePoint1.x = e.pageX; _ePoint1.y = e.pageY; _ePoint1.id = ''; _tempPointsArr[0] = _ePoint1;//_ePoint1; } } else { _tempCounter = 0; // we can use forEach, as pointer events are supported only in modern browsers _currPointers.forEach(function(p) { if(_tempCounter === 0) { _tempPointsArr[0] = p; } else if(_tempCounter === 1) { _tempPointsArr[1] = p; } _tempCounter++; }); } return _tempPointsArr; }
[ "function", "(", "e", ")", "{", "// clean up previous points, without recreating array", "while", "(", "_tempPointsArr", ".", "length", ">", "0", ")", "{", "_tempPointsArr", ".", "pop", "(", ")", ";", "}", "if", "(", "!", "_pointerEventEnabled", ")", "{", "if"...
amount of pixels to drag to determine direction of swipe
[ "amount", "of", "pixels", "to", "drag", "to", "determine", "direction", "of", "swipe" ]
80607e12542a1a54ecefa837649e862b35dffd25
https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L137-L173
train
convert touch events to points
[ 30522, 3853, 1006, 1041, 1007, 1063, 1013, 1013, 4550, 2039, 3025, 2685, 1010, 2302, 28667, 16416, 3436, 9140, 2096, 1006, 1035, 8915, 8737, 26521, 2906, 2099, 1012, 3091, 1028, 1014, 1007, 1063, 1035, 8915, 8737, 26521, 2906, 2099, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/cli.js
translateOptions
function translateOptions(cliOptions) { return { envs: cliOptions.env, extensions: cliOptions.ext, rules: cliOptions.rule, plugins: cliOptions.plugin, globals: cliOptions.global, ignore: cliOptions.ignore, ignorePath: cliOptions.ignorePath, ignorePattern: cliOptions.ignorePattern, configFile: cliOptions.config, rulePaths: cliOptions.rulesdir, useEslintrc: cliOptions.eslintrc, parser: cliOptions.parser, parserOptions: cliOptions.parserOptions, cache: cliOptions.cache, cacheFile: cliOptions.cacheFile, cacheLocation: cliOptions.cacheLocation, fix: (cliOptions.fix || cliOptions.fixDryRun) && (cliOptions.quiet ? quietFixPredicate : true), fixTypes: cliOptions.fixType, allowInlineConfig: cliOptions.inlineConfig, reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives }; }
javascript
function translateOptions(cliOptions) { return { envs: cliOptions.env, extensions: cliOptions.ext, rules: cliOptions.rule, plugins: cliOptions.plugin, globals: cliOptions.global, ignore: cliOptions.ignore, ignorePath: cliOptions.ignorePath, ignorePattern: cliOptions.ignorePattern, configFile: cliOptions.config, rulePaths: cliOptions.rulesdir, useEslintrc: cliOptions.eslintrc, parser: cliOptions.parser, parserOptions: cliOptions.parserOptions, cache: cliOptions.cache, cacheFile: cliOptions.cacheFile, cacheLocation: cliOptions.cacheLocation, fix: (cliOptions.fix || cliOptions.fixDryRun) && (cliOptions.quiet ? quietFixPredicate : true), fixTypes: cliOptions.fixType, allowInlineConfig: cliOptions.inlineConfig, reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives }; }
[ "function", "translateOptions", "(", "cliOptions", ")", "{", "return", "{", "envs", ":", "cliOptions", ".", "env", ",", "extensions", ":", "cliOptions", ".", "ext", ",", "rules", ":", "cliOptions", ".", "rule", ",", "plugins", ":", "cliOptions", ".", "plug...
Translates the CLI options into the options expected by the CLIEngine. @param {Object} cliOptions The CLI options to translate. @returns {CLIEngineOptions} The options object for the CLIEngine. @private
[ "Translates", "the", "CLI", "options", "into", "the", "options", "expected", "by", "the", "CLIEngine", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/cli.js#L48-L71
train
Translate CLI options into a object that can be passed to the command line.
[ 30522, 3853, 17637, 7361, 9285, 1006, 18856, 3695, 16790, 2015, 1007, 1063, 2709, 1063, 4372, 15088, 1024, 18856, 3695, 16790, 2015, 1012, 4372, 2615, 1010, 14305, 1024, 18856, 3695, 16790, 2015, 1012, 4654, 2102, 1010, 3513, 1024, 18856, 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...
SeleniumHQ/selenium
javascript/node/selenium-webdriver/chrome.js
createExecutor
function createExecutor(url) { let agent = new http.Agent({ keepAlive: true }); let client = url.then(url => new http.HttpClient(url, agent)); let executor = new http.Executor(client); configureExecutor(executor); return executor; }
javascript
function createExecutor(url) { let agent = new http.Agent({ keepAlive: true }); let client = url.then(url => new http.HttpClient(url, agent)); let executor = new http.Executor(client); configureExecutor(executor); return executor; }
[ "function", "createExecutor", "(", "url", ")", "{", "let", "agent", "=", "new", "http", ".", "Agent", "(", "{", "keepAlive", ":", "true", "}", ")", ";", "let", "client", "=", "url", ".", "then", "(", "url", "=>", "new", "http", ".", "HttpClient", "...
Creates a command executor with support for ChromeDriver's custom commands. @param {!Promise<string>} url The server's URL. @return {!command.Executor} The new command executor.
[ "Creates", "a", "command", "executor", "with", "support", "for", "ChromeDriver", "s", "custom", "commands", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/node/selenium-webdriver/chrome.js#L172-L178
train
Creates an executor
[ 30522, 3853, 3443, 10288, 8586, 16161, 2099, 1006, 24471, 2140, 1007, 1063, 2292, 4005, 1027, 2047, 8299, 1012, 4005, 1006, 1063, 2562, 11475, 3726, 1024, 2995, 1065, 1007, 1025, 2292, 7396, 1027, 24471, 2140, 1012, 2059, 1006, 24471, 2140,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
setQueryParam
function setQueryParam(location, key, value) { var query = parseQueryParams(location); query[encodeURIComponent(key)] = encodeURIComponent(value); var newQuery = ''; for (var q in query) { newQuery += (newQuery ? '&' : '?') + q + '=' + query[q]; } return location.origin + location.pathname + newQuery + location.hash; }
javascript
function setQueryParam(location, key, value) { var query = parseQueryParams(location); query[encodeURIComponent(key)] = encodeURIComponent(value); var newQuery = ''; for (var q in query) { newQuery += (newQuery ? '&' : '?') + q + '=' + query[q]; } return location.origin + location.pathname + newQuery + location.hash; }
[ "function", "setQueryParam", "(", "location", ",", "key", ",", "value", ")", "{", "var", "query", "=", "parseQueryParams", "(", "location", ")", ";", "query", "[", "encodeURIComponent", "(", "key", ")", "]", "=", "encodeURIComponent", "(", "value", ")", ";...
Creates a new URL by appending or replacing the given query key and value. Not supporting URL with username and password. @param {Location} location The original URL. @param {string} key The query parameter name. @param {string} value The query parameter value. @return {string} The constructed new URL.
[ "Creates", "a", "new", "URL", "by", "appending", "or", "replacing", "the", "given", "query", "key", "and", "value", ".", "Not", "supporting", "URL", "with", "username", "and", "password", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L91-L101
train
Sets a query param
[ 30522, 3853, 2275, 4226, 2854, 30524, 23032, 1027, 11968, 3366, 4226, 2854, 28689, 5244, 1006, 3295, 1007, 1025, 23032, 1031, 4372, 16044, 9496, 9006, 29513, 3372, 1006, 3145, 1007, 1033, 1027, 4372, 16044, 9496, 9006, 29513, 3372, 1006, 36...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/libs/eventor.js
triggerEvents
function triggerEvents (list, args, context) { var pass = true if (list) { var i = 0 var l = list.length var a1 = args[0] var a2 = args[1] var a3 = args[2] // call is faster than apply, optimize less than 3 argu // http://blog.csdn.net/zhengyinhui100/article/details/7837127 switch (args.length) { case 0: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context) !== false && pass} break case 1: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1) !== false && pass} break case 2: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2) !== false && pass} break case 3: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2, a3) !== false && pass} break default: for (; i < l; i += 2) {pass = list[i].apply(list[i + 1] || context, args) !== false && pass} break } } // trigger will return false if one of the callbacks return false return pass }
javascript
function triggerEvents (list, args, context) { var pass = true if (list) { var i = 0 var l = list.length var a1 = args[0] var a2 = args[1] var a3 = args[2] // call is faster than apply, optimize less than 3 argu // http://blog.csdn.net/zhengyinhui100/article/details/7837127 switch (args.length) { case 0: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context) !== false && pass} break case 1: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1) !== false && pass} break case 2: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2) !== false && pass} break case 3: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2, a3) !== false && pass} break default: for (; i < l; i += 2) {pass = list[i].apply(list[i + 1] || context, args) !== false && pass} break } } // trigger will return false if one of the callbacks return false return pass }
[ "function", "triggerEvents", "(", "list", ",", "args", ",", "context", ")", "{", "var", "pass", "=", "true", "if", "(", "list", ")", "{", "var", "i", "=", "0", "var", "l", "=", "list", ".", "length", "var", "a1", "=", "args", "[", "0", "]", "va...
Execute callbacks
[ "Execute", "callbacks" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/libs/eventor.js#L168-L189
train
trigger events in order to avoid the race condition
[ 30522, 3853, 9495, 18697, 7666, 1006, 2862, 1010, 12098, 5620, 1010, 6123, 1007, 1063, 13075, 3413, 1027, 2995, 2065, 1006, 2862, 1007, 1063, 13075, 1045, 1027, 1014, 13075, 1048, 1027, 2862, 1012, 3091, 13075, 17350, 1027, 12098, 5620, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jaywcjlove/linux-command
template/js/index.js
function (islist) { var arr = this.commands, self = this, i = 0, page_size = arr.length, arrResultHTML = [], resultData = [], show_list_count = islist ? this.page_size : this.query_size; if (arr && arr.length && toString.call(arr).indexOf('Array') > -1) { for (; i < page_size; i++) { if (!arr[i]) break; var nIdx = self.isSreachIndexOF(arr[i].n, self.query); var dIdx = self.isSreachIndexOF(arr[i].d, self.query); if (nIdx > -1 || dIdx > -1) { var json = arr[i]; json.nIdx = nIdx; json.dIdx = dIdx; resultData.push(json); } } } resultData.sort(function (a, b) { return a.nIdx - b.nIdx }).sort(function(a, b) { return a.n.length - b.n.length; }).sort(function (a, b) { if (b.n.indexOf(self.query) < 0) { return -1; } return a.n.indexOf(self.query) - b.n.indexOf(self.query); }); resultData = resultData.slice(0, show_list_count); for (i = 0; i < resultData.length; i++) { arrResultHTML.push(self.createKeyworldsHTML(resultData[i], self.query, islist)); } var elm = islist ? this.elm_search_result : this.elm_result; elm.innerHTML = ''; for (var i = 0; i < arrResultHTML.length; i++) { var myLi = document.createElement("LI"); myLi.innerHTML = arrResultHTML[i]; elm.appendChild(myLi); } if (arrResultHTML.length === 0) { var myLi = document.createElement("LI"); myLi.innerHTML = '<span>' + this.query ? '请尝试输入一些字符,进行搜索!' + '</span>' : '没有搜索到任何内容,请尝试输入其它字符!'; elm.appendChild(myLi); } }
javascript
function (islist) { var arr = this.commands, self = this, i = 0, page_size = arr.length, arrResultHTML = [], resultData = [], show_list_count = islist ? this.page_size : this.query_size; if (arr && arr.length && toString.call(arr).indexOf('Array') > -1) { for (; i < page_size; i++) { if (!arr[i]) break; var nIdx = self.isSreachIndexOF(arr[i].n, self.query); var dIdx = self.isSreachIndexOF(arr[i].d, self.query); if (nIdx > -1 || dIdx > -1) { var json = arr[i]; json.nIdx = nIdx; json.dIdx = dIdx; resultData.push(json); } } } resultData.sort(function (a, b) { return a.nIdx - b.nIdx }).sort(function(a, b) { return a.n.length - b.n.length; }).sort(function (a, b) { if (b.n.indexOf(self.query) < 0) { return -1; } return a.n.indexOf(self.query) - b.n.indexOf(self.query); }); resultData = resultData.slice(0, show_list_count); for (i = 0; i < resultData.length; i++) { arrResultHTML.push(self.createKeyworldsHTML(resultData[i], self.query, islist)); } var elm = islist ? this.elm_search_result : this.elm_result; elm.innerHTML = ''; for (var i = 0; i < arrResultHTML.length; i++) { var myLi = document.createElement("LI"); myLi.innerHTML = arrResultHTML[i]; elm.appendChild(myLi); } if (arrResultHTML.length === 0) { var myLi = document.createElement("LI"); myLi.innerHTML = '<span>' + this.query ? '请尝试输入一些字符,进行搜索!' + '</span>' : '没有搜索到任何内容,请尝试输入其它字符!'; elm.appendChild(myLi); } }
[ "function", "(", "islist", ")", "{", "var", "arr", "=", "this", ".", "commands", ",", "self", "=", "this", ",", "i", "=", "0", ",", "page_size", "=", "arr", ".", "length", ",", "arrResultHTML", "=", "[", "]", ",", "resultData", "=", "[", "]", ","...
[searchResult ] @param {[type]} islist [是否为列表]
[ "[", "searchResult", "]" ]
7d6c8c6b3468a0dd5311ee68934c9b8db64469f7
https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/template/js/index.js#L85-L131
train
Create the result HTML
[ 30522, 3853, 1006, 2003, 9863, 1007, 1063, 13075, 12098, 2099, 1027, 2023, 30524, 1010, 2265, 1035, 2862, 1035, 4175, 1027, 2003, 9863, 1029, 2023, 1012, 3931, 1035, 2946, 1024, 2023, 1012, 23032, 1035, 2946, 1025, 2065, 1006, 12098, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/xmlextras.js
getDomDocumentPrefix
function getDomDocumentPrefix() { if (getDomDocumentPrefix.prefix) return getDomDocumentPrefix.prefix; var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; var o; for (var i = 0; i < prefixes.length; i++) { try { // try to create the objects o = new ActiveXObject(prefixes[i] + ".DomDocument"); return getDomDocumentPrefix.prefix = prefixes[i]; } catch (ex) {}; } throw new Error("Could not find an installed XML parser"); }
javascript
function getDomDocumentPrefix() { if (getDomDocumentPrefix.prefix) return getDomDocumentPrefix.prefix; var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; var o; for (var i = 0; i < prefixes.length; i++) { try { // try to create the objects o = new ActiveXObject(prefixes[i] + ".DomDocument"); return getDomDocumentPrefix.prefix = prefixes[i]; } catch (ex) {}; } throw new Error("Could not find an installed XML parser"); }
[ "function", "getDomDocumentPrefix", "(", ")", "{", "if", "(", "getDomDocumentPrefix", ".", "prefix", ")", "return", "getDomDocumentPrefix", ".", "prefix", ";", "var", "prefixes", "=", "[", "\"MSXML2\"", ",", "\"Microsoft\"", ",", "\"MSXML\"", ",", "\"MSXML3\"", ...
<script> //////////////// Helper Stuff // //////////////// used to find the Automation server name
[ "<script", ">", "////////////////", "Helper", "Stuff", "//", "////////////////", "used", "to", "find", "the", "Automation", "server", "name" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/xmlextras.js#L11-L27
train
Returns the prefix of the DOM document.
[ 30522, 3853, 2131, 9527, 3527, 24894, 4765, 28139, 8873, 2595, 1006, 1007, 1063, 2065, 1006, 2131, 9527, 3527, 24894, 4765, 28139, 8873, 2595, 1012, 17576, 1007, 2709, 2131, 9527, 3527, 24894, 4765, 28139, 8873, 2595, 1012, 17576, 1025, 130...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
moleculerjs/moleculer
bin/moleculer-runner.js
run
function run() { return Promise.resolve() .then(loadEnvFile) .then(loadConfigFile) .then(mergeOptions) .then(startBroker) .catch(err => { logger.error(err); process.exit(1); }); }
javascript
function run() { return Promise.resolve() .then(loadEnvFile) .then(loadConfigFile) .then(mergeOptions) .then(startBroker) .catch(err => { logger.error(err); process.exit(1); }); }
[ "function", "run", "(", ")", "{", "return", "Promise", ".", "resolve", "(", ")", ".", "then", "(", "loadEnvFile", ")", ".", "then", "(", "loadConfigFile", ")", ".", "then", "(", "mergeOptions", ")", ".", "then", "(", "startBroker", ")", ".", "catch", ...
Running
[ "Running" ]
f95aadc2d61b0d0e3c643a43c3ed28bca6425cde
https://github.com/moleculerjs/moleculer/blob/f95aadc2d61b0d0e3c643a43c3ed28bca6425cde/bin/moleculer-runner.js#L434-L444
train
This function is called by the broker to start the broker
[ 30522, 3853, 2448, 1006, 1007, 1063, 2709, 4872, 1012, 10663, 1006, 1007, 1012, 2059, 1006, 7170, 2368, 2615, 8873, 2571, 1007, 1012, 2059, 1006, 7170, 8663, 8873, 25708, 9463, 1007, 1012, 2059, 1006, 13590, 7361, 9285, 1007, 1012, 2059, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/boxplot/boxplotLayout.js
calculateBase
function calculateBase(groupItem) { var extent; var baseAxis = groupItem.axis; var seriesModels = groupItem.seriesModels; var seriesCount = seriesModels.length; var boxWidthList = groupItem.boxWidthList = []; var boxOffsetList = groupItem.boxOffsetList = []; var boundList = []; var bandWidth; if (baseAxis.type === 'category') { bandWidth = baseAxis.getBandWidth(); } else { var maxDataCount = 0; each(seriesModels, function (seriesModel) { maxDataCount = Math.max(maxDataCount, seriesModel.getData().count()); }); extent = baseAxis.getExtent(), Math.abs(extent[1] - extent[0]) / maxDataCount; } each(seriesModels, function (seriesModel) { var boxWidthBound = seriesModel.get('boxWidth'); if (!zrUtil.isArray(boxWidthBound)) { boxWidthBound = [boxWidthBound, boxWidthBound]; } boundList.push([ parsePercent(boxWidthBound[0], bandWidth) || 0, parsePercent(boxWidthBound[1], bandWidth) || 0 ]); }); var availableWidth = bandWidth * 0.8 - 2; var boxGap = availableWidth / seriesCount * 0.3; var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount; var base = boxWidth / 2 - availableWidth / 2; each(seriesModels, function (seriesModel, idx) { boxOffsetList.push(base); base += boxGap + boxWidth; boxWidthList.push( Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]) ); }); }
javascript
function calculateBase(groupItem) { var extent; var baseAxis = groupItem.axis; var seriesModels = groupItem.seriesModels; var seriesCount = seriesModels.length; var boxWidthList = groupItem.boxWidthList = []; var boxOffsetList = groupItem.boxOffsetList = []; var boundList = []; var bandWidth; if (baseAxis.type === 'category') { bandWidth = baseAxis.getBandWidth(); } else { var maxDataCount = 0; each(seriesModels, function (seriesModel) { maxDataCount = Math.max(maxDataCount, seriesModel.getData().count()); }); extent = baseAxis.getExtent(), Math.abs(extent[1] - extent[0]) / maxDataCount; } each(seriesModels, function (seriesModel) { var boxWidthBound = seriesModel.get('boxWidth'); if (!zrUtil.isArray(boxWidthBound)) { boxWidthBound = [boxWidthBound, boxWidthBound]; } boundList.push([ parsePercent(boxWidthBound[0], bandWidth) || 0, parsePercent(boxWidthBound[1], bandWidth) || 0 ]); }); var availableWidth = bandWidth * 0.8 - 2; var boxGap = availableWidth / seriesCount * 0.3; var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount; var base = boxWidth / 2 - availableWidth / 2; each(seriesModels, function (seriesModel, idx) { boxOffsetList.push(base); base += boxGap + boxWidth; boxWidthList.push( Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]) ); }); }
[ "function", "calculateBase", "(", "groupItem", ")", "{", "var", "extent", ";", "var", "baseAxis", "=", "groupItem", ".", "axis", ";", "var", "seriesModels", "=", "groupItem", ".", "seriesModels", ";", "var", "seriesCount", "=", "seriesModels", ".", "length", ...
Calculate offset and box width for each series.
[ "Calculate", "offset", "and", "box", "width", "for", "each", "series", "." ]
4d0ea095dc3929cb6de40c45748826e7999c7aa8
https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/boxplot/boxplotLayout.js#L74-L121
train
Calculate base of the series
[ 30522, 3853, 18422, 15058, 1006, 2177, 4221, 2213, 1007, 1063, 13075, 6698, 1025, 13075, 2918, 8528, 2483, 1027, 2177, 4221, 2213, 1012, 8123, 1025, 13075, 2186, 5302, 9247, 2015, 1027, 2177, 4221, 2213, 1012, 2186, 5302, 9247, 2015, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/angular
gulpfile.js
loadTask
function loadTask(fileName, taskName) { const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); }
javascript
function loadTask(fileName, taskName) { const taskModule = require('./tools/gulp-tasks/' + fileName); const task = taskName ? taskModule[taskName] : taskModule; return task(gulp); }
[ "function", "loadTask", "(", "fileName", ",", "taskName", ")", "{", "const", "taskModule", "=", "require", "(", "'./tools/gulp-tasks/'", "+", "fileName", ")", ";", "const", "task", "=", "taskName", "?", "taskModule", "[", "taskName", "]", ":", "taskModule", ...
See `tools/gulp-tasks/README.md` for information about task loading.
[ "See", "tools", "/", "gulp", "-", "tasks", "/", "README", ".", "md", "for", "information", "about", "task", "loading", "." ]
c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c
https://github.com/angular/angular/blob/c016e2c4ecf7529f08fae4ca0f5c8b0170c6b51c/gulpfile.js#L23-L27
train
Load task from file
[ 30522, 3853, 7170, 10230, 2243, 1006, 5371, 18442, 1010, 4708, 18442, 1007, 1063, 9530, 3367, 4708, 5302, 8566, 2571, 1027, 5478, 1006, 1005, 1012, 1013, 5906, 1013, 26546, 1011, 8518, 1013, 1005, 1009, 5371, 18442, 1007, 1025, 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/extensibility/node/ExtensionManagerDomain.js
legacyPackageCheck
function legacyPackageCheck(legacyDirectory) { return fs.existsSync(legacyDirectory) && !fs.existsSync(path.join(legacyDirectory, "package.json")); }
javascript
function legacyPackageCheck(legacyDirectory) { return fs.existsSync(legacyDirectory) && !fs.existsSync(path.join(legacyDirectory, "package.json")); }
[ "function", "legacyPackageCheck", "(", "legacyDirectory", ")", "{", "return", "fs", ".", "existsSync", "(", "legacyDirectory", ")", "&&", "!", "fs", ".", "existsSync", "(", "path", ".", "join", "(", "legacyDirectory", ",", "\"package.json\"", ")", ")", ";", ...
A "legacy package" is an extension that was installed based on the GitHub name without a package.json file. Checking for the presence of these legacy extensions will help users upgrade if the extension developer puts a different name in package.json than the name of the GitHub project. @param {string} legacyDirectory directory to check for old-style extension.
[ "A", "legacy", "package", "is", "an", "extension", "that", "was", "installed", "based", "on", "the", "GitHub", "name", "without", "a", "package", ".", "json", "file", ".", "Checking", "for", "the", "presence", "of", "these", "legacy", "extensions", "will", ...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/node/ExtensionManagerDomain.js#L185-L187
train
Check if the legacy package. json exists and is a non - empty version of the legacy package. json
[ 30522, 3853, 8027, 23947, 4270, 5403, 3600, 1006, 8027, 4305, 2890, 16761, 2100, 1007, 1063, 2709, 1042, 2015, 1012, 6526, 6508, 12273, 1006, 8027, 4305, 2890, 16761, 2100, 1007, 1004, 1004, 999, 1042, 2015, 1012, 6526, 6508, 12273, 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...
zeit/now-cli
src/util/hash.js
hashes
async function hashes(files) { const map = new Map(); await Promise.all( files.map(async name => { const data = await fs.promises.readFile(name); const h = hash(data); const entry = map.get(h); if (entry) { entry.names.push(name); } else { map.set(hash(data), { names: [name], data }); } }) ); return map; }
javascript
async function hashes(files) { const map = new Map(); await Promise.all( files.map(async name => { const data = await fs.promises.readFile(name); const h = hash(data); const entry = map.get(h); if (entry) { entry.names.push(name); } else { map.set(hash(data), { names: [name], data }); } }) ); return map; }
[ "async", "function", "hashes", "(", "files", ")", "{", "const", "map", "=", "new", "Map", "(", ")", ";", "await", "Promise", ".", "all", "(", "files", ".", "map", "(", "async", "name", "=>", "{", "const", "data", "=", "await", "fs", ".", "promises"...
Computes hashes for the contents of each file given. @param {Array} of {String} full paths @return {Map}
[ "Computes", "hashes", "for", "the", "contents", "of", "each", "file", "given", "." ]
b53d907b745126113bc3e251ac2451088026a363
https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/util/hash.js#L14-L31
train
Returns a map of hashes for the given files
[ 30522, 2004, 6038, 2278, 3853, 23325, 2229, 1006, 6764, 1007, 1063, 9530, 3367, 4949, 1027, 2047, 4949, 1006, 1007, 1025, 26751, 4872, 1012, 2035, 1006, 6764, 1012, 4949, 1006, 2004, 6038, 2278, 2171, 1027, 1028, 1063, 9530, 3367, 2951, 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
release.js
center
function center (msg) { msg = ' ' + msg.trim() + ' '; const length = msg.length; const spaces = Math.floor((lineWidth - length) / 2); return Array(spaces + 1).join('-') + msg.green + Array(lineWidth - msg.length - spaces + 1).join('-'); }
javascript
function center (msg) { msg = ' ' + msg.trim() + ' '; const length = msg.length; const spaces = Math.floor((lineWidth - length) / 2); return Array(spaces + 1).join('-') + msg.green + Array(lineWidth - msg.length - spaces + 1).join('-'); }
[ "function", "center", "(", "msg", ")", "{", "msg", "=", "' '", "+", "msg", ".", "trim", "(", ")", "+", "' '", ";", "const", "length", "=", "msg", ".", "length", ";", "const", "spaces", "=", "Math", ".", "floor", "(", "(", "lineWidth", "-", "lengt...
outputs a centered message in the terminal
[ "outputs", "a", "centered", "message", "in", "the", "terminal" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L396-L401
train
center the message
[ 30522, 3853, 2415, 1006, 5796, 2290, 1007, 1063, 5796, 2290, 1027, 1005, 1005, 1009, 5796, 2290, 1012, 12241, 1006, 1007, 1009, 1005, 1005, 1025, 9530, 3367, 3091, 1027, 5796, 2290, 1012, 3091, 1025, 9530, 3367, 7258, 1027, 8785, 1012, 27...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/base/BindingParser.js
makeFormatter
function makeFormatter(aFragments) { var fnFormatter = function() { var aResult = [], l = aFragments.length, i; for (i = 0; i < l; i++) { if ( typeof aFragments[i] === "number" ) { // a numerical fragment references the part with the same number aResult.push(arguments[aFragments[i]]); } else { // anything else is a string fragment aResult.push(aFragments[i]); } } return aResult.join(''); }; fnFormatter.textFragments = aFragments; return fnFormatter; }
javascript
function makeFormatter(aFragments) { var fnFormatter = function() { var aResult = [], l = aFragments.length, i; for (i = 0; i < l; i++) { if ( typeof aFragments[i] === "number" ) { // a numerical fragment references the part with the same number aResult.push(arguments[aFragments[i]]); } else { // anything else is a string fragment aResult.push(aFragments[i]); } } return aResult.join(''); }; fnFormatter.textFragments = aFragments; return fnFormatter; }
[ "function", "makeFormatter", "(", "aFragments", ")", "{", "var", "fnFormatter", "=", "function", "(", ")", "{", "var", "aResult", "=", "[", "]", ",", "l", "=", "aFragments", ".", "length", ",", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", ...
Helper to create a formatter function. Only used to reduce the closure size of the formatter @param {number[]|string[]} aFragments array of fragments, either a literal text or the index of the binding's part @returns {function} a formatter function
[ "Helper", "to", "create", "a", "formatter", "function", ".", "Only", "used", "to", "reduce", "the", "closure", "size", "of", "the", "formatter" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/BindingParser.js#L94-L113
train
Creates a formatter function that can be used to format text fragments
[ 30522, 3853, 2191, 14192, 20097, 1006, 21358, 29181, 8163, 1007, 1063, 13075, 1042, 2078, 14192, 20097, 1027, 3853, 1006, 1007, 1063, 13075, 23631, 11314, 1027, 1031, 1033, 1010, 1048, 1027, 21358, 29181, 8163, 1012, 3091, 1010, 1045, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js
isValidRoundtrip
function isValidRoundtrip(oRequestTiming) { var bComplete, bEmpty, bCached; // if the request has been completed it has complete timing figures) bComplete = oRequestTiming.startTime > 0 && oRequestTiming.startTime <= oRequestTiming.requestStart && oRequestTiming.requestStart <= oRequestTiming.responseEnd; // encodedBodySize and transferSize info are not available in all browsers if (oRequestTiming.encodedBodySize !== undefined && oRequestTiming.transferSize !== undefined) { // if the body is empty a script tag responded from cache is assumed bEmpty = oRequestTiming.encodedBodySize === 0; // if transfer size is smaller than body an xhr responded from cache is assumed bCached = oRequestTiming.transferSize < oRequestTiming.encodedBodySize; } return bComplete && !bEmpty && !bCached; }
javascript
function isValidRoundtrip(oRequestTiming) { var bComplete, bEmpty, bCached; // if the request has been completed it has complete timing figures) bComplete = oRequestTiming.startTime > 0 && oRequestTiming.startTime <= oRequestTiming.requestStart && oRequestTiming.requestStart <= oRequestTiming.responseEnd; // encodedBodySize and transferSize info are not available in all browsers if (oRequestTiming.encodedBodySize !== undefined && oRequestTiming.transferSize !== undefined) { // if the body is empty a script tag responded from cache is assumed bEmpty = oRequestTiming.encodedBodySize === 0; // if transfer size is smaller than body an xhr responded from cache is assumed bCached = oRequestTiming.transferSize < oRequestTiming.encodedBodySize; } return bComplete && !bEmpty && !bCached; }
[ "function", "isValidRoundtrip", "(", "oRequestTiming", ")", "{", "var", "bComplete", ",", "bEmpty", ",", "bCached", ";", "// if the request has been completed it has complete timing figures)", "bComplete", "=", "oRequestTiming", ".", "startTime", ">", "0", "&&", "oRequest...
Valid timings are all timings which are completed, not empty and not responded from browser cache. Note: Currently only Chrome and FF support size related properties (body size and transfer size), hence the requests of others not supporting them are counted as complete (in dubio pro reo), as before. @param {object} oRequestTiming @private
[ "Valid", "timings", "are", "all", "timings", "which", "are", "completed", "not", "empty", "and", "not", "responded", "from", "browser", "cache", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/trace/Interaction.js#L70-L87
train
Checks if the request has been completed and if so checks if the request has been cached
[ 30522, 3853, 2003, 10175, 3593, 22494, 26379, 29443, 1006, 10848, 15500, 3775, 6562, 1007, 1063, 13075, 30524, 2065, 1996, 5227, 2038, 2042, 2949, 2009, 2038, 3143, 10984, 4481, 1007, 4647, 25377, 25890, 1027, 10848, 15500, 3775, 6562, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/menus/img/index.js
Image
function Image(editor) { this.editor = editor const imgMenuId = getRandom('w-e-img') this.$elem = $('<div class="w-e-menu" id="' + imgMenuId + '"><i class="w-e-icon-image"></i></div>') editor.imgMenuId = imgMenuId this.type = 'panel' // 当前是否 active 状态 this._active = false }
javascript
function Image(editor) { this.editor = editor const imgMenuId = getRandom('w-e-img') this.$elem = $('<div class="w-e-menu" id="' + imgMenuId + '"><i class="w-e-icon-image"></i></div>') editor.imgMenuId = imgMenuId this.type = 'panel' // 当前是否 active 状态 this._active = false }
[ "function", "Image", "(", "editor", ")", "{", "this", ".", "editor", "=", "editor", "const", "imgMenuId", "=", "getRandom", "(", "'w-e-img'", ")", "this", ".", "$elem", "=", "$", "(", "'<div class=\"w-e-menu\" id=\"'", "+", "imgMenuId", "+", "'\"><i class=\"w-...
构造函数
[ "构造函数" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/menus/img/index.js#L9-L18
train
Image 文件
[ 30522, 3853, 3746, 1006, 3559, 1007, 1063, 2023, 1012, 3559, 1027, 3559, 9530, 3367, 10047, 21693, 2368, 21272, 1027, 2131, 13033, 5358, 1006, 1005, 1059, 1011, 1041, 1011, 10047, 2290, 1005, 1007, 2023, 1012, 1002, 3449, 6633, 1027, 1002, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/components/scene/screenshot.js
function (projection) { var params = this.setCapture(projection); this.renderCapture(params.camera, params.size, params.projection); return this.canvas; }
javascript
function (projection) { var params = this.setCapture(projection); this.renderCapture(params.camera, params.size, params.projection); return this.canvas; }
[ "function", "(", "projection", ")", "{", "var", "params", "=", "this", ".", "setCapture", "(", "projection", ")", ";", "this", ".", "renderCapture", "(", "params", ".", "camera", ",", "params", ".", "size", ",", "params", ".", "projection", ")", ";", "...
Return canvas instead of triggering download (e.g., for uploading blob to server).
[ "Return", "canvas", "instead", "of", "triggering", "download", "(", "e", ".", "g", ".", "for", "uploading", "blob", "to", "server", ")", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/scene/screenshot.js#L188-L192
train
Render the image with the given projection
[ 30522, 3853, 1006, 13996, 1007, 1063, 13075, 11498, 5244, 1027, 2023, 1012, 2275, 17695, 11244, 1006, 13996, 1007, 1025, 2023, 1012, 17552, 17695, 11244, 1006, 11498, 5244, 1012, 4950, 1010, 11498, 5244, 1012, 2946, 1010, 11498, 5244, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
pixijs/pixi.js
packages/runner/benchmark/index.js
doBench
function doBench(name, fn) { timings[name] = { runs: [], total: 0, avg: 0, }; console.log(`\nbenchmarking ${name}...`); for (let r = 0; r < numRuns; ++r) { const start = performance.now(); for (let i = 0; i < numCycles; i++) { fn(); } let time = performance.now() - start; time /= 1000; timings[name].runs.push(time); timings[name].total += time; } timings[name].avg = timings[name].total / numRuns; console.log(`${name}: ${timings[name].avg}`); }
javascript
function doBench(name, fn) { timings[name] = { runs: [], total: 0, avg: 0, }; console.log(`\nbenchmarking ${name}...`); for (let r = 0; r < numRuns; ++r) { const start = performance.now(); for (let i = 0; i < numCycles; i++) { fn(); } let time = performance.now() - start; time /= 1000; timings[name].runs.push(time); timings[name].total += time; } timings[name].avg = timings[name].total / numRuns; console.log(`${name}: ${timings[name].avg}`); }
[ "function", "doBench", "(", "name", ",", "fn", ")", "{", "timings", "[", "name", "]", "=", "{", "runs", ":", "[", "]", ",", "total", ":", "0", ",", "avg", ":", "0", ",", "}", ";", "console", ".", "log", "(", "`", "\\n", "${", "name", "}", "...
bench helper
[ "bench", "helper" ]
99ae03b7565ae7ca5a6de633b0a277f7128fa4d0
https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/runner/benchmark/index.js#L40-L69
train
Runs the benchmarks for the specified name
[ 30522, 3853, 2079, 10609, 2818, 1006, 2171, 1010, 1042, 2078, 1007, 1063, 10984, 2015, 1031, 2171, 1033, 1027, 1063, 3216, 1024, 1031, 1033, 1010, 2561, 1024, 1014, 1010, 20704, 2290, 1024, 1014, 1010, 1065, 1025, 10122, 1012, 8833, 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...
getinsomnia/insomnia
packages/insomnia-app/app/ui/redux/modules/index.js
getAllDocs
async function getAllDocs() { // Restore docs in parent->child->grandchild order const allDocs = [ ...(await models.settings.all()), ...(await models.workspace.all()), ...(await models.workspaceMeta.all()), ...(await models.environment.all()), ...(await models.cookieJar.all()), ...(await models.requestGroup.all()), ...(await models.requestGroupMeta.all()), ...(await models.request.all()), ...(await models.requestMeta.all()), ...(await models.response.all()), ...(await models.oAuth2Token.all()), ...(await models.clientCertificate.all()), ]; return allDocs; }
javascript
async function getAllDocs() { // Restore docs in parent->child->grandchild order const allDocs = [ ...(await models.settings.all()), ...(await models.workspace.all()), ...(await models.workspaceMeta.all()), ...(await models.environment.all()), ...(await models.cookieJar.all()), ...(await models.requestGroup.all()), ...(await models.requestGroupMeta.all()), ...(await models.request.all()), ...(await models.requestMeta.all()), ...(await models.response.all()), ...(await models.oAuth2Token.all()), ...(await models.clientCertificate.all()), ]; return allDocs; }
[ "async", "function", "getAllDocs", "(", ")", "{", "// Restore docs in parent->child->grandchild order", "const", "allDocs", "=", "[", "...", "(", "await", "models", ".", "settings", ".", "all", "(", ")", ")", ",", "...", "(", "await", "models", ".", "workspace...
Async function to get all docs concurrently
[ "Async", "function", "to", "get", "all", "docs", "concurrently" ]
e24ce7f7b41246e700c4b9bdb6b34b6652ad589b
https://github.com/getinsomnia/insomnia/blob/e24ce7f7b41246e700c4b9bdb6b34b6652ad589b/packages/insomnia-app/app/ui/redux/modules/index.js#L48-L66
train
Get all docs
[ 30522, 2004, 6038, 2278, 3853, 2131, 8095, 3527, 6169, 1006, 1007, 1063, 1013, 1013, 9239, 9986, 2015, 1999, 6687, 1011, 1028, 2775, 1011, 1028, 2882, 19339, 2344, 9530, 3367, 2035, 3527, 6169, 1027, 1031, 1012, 1012, 1012, 1006, 26751, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/search/node/FindInFilesDomain.js
fileCrawler
function fileCrawler() { if (!files || (files && files.length === 0)) { setTimeout(fileCrawler, 1000); return; } var contents = ""; if (currentCrawlIndex < files.length) { contents = getFileContentsForFile(files[currentCrawlIndex]); if (contents) { cacheSize += contents.length; } currentCrawlIndex++; } if (currentCrawlIndex < files.length) { crawlComplete = false; setImmediate(fileCrawler); } else { crawlComplete = true; if (!crawlEventSent) { crawlEventSent = true; _domainManager.emitEvent("FindInFiles", "crawlComplete", [files.length, cacheSize]); } setTimeout(fileCrawler, 1000); } }
javascript
function fileCrawler() { if (!files || (files && files.length === 0)) { setTimeout(fileCrawler, 1000); return; } var contents = ""; if (currentCrawlIndex < files.length) { contents = getFileContentsForFile(files[currentCrawlIndex]); if (contents) { cacheSize += contents.length; } currentCrawlIndex++; } if (currentCrawlIndex < files.length) { crawlComplete = false; setImmediate(fileCrawler); } else { crawlComplete = true; if (!crawlEventSent) { crawlEventSent = true; _domainManager.emitEvent("FindInFiles", "crawlComplete", [files.length, cacheSize]); } setTimeout(fileCrawler, 1000); } }
[ "function", "fileCrawler", "(", ")", "{", "if", "(", "!", "files", "||", "(", "files", "&&", "files", ".", "length", "===", "0", ")", ")", "{", "setTimeout", "(", "fileCrawler", ",", "1000", ")", ";", "return", ";", "}", "var", "contents", "=", "\"...
Crawls through the files in the project ans stores them in cache. Since that could take a while we do it in batches so that node wont be blocked.
[ "Crawls", "through", "the", "files", "in", "the", "project", "ans", "stores", "them", "in", "cache", ".", "Since", "that", "could", "take", "a", "while", "we", "do", "it", "in", "batches", "so", "that", "node", "wont", "be", "blocked", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/node/FindInFilesDomain.js#L343-L367
train
Crawls the files
[ 30522, 3853, 5371, 26775, 10376, 3917, 1006, 1007, 1063, 2065, 1006, 999, 6764, 1064, 1064, 1006, 6764, 1004, 1004, 6764, 1012, 3091, 1027, 1027, 1027, 1014, 1007, 1007, 1063, 2275, 7292, 5833, 1006, 5371, 26775, 10376, 3917, 1010, 6694, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/prefer-object-spread.js
getParenTokens
function getParenTokens(node, leftArgumentListParen, sourceCode) { const parens = [sourceCode.getFirstToken(node), sourceCode.getLastToken(node)]; let leftNext = sourceCode.getTokenBefore(node); let rightNext = sourceCode.getTokenAfter(node); // Note: don't include the parens of the argument list. while ( leftNext && rightNext && leftNext.range[0] > leftArgumentListParen.range[0] && isOpeningParenToken(leftNext) && isClosingParenToken(rightNext) ) { parens.push(leftNext, rightNext); leftNext = sourceCode.getTokenBefore(leftNext); rightNext = sourceCode.getTokenAfter(rightNext); } return parens.sort((a, b) => a.range[0] - b.range[0]); }
javascript
function getParenTokens(node, leftArgumentListParen, sourceCode) { const parens = [sourceCode.getFirstToken(node), sourceCode.getLastToken(node)]; let leftNext = sourceCode.getTokenBefore(node); let rightNext = sourceCode.getTokenAfter(node); // Note: don't include the parens of the argument list. while ( leftNext && rightNext && leftNext.range[0] > leftArgumentListParen.range[0] && isOpeningParenToken(leftNext) && isClosingParenToken(rightNext) ) { parens.push(leftNext, rightNext); leftNext = sourceCode.getTokenBefore(leftNext); rightNext = sourceCode.getTokenAfter(rightNext); } return parens.sort((a, b) => a.range[0] - b.range[0]); }
[ "function", "getParenTokens", "(", "node", ",", "leftArgumentListParen", ",", "sourceCode", ")", "{", "const", "parens", "=", "[", "sourceCode", ".", "getFirstToken", "(", "node", ")", ",", "sourceCode", ".", "getLastToken", "(", "node", ")", "]", ";", "let"...
Get the parenthesis tokens of a given ObjectExpression node. This incldues the braces of the object literal and enclosing parentheses. @param {ASTNode} node The node to get. @param {Token} leftArgumentListParen The opening paren token of the argument list. @param {SourceCode} sourceCode The source code object to get tokens. @returns {Token[]} The parenthesis tokens of the node. This is sorted by the location.
[ "Get", "the", "parenthesis", "tokens", "of", "a", "given", "ObjectExpression", "node", ".", "This", "incldues", "the", "braces", "of", "the", "object", "literal", "and", "enclosing", "parentheses", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/prefer-object-spread.js#L77-L96
train
Get the parens of a node
[ 30522, 3853, 2131, 19362, 4765, 11045, 3619, 1006, 13045, 1010, 2187, 2906, 22850, 4765, 9863, 19362, 2368, 1010, 3120, 16044, 1007, 1063, 9530, 3367, 11968, 6132, 1027, 1031, 3120, 16044, 1012, 2131, 8873, 12096, 18715, 2368, 1006, 13045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/project/ProjectManager.js
deleteItem
function deleteItem(entry) { var result = new $.Deferred(); entry.moveToTrash(function (err) { if (!err) { DocumentManager.notifyPathDeleted(entry.fullPath); result.resolve(); } else { _showErrorDialog(ERR_TYPE_DELETE, entry.isDirectory, FileUtils.getFileErrorString(err), entry.fullPath); result.reject(err); } }); return result.promise(); }
javascript
function deleteItem(entry) { var result = new $.Deferred(); entry.moveToTrash(function (err) { if (!err) { DocumentManager.notifyPathDeleted(entry.fullPath); result.resolve(); } else { _showErrorDialog(ERR_TYPE_DELETE, entry.isDirectory, FileUtils.getFileErrorString(err), entry.fullPath); result.reject(err); } }); return result.promise(); }
[ "function", "deleteItem", "(", "entry", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "entry", ".", "moveToTrash", "(", "function", "(", "err", ")", "{", "if", "(", "!", "err", ")", "{", "DocumentManager", ".", "notifyPa...
Delete file or directore from project @param {!(File|Directory)} entry File or Directory to delete
[ "Delete", "file", "or", "directore", "from", "project" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/ProjectManager.js#L1130-L1145
train
Delete an item from the database
[ 30522, 3853, 3972, 12870, 4221, 2213, 1006, 4443, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 4443, 1012, 2693, 3406, 6494, 4095, 1006, 3853, 1006, 9413, 2099, 1007, 1063, 2065, 1006, 999, 9413, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/73_wbbin.js
write_BrtFileVersion
function write_BrtFileVersion(data, o) { if(!o) o = new_buf(127); for(var i = 0; i != 4; ++i) o.write_shift(4, 0); write_XLWideString("SheetJS", o); write_XLWideString(XLSX.version, o); write_XLWideString(XLSX.version, o); write_XLWideString("7262", o); o.length = o.l; return o.length > o.l ? o.slice(0, o.l) : o; }
javascript
function write_BrtFileVersion(data, o) { if(!o) o = new_buf(127); for(var i = 0; i != 4; ++i) o.write_shift(4, 0); write_XLWideString("SheetJS", o); write_XLWideString(XLSX.version, o); write_XLWideString(XLSX.version, o); write_XLWideString("7262", o); o.length = o.l; return o.length > o.l ? o.slice(0, o.l) : o; }
[ "function", "write_BrtFileVersion", "(", "data", ",", "o", ")", "{", "if", "(", "!", "o", ")", "o", "=", "new_buf", "(", "127", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "!=", "4", ";", "++", "i", ")", "o", ".", "write_shift", "("...
/* [MS-XLSB] 2.4.649 BrtFileVersion
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "4", ".", "649", "BrtFileVersion" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/73_wbbin.js#L202-L211
train
write BrtFileVersion - Write BrtFile version
[ 30522, 3853, 4339, 1035, 7987, 24475, 9463, 27774, 1006, 2951, 1010, 1051, 1007, 1063, 2065, 1006, 999, 1051, 1007, 1051, 1027, 2047, 1035, 20934, 2546, 1006, 13029, 1007, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 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-alert.js
findReference
function findReference(scope, node) { const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && reference.identifier.range[1] === node.range[1]); if (references.length === 1) { return references[0]; } return null; }
javascript
function findReference(scope, node) { const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] && reference.identifier.range[1] === node.range[1]); if (references.length === 1) { return references[0]; } return null; }
[ "function", "findReference", "(", "scope", ",", "node", ")", "{", "const", "references", "=", "scope", ".", "references", ".", "filter", "(", "reference", "=>", "reference", ".", "identifier", ".", "range", "[", "0", "]", "===", "node", ".", "range", "["...
Finds the eslint-scope reference in the given scope. @param {Object} scope The scope to search. @param {ASTNode} node The identifier node. @returns {Reference|null} Returns the found reference or null if none were found.
[ "Finds", "the", "eslint", "-", "scope", "reference", "in", "the", "given", "scope", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-alert.js#L32-L40
train
Find a reference in the given scope
[ 30522, 3853, 2424, 2890, 25523, 1006, 9531, 1010, 13045, 1007, 1063, 9530, 3367, 7604, 1027, 9531, 1012, 7604, 1012, 11307, 1006, 4431, 1027, 1028, 4431, 1012, 8909, 4765, 18095, 1012, 2846, 1031, 1014, 1033, 1027, 1027, 1027, 13045, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/material-design-lite
src/mdlComponentHandler.js
findRegisteredClass_
function findRegisteredClass_(name, optReplace) { for (var i = 0; i < registeredComponents_.length; i++) { if (registeredComponents_[i].className === name) { if (typeof optReplace !== 'undefined') { registeredComponents_[i] = optReplace; } return registeredComponents_[i]; } } return false; }
javascript
function findRegisteredClass_(name, optReplace) { for (var i = 0; i < registeredComponents_.length; i++) { if (registeredComponents_[i].className === name) { if (typeof optReplace !== 'undefined') { registeredComponents_[i] = optReplace; } return registeredComponents_[i]; } } return false; }
[ "function", "findRegisteredClass_", "(", "name", ",", "optReplace", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "registeredComponents_", ".", "length", ";", "i", "++", ")", "{", "if", "(", "registeredComponents_", "[", "i", "]", ".", "cl...
Searches registered components for a class we are interested in using. Optionally replaces a match with passed object if specified. @param {string} name The name of a class we want to use. @param {componentHandler.ComponentConfig=} optReplace Optional object to replace match with. @return {!Object|boolean} @private
[ "Searches", "registered", "components", "for", "a", "class", "we", "are", "interested", "in", "using", ".", "Optionally", "replaces", "a", "match", "with", "passed", "object", "if", "specified", "." ]
60f441a22ed98ed2c03f6179adf460d888bf459f
https://github.com/google/material-design-lite/blob/60f441a22ed98ed2c03f6179adf460d888bf459f/src/mdlComponentHandler.js#L104-L114
train
Find a class in the list of registered components
[ 30522, 3853, 2424, 2890, 24063, 6850, 26266, 1035, 1006, 2171, 1010, 23569, 2890, 24759, 10732, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 5068, 9006, 29513, 7666, 1035, 1012, 3091, 1025, 1045, 1009, 1009, 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...
adobe/brackets
src/extensions/default/CodeFolding/foldhelpers/foldcode.js
init
function init() { CodeMirror.defineExtension("foldCode", function (pos, options, force) { return doFold(this, pos, options, force); }); CodeMirror.defineExtension("unfoldCode", function (pos, options) { return doFold(this, pos, options, "unfold"); }); CodeMirror.defineExtension("isFolded", function (line) { return this._lineFolds && this._lineFolds[line]; }); /** * Checks the validity of the ranges passed in the parameter and returns the foldranges * that are still valid in the current document * @param {object} folds the dictionary of lines in the current document that should be folded * @returns {object} valid folds found in those passed in parameter */ CodeMirror.defineExtension("getValidFolds", function (folds) { var keys, rf = CodeMirror.fold.auto, cm = this, result = {}, range, cachedRange; if (folds && (keys = Object.keys(folds)).length) { keys.forEach(function (lineNumber) { lineNumber = +lineNumber; if (lineNumber >= cm.firstLine() && lineNumber <= cm.lastLine()) { range = rf(cm, CodeMirror.Pos(lineNumber, 0)); cachedRange = folds[lineNumber]; if (range && cachedRange && range.from.line === cachedRange.from.line && range.to.line === cachedRange.to.line) { result[lineNumber] = folds[lineNumber]; } } }); } return result; }); /** * Utility function to fold the region at the current cursor position in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?options} options extra options to pass to the fold function */ CodeMirror.commands.fold = function (cm, options) { cm.foldCode(cm.getCursor(), options, "fold"); }; /** * Utility function to unfold the region at the current cursor position in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?options} options extra options to pass to the fold function */ CodeMirror.commands.unfold = function (cm, options) { cm.foldCode(cm.getCursor(), options, "unfold"); }; /** * Utility function to fold all foldable regions in a document * @param {CodeMirror} cm the CodeMirror instance */ CodeMirror.commands.foldAll = function (cm) { cm.operation(function () { var i, e; for (i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) { cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); } }); }; /** * Utility function to unfold all folded regions in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?number} from the line number for the beginning of the region to unfold * @param {?number} to the line number for the end of the region to unfold */ CodeMirror.commands.unfoldAll = function (cm, from, to) { from = from || cm.firstLine(); to = to || cm.lastLine(); cm.operation(function () { var i, e; for (i = from, e = to; i <= e; i++) { if (cm.isFolded(i)) { cm.unfoldCode(i, {range: cm._lineFolds[i]}); } } }); }; /** * Folds the specified range. The descendants of any fold regions within the range are also folded up to * a level set globally in the `maxFoldLevel' preferences * @param {CodeMirror} cm the CodeMirror instance * @param {?number} start the line number for the beginning of the region to fold * @param {?number} end the line number for the end of the region to fold */ CodeMirror.commands.foldToLevel = function (cm, start, end) { var rf = CodeMirror.fold.auto; function foldLevel(n, from, to) { if (n > 0) { var i = from, range; while (i < to) { range = rf(cm, CodeMirror.Pos(i, 0)); if (range) { //call fold level for the range just folded foldLevel(n - 1, range.from.line + 1, range.to.line - 1); cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); i = range.to.line + 1; } else { i++; } } } } cm.operation(function () { start = start === undefined ? cm.firstLine() : start; end = end || cm.lastLine(); foldLevel(prefs.getSetting("maxFoldLevel"), start, end); }); }; /** * Helper to combine an array of fold range finders into one. This goes through the * list of fold helpers in the parameter arguments and returns the first non-null * range found from calling the fold helpers in order. */ CodeMirror.registerHelper("fold", "combine", function () { var funcs = Array.prototype.slice.call(arguments, 0); return function (cm, start) { var i; for (i = 0; i < funcs.length; ++i) { var found = funcs[i] && funcs[i](cm, start); if (found) { return found; } } }; }); /** * Creates a helper which returns the appropriate fold function based on the mode of the current position in * a document. * @param {CodeMirror} cm the CodeMirror instance * @param {number} start the current position in the document */ CodeMirror.registerHelper("fold", "auto", function (cm, start) { var helpers = cm.getHelpers(start, "fold"), i, range; //ensure mode helper is loaded if there is one var mode = cm.getMode().name; var modeHelper = CodeMirror.fold[mode]; if (modeHelper && helpers.indexOf(modeHelper) < 0) { helpers.push(modeHelper); } for (i = 0; i < helpers.length; i++) { range = helpers[i](cm, start); if (range && range.to.line - range.from.line >= prefs.getSetting("minFoldSize")) { return range; } } }); }
javascript
function init() { CodeMirror.defineExtension("foldCode", function (pos, options, force) { return doFold(this, pos, options, force); }); CodeMirror.defineExtension("unfoldCode", function (pos, options) { return doFold(this, pos, options, "unfold"); }); CodeMirror.defineExtension("isFolded", function (line) { return this._lineFolds && this._lineFolds[line]; }); /** * Checks the validity of the ranges passed in the parameter and returns the foldranges * that are still valid in the current document * @param {object} folds the dictionary of lines in the current document that should be folded * @returns {object} valid folds found in those passed in parameter */ CodeMirror.defineExtension("getValidFolds", function (folds) { var keys, rf = CodeMirror.fold.auto, cm = this, result = {}, range, cachedRange; if (folds && (keys = Object.keys(folds)).length) { keys.forEach(function (lineNumber) { lineNumber = +lineNumber; if (lineNumber >= cm.firstLine() && lineNumber <= cm.lastLine()) { range = rf(cm, CodeMirror.Pos(lineNumber, 0)); cachedRange = folds[lineNumber]; if (range && cachedRange && range.from.line === cachedRange.from.line && range.to.line === cachedRange.to.line) { result[lineNumber] = folds[lineNumber]; } } }); } return result; }); /** * Utility function to fold the region at the current cursor position in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?options} options extra options to pass to the fold function */ CodeMirror.commands.fold = function (cm, options) { cm.foldCode(cm.getCursor(), options, "fold"); }; /** * Utility function to unfold the region at the current cursor position in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?options} options extra options to pass to the fold function */ CodeMirror.commands.unfold = function (cm, options) { cm.foldCode(cm.getCursor(), options, "unfold"); }; /** * Utility function to fold all foldable regions in a document * @param {CodeMirror} cm the CodeMirror instance */ CodeMirror.commands.foldAll = function (cm) { cm.operation(function () { var i, e; for (i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) { cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); } }); }; /** * Utility function to unfold all folded regions in a document * @param {CodeMirror} cm the CodeMirror instance * @param {?number} from the line number for the beginning of the region to unfold * @param {?number} to the line number for the end of the region to unfold */ CodeMirror.commands.unfoldAll = function (cm, from, to) { from = from || cm.firstLine(); to = to || cm.lastLine(); cm.operation(function () { var i, e; for (i = from, e = to; i <= e; i++) { if (cm.isFolded(i)) { cm.unfoldCode(i, {range: cm._lineFolds[i]}); } } }); }; /** * Folds the specified range. The descendants of any fold regions within the range are also folded up to * a level set globally in the `maxFoldLevel' preferences * @param {CodeMirror} cm the CodeMirror instance * @param {?number} start the line number for the beginning of the region to fold * @param {?number} end the line number for the end of the region to fold */ CodeMirror.commands.foldToLevel = function (cm, start, end) { var rf = CodeMirror.fold.auto; function foldLevel(n, from, to) { if (n > 0) { var i = from, range; while (i < to) { range = rf(cm, CodeMirror.Pos(i, 0)); if (range) { //call fold level for the range just folded foldLevel(n - 1, range.from.line + 1, range.to.line - 1); cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); i = range.to.line + 1; } else { i++; } } } } cm.operation(function () { start = start === undefined ? cm.firstLine() : start; end = end || cm.lastLine(); foldLevel(prefs.getSetting("maxFoldLevel"), start, end); }); }; /** * Helper to combine an array of fold range finders into one. This goes through the * list of fold helpers in the parameter arguments and returns the first non-null * range found from calling the fold helpers in order. */ CodeMirror.registerHelper("fold", "combine", function () { var funcs = Array.prototype.slice.call(arguments, 0); return function (cm, start) { var i; for (i = 0; i < funcs.length; ++i) { var found = funcs[i] && funcs[i](cm, start); if (found) { return found; } } }; }); /** * Creates a helper which returns the appropriate fold function based on the mode of the current position in * a document. * @param {CodeMirror} cm the CodeMirror instance * @param {number} start the current position in the document */ CodeMirror.registerHelper("fold", "auto", function (cm, start) { var helpers = cm.getHelpers(start, "fold"), i, range; //ensure mode helper is loaded if there is one var mode = cm.getMode().name; var modeHelper = CodeMirror.fold[mode]; if (modeHelper && helpers.indexOf(modeHelper) < 0) { helpers.push(modeHelper); } for (i = 0; i < helpers.length; i++) { range = helpers[i](cm, start); if (range && range.to.line - range.from.line >= prefs.getSetting("minFoldSize")) { return range; } } }); }
[ "function", "init", "(", ")", "{", "CodeMirror", ".", "defineExtension", "(", "\"foldCode\"", ",", "function", "(", "pos", ",", "options", ",", "force", ")", "{", "return", "doFold", "(", "this", ",", "pos", ",", "options", ",", "force", ")", ";", "}",...
Initialises extensions and helpers on the CodeMirror object
[ "Initialises", "extensions", "and", "helpers", "on", "the", "CodeMirror", "object" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldcode.js#L117-L271
train
Initializes the CodeMirror instance
[ 30522, 3853, 1999, 4183, 1006, 1007, 1063, 3642, 14503, 29165, 1012, 9375, 10288, 29048, 1006, 1000, 10671, 16044, 1000, 1010, 3853, 1006, 13433, 2015, 1010, 7047, 1010, 2486, 1007, 1063, 2709, 2079, 10371, 1006, 2023, 1010, 13433, 2015, 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.fl/src/sap/ui/fl/Utils.js
function (oControl) { var sComponentId = Utils._getOwnerIdForControl(oControl); if (!sComponentId) { if (oControl && typeof oControl.getParent === "function") { var oParent = oControl.getParent(); if (oParent) { return Utils._getComponentIdForControl(oParent); } } } return sComponentId || ""; }
javascript
function (oControl) { var sComponentId = Utils._getOwnerIdForControl(oControl); if (!sComponentId) { if (oControl && typeof oControl.getParent === "function") { var oParent = oControl.getParent(); if (oParent) { return Utils._getComponentIdForControl(oParent); } } } return sComponentId || ""; }
[ "function", "(", "oControl", ")", "{", "var", "sComponentId", "=", "Utils", ".", "_getOwnerIdForControl", "(", "oControl", ")", ";", "if", "(", "!", "sComponentId", ")", "{", "if", "(", "oControl", "&&", "typeof", "oControl", ".", "getParent", "===", "\"fu...
Returns ComponentId of the control. If the control has no component, it walks up the control tree in order to find a control having one @param {sap.ui.core.Control} oControl - SAPUI5 control @returns {String} The component id or empty string if component id couldn't be found @see sap.ui.core.Component.getOwnerIdFor @private
[ "Returns", "ComponentId", "of", "the", "control", ".", "If", "the", "control", "has", "no", "component", "it", "walks", "up", "the", "control", "tree", "in", "order", "to", "find", "a", "control", "having", "one" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L512-L523
train
Returns the component id for the control
[ 30522, 3853, 1006, 1051, 8663, 13181, 2140, 1007, 1063, 13075, 8040, 25377, 5643, 16778, 2094, 1027, 21183, 12146, 1012, 1035, 2131, 12384, 11124, 20952, 2953, 8663, 13181, 2140, 1006, 1051, 8663, 13181, 2140, 1007, 1025, 2065, 1006, 999, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/dialog/dialog.js
getBoundingClientRect
function getBoundingClientRect (element, orig) { var source = angular.element((element || {})); if (source && source.length) { // Compute and save the target element's bounding rect, so that if the // element is hidden when the dialog closes, we can shrink the dialog // back to the same position it expanded from. // // Checking if the source is a rect object or a DOM element var bounds = {top:0,left:0,height:0,width:0}; var hasFn = angular.isFunction(source[0].getBoundingClientRect); return angular.extend(orig || {}, { element : hasFn ? source : undefined, bounds : hasFn ? source[0].getBoundingClientRect() : angular.extend({}, bounds, source[0]), focus : angular.bind(source, source.focus), }); } }
javascript
function getBoundingClientRect (element, orig) { var source = angular.element((element || {})); if (source && source.length) { // Compute and save the target element's bounding rect, so that if the // element is hidden when the dialog closes, we can shrink the dialog // back to the same position it expanded from. // // Checking if the source is a rect object or a DOM element var bounds = {top:0,left:0,height:0,width:0}; var hasFn = angular.isFunction(source[0].getBoundingClientRect); return angular.extend(orig || {}, { element : hasFn ? source : undefined, bounds : hasFn ? source[0].getBoundingClientRect() : angular.extend({}, bounds, source[0]), focus : angular.bind(source, source.focus), }); } }
[ "function", "getBoundingClientRect", "(", "element", ",", "orig", ")", "{", "var", "source", "=", "angular", ".", "element", "(", "(", "element", "||", "{", "}", ")", ")", ";", "if", "(", "source", "&&", "source", ".", "length", ")", "{", "// Compute a...
Identify the bounding RECT for the target element
[ "Identify", "the", "bounding", "RECT", "for", "the", "target", "element" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L912-L929
train
Get the bounding rect of the given element
[ 30522, 3853, 2131, 15494, 2075, 20464, 11638, 2890, 6593, 1006, 5783, 1010, 2030, 8004, 1007, 1063, 13075, 3120, 1027, 16108, 1012, 5783, 1006, 1006, 5783, 1064, 1064, 1063, 1065, 1007, 1007, 1025, 2065, 1006, 3120, 1004, 1004, 3120, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/api/v0.1/subscribers.js
getSubscriberByEmail
function getSubscriberByEmail(options) { if (options.email) { return models.Subscriber.getByEmail(options.email, options) .then((subscriber) => { if (!subscriber) { return Promise.reject(new common.errors.NotFoundError({ message: common.i18n.t('errors.api.subscribers.subscriberNotFound') })); } options.id = subscriber.get('id'); return options; }); } return options; }
javascript
function getSubscriberByEmail(options) { if (options.email) { return models.Subscriber.getByEmail(options.email, options) .then((subscriber) => { if (!subscriber) { return Promise.reject(new common.errors.NotFoundError({ message: common.i18n.t('errors.api.subscribers.subscriberNotFound') })); } options.id = subscriber.get('id'); return options; }); } return options; }
[ "function", "getSubscriberByEmail", "(", "options", ")", "{", "if", "(", "options", ".", "email", ")", "{", "return", "models", ".", "Subscriber", ".", "getByEmail", "(", "options", ".", "email", ",", "options", ")", ".", "then", "(", "(", "subscriber", ...
### Delete Subscriber If we have an email param, check the subscriber exists @type {[type]}
[ "###", "Delete", "Subscriber", "If", "we", "have", "an", "email", "param", "check", "the", "subscriber", "exists" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/subscribers.js#L208-L224
train
Get a subscriber by email
[ 30522, 3853, 4152, 12083, 29234, 15185, 6672, 21397, 1006, 7047, 1007, 1063, 2065, 1006, 7047, 1012, 10373, 1007, 1063, 2709, 4275, 1012, 4942, 29234, 2099, 1012, 2131, 3762, 14545, 4014, 1006, 7047, 1012, 10373, 1010, 7047, 1007, 1012, 205...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-prototype-builtins.js
disallowBuiltIns
function disallowBuiltIns(node) { if (node.callee.type !== "MemberExpression" || node.callee.computed) { return; } const propName = node.callee.property.name; if (DISALLOWED_PROPS.indexOf(propName) > -1) { context.report({ message: "Do not access Object.prototype method '{{prop}}' from target object.", loc: node.callee.property.loc.start, data: { prop: propName }, node }); } }
javascript
function disallowBuiltIns(node) { if (node.callee.type !== "MemberExpression" || node.callee.computed) { return; } const propName = node.callee.property.name; if (DISALLOWED_PROPS.indexOf(propName) > -1) { context.report({ message: "Do not access Object.prototype method '{{prop}}' from target object.", loc: node.callee.property.loc.start, data: { prop: propName }, node }); } }
[ "function", "disallowBuiltIns", "(", "node", ")", "{", "if", "(", "node", ".", "callee", ".", "type", "!==", "\"MemberExpression\"", "||", "node", ".", "callee", ".", "computed", ")", "{", "return", ";", "}", "const", "propName", "=", "node", ".", "calle...
Reports if a disallowed property is used in a CallExpression @param {ASTNode} node The CallExpression node. @returns {void}
[ "Reports", "if", "a", "disallowed", "property", "is", "used", "in", "a", "CallExpression" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-prototype-builtins.js#L37-L51
train
Check if a node is a MemberExpression that is not a MemberExpression
[ 30522, 3853, 4487, 12002, 8261, 8569, 4014, 7629, 2015, 1006, 13045, 1007, 1063, 2065, 1006, 13045, 1012, 2655, 4402, 1012, 2828, 999, 1027, 1027, 1000, 2266, 10288, 20110, 3258, 1000, 1064, 1064, 13045, 1012, 2655, 4402, 1012, 24806, 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...
nhn/tui.editor
src/js/extensions/chart/chart.js
chartReplacer
function chartReplacer(codeBlockChartDataAndOptions, extensionOptions) { const randomId = `chart-${Math.random().toString(36).substr(2, 10)}`; let renderedHTML = `<div id="${randomId}" class="chart" />`; setTimeout(() => { const chartContainer = document.querySelector(`#${randomId}`); try { parseCode2DataAndOptions(codeBlockChartDataAndOptions, ({data, options: chartOptions}) => { chartOptions = setDefaultOptions(chartOptions, extensionOptions, chartContainer); const chartType = chartOptions.editorChart.type; if (SUPPORTED_CHART_TYPES.indexOf(chartType) < 0) { chartContainer.innerHTML = `invalid chart type. type: bar, column, line, area, pie`; } else if (CATEGORY_CHART_TYPES.indexOf(chartType) > -1 && data.categories.length !== data.series[0].data.length) { chartContainer.innerHTML = 'invalid chart data'; } else { chart[chartType](chartContainer, data, chartOptions); } }); } catch (e) { chartContainer.innerHTML = 'invalid chart data'; } }, 0); return renderedHTML; }
javascript
function chartReplacer(codeBlockChartDataAndOptions, extensionOptions) { const randomId = `chart-${Math.random().toString(36).substr(2, 10)}`; let renderedHTML = `<div id="${randomId}" class="chart" />`; setTimeout(() => { const chartContainer = document.querySelector(`#${randomId}`); try { parseCode2DataAndOptions(codeBlockChartDataAndOptions, ({data, options: chartOptions}) => { chartOptions = setDefaultOptions(chartOptions, extensionOptions, chartContainer); const chartType = chartOptions.editorChart.type; if (SUPPORTED_CHART_TYPES.indexOf(chartType) < 0) { chartContainer.innerHTML = `invalid chart type. type: bar, column, line, area, pie`; } else if (CATEGORY_CHART_TYPES.indexOf(chartType) > -1 && data.categories.length !== data.series[0].data.length) { chartContainer.innerHTML = 'invalid chart data'; } else { chart[chartType](chartContainer, data, chartOptions); } }); } catch (e) { chartContainer.innerHTML = 'invalid chart data'; } }, 0); return renderedHTML; }
[ "function", "chartReplacer", "(", "codeBlockChartDataAndOptions", ",", "extensionOptions", ")", "{", "const", "randomId", "=", "`", "${", "Math", ".", "random", "(", ")", ".", "toString", "(", "36", ")", ".", "substr", "(", "2", ",", "10", ")", "}", "`",...
replace html from chart data @param {string} codeBlockChartDataAndOptions - chart data text @param {Object} extensionOptions - chart extension options @returns {string} - rendered html @ignore
[ "replace", "html", "from", "chart", "data" ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L366-L392
train
Replace chart with chart data
[ 30522, 3853, 3673, 2890, 24759, 10732, 2099, 1006, 3642, 23467, 7507, 5339, 2850, 2696, 28574, 16790, 2015, 1010, 5331, 7361, 9285, 1007, 1063, 9530, 3367, 6721, 3593, 1027, 1036, 3673, 1011, 1002, 1063, 8785, 1012, 6721, 1006, 1007, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
openlayers/openlayers
src/ol/interaction/KeyboardZoom.js
handleEvent
function handleEvent(mapBrowserEvent) { let stopEvent = false; if (mapBrowserEvent.type == EventType.KEYDOWN || mapBrowserEvent.type == EventType.KEYPRESS) { const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent); const charCode = keyEvent.charCode; if (this.condition_(mapBrowserEvent) && (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) { const map = mapBrowserEvent.map; const delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; const view = map.getView(); zoomByDelta(view, delta, undefined, this.duration_); mapBrowserEvent.preventDefault(); stopEvent = true; } } return !stopEvent; }
javascript
function handleEvent(mapBrowserEvent) { let stopEvent = false; if (mapBrowserEvent.type == EventType.KEYDOWN || mapBrowserEvent.type == EventType.KEYPRESS) { const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent); const charCode = keyEvent.charCode; if (this.condition_(mapBrowserEvent) && (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) { const map = mapBrowserEvent.map; const delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_; const view = map.getView(); zoomByDelta(view, delta, undefined, this.duration_); mapBrowserEvent.preventDefault(); stopEvent = true; } } return !stopEvent; }
[ "function", "handleEvent", "(", "mapBrowserEvent", ")", "{", "let", "stopEvent", "=", "false", ";", "if", "(", "mapBrowserEvent", ".", "type", "==", "EventType", ".", "KEYDOWN", "||", "mapBrowserEvent", ".", "type", "==", "EventType", ".", "KEYPRESS", ")", "...
Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a `KeyEvent`, and decides whether to zoom in or out (depending on whether the key pressed was '+' or '-'). @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. @return {boolean} `false` to stop event propagation. @this {KeyboardZoom}
[ "Handles", "the", "{" ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/interaction/KeyboardZoom.js#L76-L93
train
Handle a map event
[ 30522, 3853, 5047, 18697, 3372, 1006, 4949, 12618, 9333, 7869, 15338, 1007, 1063, 2292, 2644, 18697, 3372, 1027, 6270, 1025, 2065, 1006, 4949, 12618, 9333, 7869, 15338, 1012, 2828, 1027, 1027, 2724, 13874, 1012, 3145, 7698, 1064, 1064, 4949...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
requestParameterHint
function requestParameterHint(session, functionOffset) { var $deferredHints = $.Deferred(), fileInfo = getFileInfo(session, true), offset = getOffset(session, fileInfo, functionOffset), fnTypePromise = getTernFunctionType(fileInfo, offset); $.when(fnTypePromise).done( function (fnType) { session.setFnType(fnType); session.setFunctionCallPos(functionOffset); $deferredHints.resolveWith(null, [fnType]); } ).fail(function () { $deferredHints.reject(); }); return $deferredHints.promise(); }
javascript
function requestParameterHint(session, functionOffset) { var $deferredHints = $.Deferred(), fileInfo = getFileInfo(session, true), offset = getOffset(session, fileInfo, functionOffset), fnTypePromise = getTernFunctionType(fileInfo, offset); $.when(fnTypePromise).done( function (fnType) { session.setFnType(fnType); session.setFunctionCallPos(functionOffset); $deferredHints.resolveWith(null, [fnType]); } ).fail(function () { $deferredHints.reject(); }); return $deferredHints.promise(); }
[ "function", "requestParameterHint", "(", "session", ",", "functionOffset", ")", "{", "var", "$deferredHints", "=", "$", ".", "Deferred", "(", ")", ",", "fileInfo", "=", "getFileInfo", "(", "session", ",", "true", ")", ",", "offset", "=", "getOffset", "(", ...
Request a parameter hint from Tern. @param {Session} session - the active hinting session @param {{line: number, ch: number}} functionOffset - the offset of the function call. @return {jQuery.Promise} - The promise will not complete until the hint has completed.
[ "Request", "a", "parameter", "hint", "from", "Tern", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L1428-L1445
train
Request parameter hint
[ 30522, 3853, 5227, 28689, 22828, 10606, 2102, 1006, 5219, 1010, 3853, 27475, 3388, 1007, 1063, 13075, 1002, 13366, 28849, 19114, 7666, 1027, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1010, 5371, 2378, 14876, 1027, 2131, 8873, 19856, 14876, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/tableRangeHandler.js
getTableSelectionRange
function getTableSelectionRange(tableData, $selectedCells, $startContainer) { const cellIndexData = tableDataHandler.createCellIndexData(tableData); const tableRange = {}; if ($selectedCells.length) { const startRange = tableDataHandler.findCellIndex(cellIndexData, $selectedCells.first()); const endRange = util.extend({}, startRange); $selectedCells.each((index, cell) => { const cellIndex = tableDataHandler.findCellIndex(cellIndexData, $(cell)); const cellData = tableData[cellIndex.rowIndex][cellIndex.colIndex]; const lastRowMergedIndex = cellIndex.rowIndex + cellData.rowspan - 1; const lastColMergedIndex = cellIndex.colIndex + cellData.colspan - 1; endRange.rowIndex = Math.max(endRange.rowIndex, lastRowMergedIndex); endRange.colIndex = Math.max(endRange.colIndex, lastColMergedIndex); }); tableRange.start = startRange; tableRange.end = endRange; } else { const cellIndex = tableDataHandler.findCellIndex(cellIndexData, $startContainer); tableRange.start = cellIndex; tableRange.end = util.extend({}, cellIndex); } return tableRange; }
javascript
function getTableSelectionRange(tableData, $selectedCells, $startContainer) { const cellIndexData = tableDataHandler.createCellIndexData(tableData); const tableRange = {}; if ($selectedCells.length) { const startRange = tableDataHandler.findCellIndex(cellIndexData, $selectedCells.first()); const endRange = util.extend({}, startRange); $selectedCells.each((index, cell) => { const cellIndex = tableDataHandler.findCellIndex(cellIndexData, $(cell)); const cellData = tableData[cellIndex.rowIndex][cellIndex.colIndex]; const lastRowMergedIndex = cellIndex.rowIndex + cellData.rowspan - 1; const lastColMergedIndex = cellIndex.colIndex + cellData.colspan - 1; endRange.rowIndex = Math.max(endRange.rowIndex, lastRowMergedIndex); endRange.colIndex = Math.max(endRange.colIndex, lastColMergedIndex); }); tableRange.start = startRange; tableRange.end = endRange; } else { const cellIndex = tableDataHandler.findCellIndex(cellIndexData, $startContainer); tableRange.start = cellIndex; tableRange.end = util.extend({}, cellIndex); } return tableRange; }
[ "function", "getTableSelectionRange", "(", "tableData", ",", "$selectedCells", ",", "$startContainer", ")", "{", "const", "cellIndexData", "=", "tableDataHandler", ".", "createCellIndexData", "(", "tableData", ")", ";", "const", "tableRange", "=", "{", "}", ";", "...
Get table selection range. @param {Array.<Array.<object>>} tableData - table data @param {jQuery} $selectedCells - selected cells jQuery elements @param {jQuery} $startContainer - start container jQuery element of text range @returns {{ start: {rowIndex: number, colIndex: number}, end: {rowIndex: number, colIndex: number} }} @ignore
[ "Get", "table", "selection", "range", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L181-L209
train
Get table selection range
[ 30522, 3853, 2131, 10880, 11246, 18491, 24388, 2063, 1006, 2795, 2850, 2696, 1010, 1002, 3479, 29109, 4877, 1010, 1002, 2707, 8663, 18249, 2121, 1007, 1063, 9530, 3367, 3526, 22254, 10288, 2850, 2696, 1027, 2795, 2850, 2696, 11774, 3917, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netlify/netlify-cms
packages/netlify-cms-media-library-uploadcare/src/index.js
getFileGroup
function getFileGroup(files) { /** * Capture the group id from the first file in the files array. */ const groupId = new RegExp(`^.+/([^/]+~${files.length})/nth/`).exec(files[0])[1]; /** * The `openDialog` method handles the jQuery promise object returned by * `fileFrom`, but requires the promise returned by `loadFileGroup` to provide * the result of it's `done` method. */ return new Promise(resolve => uploadcare.loadFileGroup(groupId).done(group => resolve(group))); }
javascript
function getFileGroup(files) { /** * Capture the group id from the first file in the files array. */ const groupId = new RegExp(`^.+/([^/]+~${files.length})/nth/`).exec(files[0])[1]; /** * The `openDialog` method handles the jQuery promise object returned by * `fileFrom`, but requires the promise returned by `loadFileGroup` to provide * the result of it's `done` method. */ return new Promise(resolve => uploadcare.loadFileGroup(groupId).done(group => resolve(group))); }
[ "function", "getFileGroup", "(", "files", ")", "{", "/**\n * Capture the group id from the first file in the files array.\n */", "const", "groupId", "=", "new", "RegExp", "(", "`", "${", "files", ".", "length", "}", "`", ")", ".", "exec", "(", "files", "[", "0...
Returns a fileGroupInfo object wrapped in a promise-like object.
[ "Returns", "a", "fileGroupInfo", "object", "wrapped", "in", "a", "promise", "-", "like", "object", "." ]
2488556590cbfdcefa626f2f2de01e7a160cf6ee
https://github.com/netlify/netlify-cms/blob/2488556590cbfdcefa626f2f2de01e7a160cf6ee/packages/netlify-cms-media-library-uploadcare/src/index.js#L34-L46
train
Get the file group from an array of files
[ 30522, 3853, 2131, 8873, 23115, 22107, 1006, 6764, 1007, 1063, 1013, 1008, 1008, 1008, 5425, 1996, 2177, 8909, 2013, 1996, 2034, 5371, 1999, 1996, 6764, 9140, 1012, 1008, 1013, 9530, 3367, 2177, 3593, 1027, 2047, 19723, 10288, 2361, 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...
Freeboard/freeboard
js/freeboard.thirdparty.js
function(input, inst) { var showOn, buttonText, buttonImage, appendText = this._get(inst, "appendText"), isRTL = this._get(inst, "isRTL"); if (inst.append) { inst.append.remove(); } if (appendText) { inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); input[isRTL ? "before" : "after"](inst.append); } input.unbind("focus", this._showDatepicker); if (inst.trigger) { inst.trigger.remove(); } showOn = this._get(inst, "showOn"); if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field input.focus(this._showDatepicker); } if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked buttonText = this._get(inst, "buttonText"); buttonImage = this._get(inst, "buttonImage"); inst.trigger = $(this._get(inst, "buttonImageOnly") ? $("<img/>").addClass(this._triggerClass). attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $("<button type='button'></button>").addClass(this._triggerClass). html(!buttonImage ? buttonText : $("<img/>").attr( { src:buttonImage, alt:buttonText, title:buttonText }))); input[isRTL ? "before" : "after"](inst.trigger); inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { $.datepicker._hideDatepicker(); } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { $.datepicker._hideDatepicker(); $.datepicker._showDatepicker(input[0]); } else { $.datepicker._showDatepicker(input[0]); } return false; }); } }
javascript
function(input, inst) { var showOn, buttonText, buttonImage, appendText = this._get(inst, "appendText"), isRTL = this._get(inst, "isRTL"); if (inst.append) { inst.append.remove(); } if (appendText) { inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); input[isRTL ? "before" : "after"](inst.append); } input.unbind("focus", this._showDatepicker); if (inst.trigger) { inst.trigger.remove(); } showOn = this._get(inst, "showOn"); if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field input.focus(this._showDatepicker); } if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked buttonText = this._get(inst, "buttonText"); buttonImage = this._get(inst, "buttonImage"); inst.trigger = $(this._get(inst, "buttonImageOnly") ? $("<img/>").addClass(this._triggerClass). attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $("<button type='button'></button>").addClass(this._triggerClass). html(!buttonImage ? buttonText : $("<img/>").attr( { src:buttonImage, alt:buttonText, title:buttonText }))); input[isRTL ? "before" : "after"](inst.trigger); inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { $.datepicker._hideDatepicker(); } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { $.datepicker._hideDatepicker(); $.datepicker._showDatepicker(input[0]); } else { $.datepicker._showDatepicker(input[0]); } return false; }); } }
[ "function", "(", "input", ",", "inst", ")", "{", "var", "showOn", ",", "buttonText", ",", "buttonImage", ",", "appendText", "=", "this", ".", "_get", "(", "inst", ",", "\"appendText\"", ")", ",", "isRTL", "=", "this", ".", "_get", "(", "inst", ",", "...
/* Make attachments based on settings.
[ "/", "*", "Make", "attachments", "based", "on", "settings", "." ]
38789f6e8bd3d04f7d3b2c3427e509d00f2610fc
https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L7802-L7847
train
Show the date picker when the datepicker is clicked
[ 30522, 3853, 1006, 7953, 1010, 16021, 2102, 1007, 1063, 13075, 2265, 2239, 1010, 6462, 18209, 1010, 6462, 9581, 3351, 1010, 10439, 10497, 18209, 1027, 2023, 1012, 1035, 2131, 1006, 16021, 2102, 1010, 1000, 10439, 10497, 18209, 1000, 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...
cytoscape/cytoscape.js
dist/cytoscape.esm.js
renderedPosition
function renderedPosition(dim, val) { var ele = this[0]; var cy = this.cy(); var zoom = cy.zoom(); var pan = cy.pan(); var rpos = plainObject(dim) ? dim : undefined; var setting = rpos !== undefined || val !== undefined && string(dim); if (ele && ele.isNode()) { // must have an element and must be a node to return position if (setting) { for (var i = 0; i < this.length; i++) { var _ele = this[i]; if (val !== undefined) { // set one dimension _ele.position(dim, (val - pan[dim]) / zoom); } else if (rpos !== undefined) { // set whole position _ele.position(renderedToModelPosition(rpos, zoom, pan)); } } } else { // getting var pos = ele.position(); rpos = modelToRenderedPosition(pos, zoom, pan); if (dim === undefined) { // then return the whole rendered position return rpos; } else { // then return the specified dimension return rpos[dim]; } } } else if (!setting) { return undefined; // for empty collection case } return this; // chaining }
javascript
function renderedPosition(dim, val) { var ele = this[0]; var cy = this.cy(); var zoom = cy.zoom(); var pan = cy.pan(); var rpos = plainObject(dim) ? dim : undefined; var setting = rpos !== undefined || val !== undefined && string(dim); if (ele && ele.isNode()) { // must have an element and must be a node to return position if (setting) { for (var i = 0; i < this.length; i++) { var _ele = this[i]; if (val !== undefined) { // set one dimension _ele.position(dim, (val - pan[dim]) / zoom); } else if (rpos !== undefined) { // set whole position _ele.position(renderedToModelPosition(rpos, zoom, pan)); } } } else { // getting var pos = ele.position(); rpos = modelToRenderedPosition(pos, zoom, pan); if (dim === undefined) { // then return the whole rendered position return rpos; } else { // then return the specified dimension return rpos[dim]; } } } else if (!setting) { return undefined; // for empty collection case } return this; // chaining }
[ "function", "renderedPosition", "(", "dim", ",", "val", ")", "{", "var", "ele", "=", "this", "[", "0", "]", ";", "var", "cy", "=", "this", ".", "cy", "(", ")", ";", "var", "zoom", "=", "cy", ".", "zoom", "(", ")", ";", "var", "pan", "=", "cy"...
get/set the rendered (i.e. on screen) positon of the element
[ "get", "/", "set", "the", "rendered", "(", "i", ".", "e", ".", "on", "screen", ")", "positon", "of", "the", "element" ]
ad2051b65e2243cfd953d8b24a8bf95bfa8559e5
https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L8340-L8380
train
Returns the rendered position of an element in the specified dimension.
[ 30522, 3853, 10155, 26994, 1006, 11737, 1010, 11748, 1007, 1063, 13075, 3449, 2063, 1027, 2023, 1031, 1014, 1033, 1025, 13075, 22330, 1027, 2023, 1012, 22330, 1006, 1007, 1025, 13075, 24095, 1027, 22330, 1012, 24095, 1006, 1007, 1025, 13075, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
nhn/tui.editor
src/js/extensions/table/table.js
_changeHtml
function _changeHtml(html, onChangeTable) { const $tempDiv = $(`<div>${html}</div>`); const $tables = $tempDiv.find('table'); if ($tables.length) { $tables.get().forEach(tableElement => { const changedTableElement = onChangeTable(tableElement); $(tableElement).replaceWith(changedTableElement); }); html = $tempDiv.html(); } return html; }
javascript
function _changeHtml(html, onChangeTable) { const $tempDiv = $(`<div>${html}</div>`); const $tables = $tempDiv.find('table'); if ($tables.length) { $tables.get().forEach(tableElement => { const changedTableElement = onChangeTable(tableElement); $(tableElement).replaceWith(changedTableElement); }); html = $tempDiv.html(); } return html; }
[ "function", "_changeHtml", "(", "html", ",", "onChangeTable", ")", "{", "const", "$tempDiv", "=", "$", "(", "`", "${", "html", "}", "`", ")", ";", "const", "$tables", "=", "$tempDiv", ".", "find", "(", "'table'", ")", ";", "if", "(", "$tables", ".", ...
Change html by onChangeTable function. @param {string} html - original html @param {function} onChangeTable - function for changing html @returns {string} @private
[ "Change", "html", "by", "onChangeTable", "function", "." ]
e75ab08c2a7ab07d1143e318f7cde135c5e3002e
https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L80-L95
train
Change html to table elements
[ 30522, 3853, 1035, 2689, 11039, 19968, 1006, 16129, 1010, 2006, 22305, 12928, 3468, 1007, 1063, 9530, 3367, 1002, 8915, 8737, 4305, 2615, 1027, 1002, 1006, 1036, 1026, 4487, 2615, 1028, 1002, 1063, 16129, 1065, 1026, 1013, 4487, 2615, 1028,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/comma-dangle.js
forbidTrailingComma
function forbidTrailingComma(node) { const lastItem = getLastItem(node); if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { return; } const trailingToken = getTrailingToken(node, lastItem); if (astUtils.isCommaToken(trailingToken)) { context.report({ node: lastItem, loc: trailingToken.loc.start, messageId: "unexpected", fix(fixer) { return fixer.remove(trailingToken); } }); } }
javascript
function forbidTrailingComma(node) { const lastItem = getLastItem(node); if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) { return; } const trailingToken = getTrailingToken(node, lastItem); if (astUtils.isCommaToken(trailingToken)) { context.report({ node: lastItem, loc: trailingToken.loc.start, messageId: "unexpected", fix(fixer) { return fixer.remove(trailingToken); } }); } }
[ "function", "forbidTrailingComma", "(", "node", ")", "{", "const", "lastItem", "=", "getLastItem", "(", "node", ")", ";", "if", "(", "!", "lastItem", "||", "(", "node", ".", "type", "===", "\"ImportDeclaration\"", "&&", "lastItem", ".", "type", "!==", "\"I...
Reports a trailing comma if it exists. @param {ASTNode} node - A node to check. Its type is one of ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, ImportDeclaration, and ExportNamedDeclaration. @returns {void}
[ "Reports", "a", "trailing", "comma", "if", "it", "exists", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-dangle.js#L227-L246
train
Check if trailing comma is present
[ 30522, 3853, 27206, 6494, 16281, 9006, 2863, 1006, 13045, 1007, 1063, 9530, 3367, 2197, 4221, 2213, 1027, 2131, 8523, 23096, 2213, 1006, 13045, 1007, 1025, 2065, 1006, 999, 2197, 4221, 2213, 1064, 1064, 1006, 13045, 1012, 2828, 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...
angular/material
src/components/datepicker/js/datepickerDirective.js
datePickerDirective
function datePickerDirective($$mdSvgRegistry, $mdUtil, $mdAria, inputDirective) { return { template: function(tElement, tAttrs) { // Buttons are not in the tab order because users can open the calendar via keyboard // interaction on the text input, and multiple tab stops for one component (picker) // may be confusing. var hiddenIcons = tAttrs.mdHideIcons; var ariaLabelValue = tAttrs.ariaLabel || tAttrs.mdPlaceholder; var calendarButton = (hiddenIcons === 'all' || hiddenIcons === 'calendar') ? '' : '<md-button class="md-datepicker-button md-icon-button" type="button" ' + 'tabindex="-1" aria-hidden="true" ' + 'ng-click="ctrl.openCalendarPane($event)">' + '<md-icon class="md-datepicker-calendar-icon" aria-label="md-calendar" ' + 'md-svg-src="' + $$mdSvgRegistry.mdCalendar + '"></md-icon>' + '</md-button>'; var triangleButton = ''; if (hiddenIcons !== 'all' && hiddenIcons !== 'triangle') { triangleButton = '' + '<md-button type="button" md-no-ink ' + 'class="md-datepicker-triangle-button md-icon-button" ' + 'ng-click="ctrl.openCalendarPane($event)" ' + 'aria-label="{{::ctrl.locale.msgOpenCalendar}}">' + '<div class="md-datepicker-expand-triangle"></div>' + '</md-button>'; tElement.addClass(HAS_TRIANGLE_ICON_CLASS); } return calendarButton + '<div class="md-datepicker-input-container" ng-class="{\'md-datepicker-focused\': ctrl.isFocused}">' + '<input ' + (ariaLabelValue ? 'aria-label="' + ariaLabelValue + '" ' : '') + 'class="md-datepicker-input" ' + 'aria-haspopup="true" ' + 'aria-expanded="{{ctrl.isCalendarOpen}}" ' + 'ng-focus="ctrl.setFocused(true)" ' + 'ng-blur="ctrl.setFocused(false)"> ' + triangleButton + '</div>' + // This pane will be detached from here and re-attached to the document body. '<div class="md-datepicker-calendar-pane md-whiteframe-z1" id="{{::ctrl.calendarPaneId}}">' + '<div class="md-datepicker-input-mask">' + '<div class="md-datepicker-input-mask-opaque"></div>' + '</div>' + '<div class="md-datepicker-calendar">' + '<md-calendar role="dialog" aria-label="{{::ctrl.locale.msgCalendar}}" ' + 'md-current-view="{{::ctrl.currentView}}" ' + 'md-mode="{{::ctrl.mode}}" ' + 'md-min-date="ctrl.minDate" ' + 'md-max-date="ctrl.maxDate" ' + 'md-date-filter="ctrl.dateFilter" ' + 'ng-model="ctrl.date" ng-if="ctrl.isCalendarOpen">' + '</md-calendar>' + '</div>' + '</div>'; }, require: ['ngModel', 'mdDatepicker', '?^mdInputContainer', '?^form'], scope: { minDate: '=mdMinDate', maxDate: '=mdMaxDate', placeholder: '@mdPlaceholder', currentView: '@mdCurrentView', mode: '@mdMode', dateFilter: '=mdDateFilter', isOpen: '=?mdIsOpen', debounceInterval: '=mdDebounceInterval', dateLocale: '=mdDateLocale' }, controller: DatePickerCtrl, controllerAs: 'ctrl', bindToController: true, link: function(scope, element, attr, controllers) { var ngModelCtrl = controllers[0]; var mdDatePickerCtrl = controllers[1]; var mdInputContainer = controllers[2]; var parentForm = controllers[3]; var mdNoAsterisk = $mdUtil.parseAttributeBoolean(attr.mdNoAsterisk); mdDatePickerCtrl.configureNgModel(ngModelCtrl, mdInputContainer, inputDirective); if (mdInputContainer) { // We need to move the spacer after the datepicker itself, // because md-input-container adds it after the // md-datepicker-input by default. The spacer gets wrapped in a // div, because it floats and gets aligned next to the datepicker. // There are easier ways of working around this with CSS (making the // datepicker 100% wide, change the `display` etc.), however they // break the alignment with any other form controls. var spacer = element[0].querySelector('.md-errors-spacer'); if (spacer) { element.after(angular.element('<div>').append(spacer)); } mdInputContainer.setHasPlaceholder(attr.mdPlaceholder); mdInputContainer.input = element; mdInputContainer.element .addClass(INPUT_CONTAINER_CLASS) .toggleClass(HAS_CALENDAR_ICON_CLASS, attr.mdHideIcons !== 'calendar' && attr.mdHideIcons !== 'all'); if (!mdInputContainer.label) { $mdAria.expect(element, 'aria-label', attr.mdPlaceholder); } else if (!mdNoAsterisk) { attr.$observe('required', function(value) { mdInputContainer.label.toggleClass('md-required', !!value); }); } scope.$watch(mdInputContainer.isErrorGetter || function() { return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (parentForm && parentForm.$submitted)); }, mdInputContainer.setInvalid); } else if (parentForm) { // If invalid, highlights the input when the parent form is submitted. var parentSubmittedWatcher = scope.$watch(function() { return parentForm.$submitted; }, function(isSubmitted) { if (isSubmitted) { mdDatePickerCtrl.updateErrorState(); parentSubmittedWatcher(); } }); } } }; }
javascript
function datePickerDirective($$mdSvgRegistry, $mdUtil, $mdAria, inputDirective) { return { template: function(tElement, tAttrs) { // Buttons are not in the tab order because users can open the calendar via keyboard // interaction on the text input, and multiple tab stops for one component (picker) // may be confusing. var hiddenIcons = tAttrs.mdHideIcons; var ariaLabelValue = tAttrs.ariaLabel || tAttrs.mdPlaceholder; var calendarButton = (hiddenIcons === 'all' || hiddenIcons === 'calendar') ? '' : '<md-button class="md-datepicker-button md-icon-button" type="button" ' + 'tabindex="-1" aria-hidden="true" ' + 'ng-click="ctrl.openCalendarPane($event)">' + '<md-icon class="md-datepicker-calendar-icon" aria-label="md-calendar" ' + 'md-svg-src="' + $$mdSvgRegistry.mdCalendar + '"></md-icon>' + '</md-button>'; var triangleButton = ''; if (hiddenIcons !== 'all' && hiddenIcons !== 'triangle') { triangleButton = '' + '<md-button type="button" md-no-ink ' + 'class="md-datepicker-triangle-button md-icon-button" ' + 'ng-click="ctrl.openCalendarPane($event)" ' + 'aria-label="{{::ctrl.locale.msgOpenCalendar}}">' + '<div class="md-datepicker-expand-triangle"></div>' + '</md-button>'; tElement.addClass(HAS_TRIANGLE_ICON_CLASS); } return calendarButton + '<div class="md-datepicker-input-container" ng-class="{\'md-datepicker-focused\': ctrl.isFocused}">' + '<input ' + (ariaLabelValue ? 'aria-label="' + ariaLabelValue + '" ' : '') + 'class="md-datepicker-input" ' + 'aria-haspopup="true" ' + 'aria-expanded="{{ctrl.isCalendarOpen}}" ' + 'ng-focus="ctrl.setFocused(true)" ' + 'ng-blur="ctrl.setFocused(false)"> ' + triangleButton + '</div>' + // This pane will be detached from here and re-attached to the document body. '<div class="md-datepicker-calendar-pane md-whiteframe-z1" id="{{::ctrl.calendarPaneId}}">' + '<div class="md-datepicker-input-mask">' + '<div class="md-datepicker-input-mask-opaque"></div>' + '</div>' + '<div class="md-datepicker-calendar">' + '<md-calendar role="dialog" aria-label="{{::ctrl.locale.msgCalendar}}" ' + 'md-current-view="{{::ctrl.currentView}}" ' + 'md-mode="{{::ctrl.mode}}" ' + 'md-min-date="ctrl.minDate" ' + 'md-max-date="ctrl.maxDate" ' + 'md-date-filter="ctrl.dateFilter" ' + 'ng-model="ctrl.date" ng-if="ctrl.isCalendarOpen">' + '</md-calendar>' + '</div>' + '</div>'; }, require: ['ngModel', 'mdDatepicker', '?^mdInputContainer', '?^form'], scope: { minDate: '=mdMinDate', maxDate: '=mdMaxDate', placeholder: '@mdPlaceholder', currentView: '@mdCurrentView', mode: '@mdMode', dateFilter: '=mdDateFilter', isOpen: '=?mdIsOpen', debounceInterval: '=mdDebounceInterval', dateLocale: '=mdDateLocale' }, controller: DatePickerCtrl, controllerAs: 'ctrl', bindToController: true, link: function(scope, element, attr, controllers) { var ngModelCtrl = controllers[0]; var mdDatePickerCtrl = controllers[1]; var mdInputContainer = controllers[2]; var parentForm = controllers[3]; var mdNoAsterisk = $mdUtil.parseAttributeBoolean(attr.mdNoAsterisk); mdDatePickerCtrl.configureNgModel(ngModelCtrl, mdInputContainer, inputDirective); if (mdInputContainer) { // We need to move the spacer after the datepicker itself, // because md-input-container adds it after the // md-datepicker-input by default. The spacer gets wrapped in a // div, because it floats and gets aligned next to the datepicker. // There are easier ways of working around this with CSS (making the // datepicker 100% wide, change the `display` etc.), however they // break the alignment with any other form controls. var spacer = element[0].querySelector('.md-errors-spacer'); if (spacer) { element.after(angular.element('<div>').append(spacer)); } mdInputContainer.setHasPlaceholder(attr.mdPlaceholder); mdInputContainer.input = element; mdInputContainer.element .addClass(INPUT_CONTAINER_CLASS) .toggleClass(HAS_CALENDAR_ICON_CLASS, attr.mdHideIcons !== 'calendar' && attr.mdHideIcons !== 'all'); if (!mdInputContainer.label) { $mdAria.expect(element, 'aria-label', attr.mdPlaceholder); } else if (!mdNoAsterisk) { attr.$observe('required', function(value) { mdInputContainer.label.toggleClass('md-required', !!value); }); } scope.$watch(mdInputContainer.isErrorGetter || function() { return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (parentForm && parentForm.$submitted)); }, mdInputContainer.setInvalid); } else if (parentForm) { // If invalid, highlights the input when the parent form is submitted. var parentSubmittedWatcher = scope.$watch(function() { return parentForm.$submitted; }, function(isSubmitted) { if (isSubmitted) { mdDatePickerCtrl.updateErrorState(); parentSubmittedWatcher(); } }); } } }; }
[ "function", "datePickerDirective", "(", "$$mdSvgRegistry", ",", "$mdUtil", ",", "$mdAria", ",", "inputDirective", ")", "{", "return", "{", "template", ":", "function", "(", "tElement", ",", "tAttrs", ")", "{", "// Buttons are not in the tab order because users can open ...
@ngdoc directive @name mdDatepicker @module material.components.datepicker @param {Date} ng-model The component's model. Expects either a JavaScript Date object or a value that can be parsed into one (e.g. a ISO 8601 string). @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being updated. Also allows for a timezone to be specified. <a href="https://docs.angularjs.org/api/ng/directive/ngModelOptions#usage"> Read more at the ngModelOptions docs.</a> @param {expression=} ng-change Expression evaluated when the model value changes. @param {expression=} ng-focus Expression evaluated when the input is focused or the calendar is opened. @param {expression=} ng-blur Expression evaluated when focus is removed from the input or the calendar is closed. @param {boolean=} ng-disabled Whether the datepicker is disabled. @param {boolean=} ng-required Whether a value is required for the datepicker. @param {Date=} md-min-date Expression representing a min date (inclusive). @param {Date=} md-max-date Expression representing a max date (inclusive). @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a boolean whether it can be selected or not. @param {String=} md-placeholder The date input placeholder value. @param {String=} md-open-on-focus When present, the calendar will be opened when the input is focused. @param {Boolean=} md-is-open Expression that can be used to open the datepicker's calendar on-demand. @param {String=} md-current-view Default open view of the calendar pane. Can be either "month" or "year". @param {String=} md-mode Restricts the user to only selecting a value from a particular view. This option can be used if the user is only supposed to choose from a certain date type (e.g. only selecting the month). Can be either "month" or "day". **Note** that this will overwrite the `md-current-view` value. @param {String=} md-hide-icons Determines which datepicker icons should be hidden. Note that this may cause the datepicker to not align properly with other components. **Use at your own risk.** Possible values are: * `"all"` - Hides all icons. * `"calendar"` - Only hides the calendar icon. * `"triangle"` - Only hides the triangle icon. @param {Object=} md-date-locale Allows for the values from the `$mdDateLocaleProvider` to be ovewritten on a per-element basis (e.g. `msgOpenCalendar` can be overwritten with `md-date-locale="{ msgOpenCalendar: 'Open a special calendar' }"`). @description `<md-datepicker>` is a component used to select a single date. For information on how to configure internationalization for the date picker, see {@link api/service/$mdDateLocaleProvider $mdDateLocaleProvider}. This component supports [ngMessages](https://docs.angularjs.org/api/ngMessages/directive/ngMessages). Supported attributes are: * `required`: whether a required date is not set. * `mindate`: whether the selected date is before the minimum allowed date. * `maxdate`: whether the selected date is after the maximum allowed date. * `debounceInterval`: ms to delay input processing (since last debounce reset); default value 500ms @usage <hljs lang="html"> <md-datepicker ng-model="birthday"></md-datepicker> </hljs>
[ "@ngdoc", "directive", "@name", "mdDatepicker", "@module", "material", ".", "components", ".", "datepicker" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/datepickerDirective.js#L76-L204
train
Directive to create a date picker
[ 30522, 3853, 3058, 24330, 5484, 4305, 2890, 15277, 1006, 1002, 1002, 9108, 2015, 2615, 17603, 24063, 2854, 1010, 1002, 9108, 21823, 2140, 1010, 1002, 9108, 10980, 1010, 7953, 4305, 2890, 15277, 1007, 1063, 2709, 1063, 23561, 1024, 3853, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/extensions/default/QuickOpenCSS/main.js
itemFocus
function itemFocus(selectedItem, query, explicit) { if (!selectedItem || (query.length < 2 && !explicit)) { return; } var selectorInfo = selectedItem.selectorInfo; var from = {line: selectorInfo.selectorStartLine, ch: selectorInfo.selectorStartChar}; var to = {line: selectorInfo.selectorStartLine, ch: selectorInfo.selectorEndChar}; EditorManager.getCurrentFullEditor().setSelection(from, to, true); }
javascript
function itemFocus(selectedItem, query, explicit) { if (!selectedItem || (query.length < 2 && !explicit)) { return; } var selectorInfo = selectedItem.selectorInfo; var from = {line: selectorInfo.selectorStartLine, ch: selectorInfo.selectorStartChar}; var to = {line: selectorInfo.selectorStartLine, ch: selectorInfo.selectorEndChar}; EditorManager.getCurrentFullEditor().setSelection(from, to, true); }
[ "function", "itemFocus", "(", "selectedItem", ",", "query", ",", "explicit", ")", "{", "if", "(", "!", "selectedItem", "||", "(", "query", ".", "length", "<", "2", "&&", "!", "explicit", ")", ")", "{", "return", ";", "}", "var", "selectorInfo", "=", ...
Scroll to the selected item in the current document (unless no query string entered yet, in which case the topmost list item is irrelevant) @param {?SearchResult} selectedItem @param {string} query @param {boolean} explicit False if this is only highlighted due to being at top of list after search()
[ "Scroll", "to", "the", "selected", "item", "in", "the", "current", "document", "(", "unless", "no", "query", "string", "entered", "yet", "in", "which", "case", "the", "topmost", "list", "item", "is", "irrelevant", ")" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/QuickOpenCSS/main.js#L85-L94
train
Focuses the current item
[ 30522, 3853, 8875, 14876, 7874, 1006, 3479, 4221, 2213, 1010, 23032, 1010, 13216, 1007, 1063, 2065, 1006, 999, 3479, 4221, 2213, 1064, 1064, 1006, 23032, 1012, 3091, 1026, 1016, 1004, 1004, 999, 13216, 1007, 1007, 1063, 2709, 1025, 1065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SheetJS/js-xlsx
xlsx.js
sheet_to_rtf
function sheet_to_rtf(ws) { var o = ["{\\rtf1\\ansi"]; var r = safe_decode_range(ws['!ref']), cell; var dense = Array.isArray(ws); for(var R = r.s.r; R <= r.e.r; ++R) { o.push("\\trowd\\trautofit1"); for(var C = r.s.c; C <= r.e.c; ++C) o.push("\\cellx" + (C+1)); o.push("\\pard\\intbl"); for(C = r.s.c; C <= r.e.c; ++C) { var coord = encode_cell({r:R,c:C}); cell = dense ? (ws[R]||[])[C]: ws[coord]; if(!cell || cell.v == null && (!cell.f || cell.F)) continue; o.push(" " + (cell.w || (format_cell(cell), cell.w))); o.push("\\cell"); } o.push("\\pard\\intbl\\row"); } return o.join("") + "}"; }
javascript
function sheet_to_rtf(ws) { var o = ["{\\rtf1\\ansi"]; var r = safe_decode_range(ws['!ref']), cell; var dense = Array.isArray(ws); for(var R = r.s.r; R <= r.e.r; ++R) { o.push("\\trowd\\trautofit1"); for(var C = r.s.c; C <= r.e.c; ++C) o.push("\\cellx" + (C+1)); o.push("\\pard\\intbl"); for(C = r.s.c; C <= r.e.c; ++C) { var coord = encode_cell({r:R,c:C}); cell = dense ? (ws[R]||[])[C]: ws[coord]; if(!cell || cell.v == null && (!cell.f || cell.F)) continue; o.push(" " + (cell.w || (format_cell(cell), cell.w))); o.push("\\cell"); } o.push("\\pard\\intbl\\row"); } return o.join("") + "}"; }
[ "function", "sheet_to_rtf", "(", "ws", ")", "{", "var", "o", "=", "[", "\"{\\\\rtf1\\\\ansi\"", "]", ";", "var", "r", "=", "safe_decode_range", "(", "ws", "[", "'!ref'", "]", ")", ",", "cell", ";", "var", "dense", "=", "Array", ".", "isArray", "(", "...
/* TODO: this is a stub
[ "/", "*", "TODO", ":", "this", "is", "a", "stub" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L8455-L8473
train
Converts a sheet to RTF format
[ 30522, 3853, 7123, 1035, 2000, 1035, 19387, 2546, 1006, 1059, 2015, 1007, 1063, 13075, 1051, 1027, 1031, 1000, 1063, 1032, 1032, 19387, 2546, 2487, 1032, 1032, 2019, 5332, 1000, 1033, 1025, 13075, 1054, 1027, 3647, 1035, 21933, 3207, 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...
TryGhost/Ghost
core/server/api/v0.1/mail.js
generateContent
function generateContent(result) { return mail.utils.generateContent({template: 'test'}).then((content) => { const payload = { mail: [{ message: { to: result.get('email'), subject: common.i18n.t('common.api.mail.testGhostEmail'), html: content.html, text: content.text } }] }; return payload; }); }
javascript
function generateContent(result) { return mail.utils.generateContent({template: 'test'}).then((content) => { const payload = { mail: [{ message: { to: result.get('email'), subject: common.i18n.t('common.api.mail.testGhostEmail'), html: content.html, text: content.text } }] }; return payload; }); }
[ "function", "generateContent", "(", "result", ")", "{", "return", "mail", ".", "utils", ".", "generateContent", "(", "{", "template", ":", "'test'", "}", ")", ".", "then", "(", "(", "content", ")", "=>", "{", "const", "payload", "=", "{", "mail", ":", ...
### Generate content
[ "###", "Generate", "content" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/api/v0.1/mail.js#L118-L133
train
Generate the content for the test
[ 30522, 3853, 9699, 8663, 6528, 2102, 1006, 2765, 1007, 1063, 2709, 5653, 1012, 21183, 12146, 1012, 9699, 8663, 6528, 2102, 1006, 1063, 23561, 1024, 1005, 3231, 1005, 1065, 1007, 1012, 2059, 1006, 1006, 4180, 1007, 1027, 1028, 1063, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js
findControlClass
function findControlClass(sNamespaceURI, sLocalName) { var sClassName; var mLibraries = sap.ui.getCore().getLoadedLibraries(); jQuery.each(mLibraries, function(sLibName, oLibrary) { if ( sNamespaceURI === oLibrary.namespace || sNamespaceURI === oLibrary.name ) { sClassName = oLibrary.name + "." + ((oLibrary.tagNames && oLibrary.tagNames[sLocalName]) || sLocalName); } }); // TODO guess library from sNamespaceURI and load corresponding lib!? sClassName = sClassName || sNamespaceURI + "." + sLocalName; // ensure that control and library are loaded function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; } var sResourceName = sClassName.replace(/\./g, "/"); var oClassObject = sap.ui.require(sResourceName); if (!oClassObject) { if (bAsync) { return new Promise(function(resolve) { sap.ui.require([sResourceName], function(oClassObject) { oClassObject = getObjectFallback(oClassObject); resolve(oClassObject); }); }); } else { oClassObject = sap.ui.requireSync(sResourceName); oClassObject = getObjectFallback(oClassObject); } } return oClassObject; }
javascript
function findControlClass(sNamespaceURI, sLocalName) { var sClassName; var mLibraries = sap.ui.getCore().getLoadedLibraries(); jQuery.each(mLibraries, function(sLibName, oLibrary) { if ( sNamespaceURI === oLibrary.namespace || sNamespaceURI === oLibrary.name ) { sClassName = oLibrary.name + "." + ((oLibrary.tagNames && oLibrary.tagNames[sLocalName]) || sLocalName); } }); // TODO guess library from sNamespaceURI and load corresponding lib!? sClassName = sClassName || sNamespaceURI + "." + sLocalName; // ensure that control and library are loaded function getObjectFallback(oClassObject) { // some modules might not return a class definition, so we fallback to the global // this is against the AMD definition, but is required for backward compatibility if (!oClassObject) { Log.error("Control '" + sClassName + "' did not return a class definition from sap.ui.define.", "", "XMLTemplateProcessor"); oClassObject = ObjectPath.get(sClassName); } if (!oClassObject) { Log.error("Can't find object class '" + sClassName + "' for XML-view", "", "XMLTemplateProcessor"); } return oClassObject; } var sResourceName = sClassName.replace(/\./g, "/"); var oClassObject = sap.ui.require(sResourceName); if (!oClassObject) { if (bAsync) { return new Promise(function(resolve) { sap.ui.require([sResourceName], function(oClassObject) { oClassObject = getObjectFallback(oClassObject); resolve(oClassObject); }); }); } else { oClassObject = sap.ui.requireSync(sResourceName); oClassObject = getObjectFallback(oClassObject); } } return oClassObject; }
[ "function", "findControlClass", "(", "sNamespaceURI", ",", "sLocalName", ")", "{", "var", "sClassName", ";", "var", "mLibraries", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLoadedLibraries", "(", ")", ";", "jQuery", ".", "each", "(", "mLibra...
Requests the control class if not loaded yet. If the View is set to async=true, an async XHR is sent, otherwise a sync XHR. @param {string} sNamespaceURI @param {string} sLocalName @returns {function|Promise|undefined} the loaded ControlClass plain or resolved from a Promise
[ "Requests", "the", "control", "class", "if", "not", "loaded", "yet", ".", "If", "the", "View", "is", "set", "to", "async", "=", "true", "an", "async", "XHR", "is", "sent", "otherwise", "a", "sync", "XHR", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/XMLTemplateProcessor.js#L469-L510
train
Finds the control class from the library
[ 30522, 3853, 2424, 8663, 13181, 15472, 27102, 1006, 1055, 18442, 23058, 9496, 1010, 22889, 24755, 19666, 14074, 1007, 1063, 13075, 8040, 27102, 18442, 1025, 13075, 19875, 12322, 19848, 3111, 1027, 20066, 1012, 21318, 1012, 2131, 17345, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/preferences/PreferencesBase.js
function (id, context) { var layerCounter, layers = this._layers, layer, data = this.data, result; context = context || {}; for (layerCounter = 0; layerCounter < layers.length; layerCounter++) { layer = layers[layerCounter]; result = layer.get(data[layer.key], id, context); if (result !== undefined) { return result; } } if (this._exclusions.indexOf(id) === -1) { return data[id]; } }
javascript
function (id, context) { var layerCounter, layers = this._layers, layer, data = this.data, result; context = context || {}; for (layerCounter = 0; layerCounter < layers.length; layerCounter++) { layer = layers[layerCounter]; result = layer.get(data[layer.key], id, context); if (result !== undefined) { return result; } } if (this._exclusions.indexOf(id) === -1) { return data[id]; } }
[ "function", "(", "id", ",", "context", ")", "{", "var", "layerCounter", ",", "layers", "=", "this", ".", "_layers", ",", "layer", ",", "data", "=", "this", ".", "data", ",", "result", ";", "context", "=", "context", "||", "{", "}", ";", "for", "(",...
Get the value for id, given the context. The context is provided to layers which may override the value from the main data of the Scope. Note that layers will often exclude values from consideration. @param {string} id Preference to retrieve @param {?Object} context Optional additional information about the request @return {*} Current value of the Preference
[ "Get", "the", "value", "for", "id", "given", "the", "context", ".", "The", "context", "is", "provided", "to", "layers", "which", "may", "override", "the", "value", "from", "the", "main", "data", "of", "the", "Scope", ".", "Note", "that", "layers", "will"...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L415-L435
train
Get a record from the cache
[ 30522, 3853, 1006, 8909, 1010, 6123, 1007, 1063, 13075, 6741, 3597, 16671, 2121, 1010, 9014, 1027, 2023, 1012, 1035, 9014, 1010, 6741, 1010, 2951, 1027, 2023, 1012, 2951, 1010, 2765, 1025, 6123, 1027, 6123, 1064, 1064, 1063, 1065, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
javascript/selenium-core/scripts/htmlutils.js
function(globString) { this.regexp = new RegExp(PatternMatcher.regexpFromGlobContains(globString)); this.matches = function(actual) { return this.regexp.test(actual); }; }
javascript
function(globString) { this.regexp = new RegExp(PatternMatcher.regexpFromGlobContains(globString)); this.matches = function(actual) { return this.regexp.test(actual); }; }
[ "function", "(", "globString", ")", "{", "this", ".", "regexp", "=", "new", "RegExp", "(", "PatternMatcher", ".", "regexpFromGlobContains", "(", "globString", ")", ")", ";", "this", ".", "matches", "=", "function", "(", "actual", ")", "{", "return", "this"...
"globContains" (aka "wildmat") patterns, e.g. "glob:one,two,*", but don't require a perfect match; instead succeed if actual contains something that matches globString. Making this distinction is motivated by a bug in IE6 which leads to the browser hanging if we implement *TextPresent tests by just matching against a regular expression beginning and ending with ".*". The globcontains strategy allows us to satisfy the functional needs of the *TextPresent ops more efficiently and so avoid running into this IE6 freeze.
[ "globContains", "(", "aka", "wildmat", ")", "patterns", "e", ".", "g", ".", "glob", ":", "one", "two", "*", "but", "don", "t", "require", "a", "perfect", "match", ";", "instead", "succeed", "if", "actual", "contains", "something", "that", "matches", "glo...
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/selenium-core/scripts/htmlutils.js#L672-L677
train
A class that matches a glob string
[ 30522, 3853, 1006, 1043, 4135, 5910, 18886, 3070, 1007, 1063, 2023, 1012, 19723, 10288, 2361, 1027, 2047, 19723, 10288, 2361, 1006, 5418, 18900, 7474, 1012, 19723, 10288, 14376, 21716, 23296, 16429, 8663, 18249, 2015, 1006, 1043, 4135, 5910, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/CustomListSelection.js
function() { if (!this.selectionmodel) { this.selectionmodel = new SelectionModel(SelectionModel.MULTI_SELECTION); } else { this.selectionmodel.clearSelection(); } var aIndices = this._getSelectedIndicesFromModel(); for (var i = 0; i < aIndices.length; i++) { this.selectionmodel.addSelectionInterval(aIndices[i], aIndices[i]); } if (this._doAfterInitSelectionModel) { this._doAfterInitSelectionModel(); } }
javascript
function() { if (!this.selectionmodel) { this.selectionmodel = new SelectionModel(SelectionModel.MULTI_SELECTION); } else { this.selectionmodel.clearSelection(); } var aIndices = this._getSelectedIndicesFromModel(); for (var i = 0; i < aIndices.length; i++) { this.selectionmodel.addSelectionInterval(aIndices[i], aIndices[i]); } if (this._doAfterInitSelectionModel) { this._doAfterInitSelectionModel(); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "selectionmodel", ")", "{", "this", ".", "selectionmodel", "=", "new", "SelectionModel", "(", "SelectionModel", ".", "MULTI_SELECTION", ")", ";", "}", "else", "{", "this", ".", "selectionmodel", ".", ...
Private
[ "Private" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/CustomListSelection.js#L336-L351
train
Initializes the selection model
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 2023, 1012, 4989, 5302, 9247, 1007, 1063, 2023, 1012, 4989, 5302, 9247, 1027, 2047, 4989, 5302, 9247, 1006, 4989, 5302, 9247, 1012, 4800, 1035, 4989, 1007, 1025, 1065, 2842, 1063, 2023, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
TryGhost/Ghost
core/server/services/url/utils.js
urlFor
function urlFor(context, data, absolute) { var urlPath = '/', secure, imagePathRe, knownObjects = ['image', 'nav'], baseUrl, hostname, // this will become really big knownPaths = { home: '/', sitemap_xsl: '/sitemap.xsl' }; // Make data properly optional if (_.isBoolean(data)) { absolute = data; data = null; } // Can pass 'secure' flag in either context or data arg secure = (context && context.secure) || (data && data.secure); if (_.isObject(context) && context.relativeUrl) { urlPath = context.relativeUrl; } else if (_.isString(context) && _.indexOf(knownObjects, context) !== -1) { if (context === 'image' && data.image) { urlPath = data.image; imagePathRe = new RegExp('^' + getSubdir() + '/' + STATIC_IMAGE_URL_PREFIX); absolute = imagePathRe.test(data.image) ? absolute : false; if (absolute) { // Remove the sub-directory from the URL because ghostConfig will add it back. urlPath = urlPath.replace(new RegExp('^' + getSubdir()), ''); baseUrl = getBlogUrl(secure).replace(/\/$/, ''); urlPath = baseUrl + urlPath; } return urlPath; } else if (context === 'nav' && data.nav) { urlPath = data.nav.url; secure = data.nav.secure || secure; baseUrl = getBlogUrl(secure); hostname = baseUrl.split('//')[1]; // If the hostname is present in the url if (urlPath.indexOf(hostname) > -1 // do no not apply, if there is a subdomain, or a mailto link && !urlPath.split(hostname)[0].match(/\.|mailto:/) // do not apply, if there is a port after the hostname && urlPath.split(hostname)[1].substring(0, 1) !== ':') { // make link relative to account for possible mismatch in http/https etc, force absolute urlPath = urlPath.split(hostname)[1]; urlPath = urlJoin('/', urlPath); absolute = true; } } } else if (context === 'home' && absolute) { urlPath = getBlogUrl(secure); // CASE: there are cases where urlFor('home') needs to be returned without trailing // slash e. g. the `{{@site.url}}` helper. See https://github.com/TryGhost/Ghost/issues/8569 if (data && data.trailingSlash === false) { urlPath = urlPath.replace(/\/$/, ''); } } else if (context === 'admin') { urlPath = getAdminUrl() || getBlogUrl(); if (absolute) { urlPath += 'ghost/'; } else { urlPath = '/ghost/'; } } else if (context === 'api') { urlPath = getAdminUrl() || getBlogUrl(); let apiPath = getApiPath({version: 'v0.1', type: 'content'}); // CASE: with or without protocol? If your blog url (or admin url) is configured to http, it's still possible that e.g. nginx allows both https+http. // So it depends how you serve your blog. The main focus here is to avoid cors problems. // @TODO: rename cors if (data && data.cors) { if (!urlPath.match(/^https:/)) { urlPath = urlPath.replace(/^.*?:\/\//g, '//'); } } if (data && data.version) { apiPath = getApiPath({version: data.version, type: data.versionType}); } if (absolute) { urlPath = urlPath.replace(/\/$/, '') + apiPath; } else { urlPath = apiPath; } } else if (_.isString(context) && _.indexOf(_.keys(knownPaths), context) !== -1) { // trying to create a url for a named path urlPath = knownPaths[context]; } // This url already has a protocol so is likely an external url to be returned // or it is an alternative scheme, protocol-less, or an anchor-only path if (urlPath && (urlPath.indexOf('://') !== -1 || urlPath.match(/^(\/\/|#|[a-zA-Z0-9-]+:)/))) { return urlPath; } return createUrl(urlPath, absolute, secure); }
javascript
function urlFor(context, data, absolute) { var urlPath = '/', secure, imagePathRe, knownObjects = ['image', 'nav'], baseUrl, hostname, // this will become really big knownPaths = { home: '/', sitemap_xsl: '/sitemap.xsl' }; // Make data properly optional if (_.isBoolean(data)) { absolute = data; data = null; } // Can pass 'secure' flag in either context or data arg secure = (context && context.secure) || (data && data.secure); if (_.isObject(context) && context.relativeUrl) { urlPath = context.relativeUrl; } else if (_.isString(context) && _.indexOf(knownObjects, context) !== -1) { if (context === 'image' && data.image) { urlPath = data.image; imagePathRe = new RegExp('^' + getSubdir() + '/' + STATIC_IMAGE_URL_PREFIX); absolute = imagePathRe.test(data.image) ? absolute : false; if (absolute) { // Remove the sub-directory from the URL because ghostConfig will add it back. urlPath = urlPath.replace(new RegExp('^' + getSubdir()), ''); baseUrl = getBlogUrl(secure).replace(/\/$/, ''); urlPath = baseUrl + urlPath; } return urlPath; } else if (context === 'nav' && data.nav) { urlPath = data.nav.url; secure = data.nav.secure || secure; baseUrl = getBlogUrl(secure); hostname = baseUrl.split('//')[1]; // If the hostname is present in the url if (urlPath.indexOf(hostname) > -1 // do no not apply, if there is a subdomain, or a mailto link && !urlPath.split(hostname)[0].match(/\.|mailto:/) // do not apply, if there is a port after the hostname && urlPath.split(hostname)[1].substring(0, 1) !== ':') { // make link relative to account for possible mismatch in http/https etc, force absolute urlPath = urlPath.split(hostname)[1]; urlPath = urlJoin('/', urlPath); absolute = true; } } } else if (context === 'home' && absolute) { urlPath = getBlogUrl(secure); // CASE: there are cases where urlFor('home') needs to be returned without trailing // slash e. g. the `{{@site.url}}` helper. See https://github.com/TryGhost/Ghost/issues/8569 if (data && data.trailingSlash === false) { urlPath = urlPath.replace(/\/$/, ''); } } else if (context === 'admin') { urlPath = getAdminUrl() || getBlogUrl(); if (absolute) { urlPath += 'ghost/'; } else { urlPath = '/ghost/'; } } else if (context === 'api') { urlPath = getAdminUrl() || getBlogUrl(); let apiPath = getApiPath({version: 'v0.1', type: 'content'}); // CASE: with or without protocol? If your blog url (or admin url) is configured to http, it's still possible that e.g. nginx allows both https+http. // So it depends how you serve your blog. The main focus here is to avoid cors problems. // @TODO: rename cors if (data && data.cors) { if (!urlPath.match(/^https:/)) { urlPath = urlPath.replace(/^.*?:\/\//g, '//'); } } if (data && data.version) { apiPath = getApiPath({version: data.version, type: data.versionType}); } if (absolute) { urlPath = urlPath.replace(/\/$/, '') + apiPath; } else { urlPath = apiPath; } } else if (_.isString(context) && _.indexOf(_.keys(knownPaths), context) !== -1) { // trying to create a url for a named path urlPath = knownPaths[context]; } // This url already has a protocol so is likely an external url to be returned // or it is an alternative scheme, protocol-less, or an anchor-only path if (urlPath && (urlPath.indexOf('://') !== -1 || urlPath.match(/^(\/\/|#|[a-zA-Z0-9-]+:)/))) { return urlPath; } return createUrl(urlPath, absolute, secure); }
[ "function", "urlFor", "(", "context", ",", "data", ",", "absolute", ")", "{", "var", "urlPath", "=", "'/'", ",", "secure", ",", "imagePathRe", ",", "knownObjects", "=", "[", "'image'", ",", "'nav'", "]", ",", "baseUrl", ",", "hostname", ",", "// this wil...
## urlFor Synchronous url creation for a given context Can generate a url for a named path and given path. Determines what sort of context it has been given, and delegates to the correct generation method, Finally passing to createUrl, to ensure any subdirectory is honoured, and the url is absolute if needed Usage: urlFor('home', true) -> http://my-ghost-blog.com/ E.g. /blog/ subdir urlFor({relativeUrl: '/my-static-page/'}) -> /blog/my-static-page/ Parameters: - context - a string, or json object describing the context for which you need a url - data (optional) - a json object containing data needed to generate a url - absolute (optional, default:false) - boolean whether or not the url should be absolute This is probably not the right place for this, but it's the best place for now @TODO: rewrite, very hard to read, create private functions!
[ "##", "urlFor", "Synchronous", "url", "creation", "for", "a", "given", "context", "Can", "generate", "a", "url", "for", "a", "named", "path", "and", "given", "path", ".", "Determines", "what", "sort", "of", "context", "it", "has", "been", "given", "and", ...
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/services/url/utils.js#L260-L364
train
Get the URL for a specific context
[ 30522, 3853, 24471, 10270, 2953, 1006, 6123, 1010, 2951, 1010, 7619, 1007, 1063, 13075, 24471, 14277, 8988, 1027, 1005, 1013, 1005, 1010, 5851, 1010, 3746, 15069, 2890, 1010, 2124, 16429, 20614, 2015, 1027, 1031, 1005, 3746, 1005, 1010, 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...
aframevr/aframe
src/components/material.js
parseBlending
function parseBlending (blending) { switch (blending) { case 'none': { return THREE.NoBlending; } case 'additive': { return THREE.AdditiveBlending; } case 'subtractive': { return THREE.SubtractiveBlending; } case 'multiply': { return THREE.MultiplyBlending; } default: { return THREE.NormalBlending; } } }
javascript
function parseBlending (blending) { switch (blending) { case 'none': { return THREE.NoBlending; } case 'additive': { return THREE.AdditiveBlending; } case 'subtractive': { return THREE.SubtractiveBlending; } case 'multiply': { return THREE.MultiplyBlending; } default: { return THREE.NormalBlending; } } }
[ "function", "parseBlending", "(", "blending", ")", "{", "switch", "(", "blending", ")", "{", "case", "'none'", ":", "{", "return", "THREE", ".", "NoBlending", ";", "}", "case", "'additive'", ":", "{", "return", "THREE", ".", "AdditiveBlending", ";", "}", ...
Return a three.js constant determining blending @param {string} [blending=normal] - `none`, additive`, `subtractive`,`multiply` or `normal`. @returns {number}
[ "Return", "a", "three", ".", "js", "constant", "determining", "blending" ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/material.js#L241-L259
train
Parse a single blending
[ 30522, 3853, 11968, 3366, 3468, 15683, 1006, 23293, 1007, 1063, 6942, 1006, 23293, 1007, 1063, 2553, 1005, 3904, 1005, 1024, 1063, 2709, 2093, 1012, 7015, 15683, 1025, 1065, 2553, 1005, 29167, 1005, 1024, 1063, 2709, 2093, 1012, 29167, 3468...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/chart.js/Chart.js
function(data){ //Declare segments as a static property to prevent inheriting across the Chart type prototype this.segments = []; this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2; this.SegmentArc = Chart.Arc.extend({ ctx : this.chart.ctx, x : this.chart.width/2, y : this.chart.height/2 }); //Set up tooltip events on the chart if (this.options.showTooltips){ helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : []; helpers.each(this.segments,function(segment){ segment.restore(["fillColor"]); }); helpers.each(activeSegments,function(activeSegment){ activeSegment.fillColor = activeSegment.highlightColor; }); this.showTooltip(activeSegments); }); } this.calculateTotal(data); helpers.each(data,function(datapoint, index){ this.addData(datapoint, index, true); },this); this.render(); }
javascript
function(data){ //Declare segments as a static property to prevent inheriting across the Chart type prototype this.segments = []; this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2; this.SegmentArc = Chart.Arc.extend({ ctx : this.chart.ctx, x : this.chart.width/2, y : this.chart.height/2 }); //Set up tooltip events on the chart if (this.options.showTooltips){ helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : []; helpers.each(this.segments,function(segment){ segment.restore(["fillColor"]); }); helpers.each(activeSegments,function(activeSegment){ activeSegment.fillColor = activeSegment.highlightColor; }); this.showTooltip(activeSegments); }); } this.calculateTotal(data); helpers.each(data,function(datapoint, index){ this.addData(datapoint, index, true); },this); this.render(); }
[ "function", "(", "data", ")", "{", "//Declare segments as a static property to prevent inheriting across the Chart type prototype", "this", ".", "segments", "=", "[", "]", ";", "this", ".", "outerRadius", "=", "(", "helpers", ".", "min", "(", "[", "this", ".", "char...
Initialize is fired when the chart is initialized - Data is passed in as a parameter Config is automatically merged by the core of Chart.js, and is available at this.options
[ "Initialize", "is", "fired", "when", "the", "chart", "is", "initialized", "-", "Data", "is", "passed", "in", "as", "a", "parameter", "Config", "is", "automatically", "merged", "by", "the", "core", "of", "Chart", ".", "js", "and", "is", "available", "at", ...
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L2372-L2405
train
Initialize the chart with the given data
[ 30522, 3853, 1006, 2951, 1007, 1063, 1013, 1013, 13520, 9214, 2004, 1037, 10763, 3200, 2000, 4652, 22490, 2075, 2408, 1996, 3673, 2828, 8773, 2023, 1012, 9214, 1027, 1031, 1033, 1025, 2023, 1012, 6058, 12173, 4173, 1027, 1006, 2393, 2545, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
processComputed
function processComputed (instance) { const computed = [] const defs = instance.$options.computed || {} // use for...in here because if 'computed' is not defined // on component, computed properties will be placed in prototype // and Object.keys does not include // properties from object's prototype for (const key in defs) { const def = defs[key] const type = typeof def === 'function' && def.vuex ? 'vuex bindings' : 'computed' // use try ... catch here because some computed properties may // throw error during its evaluation let computedProp = null try { computedProp = { type, key, value: instance[key] } } catch (e) { computedProp = { type, key, value: '(error during evaluation)' } } computed.push(computedProp) } return computed }
javascript
function processComputed (instance) { const computed = [] const defs = instance.$options.computed || {} // use for...in here because if 'computed' is not defined // on component, computed properties will be placed in prototype // and Object.keys does not include // properties from object's prototype for (const key in defs) { const def = defs[key] const type = typeof def === 'function' && def.vuex ? 'vuex bindings' : 'computed' // use try ... catch here because some computed properties may // throw error during its evaluation let computedProp = null try { computedProp = { type, key, value: instance[key] } } catch (e) { computedProp = { type, key, value: '(error during evaluation)' } } computed.push(computedProp) } return computed }
[ "function", "processComputed", "(", "instance", ")", "{", "const", "computed", "=", "[", "]", "const", "defs", "=", "instance", ".", "$options", ".", "computed", "||", "{", "}", "// use for...in here because if 'computed' is not defined", "// on component, computed prop...
Process the computed properties of an instance. @param {Vue} instance @return {Array}
[ "Process", "the", "computed", "properties", "of", "an", "instance", "." ]
4de4b86388453cd07f0c1bf967d43a4dd4b011c9
https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/backend/index.js#L719-L752
train
Process computed properties from component
[ 30522, 3853, 2832, 9006, 29462, 1006, 6013, 1007, 1063, 9530, 3367, 24806, 1027, 1031, 1033, 9530, 3367, 13366, 2015, 1027, 6013, 1012, 1002, 7047, 1012, 24806, 1064, 1064, 1063, 1065, 1013, 1013, 2224, 2005, 1012, 1012, 1012, 1999, 2182, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/search.js
searchBar_search
function searchBar_search(data) { var searchBar = this.getElement({type: "searchBar"}); this.type(data.text); switch (data.action) { case "returnKey": this._controller.keypress(searchBar, 'VK_RETURN', {}); break; case "goButton": default: this._controller.click(this.getElement({type: "searchBar_goButton"})); break; } this._controller.waitForPageLoad(); this.checkSearchResultPage(data.text); }
javascript
function searchBar_search(data) { var searchBar = this.getElement({type: "searchBar"}); this.type(data.text); switch (data.action) { case "returnKey": this._controller.keypress(searchBar, 'VK_RETURN', {}); break; case "goButton": default: this._controller.click(this.getElement({type: "searchBar_goButton"})); break; } this._controller.waitForPageLoad(); this.checkSearchResultPage(data.text); }
[ "function", "searchBar_search", "(", "data", ")", "{", "var", "searchBar", "=", "this", ".", "getElement", "(", "{", "type", ":", "\"searchBar\"", "}", ")", ";", "this", ".", "type", "(", "data", ".", "text", ")", ";", "switch", "(", "data", ".", "ac...
Start a search with the given search term and check if the resulting URL contains the search term. @param {object} data Object which contains the search term and the action type
[ "Start", "a", "search", "with", "the", "given", "search", "term", "and", "check", "if", "the", "resulting", "URL", "contains", "the", "search", "term", "." ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/search.js#L783-L800
train
search bar search
[ 30522, 3853, 3945, 8237, 1035, 3945, 1006, 2951, 1007, 1063, 13075, 3945, 8237, 1027, 2023, 1012, 2131, 12260, 3672, 1006, 1063, 2828, 1024, 1000, 3945, 8237, 1000, 1065, 1007, 1025, 2023, 1012, 2828, 1006, 2951, 1012, 3793, 1007, 1025, 6...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sass/node-sass
lib/extensions.js
getBinaryCachePath
function getBinaryCachePath() { var i, cachePath, cachePathCandidates = getCachePathCandidates(); for (i = 0; i < cachePathCandidates.length; i++) { cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version); try { mkdir.sync(cachePath); return cachePath; } catch (e) { // Directory is not writable, try another } } return ''; }
javascript
function getBinaryCachePath() { var i, cachePath, cachePathCandidates = getCachePathCandidates(); for (i = 0; i < cachePathCandidates.length; i++) { cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version); try { mkdir.sync(cachePath); return cachePath; } catch (e) { // Directory is not writable, try another } } return ''; }
[ "function", "getBinaryCachePath", "(", ")", "{", "var", "i", ",", "cachePath", ",", "cachePathCandidates", "=", "getCachePathCandidates", "(", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "cachePathCandidates", ".", "length", ";", "i", "++", ")", ...
The most suitable location for caching the binding on disk. Given the candidates directories provided by `getCachePathCandidates()` this returns the first writable directory. By treating the candidate directories as a prioritised list this method is deterministic, assuming no change to the local environment. @return {String} directory to cache binding @api public
[ "The", "most", "suitable", "location", "for", "caching", "the", "binding", "on", "disk", "." ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/lib/extensions.js#L346-L363
train
Get the binary cache path
[ 30522, 3853, 2131, 21114, 2854, 3540, 5403, 15069, 1006, 1007, 1063, 13075, 1045, 1010, 17053, 15069, 1010, 17053, 15069, 9336, 4305, 27122, 1027, 2131, 3540, 5403, 15069, 9336, 4305, 27122, 1006, 1007, 1025, 2005, 1006, 1045, 1027, 1014, 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...
pixijs/pixi.js
packages/text/src/TextStyle.js
areArraysEqual
function areArraysEqual(array1, array2) { if (!Array.isArray(array1) || !Array.isArray(array2)) { return false; } if (array1.length !== array2.length) { return false; } for (let i = 0; i < array1.length; ++i) { if (array1[i] !== array2[i]) { return false; } } return true; }
javascript
function areArraysEqual(array1, array2) { if (!Array.isArray(array1) || !Array.isArray(array2)) { return false; } if (array1.length !== array2.length) { return false; } for (let i = 0; i < array1.length; ++i) { if (array1[i] !== array2[i]) { return false; } } return true; }
[ "function", "areArraysEqual", "(", "array1", ",", "array2", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "array1", ")", "||", "!", "Array", ".", "isArray", "(", "array2", ")", ")", "{", "return", "false", ";", "}", "if", "(", "array1", "...
Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. This version can also convert array of colors @private @param {Array} array1 First array to compare @param {Array} array2 Second array to compare @return {boolean} Do the arrays contain the same values in the same order
[ "Utility", "function", "to", "convert", "hexadecimal", "colors", "to", "strings", "and", "simply", "return", "the", "color", "if", "it", "s", "a", "string", ".", "This", "version", "can", "also", "convert", "array", "of", "colors" ]
99ae03b7565ae7ca5a6de633b0a277f7128fa4d0
https://github.com/pixijs/pixi.js/blob/99ae03b7565ae7ca5a6de633b0a277f7128fa4d0/packages/text/src/TextStyle.js#L776-L797
train
Check if two arrays are equal
[ 30522, 3853, 2181, 11335, 23274, 26426, 1006, 9140, 2487, 1010, 9140, 2475, 1007, 1063, 2065, 1006, 999, 9140, 1012, 18061, 11335, 2100, 1006, 9140, 2487, 1007, 1064, 1064, 999, 9140, 1012, 18061, 11335, 2100, 1006, 9140, 2475, 1007, 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...
angular/material
src/core/services/gesture/gesture.js
register
function register(element, handlerName, options) { var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; if (!handler) { throw new Error('Failed to register element with handler ' + handlerName + '. ' + 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); } return handler.registerElement(element, options); }
javascript
function register(element, handlerName, options) { var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; if (!handler) { throw new Error('Failed to register element with handler ' + handlerName + '. ' + 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); } return handler.registerElement(element, options); }
[ "function", "register", "(", "element", ",", "handlerName", ",", "options", ")", "{", "var", "handler", "=", "HANDLERS", "[", "handlerName", ".", "replace", "(", "/", "^\\$md.", "/", ",", "''", ")", "]", ";", "if", "(", "!", "handler", ")", "{", "thr...
Register an element to listen for a handler. This allows an element to override the default options for a handler. Additionally, some handlers like drag and hold only dispatch events if the domEvent happens inside an element that's registered to listen for these events. @see GestureHandler for how overriding of default options works. @example $mdGesture.register(myElement, 'drag', { minDistance: 20, horizontal: false })
[ "Register", "an", "element", "to", "listen", "for", "a", "handler", ".", "This", "allows", "an", "element", "to", "override", "the", "default", "options", "for", "a", "handler", ".", "Additionally", "some", "handlers", "like", "drag", "and", "hold", "only", ...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L179-L186
train
Register an element with a handler
[ 30522, 3853, 4236, 1006, 5783, 1010, 28213, 18442, 1010, 7047, 1007, 1063, 13075, 28213, 1027, 28213, 2015, 1031, 28213, 18442, 1012, 5672, 1006, 1013, 1034, 1032, 1002, 9108, 1012, 1013, 1010, 1005, 1005, 1007, 1033, 1025, 2065, 1006, 999,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/autocomplete/js/autocompleteController.js
isSearchable
function isSearchable() { if (ctrl.loading && !hasMatches()) { // No query when query is in progress. return false; } else if (hasSelection()) { // No query if there is already a selection return false; } else if (!hasFocus) { // No query if the input does not have focus return false; } return true; }
javascript
function isSearchable() { if (ctrl.loading && !hasMatches()) { // No query when query is in progress. return false; } else if (hasSelection()) { // No query if there is already a selection return false; } else if (!hasFocus) { // No query if the input does not have focus return false; } return true; }
[ "function", "isSearchable", "(", ")", "{", "if", "(", "ctrl", ".", "loading", "&&", "!", "hasMatches", "(", ")", ")", "{", "// No query when query is in progress.", "return", "false", ";", "}", "else", "if", "(", "hasSelection", "(", ")", ")", "{", "// No ...
Determines whether the autocomplete is able to query within the current state. @returns {boolean} true if the query can be run
[ "Determines", "whether", "the", "autocomplete", "is", "able", "to", "query", "within", "the", "current", "state", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L713-L726
train
Check if the search is able to be performed
[ 30522, 3853, 26354, 14644, 7507, 3468, 1006, 1007, 1063, 2065, 1006, 14931, 12190, 1012, 10578, 1004, 1004, 999, 2038, 18900, 8376, 1006, 1007, 1007, 1063, 1013, 1013, 2053, 23032, 2043, 23032, 2003, 1999, 5082, 1012, 2709, 6270, 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...
laurent22/joplin
Clipper/joplin-webclipper/content_scripts/Readability.js
function(helperIsVisible) { var nodes = this._getAllNodesWithTag(this._doc, ["p", "pre"]); // Get <div> nodes which have <br> node(s) and append them into the `nodes` variable. // Some articles' DOM structures might look like // <div> // Sentences<br> // <br> // Sentences<br> // </div> var brNodes = this._getAllNodesWithTag(this._doc, ["div > br"]); if (brNodes.length) { var set = new Set(); [].forEach.call(brNodes, function(node) { set.add(node.parentNode); }); nodes = [].concat.apply(Array.from(set), nodes); } // FIXME we should have a fallback for helperIsVisible, but this is // problematic because of jsdom's elem.style handling - see // https://github.com/mozilla/readability/pull/186 for context. var score = 0; // This is a little cheeky, we use the accumulator 'score' to decide what to return from // this callback: return this._someNode(nodes, function(node) { if (helperIsVisible && !helperIsVisible(node)) return false; var matchString = node.className + " " + node.id; if (this.REGEXPS.unlikelyCandidates.test(matchString) && !this.REGEXPS.okMaybeItsACandidate.test(matchString)) { return false; } if (node.matches && node.matches("li p")) { return false; } var textContentLength = node.textContent.trim().length; if (textContentLength < 140) { return false; } score += Math.sqrt(textContentLength - 140); if (score > 20) { return true; } return false; }); }
javascript
function(helperIsVisible) { var nodes = this._getAllNodesWithTag(this._doc, ["p", "pre"]); // Get <div> nodes which have <br> node(s) and append them into the `nodes` variable. // Some articles' DOM structures might look like // <div> // Sentences<br> // <br> // Sentences<br> // </div> var brNodes = this._getAllNodesWithTag(this._doc, ["div > br"]); if (brNodes.length) { var set = new Set(); [].forEach.call(brNodes, function(node) { set.add(node.parentNode); }); nodes = [].concat.apply(Array.from(set), nodes); } // FIXME we should have a fallback for helperIsVisible, but this is // problematic because of jsdom's elem.style handling - see // https://github.com/mozilla/readability/pull/186 for context. var score = 0; // This is a little cheeky, we use the accumulator 'score' to decide what to return from // this callback: return this._someNode(nodes, function(node) { if (helperIsVisible && !helperIsVisible(node)) return false; var matchString = node.className + " " + node.id; if (this.REGEXPS.unlikelyCandidates.test(matchString) && !this.REGEXPS.okMaybeItsACandidate.test(matchString)) { return false; } if (node.matches && node.matches("li p")) { return false; } var textContentLength = node.textContent.trim().length; if (textContentLength < 140) { return false; } score += Math.sqrt(textContentLength - 140); if (score > 20) { return true; } return false; }); }
[ "function", "(", "helperIsVisible", ")", "{", "var", "nodes", "=", "this", ".", "_getAllNodesWithTag", "(", "this", ".", "_doc", ",", "[", "\"p\"", ",", "\"pre\"", "]", ")", ";", "// Get <div> nodes which have <br> node(s) and append them into the `nodes` variable.", ...
Decides whether or not the document is reader-able without parsing the whole thing. @return boolean Whether or not we suspect parse() will suceeed at returning an article object.
[ "Decides", "whether", "or", "not", "the", "document", "is", "reader", "-", "able", "without", "parsing", "the", "whole", "thing", "." ]
beb428b246cecba4630a3ca57b472f43c0933a43
https://github.com/laurent22/joplin/blob/beb428b246cecba4630a3ca57b472f43c0933a43/Clipper/joplin-webclipper/content_scripts/Readability.js#L1702-L1754
train
Returns true if the article is visible
[ 30522, 3853, 1006, 2393, 11124, 2015, 11365, 7028, 1007, 1063, 13075, 14164, 1027, 2023, 1012, 1035, 2131, 8095, 3630, 6155, 24415, 15900, 1006, 2023, 1012, 1035, 9986, 1010, 1031, 1000, 1052, 1000, 1010, 1000, 3653, 1000, 1033, 1007, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mochajs/mocha
lib/growl.js
onCompletion
function onCompletion(err) { if (err) { // As notifications are tangential to our purpose, just log the error. const message = err.code === 'ENOENT' ? 'prerequisite software not found' : err.message; console.error('notification error:', message); } }
javascript
function onCompletion(err) { if (err) { // As notifications are tangential to our purpose, just log the error. const message = err.code === 'ENOENT' ? 'prerequisite software not found' : err.message; console.error('notification error:', message); } }
[ "function", "onCompletion", "(", "err", ")", "{", "if", "(", "err", ")", "{", "// As notifications are tangential to our purpose, just log the error.", "const", "message", "=", "err", ".", "code", "===", "'ENOENT'", "?", "'prerequisite software not found'", ":", "err", ...
@summary Callback for result of attempted Growl notification. @description Despite its appearance, this is <strong>not</strong> an Error-first callback -- all parameters are populated regardless of success. @private @callback Growl~growlCB @param {*} err - Error object, or <code>null</code> if successful.
[ "@summary", "Callback", "for", "result", "of", "attempted", "Growl", "notification", "." ]
9b00fedb610241e33f7592c40164e42a38a793cf
https://github.com/mochajs/mocha/blob/9b00fedb610241e33f7592c40164e42a38a793cf/lib/growl.js#L98-L105
train
Called when the process has completed
[ 30522, 3853, 2006, 9006, 10814, 3508, 1006, 9413, 2099, 1007, 1063, 2065, 1006, 9413, 2099, 1007, 1063, 1013, 1013, 2004, 26828, 2015, 2024, 27250, 4818, 2000, 2256, 3800, 1010, 2074, 8833, 1996, 7561, 1012, 9530, 3367, 4471, 1027, 9413, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
extend
function extend(oTarget, oSource) { var sName; for (sName in oSource) { if (bPrivileged || !(sName in oTarget)) { oTarget[sName] = oSource[sName]; } } }
javascript
function extend(oTarget, oSource) { var sName; for (sName in oSource) { if (bPrivileged || !(sName in oTarget)) { oTarget[sName] = oSource[sName]; } } }
[ "function", "extend", "(", "oTarget", ",", "oSource", ")", "{", "var", "sName", ";", "for", "(", "sName", "in", "oSource", ")", "{", "if", "(", "bPrivileged", "||", "!", "(", "sName", "in", "oTarget", ")", ")", "{", "oTarget", "[", "sName", "]", "=...
/* "PUT" semantics on term/qualifier level, only privileged sources may overwrite. @param {object} oTarget The target object (which is modified) @param {object} oSource The source object
[ "/", "*", "PUT", "semantics", "on", "term", "/", "qualifier", "level", "only", "privileged", "sources", "may", "overwrite", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L286-L294
train
Extend the target object with the source object.
[ 30522, 3853, 7949, 1006, 27178, 2906, 18150, 1010, 9808, 8162, 3401, 1007, 1063, 13075, 1055, 18442, 1025, 2005, 1006, 1055, 18442, 1999, 9808, 8162, 3401, 1007, 1063, 2065, 1006, 17531, 3089, 14762, 24746, 2094, 1064, 1064, 999, 1006, 1055...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js
parseTagAndAttrs
function parseTagAndAttrs(parts, pos) { var m = /^(\w+)/.exec(parts[pos]); var tag = { name: lcase(m[1]) }; if (html4.ELEMENTS.hasOwnProperty(tag.name)) { tag.eflags = html4.ELEMENTS[tag.name]; } else { tag.eflags = void 0; } var buf = parts[pos].substr(m[0].length); // Find the next '>'. We optimistically assume this '>' is not in a // quoted context, and further down we fix things up if it turns out to // be quoted. var p = pos + 1; var end = parts.length; for (; p < end; p++) { if (parts[p] === '>') { break; } buf += parts[p]; } if (end <= p) { return void 0; } var attrs = []; while (buf !== '') { m = ATTR_RE.exec(buf); if (!m) { // No attribute found: skip garbage buf = buf.replace(/^[\s\S][^a-z\s]*/, ''); } else if ((m[4] && !m[5]) || (m[6] && !m[7])) { // Unterminated quote: slurp to the next unquoted '>' var quote = m[4] || m[6]; var sawQuote = false; var abuf = [buf, parts[p++]]; for (; p < end; p++) { if (sawQuote) { if (parts[p] === '>') { break; } } else if (0 <= parts[p].indexOf(quote)) { sawQuote = true; } abuf.push(parts[p]); } // Slurp failed: lose the garbage if (end <= p) { break; } // Otherwise retry attribute parsing buf = abuf.join(''); continue; } else { // We have an attribute var aName = lcase(m[1]); var aValue = m[2] ? decodeValue(m[3]) : aName; attrs.push(aName, aValue); buf = buf.substr(m[0].length); } } tag.attrs = attrs; tag.next = p + 1; return tag; }
javascript
function parseTagAndAttrs(parts, pos) { var m = /^(\w+)/.exec(parts[pos]); var tag = { name: lcase(m[1]) }; if (html4.ELEMENTS.hasOwnProperty(tag.name)) { tag.eflags = html4.ELEMENTS[tag.name]; } else { tag.eflags = void 0; } var buf = parts[pos].substr(m[0].length); // Find the next '>'. We optimistically assume this '>' is not in a // quoted context, and further down we fix things up if it turns out to // be quoted. var p = pos + 1; var end = parts.length; for (; p < end; p++) { if (parts[p] === '>') { break; } buf += parts[p]; } if (end <= p) { return void 0; } var attrs = []; while (buf !== '') { m = ATTR_RE.exec(buf); if (!m) { // No attribute found: skip garbage buf = buf.replace(/^[\s\S][^a-z\s]*/, ''); } else if ((m[4] && !m[5]) || (m[6] && !m[7])) { // Unterminated quote: slurp to the next unquoted '>' var quote = m[4] || m[6]; var sawQuote = false; var abuf = [buf, parts[p++]]; for (; p < end; p++) { if (sawQuote) { if (parts[p] === '>') { break; } } else if (0 <= parts[p].indexOf(quote)) { sawQuote = true; } abuf.push(parts[p]); } // Slurp failed: lose the garbage if (end <= p) { break; } // Otherwise retry attribute parsing buf = abuf.join(''); continue; } else { // We have an attribute var aName = lcase(m[1]); var aValue = m[2] ? decodeValue(m[3]) : aName; attrs.push(aName, aValue); buf = buf.substr(m[0].length); } } tag.attrs = attrs; tag.next = p + 1; return tag; }
[ "function", "parseTagAndAttrs", "(", "parts", ",", "pos", ")", "{", "var", "m", "=", "/", "^(\\w+)", "/", ".", "exec", "(", "parts", "[", "pos", "]", ")", ";", "var", "tag", "=", "{", "name", ":", "lcase", "(", "m", "[", "1", "]", ")", "}", "...
at this point, parts[pos-1] is either "<" or "<\/".
[ "at", "this", "point", "parts", "[", "pos", "-", "1", "]", "is", "either", "<", "or", "<", "\\", "/", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L3236-L3292
train
Parses a tag and its attributes.
[ 30522, 3853, 11968, 13462, 16098, 8943, 4779, 2869, 1006, 3033, 1010, 13433, 2015, 1007, 1063, 13075, 1049, 1027, 1013, 1034, 1006, 1032, 1059, 1009, 1007, 1013, 1012, 4654, 8586, 1006, 3033, 1031, 13433, 2015, 1033, 1007, 1025, 13075, 6415...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/tabsPaginationService.js
decreasePageOffset
function decreasePageOffset(elements, currentOffset) { var canvas = elements.canvas, tabOffsets = getTabOffsets(elements), i, firstVisibleTabOffset; // Find the first fully visible tab in offset range for (i = 0; i < tabOffsets.length; i++) { if (tabOffsets[i] >= currentOffset) { firstVisibleTabOffset = tabOffsets[i]; break; } } // Return (the first visible tab offset - the tabs container width) without going negative return Math.max(0, firstVisibleTabOffset - canvas.clientWidth); }
javascript
function decreasePageOffset(elements, currentOffset) { var canvas = elements.canvas, tabOffsets = getTabOffsets(elements), i, firstVisibleTabOffset; // Find the first fully visible tab in offset range for (i = 0; i < tabOffsets.length; i++) { if (tabOffsets[i] >= currentOffset) { firstVisibleTabOffset = tabOffsets[i]; break; } } // Return (the first visible tab offset - the tabs container width) without going negative return Math.max(0, firstVisibleTabOffset - canvas.clientWidth); }
[ "function", "decreasePageOffset", "(", "elements", ",", "currentOffset", ")", "{", "var", "canvas", "=", "elements", ".", "canvas", ",", "tabOffsets", "=", "getTabOffsets", "(", "elements", ")", ",", "i", ",", "firstVisibleTabOffset", ";", "// Find the first fully...
Returns the offset for the next decreasing page. @param elements @param currentOffset @returns {number}
[ "Returns", "the", "offset", "for", "the", "next", "decreasing", "page", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L38-L53
train
Increase the page offset of the tabs container
[ 30522, 3853, 9885, 13704, 27475, 3388, 1006, 3787, 1010, 2783, 27475, 3388, 1007, 1063, 13075, 10683, 1027, 3787, 1012, 10683, 1010, 21628, 27475, 8454, 1027, 2131, 2696, 5092, 21807, 8454, 1006, 3787, 1007, 1010, 1045, 1010, 2034, 11365, 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...
dequelabs/axe-core
lib/checks/navigation/region.js
isRegion
function isRegion(virtualNode) { const node = virtualNode.actualNode; const explicitRole = axe.commons.aria.getRole(node, { noImplicit: true }); const ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim(); if (explicitRole) { return explicitRole === 'dialog' || landmarkRoles.includes(explicitRole); } // Ignore content inside of aria-live if (['assertive', 'polite'].includes(ariaLive)) { return true; } // Check if the node matches any of the CSS selectors of implicit landmarks return implicitLandmarks.some(implicitSelector => { let matches = axe.utils.matchesSelector(node, implicitSelector); if (node.nodeName.toUpperCase() === 'FORM') { let titleAttr = node.getAttribute('title'); let title = titleAttr && titleAttr.trim() !== '' ? axe.commons.text.sanitize(titleAttr) : null; return matches && (!!aria.labelVirtual(virtualNode) || !!title); } return matches; }); }
javascript
function isRegion(virtualNode) { const node = virtualNode.actualNode; const explicitRole = axe.commons.aria.getRole(node, { noImplicit: true }); const ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim(); if (explicitRole) { return explicitRole === 'dialog' || landmarkRoles.includes(explicitRole); } // Ignore content inside of aria-live if (['assertive', 'polite'].includes(ariaLive)) { return true; } // Check if the node matches any of the CSS selectors of implicit landmarks return implicitLandmarks.some(implicitSelector => { let matches = axe.utils.matchesSelector(node, implicitSelector); if (node.nodeName.toUpperCase() === 'FORM') { let titleAttr = node.getAttribute('title'); let title = titleAttr && titleAttr.trim() !== '' ? axe.commons.text.sanitize(titleAttr) : null; return matches && (!!aria.labelVirtual(virtualNode) || !!title); } return matches; }); }
[ "function", "isRegion", "(", "virtualNode", ")", "{", "const", "node", "=", "virtualNode", ".", "actualNode", ";", "const", "explicitRole", "=", "axe", ".", "commons", ".", "aria", ".", "getRole", "(", "node", ",", "{", "noImplicit", ":", "true", "}", ")...
Check if the current element is a landmark
[ "Check", "if", "the", "current", "element", "is", "a", "landmark" ]
727323c07980e2291575f545444d389fb942906f
https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/checks/navigation/region.js#L10-L36
train
Determines if the node is a region
[ 30522, 3853, 2003, 23784, 1006, 7484, 3630, 3207, 1007, 1063, 9530, 3367, 13045, 1027, 7484, 3630, 3207, 1012, 5025, 3630, 3207, 1025, 9530, 3367, 13216, 13153, 2063, 1027, 12946, 1012, 7674, 1012, 9342, 1012, 2131, 13153, 2063, 1006, 13045...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
MoePlayer/DPlayer
demo/modernizr.js
createElement
function createElement() { if (typeof document.createElement !== 'function') { // This is the case in IE7, where the type of createElement is "object". // For this reason, we cannot call apply() as Object is not a Function. return document.createElement(arguments[0]); } else if (isSVG) { return document.createElementNS.call(document, 'http://www.w3.org/2000/svg', arguments[0]); } else { return document.createElement.apply(document, arguments); } }
javascript
function createElement() { if (typeof document.createElement !== 'function') { // This is the case in IE7, where the type of createElement is "object". // For this reason, we cannot call apply() as Object is not a Function. return document.createElement(arguments[0]); } else if (isSVG) { return document.createElementNS.call(document, 'http://www.w3.org/2000/svg', arguments[0]); } else { return document.createElement.apply(document, arguments); } }
[ "function", "createElement", "(", ")", "{", "if", "(", "typeof", "document", ".", "createElement", "!==", "'function'", ")", "{", "// This is the case in IE7, where the type of createElement is \"object\".", "// For this reason, we cannot call apply() as Object is not a Function.", ...
createElement is a convenience wrapper around document.createElement. Since we use createElement all over the place, this allows for (slightly) smaller code as well as abstracting away issues with creating elements in contexts other than HTML documents (e.g. SVG documents). @access private @function createElement @returns {HTMLElement|SVGElement} An HTML or SVG element
[ "createElement", "is", "a", "convenience", "wrapper", "around", "document", ".", "createElement", ".", "Since", "we", "use", "createElement", "all", "over", "the", "place", "this", "allows", "for", "(", "slightly", ")", "smaller", "code", "as", "well", "as", ...
f5c53f082634a6e5af56cfc72978ad7bad49b989
https://github.com/MoePlayer/DPlayer/blob/f5c53f082634a6e5af56cfc72978ad7bad49b989/demo/modernizr.js#L382-L392
train
Creates an element
[ 30522, 3853, 3443, 12260, 3672, 1006, 1007, 1063, 2065, 1006, 2828, 11253, 6254, 1012, 3443, 12260, 3672, 999, 1027, 1027, 1005, 3853, 1005, 1007, 1063, 1013, 1013, 2023, 2003, 1996, 2553, 1999, 29464, 2581, 1010, 2073, 1996, 2828, 1997, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/vue-server-renderer/build.js
cached
function cached (fn) { var cache = Object.create(null); return (function cachedFn (str) { var hit = cache[str]; return hit || (cache[str] = fn(str)) }) }
javascript
function cached (fn) { var cache = Object.create(null); return (function cachedFn (str) { var hit = cache[str]; return hit || (cache[str] = fn(str)) }) }
[ "function", "cached", "(", "fn", ")", "{", "var", "cache", "=", "Object", ".", "create", "(", "null", ")", ";", "return", "(", "function", "cachedFn", "(", "str", ")", "{", "var", "hit", "=", "cache", "[", "str", "]", ";", "return", "hit", "||", ...
Create a cached version of a pure function.
[ "Create", "a", "cached", "version", "of", "a", "pure", "function", "." ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L104-L110
train
Returns a function that caches the result of the given function.
[ 30522, 3853, 17053, 2094, 1006, 1042, 2078, 1007, 1063, 13075, 17053, 1027, 4874, 1012, 3443, 1006, 19701, 1007, 1025, 2709, 1006, 3853, 17053, 20952, 2078, 1006, 2358, 2099, 1007, 1063, 13075, 2718, 1027, 17053, 1031, 2358, 2099, 1033, 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...
showdownjs/showdown
dist/showdown.js
writeAnchorTag
function writeAnchorTag (evt, options, globals, emptyCase) { var wholeMatch = evt.getMatches().wholeMatch; var text = evt.getMatches().text; var id = evt.getMatches().id; var url = evt.getMatches().url; var title = evt.getMatches().title; var target = ''; if (!title) { title = ''; } id = (id) ? id.toLowerCase() : ''; if (emptyCase) { url = ''; } else if (!url) { if (!id) { // lower-case and turn embedded newlines into spaces id = text.toLowerCase().replace(/ ?\n/g, ' '); } url = '#' + id; if (!showdown.helper.isUndefined(globals.gUrls[id])) { url = globals.gUrls[id]; if (!showdown.helper.isUndefined(globals.gTitles[id])) { title = globals.gTitles[id]; } } else { return wholeMatch; } } //url = showdown.helper.escapeCharacters(url, '*_:~', false); // replaced line to improve performance url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback); if (title !== '' && title !== null) { title = title.replace(/"/g, '&quot;'); //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance title = title.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback); title = ' title="' + title + '"'; } // optionLinksInNewWindow only applies // to external links. Hash links (#) open in same page if (options.openLinksInNewWindow && !/^#/.test(url)) { // escaped _ target = ' target="¨E95Eblank"'; } // Text can be a markdown element, so we run through the appropriate parsers text = showdown.subParser('makehtml.codeSpans')(text, options, globals); text = showdown.subParser('makehtml.emoji')(text, options, globals); text = showdown.subParser('makehtml.underline')(text, options, globals); text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals); text = showdown.subParser('makehtml.strikethrough')(text, options, globals); text = showdown.subParser('makehtml.ellipsis')(text, options, globals); text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals); //evt = createEvent(rgx, evtRootName + '.captureEnd', wholeMatch, text, id, url, title, options, globals); var result = '<a href="' + url + '"' + title + target + '>' + text + '</a>'; //evt = createEvent(rgx, evtRootName + '.beforeHash', wholeMatch, text, id, url, title, options, globals); result = showdown.subParser('makehtml.hashHTMLSpans')(result, options, globals); return result; }
javascript
function writeAnchorTag (evt, options, globals, emptyCase) { var wholeMatch = evt.getMatches().wholeMatch; var text = evt.getMatches().text; var id = evt.getMatches().id; var url = evt.getMatches().url; var title = evt.getMatches().title; var target = ''; if (!title) { title = ''; } id = (id) ? id.toLowerCase() : ''; if (emptyCase) { url = ''; } else if (!url) { if (!id) { // lower-case and turn embedded newlines into spaces id = text.toLowerCase().replace(/ ?\n/g, ' '); } url = '#' + id; if (!showdown.helper.isUndefined(globals.gUrls[id])) { url = globals.gUrls[id]; if (!showdown.helper.isUndefined(globals.gTitles[id])) { title = globals.gTitles[id]; } } else { return wholeMatch; } } //url = showdown.helper.escapeCharacters(url, '*_:~', false); // replaced line to improve performance url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback); if (title !== '' && title !== null) { title = title.replace(/"/g, '&quot;'); //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance title = title.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback); title = ' title="' + title + '"'; } // optionLinksInNewWindow only applies // to external links. Hash links (#) open in same page if (options.openLinksInNewWindow && !/^#/.test(url)) { // escaped _ target = ' target="¨E95Eblank"'; } // Text can be a markdown element, so we run through the appropriate parsers text = showdown.subParser('makehtml.codeSpans')(text, options, globals); text = showdown.subParser('makehtml.emoji')(text, options, globals); text = showdown.subParser('makehtml.underline')(text, options, globals); text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals); text = showdown.subParser('makehtml.strikethrough')(text, options, globals); text = showdown.subParser('makehtml.ellipsis')(text, options, globals); text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals); //evt = createEvent(rgx, evtRootName + '.captureEnd', wholeMatch, text, id, url, title, options, globals); var result = '<a href="' + url + '"' + title + target + '>' + text + '</a>'; //evt = createEvent(rgx, evtRootName + '.beforeHash', wholeMatch, text, id, url, title, options, globals); result = showdown.subParser('makehtml.hashHTMLSpans')(result, options, globals); return result; }
[ "function", "writeAnchorTag", "(", "evt", ",", "options", ",", "globals", ",", "emptyCase", ")", "{", "var", "wholeMatch", "=", "evt", ".", "getMatches", "(", ")", ".", "wholeMatch", ";", "var", "text", "=", "evt", ".", "getMatches", "(", ")", ".", "te...
Helper Function: Normalize and write an anchor tag based on passed parameters @param evt @param options @param globals @param {boolean} emptyCase @returns {string}
[ "Helper", "Function", ":", "Normalize", "and", "write", "an", "anchor", "tag", "based", "on", "passed", "parameters" ]
33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9
https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/dist/showdown.js#L3320-L3387
train
Write anchor tag
[ 30522, 3853, 4339, 2319, 9905, 13320, 2290, 1006, 23408, 30524, 8376, 1006, 1007, 1012, 2878, 18900, 2818, 1025, 13075, 3793, 1027, 23408, 2102, 1012, 2131, 18900, 8376, 1006, 1007, 1012, 3793, 1025, 13075, 8909, 1027, 23408, 2102, 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...
eslint/eslint
lib/rules/key-spacing.js
initOptions
function initOptions(toOptions, fromOptions) { if (typeof fromOptions.align === "object") { // Initialize the alignment configuration toOptions.align = initOptionProperty({}, fromOptions.align); toOptions.align.on = fromOptions.align.on || "colon"; toOptions.align.mode = fromOptions.align.mode || "strict"; toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); } else { // string or undefined toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); // If alignment options are defined in multiLine, pull them out into the general align configuration if (toOptions.multiLine.align) { toOptions.align = { on: toOptions.multiLine.align.on, mode: toOptions.multiLine.align.mode || toOptions.multiLine.mode, beforeColon: toOptions.multiLine.align.beforeColon, afterColon: toOptions.multiLine.align.afterColon }; } } return toOptions; }
javascript
function initOptions(toOptions, fromOptions) { if (typeof fromOptions.align === "object") { // Initialize the alignment configuration toOptions.align = initOptionProperty({}, fromOptions.align); toOptions.align.on = fromOptions.align.on || "colon"; toOptions.align.mode = fromOptions.align.mode || "strict"; toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); } else { // string or undefined toOptions.multiLine = initOptionProperty({}, (fromOptions.multiLine || fromOptions)); toOptions.singleLine = initOptionProperty({}, (fromOptions.singleLine || fromOptions)); // If alignment options are defined in multiLine, pull them out into the general align configuration if (toOptions.multiLine.align) { toOptions.align = { on: toOptions.multiLine.align.on, mode: toOptions.multiLine.align.mode || toOptions.multiLine.mode, beforeColon: toOptions.multiLine.align.beforeColon, afterColon: toOptions.multiLine.align.afterColon }; } } return toOptions; }
[ "function", "initOptions", "(", "toOptions", ",", "fromOptions", ")", "{", "if", "(", "typeof", "fromOptions", ".", "align", "===", "\"object\"", ")", "{", "// Initialize the alignment configuration", "toOptions", ".", "align", "=", "initOptionProperty", "(", "{", ...
Initializes all the option values (singleLine, multiLine and align) from the configuration with defaults for undefined values @param {Object} toOptions Object to be initialized @param {Object} fromOptions Object to be initialized from @returns {Object} The object with correctly initialized options and values
[ "Initializes", "all", "the", "option", "values", "(", "singleLine", "multiLine", "and", "align", ")", "from", "the", "configuration", "with", "defaults", "for", "undefined", "values" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/key-spacing.js#L91-L118
train
Initialize the options object
[ 30522, 3853, 1999, 9956, 16790, 2015, 1006, 2205, 16790, 2015, 1010, 2013, 7361, 9285, 1007, 1063, 2065, 1006, 2828, 11253, 2013, 7361, 9285, 1012, 25705, 1027, 1027, 1027, 1000, 4874, 1000, 1007, 1063, 1013, 1013, 3988, 4697, 1996, 12139, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ColorlibHQ/AdminLTE
bower_components/ion.rangeSlider/js/ion.rangeSlider.js
function () { if (!this.coords.w_rs) { return; } this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100; this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100; }
javascript
function () { if (!this.coords.w_rs) { return; } this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100; this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "coords", ".", "w_rs", ")", "{", "return", ";", "}", "this", ".", "labels", ".", "p_min", "=", "this", ".", "labels", ".", "w_min", "/", "this", ".", "coords", ".", "w_rs", "*", "100", ";"...
Measure Min and Max labels width in percent
[ "Measure", "Min", "and", "Max", "labels", "width", "in", "percent" ]
19113c3cbc19a7afe0cfd3158d647064d2d30661
https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1274-L1281
train
cisco cisco cisco
[ 30522, 3853, 1006, 1007, 1063, 2065, 1006, 999, 2023, 1012, 2522, 8551, 2015, 1012, 1059, 1035, 12667, 1007, 1063, 2709, 1025, 1065, 2023, 1012, 10873, 1012, 1052, 1035, 8117, 1027, 2023, 1012, 10873, 1012, 1059, 1035, 8117, 1013, 2023, 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...
eslint/eslint
lib/config/config-file.js
load
function load(extendedConfigReference, configContext, referencedFromPath) { const resolvedPath = resolve(extendedConfigReference, referencedFromPath, configContext.getPluginRootPath()); const cachedConfig = configContext.configCache.getConfig(resolvedPath.configFullName); if (cachedConfig) { return cachedConfig; } const config = loadFromDisk(resolvedPath, configContext); if (config) { configContext.configCache.setConfig(resolvedPath.configFullName, config); } return config; }
javascript
function load(extendedConfigReference, configContext, referencedFromPath) { const resolvedPath = resolve(extendedConfigReference, referencedFromPath, configContext.getPluginRootPath()); const cachedConfig = configContext.configCache.getConfig(resolvedPath.configFullName); if (cachedConfig) { return cachedConfig; } const config = loadFromDisk(resolvedPath, configContext); if (config) { configContext.configCache.setConfig(resolvedPath.configFullName, config); } return config; }
[ "function", "load", "(", "extendedConfigReference", ",", "configContext", ",", "referencedFromPath", ")", "{", "const", "resolvedPath", "=", "resolve", "(", "extendedConfigReference", ",", "referencedFromPath", ",", "configContext", ".", "getPluginRootPath", "(", ")", ...
Loads a config object from the config cache based on its filename, falling back to the disk if the file is not yet cached. @param {string} extendedConfigReference The config to extend, as it appears in a config file @param {Config} configContext Context for the config instance @param {string} referencedFromPath The path to the config file that contains `extendedConfigReference` (or where the `extendedConfigReference` should be resolved from, if it doesn't appear in a config file) @returns {Object} the parsed config object (empty object if there was a parse error) @private
[ "Loads", "a", "config", "object", "from", "the", "config", "cache", "based", "on", "its", "filename", "falling", "back", "to", "the", "disk", "if", "the", "file", "is", "not", "yet", "cached", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/config/config-file.js#L545-L561
train
Load the config from disk
[ 30522, 3853, 7170, 1006, 3668, 8663, 8873, 17603, 25523, 1010, 9530, 8873, 18195, 28040, 18413, 1010, 14964, 19699, 25377, 8988, 1007, 1063, 9530, 3367, 10395, 15069, 1027, 10663, 1006, 3668, 8663, 8873, 17603, 25523, 1010, 14964, 19699, 2537...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...