repo
stringclasses
195 values
path
stringlengths
4
99
func_name
stringlengths
0
41
original_string
stringlengths
72
56.1k
language
stringclasses
1 value
code
stringlengths
72
56.1k
code_tokens
listlengths
25
8.12k
docstring
stringlengths
2
12.5k
docstring_tokens
listlengths
1
449
sha
stringclasses
197 values
url
stringlengths
88
186
partition
stringclasses
1 value
summary
stringlengths
8
338
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js
function(oRm, oControl) { if (oControl.getResizeEnabled()) { fnRenderToggler(oRm, oControl); } if (oControl.hasItems()) { if (oControl.getVisibleStatus() == NotificationBarStatus.Max) { fnWriteItemsMaximized(oRm, oControl); } else { fnWriteItemsDefault(oRm, oControl); } } }
javascript
function(oRm, oControl) { if (oControl.getResizeEnabled()) { fnRenderToggler(oRm, oControl); } if (oControl.hasItems()) { if (oControl.getVisibleStatus() == NotificationBarStatus.Max) { fnWriteItemsMaximized(oRm, oControl); } else { fnWriteItemsDefault(oRm, oControl); } } }
[ "function", "(", "oRm", ",", "oControl", ")", "{", "if", "(", "oControl", ".", "getResizeEnabled", "(", ")", ")", "{", "fnRenderToggler", "(", "oRm", ",", "oControl", ")", ";", "}", "if", "(", "oControl", ".", "hasItems", "(", ")", ")", "{", "if", ...
Renders all notifiers
[ "Renders", "all", "notifiers" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/NotificationBarRenderer.js#L232-L244
train
Renders the notification bar
[ 30522, 3853, 1006, 2030, 2213, 1010, 1051, 8663, 13181, 2140, 1007, 1063, 2065, 1006, 1051, 8663, 13181, 2140, 1012, 2131, 6072, 4697, 8189, 23242, 1006, 1007, 1007, 1063, 1042, 16118, 10497, 8743, 8649, 17420, 1006, 2030, 2213, 1010, 1051,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(sQueryOptionName) { var sQueryOptionValue = null; switch (sQueryOptionName) { case "$select": { var sSelectOption = ""; sSelectOption += (sSelectOption == "" ? "" : ",") + this._oParameter.getProperty().name; if (this._oValueSetResult.text == true && this._oParameter.getTextProperty()) { sSelectOption += (sSelectOption == "" ? "" : ",") + this._oParameter.getTextProperty().name; } sQueryOptionValue = (sSelectOption ? sSelectOption : null); break; } case "$filter": { var sFilterOption = null; if (this._oFilterExpression) { sFilterOption = this._oFilterExpression.getURIFilterOptionValue(); } sQueryOptionValue = (sFilterOption ? sFilterOption : null); break; } case "$orderby": { var sSortOption = null; if (this._oSortExpression) { sSortOption = this._oSortExpression.getURIOrderByOptionValue(); } sQueryOptionValue = (sSortOption ? sSortOption : null); break; } default: break; } return sQueryOptionValue; }
javascript
function(sQueryOptionName) { var sQueryOptionValue = null; switch (sQueryOptionName) { case "$select": { var sSelectOption = ""; sSelectOption += (sSelectOption == "" ? "" : ",") + this._oParameter.getProperty().name; if (this._oValueSetResult.text == true && this._oParameter.getTextProperty()) { sSelectOption += (sSelectOption == "" ? "" : ",") + this._oParameter.getTextProperty().name; } sQueryOptionValue = (sSelectOption ? sSelectOption : null); break; } case "$filter": { var sFilterOption = null; if (this._oFilterExpression) { sFilterOption = this._oFilterExpression.getURIFilterOptionValue(); } sQueryOptionValue = (sFilterOption ? sFilterOption : null); break; } case "$orderby": { var sSortOption = null; if (this._oSortExpression) { sSortOption = this._oSortExpression.getURIOrderByOptionValue(); } sQueryOptionValue = (sSortOption ? sSortOption : null); break; } default: break; } return sQueryOptionValue; }
[ "function", "(", "sQueryOptionName", ")", "{", "var", "sQueryOptionValue", "=", "null", ";", "switch", "(", "sQueryOptionName", ")", "{", "case", "\"$select\"", ":", "{", "var", "sSelectOption", "=", "\"\"", ";", "sSelectOption", "+=", "(", "sSelectOption", "=...
Get the value of a query option for the OData request URI corresponding to this request. @param {String} sQueryOptionName Identifies the query option: $select, $filter,... or any custom query option @returns {String} The value of the requested query option or null, if this option is not used for the OData request. @public @function @name sap.ui.model.analytics.odata4analytics.ParameterValueSetRequest#getURIQueryOptionValue
[ "Get", "the", "value", "of", "a", "query", "option", "for", "the", "OData", "request", "URI", "corresponding", "to", "this", "request", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L5051-L5085
train
Returns the value of the given query option
[ 30522, 3853, 1006, 5490, 13094, 7677, 16790, 18442, 1007, 1063, 13075, 5490, 13094, 7677, 16790, 10175, 5657, 1027, 19701, 1025, 6942, 1006, 5490, 13094, 7677, 16790, 18442, 1007, 1063, 2553, 1000, 1002, 7276, 1000, 1024, 1063, 13075, 7020, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
LLK/scratch-blocks
blocks_vertical/motion.js
function() { this.jsonInit({ "message0": Blockly.Msg.MOTION_TURNRIGHT, "args0": [ { "type": "field_image", "src": Blockly.mainWorkspace.options.pathToMedia + "rotate-right.svg", "width": 24, "height": 24 }, { "type": "input_value", "name": "DEGREES" } ], "category": Blockly.Categories.motion, "extensions": ["colours_motion", "shape_statement"] }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.MOTION_TURNRIGHT, "args0": [ { "type": "field_image", "src": Blockly.mainWorkspace.options.pathToMedia + "rotate-right.svg", "width": 24, "height": 24 }, { "type": "input_value", "name": "DEGREES" } ], "category": Blockly.Categories.motion, "extensions": ["colours_motion", "shape_statement"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "MOTION_TURNRIGHT", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_image\"", ",", "\"src\"", ":", "Blockly", ".", "mainWorkspace", "....
Block to turn right. @this Blockly.Block
[ "Block", "to", "turn", "right", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/motion.js#L56-L74
train
Block for rotate - right.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 4367, 1035, 2735, 15950, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 1063, 1000, 2828, 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...
SeleniumHQ/selenium
common/src/web/jquery-1.3.2.js
function( elem ) { return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); }
javascript
function( elem ) { return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); }
[ "function", "(", "elem", ")", "{", "return", "elem", ".", "nodeType", "===", "9", "&&", "elem", ".", "documentElement", ".", "nodeName", "!==", "\"HTML\"", "||", "!", "!", "elem", ".", "ownerDocument", "&&", "jQuery", ".", "isXMLDoc", "(", "elem", ".", ...
check if an element is in a (or is an) XML document
[ "check", "if", "an", "element", "is", "in", "a", "(", "or", "is", "an", ")", "XML", "document" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L640-L643
train
Returns true if the element is an HTML element
[ 30522, 3853, 1006, 3449, 6633, 1007, 1063, 2709, 3449, 6633, 1012, 13045, 13874, 1027, 1027, 1027, 1023, 1004, 1004, 3449, 6633, 1012, 6254, 12260, 3672, 1012, 13045, 18442, 999, 1027, 1027, 1000, 16129, 1000, 1064, 1064, 999, 999, 3449, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Support.js
getTechnicalContent
function getTechnicalContent(oFrameworkInformation) { oData = { version: oFrameworkInformation.commonInformation.version, build: oFrameworkInformation.commonInformation.buildTime, change: oFrameworkInformation.commonInformation.lastChange, useragent: oFrameworkInformation.commonInformation.userAgent, docmode: oFrameworkInformation.commonInformation.documentMode, debug: oFrameworkInformation.commonInformation.debugMode, bootconfig: oFrameworkInformation.configurationBootstrap, config: oFrameworkInformation.configurationComputed, loadedlibs: oFrameworkInformation.loadedLibraries, modules: oFrameworkInformation.loadedModules, uriparams: oFrameworkInformation.URLParameters, appurl: oFrameworkInformation.commonInformation.applicationHREF }; var html = ["<table class='sapUiSelectable' border='0' cellspacing='5' cellpadding='5' width='100%'><tbody class='sapUiSelectable'>"]; line(html, true, true, "SAPUI5 Version", function (buffer) { buffer.push(oData.version, " (built at ", oData.build, ", last change ", oData.change, ")"); }); line(html, true, true, "User Agent", function (buffer) { buffer.push(oData.useragent, (oData.docmode ? ", Document Mode '" + oData.docmode + "'" : "")); }); line(html, true, true, "Debug Sources", function (buffer) { buffer.push((oData.debug ? "ON" : "OFF")); }); line(html, true, true, "Application", oData.appurl); multiline(html, true, true, "Configuration (bootstrap)", oData.bootconfig); multiline(html, true, true, "Configuration (computed)", oData.config); multiline(html, true, true, "URI Parameters", oData.uriparams); // e2e trace section line(html, true, true, "End-to-End Trace", function (buffer) { buffer.push("<label class='sapUiSupportLabel'>Trace Level:</label>", "<select id='" + buildControlId(e2eTraceConst.selLevel) + "' class='sapUiSupportTxtFld' >", "<option value='low'>LOW</option>", "<option value='medium' selected>MEDIUM</option>", "<option value='high'>HIGH</option>", "</select>" ); buffer.push("<button id='" + buildControlId(e2eTraceConst.btnStart) + "' class='sapUiSupportBtn'>Start</button>"); buffer.push("<div class='sapUiSupportDiv'>"); buffer.push("<label class='sapUiSupportLabel'>XML Output:</label>"); buffer.push("<textarea id='" + buildControlId(e2eTraceConst.taContent) + "' class='sapUiSupportTxtArea sapUiSelectable' readonly ></textarea>"); buffer.push("</div>"); }); line(html, true, true, "Loaded Libraries", function (buffer) { buffer.push("<ul class='sapUiSelectable'>"); jQuery.each(oData.loadedlibs, function (i, v) { if (v && (typeof (v) === "string" || typeof (v) === "boolean")) { buffer.push("<li class='sapUiSelectable'>", i + " " + v, "</li>"); } }); buffer.push("</ul>"); }); line(html, true, true, "Loaded Modules", function (buffer) { buffer.push("<div class='sapUiSupportDiv sapUiSelectable' id='" + buildControlId(controlIDs.dvLoadedModules) + "'></div>"); }); html.push("</tbody></table>"); return new sap.ui.core.HTML({ content: html.join("").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;") }); }
javascript
function getTechnicalContent(oFrameworkInformation) { oData = { version: oFrameworkInformation.commonInformation.version, build: oFrameworkInformation.commonInformation.buildTime, change: oFrameworkInformation.commonInformation.lastChange, useragent: oFrameworkInformation.commonInformation.userAgent, docmode: oFrameworkInformation.commonInformation.documentMode, debug: oFrameworkInformation.commonInformation.debugMode, bootconfig: oFrameworkInformation.configurationBootstrap, config: oFrameworkInformation.configurationComputed, loadedlibs: oFrameworkInformation.loadedLibraries, modules: oFrameworkInformation.loadedModules, uriparams: oFrameworkInformation.URLParameters, appurl: oFrameworkInformation.commonInformation.applicationHREF }; var html = ["<table class='sapUiSelectable' border='0' cellspacing='5' cellpadding='5' width='100%'><tbody class='sapUiSelectable'>"]; line(html, true, true, "SAPUI5 Version", function (buffer) { buffer.push(oData.version, " (built at ", oData.build, ", last change ", oData.change, ")"); }); line(html, true, true, "User Agent", function (buffer) { buffer.push(oData.useragent, (oData.docmode ? ", Document Mode '" + oData.docmode + "'" : "")); }); line(html, true, true, "Debug Sources", function (buffer) { buffer.push((oData.debug ? "ON" : "OFF")); }); line(html, true, true, "Application", oData.appurl); multiline(html, true, true, "Configuration (bootstrap)", oData.bootconfig); multiline(html, true, true, "Configuration (computed)", oData.config); multiline(html, true, true, "URI Parameters", oData.uriparams); // e2e trace section line(html, true, true, "End-to-End Trace", function (buffer) { buffer.push("<label class='sapUiSupportLabel'>Trace Level:</label>", "<select id='" + buildControlId(e2eTraceConst.selLevel) + "' class='sapUiSupportTxtFld' >", "<option value='low'>LOW</option>", "<option value='medium' selected>MEDIUM</option>", "<option value='high'>HIGH</option>", "</select>" ); buffer.push("<button id='" + buildControlId(e2eTraceConst.btnStart) + "' class='sapUiSupportBtn'>Start</button>"); buffer.push("<div class='sapUiSupportDiv'>"); buffer.push("<label class='sapUiSupportLabel'>XML Output:</label>"); buffer.push("<textarea id='" + buildControlId(e2eTraceConst.taContent) + "' class='sapUiSupportTxtArea sapUiSelectable' readonly ></textarea>"); buffer.push("</div>"); }); line(html, true, true, "Loaded Libraries", function (buffer) { buffer.push("<ul class='sapUiSelectable'>"); jQuery.each(oData.loadedlibs, function (i, v) { if (v && (typeof (v) === "string" || typeof (v) === "boolean")) { buffer.push("<li class='sapUiSelectable'>", i + " " + v, "</li>"); } }); buffer.push("</ul>"); }); line(html, true, true, "Loaded Modules", function (buffer) { buffer.push("<div class='sapUiSupportDiv sapUiSelectable' id='" + buildControlId(controlIDs.dvLoadedModules) + "'></div>"); }); html.push("</tbody></table>"); return new sap.ui.core.HTML({ content: html.join("").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;") }); }
[ "function", "getTechnicalContent", "(", "oFrameworkInformation", ")", "{", "oData", "=", "{", "version", ":", "oFrameworkInformation", ".", "commonInformation", ".", "version", ",", "build", ":", "oFrameworkInformation", ".", "commonInformation", ".", "buildTime", ","...
copied from core
[ "copied", "from", "core" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/Support.js#L109-L174
train
Get the technical content of the current framework
[ 30522, 3853, 2131, 15007, 20913, 8663, 6528, 2102, 1006, 1997, 6444, 7974, 2953, 4939, 14192, 3370, 1007, 1063, 1051, 2850, 2696, 1027, 1063, 2544, 1024, 1997, 6444, 7974, 2953, 4939, 14192, 3370, 1012, 2691, 2378, 14192, 3370, 1012, 2544, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
radare/radare2
shlr/www/graph/js-graph-it.js
VerticalLStrategy
function VerticalLStrategy(connector) { this.connector = connector; this.startSegment; this.endSegment; this.strategyName = "vertical_L"; this.isApplicable = function() { var sourceMiddle = Math.floor(this.connector.source.left() + this.connector.source.width() / 2); var dl = this.connector.destination.left(); var dw = this.connector.destination.width(); var st = this.connector.source.top(); var sh = this.connector.source.height(); var destMiddle = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2); if(sourceMiddle > dl && sourceMiddle < dl + dw) return false; if(destMiddle > st && destMiddle < st + sh) return false; return true; } /** * Chooses the longest segment as the "middle" segment. */ this.getMiddleSegment = function() { if(this.startSegment.length > this.endSegment.length) return this.startSegment; return this.endSegment; } this.paint = function() { this.startSegment = this.connector.createSegment(); this.endSegment = this.connector.createSegment(); var destMiddleY = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2); var dl = this.connector.destination.left(); var dw = this.connector.destination.width(); var st = this.connector.source.top(); var sh = this.connector.source.height(); this.startSegment.startX = Math.floor(this.connector.source.left() + this.connector.source.width() / 2); // decide which side of the source block to connect to if(Math.abs(destMiddleY - st) < Math.abs(destMiddleY - (st + sh))) { // use the upper face this.startSegment.orientation = (destMiddleY < st) ? UP : DOWN; this.startSegment.startY = st; } else { // use the lower face this.startSegment.orientation = (destMiddleY > (st + sh)) ? DOWN : UP; this.startSegment.startY = st + sh; } this.startSegment.length = Math.abs(destMiddleY - this.startSegment.startY); // decide which side of the destination block to connect to if(Math.abs(this.startSegment.startX - dl) < Math.abs(this.startSegment.startX - (dl + dw))) { // use the left face this.endSegment.orientation = (this.startSegment.startX < dl) ? RIGHT : LEFT; this.endSegment.length = Math.abs(this.startSegment.startX - dl); } else { // use the right face this.endSegment.orientation = (this.startSegment.startX > dl + dw) ? LEFT : RIGHT; this.endSegment.length = Math.abs(this.startSegment.startX - (dl + dw)); } } }
javascript
function VerticalLStrategy(connector) { this.connector = connector; this.startSegment; this.endSegment; this.strategyName = "vertical_L"; this.isApplicable = function() { var sourceMiddle = Math.floor(this.connector.source.left() + this.connector.source.width() / 2); var dl = this.connector.destination.left(); var dw = this.connector.destination.width(); var st = this.connector.source.top(); var sh = this.connector.source.height(); var destMiddle = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2); if(sourceMiddle > dl && sourceMiddle < dl + dw) return false; if(destMiddle > st && destMiddle < st + sh) return false; return true; } /** * Chooses the longest segment as the "middle" segment. */ this.getMiddleSegment = function() { if(this.startSegment.length > this.endSegment.length) return this.startSegment; return this.endSegment; } this.paint = function() { this.startSegment = this.connector.createSegment(); this.endSegment = this.connector.createSegment(); var destMiddleY = Math.floor(this.connector.destination.top() + this.connector.destination.height() / 2); var dl = this.connector.destination.left(); var dw = this.connector.destination.width(); var st = this.connector.source.top(); var sh = this.connector.source.height(); this.startSegment.startX = Math.floor(this.connector.source.left() + this.connector.source.width() / 2); // decide which side of the source block to connect to if(Math.abs(destMiddleY - st) < Math.abs(destMiddleY - (st + sh))) { // use the upper face this.startSegment.orientation = (destMiddleY < st) ? UP : DOWN; this.startSegment.startY = st; } else { // use the lower face this.startSegment.orientation = (destMiddleY > (st + sh)) ? DOWN : UP; this.startSegment.startY = st + sh; } this.startSegment.length = Math.abs(destMiddleY - this.startSegment.startY); // decide which side of the destination block to connect to if(Math.abs(this.startSegment.startX - dl) < Math.abs(this.startSegment.startX - (dl + dw))) { // use the left face this.endSegment.orientation = (this.startSegment.startX < dl) ? RIGHT : LEFT; this.endSegment.length = Math.abs(this.startSegment.startX - dl); } else { // use the right face this.endSegment.orientation = (this.startSegment.startX > dl + dw) ? LEFT : RIGHT; this.endSegment.length = Math.abs(this.startSegment.startX - (dl + dw)); } } }
[ "function", "VerticalLStrategy", "(", "connector", ")", "{", "this", ".", "connector", "=", "connector", ";", "this", ".", "startSegment", ";", "this", ".", "endSegment", ";", "this", ".", "strategyName", "=", "\"vertical_L\"", ";", "this", ".", "isApplicable"...
Vertical "L" connector routing strategy
[ "Vertical", "L", "connector", "routing", "strategy" ]
bf5e3028810a0ec7c267c6fe4bfad639b4819e35
https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L1528-L1596
train
Vertical L strategy
[ 30522, 3853, 7471, 4877, 6494, 2618, 6292, 1006, 19400, 1007, 1063, 2023, 1012, 19400, 1027, 19400, 1025, 2023, 1012, 30524, 4515, 13910, 3672, 1025, 2023, 1012, 5656, 18442, 1027, 1000, 7471, 1035, 1048, 1000, 1025, 2023, 1012, 18061, 9397...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
function () { var defaultMaterial = new THREE.MeshBasicMaterial(); var material = this.material; var object3D = this.el.getObject3D('mesh'); if (object3D) { object3D.material = defaultMaterial; } disposeMaterial(material, this.system); }
javascript
function () { var defaultMaterial = new THREE.MeshBasicMaterial(); var material = this.material; var object3D = this.el.getObject3D('mesh'); if (object3D) { object3D.material = defaultMaterial; } disposeMaterial(material, this.system); }
[ "function", "(", ")", "{", "var", "defaultMaterial", "=", "new", "THREE", ".", "MeshBasicMaterial", "(", ")", ";", "var", "material", "=", "this", ".", "material", ";", "var", "object3D", "=", "this", ".", "el", ".", "getObject3D", "(", "'mesh'", ")", ...
Remove material on remove (callback). Dispose of it from memory and unsubscribe from scene updates.
[ "Remove", "material", "on", "remove", "(", "callback", ")", ".", "Dispose", "of", "it", "from", "memory", "and", "unsubscribe", "from", "scene", "updates", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/components/material.js#L155-L161
train
Dispose the material
[ 30522, 3853, 1006, 1007, 1063, 13075, 12398, 8585, 14482, 1027, 2047, 2093, 1012, 20437, 22083, 2594, 8585, 14482, 1006, 1007, 1025, 13075, 3430, 1027, 2023, 1012, 3430, 1025, 13075, 4874, 29097, 1027, 2023, 1012, 3449, 1012, 2131, 16429, 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...
caolan/async
support/jsdoc/theme/publish.js
sortStrs
function sortStrs(strArr) { return strArr.sort(function(s1, s2) { var lowerCaseS1 = s1.toLowerCase(); var lowerCaseS2 = s2.toLowerCase(); if (lowerCaseS1 < lowerCaseS2) { return -1; } else if (lowerCaseS1 > lowerCaseS2) { return 1; } else { return 0; } }); }
javascript
function sortStrs(strArr) { return strArr.sort(function(s1, s2) { var lowerCaseS1 = s1.toLowerCase(); var lowerCaseS2 = s2.toLowerCase(); if (lowerCaseS1 < lowerCaseS2) { return -1; } else if (lowerCaseS1 > lowerCaseS2) { return 1; } else { return 0; } }); }
[ "function", "sortStrs", "(", "strArr", ")", "{", "return", "strArr", ".", "sort", "(", "function", "(", "s1", ",", "s2", ")", "{", "var", "lowerCaseS1", "=", "s1", ".", "toLowerCase", "(", ")", ";", "var", "lowerCaseS2", "=", "s2", ".", "toLowerCase", ...
Sorts an array of strings alphabetically @param {Array<String>} strArr - Array of strings to sort @return {Array<String>} The sorted array
[ "Sorts", "an", "array", "of", "strings", "alphabetically" ]
4330d536c106592139fa82062494c9dba0da1fdb
https://github.com/caolan/async/blob/4330d536c106592139fa82062494c9dba0da1fdb/support/jsdoc/theme/publish.js#L395-L408
train
sorts an array of strings
[ 30522, 3853, 11901, 16344, 2015, 1006, 2358, 19848, 2099, 1007, 1063, 2709, 2358, 19848, 2099, 1012, 4066, 1006, 3853, 1006, 1055, 2487, 1010, 1055, 2475, 1007, 1063, 13075, 2896, 18382, 30524, 18992, 3366, 1006, 1007, 1025, 13075, 2896, 18...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/code-path-analysis/fork-context.js
mergeExtraSegments
function mergeExtraSegments(context, segments) { let currentSegments = segments; while (currentSegments.length > context.count) { const merged = []; for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) { merged.push(CodePathSegment.newNext( context.idGenerator.next(), [currentSegments[i], currentSegments[i + length]] )); } currentSegments = merged; } return currentSegments; }
javascript
function mergeExtraSegments(context, segments) { let currentSegments = segments; while (currentSegments.length > context.count) { const merged = []; for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) { merged.push(CodePathSegment.newNext( context.idGenerator.next(), [currentSegments[i], currentSegments[i + length]] )); } currentSegments = merged; } return currentSegments; }
[ "function", "mergeExtraSegments", "(", "context", ",", "segments", ")", "{", "let", "currentSegments", "=", "segments", ";", "while", "(", "currentSegments", ".", "length", ">", "context", ".", "count", ")", "{", "const", "merged", "=", "[", "]", ";", "for...
`segments` becomes doubly in a `finally` block. Then if a code path exits by a control statement (such as `break`, `continue`) from the `finally` block, the destination's segments may be half of the source segments. In that case, this merges segments. @param {ForkContext} context - An instance. @param {CodePathSegment[]} segments - Segments to merge. @returns {CodePathSegment[]} The merged segments.
[ "segments", "becomes", "doubly", "in", "a", "finally", "block", ".", "Then", "if", "a", "code", "path", "exits", "by", "a", "control", "statement", "(", "such", "as", "break", "continue", ")", "from", "the", "finally", "block", "the", "destination", "s", ...
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/fork-context.js#L77-L92
train
Merge extra segments into one
[ 30522, 3853, 13590, 10288, 6494, 3366, 21693, 11187, 1006, 6123, 1010, 9214, 1007, 1063, 2292, 14731, 13910, 8163, 1027, 9214, 1025, 2096, 1006, 14731, 13910, 8163, 1012, 3091, 1028, 6123, 1012, 4175, 1007, 1063, 9530, 3367, 5314, 1027, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/JSONUtils.js
getContextInfo
function getContextInfo(editor, constPos, requireParent, requireNextToken) { var pos, ctx, ctxPrev, ctxNext, offset, keyName, valueName, parentKeyName, isArray, exclusionList, hasColon, hasComma, hasBracket, shouldReplace; pos = $.extend({}, constPos); ctx = TokenUtils.getInitialContext(editor._codeMirror, pos); offset = TokenUtils.offsetInToken(ctx); if (ctx.token && ctx.token.type === "string property") { // String literals used as keys. // Disallow hints if cursor is out of the string. if (/^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return null; } keyName = stripQuotes(ctx.token.string); // Get parent key name. if (requireParent) { ctxPrev = $.extend(true, {}, ctx); parentKeyName = stripQuotes(_getParentKeyName(ctxPrev)); } // Check if the key is followed by a colon, so we should not append colon again. ctxNext = $.extend(true, {}, ctx); TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, ctxNext); if (ctxNext.token.type === null && ctxNext.token.string === ":") { shouldReplace = true; } // Get an exclusion list of properties. pos = $.extend({}, constPos); exclusionList = _getExclusionList(editor, pos); return _createContextInfo(ctx.token, TOKEN_KEY, offset, keyName, valueName, parentKeyName, null, exclusionList, shouldReplace); } else if (ctx.token && (valueTokenTypes.indexOf(ctx.token.type) !== -1 || (ctx.token.type === null && regexAllowedChars.test(ctx.token.string)))) { // Boolean, String, Number and variable literal values. // Disallow hints if cursor is out of the string. if (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return null; } valueName = ctx.token.string; // Check the current token if (ctx.token.type === null) { if (ctx.token.string === ":") { hasColon = true; } else if (ctx.token.string === ",") { hasComma = true; } else if (ctx.token.string === "[") { hasBracket = true; } } // move context back and find corresponding key name. ctxPrev = $.extend(true, {}, ctx); while (TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctxPrev)) { if (ctxPrev.token.type === "string property") { keyName = stripQuotes(ctxPrev.token.string); break; } else if (ctxPrev.token.type === null) { if (ctxPrev.token.string === ":") { hasColon = true; } else if (ctxPrev.token.string === ",") { hasComma = true; } else if (ctxPrev.token.string === "[") { hasBracket = true; } else { return null; } } else if (!hasComma) { return null; } } // If no key name or colon found OR // If we have a comma but no opening bracket, return null. if ((!keyName || !hasColon) || (hasComma && !hasBracket)) { return null; } else { isArray = hasBracket; } // Get parent key name. if (requireParent) { ctxPrev = $.extend(true, {}, ctx); parentKeyName = stripQuotes(_getParentKeyName(ctxPrev)); } // Check if we can replace the next token of a value. ctxNext = $.extend(true, {}, ctx); TokenUtils.moveNextToken(ctxNext); if (requireNextToken && valueTokenTypes.indexOf(ctxNext.token.type) !== -1) { shouldReplace = true; } return _createContextInfo((shouldReplace) ? ctxNext.token : ctx.token, TOKEN_VALUE, offset, keyName, valueName, parentKeyName, isArray, null, shouldReplace); } return null; }
javascript
function getContextInfo(editor, constPos, requireParent, requireNextToken) { var pos, ctx, ctxPrev, ctxNext, offset, keyName, valueName, parentKeyName, isArray, exclusionList, hasColon, hasComma, hasBracket, shouldReplace; pos = $.extend({}, constPos); ctx = TokenUtils.getInitialContext(editor._codeMirror, pos); offset = TokenUtils.offsetInToken(ctx); if (ctx.token && ctx.token.type === "string property") { // String literals used as keys. // Disallow hints if cursor is out of the string. if (/^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return null; } keyName = stripQuotes(ctx.token.string); // Get parent key name. if (requireParent) { ctxPrev = $.extend(true, {}, ctx); parentKeyName = stripQuotes(_getParentKeyName(ctxPrev)); } // Check if the key is followed by a colon, so we should not append colon again. ctxNext = $.extend(true, {}, ctx); TokenUtils.moveSkippingWhitespace(TokenUtils.moveNextToken, ctxNext); if (ctxNext.token.type === null && ctxNext.token.string === ":") { shouldReplace = true; } // Get an exclusion list of properties. pos = $.extend({}, constPos); exclusionList = _getExclusionList(editor, pos); return _createContextInfo(ctx.token, TOKEN_KEY, offset, keyName, valueName, parentKeyName, null, exclusionList, shouldReplace); } else if (ctx.token && (valueTokenTypes.indexOf(ctx.token.type) !== -1 || (ctx.token.type === null && regexAllowedChars.test(ctx.token.string)))) { // Boolean, String, Number and variable literal values. // Disallow hints if cursor is out of the string. if (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.substr(-1, 1)) && ctx.token.string.length !== 1 && ctx.token.end === pos.ch) { return null; } valueName = ctx.token.string; // Check the current token if (ctx.token.type === null) { if (ctx.token.string === ":") { hasColon = true; } else if (ctx.token.string === ",") { hasComma = true; } else if (ctx.token.string === "[") { hasBracket = true; } } // move context back and find corresponding key name. ctxPrev = $.extend(true, {}, ctx); while (TokenUtils.moveSkippingWhitespace(TokenUtils.movePrevToken, ctxPrev)) { if (ctxPrev.token.type === "string property") { keyName = stripQuotes(ctxPrev.token.string); break; } else if (ctxPrev.token.type === null) { if (ctxPrev.token.string === ":") { hasColon = true; } else if (ctxPrev.token.string === ",") { hasComma = true; } else if (ctxPrev.token.string === "[") { hasBracket = true; } else { return null; } } else if (!hasComma) { return null; } } // If no key name or colon found OR // If we have a comma but no opening bracket, return null. if ((!keyName || !hasColon) || (hasComma && !hasBracket)) { return null; } else { isArray = hasBracket; } // Get parent key name. if (requireParent) { ctxPrev = $.extend(true, {}, ctx); parentKeyName = stripQuotes(_getParentKeyName(ctxPrev)); } // Check if we can replace the next token of a value. ctxNext = $.extend(true, {}, ctx); TokenUtils.moveNextToken(ctxNext); if (requireNextToken && valueTokenTypes.indexOf(ctxNext.token.type) !== -1) { shouldReplace = true; } return _createContextInfo((shouldReplace) ? ctxNext.token : ctx.token, TOKEN_VALUE, offset, keyName, valueName, parentKeyName, isArray, null, shouldReplace); } return null; }
[ "function", "getContextInfo", "(", "editor", ",", "constPos", ",", "requireParent", ",", "requireNextToken", ")", "{", "var", "pos", ",", "ctx", ",", "ctxPrev", ",", "ctxNext", ",", "offset", ",", "keyName", ",", "valueName", ",", "parentKeyName", ",", "isAr...
Returns context info at a given position in editor @param {!Editor} editor @param {!{line: number, ch: number}} constPos Position of cursor in the editor @param {Boolean} requireParent If true will look for parent key name @param {Boolean} requireNextToken if true we can replace the next token of a value. @return {!{token: Object, tokenType: number, offset: number, keyName: String, valueName: String, parentKeyName: String, isArray: Boolean, exclusionList: Array.<String>, shouldReplace: Boolean}}
[ "Returns", "context", "info", "at", "a", "given", "position", "in", "editor" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSONUtils.js#L191-L295
train
Get the context info for a given position.
[ 30522, 3853, 2131, 8663, 18209, 2378, 14876, 1006, 3559, 1010, 9530, 3367, 6873, 2015, 1010, 5478, 19362, 4765, 1010, 5478, 2638, 18413, 18715, 2368, 1007, 1063, 13075, 13433, 2015, 1010, 14931, 2595, 1010, 14931, 2595, 28139, 2615, 1010, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js
_checkAndEnhanceODataProperty
function _checkAndEnhanceODataProperty(oInvisibleElement, aODataProperties, aNavigationProperties, aNavigationEntityNames, mBindingPaths) { var aBindingPaths = mBindingPaths.bindingPaths, aBindingContextPaths = mBindingPaths.bindingContextPaths, mODataProperty; return ( // include it if the field has no bindings (bindings can be added in runtime) !_hasBindings(aBindingPaths) // include it if some properties got binding through valid navigations of the current Model || _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) // looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced // with extra data from it || ( (mODataProperty = _findODataProperty(aBindingPaths, aODataProperties)) && (_enhanceInvisibleElement(oInvisibleElement, mODataProperty) || true) ) ); }
javascript
function _checkAndEnhanceODataProperty(oInvisibleElement, aODataProperties, aNavigationProperties, aNavigationEntityNames, mBindingPaths) { var aBindingPaths = mBindingPaths.bindingPaths, aBindingContextPaths = mBindingPaths.bindingContextPaths, mODataProperty; return ( // include it if the field has no bindings (bindings can be added in runtime) !_hasBindings(aBindingPaths) // include it if some properties got binding through valid navigations of the current Model || _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) // looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced // with extra data from it || ( (mODataProperty = _findODataProperty(aBindingPaths, aODataProperties)) && (_enhanceInvisibleElement(oInvisibleElement, mODataProperty) || true) ) ); }
[ "function", "_checkAndEnhanceODataProperty", "(", "oInvisibleElement", ",", "aODataProperties", ",", "aNavigationProperties", ",", "aNavigationEntityNames", ",", "mBindingPaths", ")", "{", "var", "aBindingPaths", "=", "mBindingPaths", ".", "bindingPaths", ",", "aBindingCont...
Checks if this InvisibleProperty should be included in resulting list and adds information from oDataProperty to the InvisibleProperty if available @param {sap.ui.core.Control} oInvisibleElement - Invisible Element @param {Array.<Object>} aODataProperties - Array of Fields @param {Array.<Object>} aNavigationProperties - Array of Navigation Properties @param {Array.<Object>} aNavigationEntityNames - Array of Navigation Entity names @param {Object} mBindingPaths - Map of all binding paths and binding context paths of the passed invisible element @return {Boolean} - whether this field is @private
[ "Checks", "if", "this", "InvisibleProperty", "should", "be", "included", "in", "resulting", "list", "and", "adds", "information", "from", "oDataProperty", "to", "the", "InvisibleProperty", "if", "available" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.rta/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js#L403-L420
train
Checks if the current InvisibleElement has bindings and if so adds it to the OData property
[ 30522, 3853, 1035, 4638, 5685, 2368, 4819, 3401, 13390, 2696, 21572, 4842, 3723, 1006, 1051, 2378, 11365, 7028, 12260, 3672, 1010, 20118, 2850, 2696, 21572, 4842, 7368, 1010, 9617, 5737, 12540, 21572, 4842, 7368, 1010, 9617, 5737, 12540, 47...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jaywcjlove/linux-command
build/build.js
createDataJSON
function createDataJSON(pathArr) { return new Promise((resolve, reject) => { try { const commandData = {}; const indexes = []; pathArr.forEach((mdPath, i) => { const json = {} const con = FS.readFileSync(mdPath); const str = con.toString(); let title = str.match(/[^===]+(?=[===])/g); title = title[0] ? title[0].replace(/\n/g, '') : title[0]; title = title.replace(/\r/, '') // 命令名称 json["n"] = title; // 命令路径 json["p"] = `/${path.basename(mdPath, '.md').replace(/\\/g, '/')}`; // 命令描述 let des = str.match(/\n==={1,}([\s\S]*?)##/i); if (!des) { throw `格式错误: ${mdPath}`; } des = des[1] ? des[1].replace(/\n/g, '') : des[1]; des = des.replace(/\r/g, '') json["d"] = des; indexes.push(json); commandData[title] = json; }) resolve({ json: commandData, data: indexes }); } catch (err) { reject(err); } }); }
javascript
function createDataJSON(pathArr) { return new Promise((resolve, reject) => { try { const commandData = {}; const indexes = []; pathArr.forEach((mdPath, i) => { const json = {} const con = FS.readFileSync(mdPath); const str = con.toString(); let title = str.match(/[^===]+(?=[===])/g); title = title[0] ? title[0].replace(/\n/g, '') : title[0]; title = title.replace(/\r/, '') // 命令名称 json["n"] = title; // 命令路径 json["p"] = `/${path.basename(mdPath, '.md').replace(/\\/g, '/')}`; // 命令描述 let des = str.match(/\n==={1,}([\s\S]*?)##/i); if (!des) { throw `格式错误: ${mdPath}`; } des = des[1] ? des[1].replace(/\n/g, '') : des[1]; des = des.replace(/\r/g, '') json["d"] = des; indexes.push(json); commandData[title] = json; }) resolve({ json: commandData, data: indexes }); } catch (err) { reject(err); } }); }
[ "function", "createDataJSON", "(", "pathArr", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "try", "{", "const", "commandData", "=", "{", "}", ";", "const", "indexes", "=", "[", "]", ";", "pathArr", ".", "f...
Ensures that the directory exists. @param {String} pathArr
[ "Ensures", "that", "the", "directory", "exists", "." ]
7d6c8c6b3468a0dd5311ee68934c9b8db64469f7
https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/build/build.js#L253-L288
train
Create data json from a list of files
[ 30522, 3853, 2580, 6790, 22578, 2239, 1006, 4130, 2906, 2099, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 3046, 1063, 9530, 3367, 3094, 2850, 2696, 1027, 1063, 1065, 1025, 9530, 3367, 5950, 2229, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/BaseController.js
function() { var aVisibleColumnsIds = [], aColumns = SelectionUtils.treeTable.getColumns(); aColumns.forEach(function (oColumn) { if (oColumn.getVisible()){ aVisibleColumnsIds.push(oColumn.sId); } }); storage.setVisibleColumns(aVisibleColumnsIds); }
javascript
function() { var aVisibleColumnsIds = [], aColumns = SelectionUtils.treeTable.getColumns(); aColumns.forEach(function (oColumn) { if (oColumn.getVisible()){ aVisibleColumnsIds.push(oColumn.sId); } }); storage.setVisibleColumns(aVisibleColumnsIds); }
[ "function", "(", ")", "{", "var", "aVisibleColumnsIds", "=", "[", "]", ",", "aColumns", "=", "SelectionUtils", ".", "treeTable", ".", "getColumns", "(", ")", ";", "aColumns", ".", "forEach", "(", "function", "(", "oColumn", ")", "{", "if", "(", "oColumn"...
Persist visible columns selection in local storage.
[ "Persist", "visible", "columns", "selection", "in", "local", "storage", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/BaseController.js#L54-L65
train
Sets the visible columns of the tree table
[ 30522, 3853, 1006, 1007, 1063, 13075, 20704, 17417, 3468, 25778, 2819, 3619, 9821, 1027, 1031, 1033, 1010, 9353, 4747, 2819, 3619, 1027, 4989, 21823, 4877, 1012, 3392, 10880, 1012, 2131, 25778, 2819, 3619, 1006, 1007, 1025, 9353, 4747, 2819...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/closure-library
closure-deps/bin/closuremakedeps.js
getClosureDep
function getClosureDep(deps, args) { let closureDep = deps.find(d => d.closureSymbols.indexOf('goog') >= 0); // We need the path to Closure Library to be able to write a dependency file. // Note that if we find base.js via a dependency file (like Closure's deps.js) // it doesn't help us - we need the actual path of base.js, but the dependency // only knows the relative path from Closure Library to base.js, which is // always "base.js". if (!args.closurePath && (!closureDep || closureDep.isParsedFromDepsFile())) { throw new Error( 'Could not find path to Closure. Closure\'s base.js either needs to ' + 'be included or --closure-path provided.'); } if (args.closurePath && closureDep && !closureDep.isParsedFromDepsFile()) { throw new Error( 'Both --closure-path and Closure\'s base.js file should not be ' + 'inputs.'); } if (args.closurePath && closureDep && closureDep.isParsedFromDepsFile()) { closureDep.setClosurePath(args.closurePath); } if (!closureDep) { closureDep = new depGraph.Dependency( depGraph.DependencyType.SCRIPT, path.join(args.closurePath, 'base.js'), ['goog'], []); deps.push(closureDep); } return closureDep; }
javascript
function getClosureDep(deps, args) { let closureDep = deps.find(d => d.closureSymbols.indexOf('goog') >= 0); // We need the path to Closure Library to be able to write a dependency file. // Note that if we find base.js via a dependency file (like Closure's deps.js) // it doesn't help us - we need the actual path of base.js, but the dependency // only knows the relative path from Closure Library to base.js, which is // always "base.js". if (!args.closurePath && (!closureDep || closureDep.isParsedFromDepsFile())) { throw new Error( 'Could not find path to Closure. Closure\'s base.js either needs to ' + 'be included or --closure-path provided.'); } if (args.closurePath && closureDep && !closureDep.isParsedFromDepsFile()) { throw new Error( 'Both --closure-path and Closure\'s base.js file should not be ' + 'inputs.'); } if (args.closurePath && closureDep && closureDep.isParsedFromDepsFile()) { closureDep.setClosurePath(args.closurePath); } if (!closureDep) { closureDep = new depGraph.Dependency( depGraph.DependencyType.SCRIPT, path.join(args.closurePath, 'base.js'), ['goog'], []); deps.push(closureDep); } return closureDep; }
[ "function", "getClosureDep", "(", "deps", ",", "args", ")", "{", "let", "closureDep", "=", "deps", ".", "find", "(", "d", "=>", "d", ".", "closureSymbols", ".", "indexOf", "(", "'goog'", ")", ">=", "0", ")", ";", "// We need the path to Closure Library to be...
Finds or creates a dependency for Closure's base.js (which provides the `goog` symbol). @param {!Array<!depGraph.Dependency>} deps @param {!Arguments} args @return {!depGraph.Dependency}
[ "Finds", "or", "creates", "a", "dependency", "for", "Closure", "s", "base", ".", "js", "(", "which", "provides", "the", "goog", "symbol", ")", "." ]
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure-deps/bin/closuremakedeps.js#L169-L201
train
Get Closure dependency from dependency graph
[ 30522, 3853, 2131, 20464, 2891, 12165, 13699, 1006, 2139, 4523, 1010, 12098, 5620, 1007, 1063, 2292, 8503, 3207, 2361, 1027, 2139, 4523, 1012, 2424, 1006, 1040, 1027, 1028, 1040, 1012, 8503, 6508, 13344, 4877, 1012, 5950, 11253, 1006, 1005,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ccxt/ccxt
examples/js/load-all-tickers-at-once.js
main
async function main () { let exchanges = [] // instantiate all exchanges await Promise.all (ccxt.exchanges.map (async id => { let exchange = new (ccxt)[id] () exchanges.push (exchange) await test (exchange, symbol) })) let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green let failed = exchanges.filter (exchange => exchange.markets ? false : true).length let total = ccxt.exchanges.length.toString ().bright.white console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) }
javascript
async function main () { let exchanges = [] // instantiate all exchanges await Promise.all (ccxt.exchanges.map (async id => { let exchange = new (ccxt)[id] () exchanges.push (exchange) await test (exchange, symbol) })) let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green let failed = exchanges.filter (exchange => exchange.markets ? false : true).length let total = ccxt.exchanges.length.toString ().bright.white console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) }
[ "async", "function", "main", "(", ")", "{", "let", "exchanges", "=", "[", "]", "// instantiate all exchanges", "await", "Promise", ".", "all", "(", "ccxt", ".", "exchanges", ".", "map", "(", "async", "id", "=>", "{", "let", "exchange", "=", "new", "(", ...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
8168069b9180a465532905e225586215e115a565
https://github.com/ccxt/ccxt/blob/8168069b9180a465532905e225586215e115a565/examples/js/load-all-tickers-at-once.js#L71-L86
train
main function
[ 30522, 2004, 6038, 2278, 3853, 2364, 1006, 1007, 1063, 2292, 15800, 1027, 1031, 1033, 1013, 1013, 7107, 13143, 2035, 15800, 26751, 4872, 1012, 2035, 1006, 10507, 18413, 1012, 15800, 1012, 4949, 1006, 2004, 6038, 2278, 8909, 1027, 1028, 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...
GitbookIO/gitbook
lib/json/encodeOutputWithPage.js
encodeOutputWithPage
function encodeOutputWithPage(output, page) { var file = page.getFile(); var book = output.getBook(); var result = encodeOutput(output); result.page = encodePage(page, book.getSummary()); result.file = encodeFile(file); return result; }
javascript
function encodeOutputWithPage(output, page) { var file = page.getFile(); var book = output.getBook(); var result = encodeOutput(output); result.page = encodePage(page, book.getSummary()); result.file = encodeFile(file); return result; }
[ "function", "encodeOutputWithPage", "(", "output", ",", "page", ")", "{", "var", "file", "=", "page", ".", "getFile", "(", ")", ";", "var", "book", "=", "output", ".", "getBook", "(", ")", ";", "var", "result", "=", "encodeOutput", "(", "output", ")", ...
Return a JSON representation of a book with a specific file @param {Book} output @param {Page} page @return {Object}
[ "Return", "a", "JSON", "representation", "of", "a", "book", "with", "a", "specific", "file" ]
6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4
https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/json/encodeOutputWithPage.js#L12-L21
train
Encode output with page
[ 30522, 3853, 4372, 16044, 5833, 18780, 24415, 13704, 1006, 6434, 1010, 3931, 1007, 1063, 13075, 5371, 1027, 3931, 1012, 2131, 8873, 2571, 1006, 1007, 1025, 13075, 2338, 1027, 6434, 1012, 2131, 8654, 1006, 1007, 1025, 13075, 2765, 1027, 4372...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
lib/jsdoc/transform-apijson-for-sdk.js
function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
function (namespace) { var result, aNamespaceParts = namespace.split("."); if (aNamespaceParts[0] === "Org" && aNamespaceParts[1] === "OData") { result = '<a href="' + this.ANNOTATIONS_NAMESPACE_LINK + namespace + '.xml">' + namespace + '</a>'; } else { result = namespace; } result = this._preProcessLinksInTextBlock(result); return result; }
[ "function", "(", "namespace", ")", "{", "var", "result", ",", "aNamespaceParts", "=", "namespace", ".", "split", "(", "\".\"", ")", ";", "if", "(", "aNamespaceParts", "[", "0", "]", "===", "\"Org\"", "&&", "aNamespaceParts", "[", "1", "]", "===", "\"ODat...
Formats the namespace of annotations @param namespace - the namespace to be formatted @returns string - the formatted text
[ "Formats", "the", "namespace", "of", "annotations" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/transform-apijson-for-sdk.js#L986-L998
train
Returns a link to the specified namespace
[ 30522, 3853, 1006, 3415, 15327, 1007, 1063, 13075, 2765, 1010, 9617, 7834, 15327, 26950, 1027, 3415, 15327, 1012, 3975, 1006, 1000, 1012, 1000, 1007, 1025, 2065, 1006, 9617, 7834, 15327, 26950, 1031, 1014, 1033, 1027, 1027, 1027, 1000, 8917...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
facebook/relay
packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js
exportType
function exportType(name: string, type: BabelAST) { return t.exportNamedDeclaration( t.typeAlias(t.identifier(name), null, type), [], null, ); }
javascript
function exportType(name: string, type: BabelAST) { return t.exportNamedDeclaration( t.typeAlias(t.identifier(name), null, type), [], null, ); }
[ "function", "exportType", "(", "name", ":", "string", ",", "type", ":", "BabelAST", ")", "{", "return", "t", ".", "exportNamedDeclaration", "(", "t", ".", "typeAlias", "(", "t", ".", "identifier", "(", "name", ")", ",", "null", ",", "type", ")", ",", ...
export type NAME = TYPE
[ "export", "type", "NAME", "=", "TYPE" ]
7fb9be5182b9650637d7b92ead9a42713ac30aa4
https://github.com/facebook/relay/blob/7fb9be5182b9650637d7b92ead9a42713ac30aa4/packages/relay-compiler/language/javascript/RelayFlowBabelFactories.js#L39-L45
train
Export a type declaration
[ 30522, 3853, 9167, 13874, 1006, 2171, 1024, 5164, 1010, 2828, 1024, 11561, 8523, 2102, 1007, 1063, 2709, 1056, 1012, 9167, 18442, 14141, 8586, 8017, 3370, 1006, 1056, 1012, 2828, 22786, 2015, 1006, 1056, 1012, 8909, 4765, 18095, 1006, 2171,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-spacing.js
addNullElementsToIgnoreList
function addNullElementsToIgnoreList(node) { let previousToken = sourceCode.getFirstToken(node); node.elements.forEach(element => { let token; if (element === null) { token = sourceCode.getTokenAfter(previousToken); if (astUtils.isCommaToken(token)) { commaTokensToIgnore.push(token); } } else { token = sourceCode.getTokenAfter(element); } previousToken = token; }); }
javascript
function addNullElementsToIgnoreList(node) { let previousToken = sourceCode.getFirstToken(node); node.elements.forEach(element => { let token; if (element === null) { token = sourceCode.getTokenAfter(previousToken); if (astUtils.isCommaToken(token)) { commaTokensToIgnore.push(token); } } else { token = sourceCode.getTokenAfter(element); } previousToken = token; }); }
[ "function", "addNullElementsToIgnoreList", "(", "node", ")", "{", "let", "previousToken", "=", "sourceCode", ".", "getFirstToken", "(", "node", ")", ";", "node", ".", "elements", ".", "forEach", "(", "element", "=>", "{", "let", "token", ";", "if", "(", "e...
Adds null elements of the given ArrayExpression or ArrayPattern node to the ignore list. @param {ASTNode} node An ArrayExpression or ArrayPattern node. @returns {void}
[ "Adds", "null", "elements", "of", "the", "given", "ArrayExpression", "or", "ArrayPattern", "node", "to", "the", "ignore", "list", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/comma-spacing.js#L143-L161
train
Add null elements to ignore list
[ 30522, 3853, 5587, 11231, 6216, 16930, 11187, 3406, 23773, 5686, 9863, 1006, 13045, 1007, 1063, 2292, 3025, 18715, 2368, 1027, 3120, 16044, 1012, 2131, 8873, 12096, 18715, 2368, 1006, 13045, 1007, 1025, 13045, 1012, 3787, 1012, 18921, 6776, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
common/src/web/jquery-1.3.2.js
function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector; else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")"; // Return the newly-formed element set return ret; }
javascript
function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery( elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector; else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")"; // Return the newly-formed element set return ret; }
[ "function", "(", "elems", ",", "name", ",", "selector", ")", "{", "// Build a new jQuery matched element set", "var", "ret", "=", "jQuery", "(", "elems", ")", ";", "// Add the old object onto the stack (as a reference)", "ret", ".", "prevObject", "=", "this", ";", "...
Take an array of elements and push it onto the stack (returning the new matched element set)
[ "Take", "an", "array", "of", "elements", "and", "push", "it", "onto", "the", "stack", "(", "returning", "the", "new", "matched", "element", "set", ")" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/common/src/web/jquery-1.3.2.js#L121-L137
train
Creates a jQuery matched element
[ 30522, 3853, 1006, 3449, 6633, 2015, 1010, 2171, 1010, 27000, 1007, 1063, 1013, 1013, 3857, 1037, 2047, 1046, 4226, 2854, 10349, 5783, 2275, 13075, 2128, 2102, 1027, 1046, 4226, 2854, 1006, 3449, 6633, 2015, 1007, 1025, 1013, 1013, 5587, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
firebase/firebaseui-web
javascript/widgets/handler/common.js
function(firebaseCredential) { var status = false; var p = component.executePromiseRequest( /** @type {function (): !goog.Promise} */ ( goog.bind(app.startSignInWithCredential, app)), [firebaseCredential], function(result) { var container = component.getContainer(); component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.CALLBACK, app, container, goog.Promise.resolve(result)); status = true; }, function(error) { if (error['name'] && error['name'] == 'cancel') { return; } else if (error && error['code'] == 'auth/credential-already-in-use') { // Do nothing when anonymous user is getting updated. // Developer should handle this in signInFailure callback. return; } else if (error && error['code'] == 'auth/email-already-in-use' && error['email'] && error['credential']) { // Email already in use error should trigger account linking flow. // Pass error to callback handler to trigger that flow. var container = component.getContainer(); component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.CALLBACK, app, container, goog.Promise.reject(error)); return; } var errorMessage = firebaseui.auth.widget.handler.common.getErrorMessage(error); // Show error message in the info bar. component.showInfoBar(errorMessage); }); app.registerPending(p); return p.then(function() { // Status needs to be returned. return status; }, function(error) { return false; }); }
javascript
function(firebaseCredential) { var status = false; var p = component.executePromiseRequest( /** @type {function (): !goog.Promise} */ ( goog.bind(app.startSignInWithCredential, app)), [firebaseCredential], function(result) { var container = component.getContainer(); component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.CALLBACK, app, container, goog.Promise.resolve(result)); status = true; }, function(error) { if (error['name'] && error['name'] == 'cancel') { return; } else if (error && error['code'] == 'auth/credential-already-in-use') { // Do nothing when anonymous user is getting updated. // Developer should handle this in signInFailure callback. return; } else if (error && error['code'] == 'auth/email-already-in-use' && error['email'] && error['credential']) { // Email already in use error should trigger account linking flow. // Pass error to callback handler to trigger that flow. var container = component.getContainer(); component.dispose(); firebaseui.auth.widget.handler.handle( firebaseui.auth.widget.HandlerName.CALLBACK, app, container, goog.Promise.reject(error)); return; } var errorMessage = firebaseui.auth.widget.handler.common.getErrorMessage(error); // Show error message in the info bar. component.showInfoBar(errorMessage); }); app.registerPending(p); return p.then(function() { // Status needs to be returned. return status; }, function(error) { return false; }); }
[ "function", "(", "firebaseCredential", ")", "{", "var", "status", "=", "false", ";", "var", "p", "=", "component", ".", "executePromiseRequest", "(", "/** @type {function (): !goog.Promise} */", "(", "goog", ".", "bind", "(", "app", ".", "startSignInWithCredential",...
Sign in with a Firebase Auth credential. @param {!firebase.auth.AuthCredential} firebaseCredential The Firebase Auth credential. @return {!goog.Promise<boolean>}
[ "Sign", "in", "with", "a", "Firebase", "Auth", "credential", "." ]
c10aa51e38aeb38dc63baa22b48cd6690c2be087
https://github.com/firebase/firebaseui-web/blob/c10aa51e38aeb38dc63baa22b48cd6690c2be087/javascript/widgets/handler/common.js#L1135-L1185
train
Sign in with a credential
[ 30522, 3853, 1006, 2543, 15058, 16748, 16454, 4818, 1007, 1063, 13075, 3570, 1027, 6270, 1025, 13075, 1052, 1027, 6922, 1012, 15389, 21572, 28732, 2890, 15500, 1006, 1013, 1008, 1008, 1030, 2828, 1063, 3853, 1006, 1007, 1024, 999, 27571, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/sidenav/sidenav.js
findInstance
function findInstance(handle, shouldWait) { var instance = $mdComponentRegistry.get(handle); if (!instance && !shouldWait) { // Report missing instance $log.error($mdUtil.supplant(errorMsg, [handle || ""])); // The component has not registered itself... most like NOT yet created // return null to indicate that the Sidenav is not in the DOM return undefined; } return instance; }
javascript
function findInstance(handle, shouldWait) { var instance = $mdComponentRegistry.get(handle); if (!instance && !shouldWait) { // Report missing instance $log.error($mdUtil.supplant(errorMsg, [handle || ""])); // The component has not registered itself... most like NOT yet created // return null to indicate that the Sidenav is not in the DOM return undefined; } return instance; }
[ "function", "findInstance", "(", "handle", ",", "shouldWait", ")", "{", "var", "instance", "=", "$mdComponentRegistry", ".", "get", "(", "handle", ")", ";", "if", "(", "!", "instance", "&&", "!", "shouldWait", ")", "{", "// Report missing instance", "$log", ...
Synchronously lookup the controller instance for the specified sidNav instance which has been registered with the markup `md-component-id`
[ "Synchronously", "lookup", "the", "controller", "instance", "for", "the", "specified", "sidNav", "instance", "which", "has", "been", "registered", "with", "the", "markup", "md", "-", "component", "-", "id" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L131-L143
train
Find the instance of the specified component
[ 30522, 3853, 2424, 7076, 26897, 1006, 5047, 1010, 2323, 21547, 2102, 1007, 1063, 13075, 6013, 1027, 1002, 9108, 9006, 29513, 3372, 2890, 24063, 2854, 1012, 2131, 1006, 5047, 1007, 1025, 2065, 1006, 999, 6013, 1004, 1004, 999, 2323, 21547, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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) { context = context || {}; return this.base.get(this.prefix + id, this.base._getContext(context)); }
javascript
function (id, context) { context = context || {}; return this.base.get(this.prefix + id, this.base._getContext(context)); }
[ "function", "(", "id", ",", "context", ")", "{", "context", "=", "context", "||", "{", "}", ";", "return", "this", ".", "base", ".", "get", "(", "this", ".", "prefix", "+", "id", ",", "this", ".", "base", ".", "_getContext", "(", "context", ")", ...
Gets the prefixed preference @param {string} id Name of the preference for which the value should be retrieved @param {Object=} context Optional context object to change the preference lookup
[ "Gets", "the", "prefixed", "preference" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L1099-L1102
train
Get a record by id
[ 30522, 3853, 1006, 8909, 1010, 6123, 1007, 1063, 6123, 1027, 6123, 1064, 1064, 1063, 1065, 1025, 2709, 2023, 1012, 2918, 1012, 2131, 1006, 2023, 1012, 17576, 1009, 8909, 1010, 2023, 1012, 2918, 1012, 1035, 2131, 8663, 18209, 1006, 6123, 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...
dcloudio/mui
examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js
function () { req.date = new Date(); if (self._conn.options.customHeaders){ var headers = self._conn.options.customHeaders; for (var header in headers) { if (headers.hasOwnProperty(header)) { req.xhr.setRequestHeader(header, headers[header]); } } } req.xhr.send(req.data); }
javascript
function () { req.date = new Date(); if (self._conn.options.customHeaders){ var headers = self._conn.options.customHeaders; for (var header in headers) { if (headers.hasOwnProperty(header)) { req.xhr.setRequestHeader(header, headers[header]); } } } req.xhr.send(req.data); }
[ "function", "(", ")", "{", "req", ".", "date", "=", "new", "Date", "(", ")", ";", "if", "(", "self", ".", "_conn", ".", "options", ".", "customHeaders", ")", "{", "var", "headers", "=", "self", ".", "_conn", ".", "options", ".", "customHeaders", ";...
Fires the XHR request -- may be invoked immediately or on a gradually expanding retry window for reconnects
[ "Fires", "the", "XHR", "request", "--", "may", "be", "invoked", "immediately", "or", "on", "a", "gradually", "expanding", "retry", "window", "for", "reconnects" ]
ff74c90a1671a552f3604b1288bf38a4126312d0
https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4525-L4536
train
Send the request to the remote node
[ 30522, 3853, 1006, 1007, 1063, 2128, 4160, 1012, 3058, 1027, 2047, 3058, 1006, 1007, 1025, 2065, 1006, 2969, 1012, 1035, 9530, 2078, 1012, 7047, 1012, 7661, 4974, 2545, 1007, 1063, 13075, 20346, 2015, 1027, 2969, 1012, 1035, 9530, 2078, 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...
sass/node-sass
scripts/build.js
build
function build(options) { var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat( ['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) { return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join(''); })).concat(options.args); console.log('Building:', [process.execPath].concat(args).join(' ')); var proc = spawn(process.execPath, args, { stdio: [0, 1, 2] }); proc.on('exit', function(errorCode) { if (!errorCode) { afterBuild(options); return; } if (errorCode === 127 ) { console.error('node-gyp not found!'); } else { console.error('Build failed with error code:', errorCode); } process.exit(1); }); }
javascript
function build(options) { var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat( ['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) { return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join(''); })).concat(options.args); console.log('Building:', [process.execPath].concat(args).join(' ')); var proc = spawn(process.execPath, args, { stdio: [0, 1, 2] }); proc.on('exit', function(errorCode) { if (!errorCode) { afterBuild(options); return; } if (errorCode === 127 ) { console.error('node-gyp not found!'); } else { console.error('Build failed with error code:', errorCode); } process.exit(1); }); }
[ "function", "build", "(", "options", ")", "{", "var", "args", "=", "[", "require", ".", "resolve", "(", "path", ".", "join", "(", "'node-gyp'", ",", "'bin'", ",", "'node-gyp.js'", ")", ")", ",", "'rebuild'", ",", "'--verbose'", "]", ".", "concat", "(",...
Build @param {Object} options @api private
[ "Build" ]
0c1a49eefa37544d16041c5fe5b2e3d9168004b7
https://github.com/sass/node-sass/blob/0c1a49eefa37544d16041c5fe5b2e3d9168004b7/scripts/build.js#L58-L84
train
Build the node - gyp
[ 30522, 3853, 3857, 1006, 7047, 1007, 1063, 13075, 12098, 5620, 1027, 1031, 5478, 1012, 10663, 1006, 4130, 1012, 3693, 1006, 1005, 13045, 1011, 1043, 22571, 1005, 1010, 1005, 8026, 1005, 1010, 1005, 13045, 1011, 1043, 22571, 1012, 1046, 2015...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
radare/radare2
shlr/www/graph/js-graph-it.js
startDrag
function startDrag(e) { var eventSource = nn6 ? e.target : event.srcElement; if (eventSource.tagName == 'HTML') return; while (eventSource != document.body && !hasClass(eventSource, "draggable")) { eventSource = nn6 ? eventSource.parentNode : eventSource.parentElement; } // if a draggable element was found, calculate its actual position if (hasClass(eventSource, "draggable")) { isdrag = true; elementToMove = eventSource; // set absolute positioning on the element elementToMove.style.position = "absolute"; // calculate start point elementStartX = elementToMove.offsetLeft; elementStartY = elementToMove.offsetTop; // calculate mouse start point mouseStartX = nn6 ? e.clientX : event.clientX; mouseStartY = nn6 ? e.clientY : event.clientY; // calculate bounds as left, top, width, height of the parent element if(getStyle(elementToMove.parentNode, "position") == 'absolute') { bounds[0] = bounds[1] = 0; } else { bounds[0] = calculateOffsetLeft(elementToMove.parentNode); bounds[1] = calculateOffsetTop(elementToMove.parentNode); } bounds[2] = bounds[0] + elementToMove.parentNode.offsetWidth; bounds[3] = bounds[1] + elementToMove.parentNode.offsetHeight; // either find the block related to the dragging element to call its onMove method blocksToMove = new Array(); blocksToMoveScanner.scan(eventSource); document.onmousemove = movemouse; originalZIndex = getStyle(elementToMove, "z-index"); elementToMove.style.zIndex = "3"; return false; } }
javascript
function startDrag(e) { var eventSource = nn6 ? e.target : event.srcElement; if (eventSource.tagName == 'HTML') return; while (eventSource != document.body && !hasClass(eventSource, "draggable")) { eventSource = nn6 ? eventSource.parentNode : eventSource.parentElement; } // if a draggable element was found, calculate its actual position if (hasClass(eventSource, "draggable")) { isdrag = true; elementToMove = eventSource; // set absolute positioning on the element elementToMove.style.position = "absolute"; // calculate start point elementStartX = elementToMove.offsetLeft; elementStartY = elementToMove.offsetTop; // calculate mouse start point mouseStartX = nn6 ? e.clientX : event.clientX; mouseStartY = nn6 ? e.clientY : event.clientY; // calculate bounds as left, top, width, height of the parent element if(getStyle(elementToMove.parentNode, "position") == 'absolute') { bounds[0] = bounds[1] = 0; } else { bounds[0] = calculateOffsetLeft(elementToMove.parentNode); bounds[1] = calculateOffsetTop(elementToMove.parentNode); } bounds[2] = bounds[0] + elementToMove.parentNode.offsetWidth; bounds[3] = bounds[1] + elementToMove.parentNode.offsetHeight; // either find the block related to the dragging element to call its onMove method blocksToMove = new Array(); blocksToMoveScanner.scan(eventSource); document.onmousemove = movemouse; originalZIndex = getStyle(elementToMove, "z-index"); elementToMove.style.zIndex = "3"; return false; } }
[ "function", "startDrag", "(", "e", ")", "{", "var", "eventSource", "=", "nn6", "?", "e", ".", "target", ":", "event", ".", "srcElement", ";", "if", "(", "eventSource", ".", "tagName", "==", "'HTML'", ")", "return", ";", "while", "(", "eventSource", "!=...
finds the innermost draggable element starting from the one that generated the event "e" (i.e.: the html element under mouse pointer), then setup the document's onmousemove function to move the element around.
[ "finds", "the", "innermost", "draggable", "element", "starting", "from", "the", "one", "that", "generated", "the", "event", "e", "(", "i", ".", "e", ".", ":", "the", "html", "element", "under", "mouse", "pointer", ")", "then", "setup", "the", "document", ...
bf5e3028810a0ec7c267c6fe4bfad639b4819e35
https://github.com/radare/radare2/blob/bf5e3028810a0ec7c267c6fe4bfad639b4819e35/shlr/www/graph/js-graph-it.js#L122-L169
train
start drag
[ 30522, 3853, 2707, 7265, 2290, 1006, 1041, 1007, 1063, 13075, 2824, 8162, 3401, 1027, 1050, 2078, 2575, 1029, 1041, 1012, 4539, 1024, 2724, 1012, 5034, 29109, 13665, 1025, 2065, 1006, 2824, 8162, 3401, 1012, 6415, 18442, 1027, 1027, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/resource_waiter.js
loadWaiterConfig
function loadWaiterConfig(state) { if (!this.service.api.waiters[state]) { throw new AWS.util.error(new Error(), { code: 'StateNotFoundError', message: 'State ' + state + ' not found.' }); } this.config = AWS.util.copy(this.service.api.waiters[state]); }
javascript
function loadWaiterConfig(state) { if (!this.service.api.waiters[state]) { throw new AWS.util.error(new Error(), { code: 'StateNotFoundError', message: 'State ' + state + ' not found.' }); } this.config = AWS.util.copy(this.service.api.waiters[state]); }
[ "function", "loadWaiterConfig", "(", "state", ")", "{", "if", "(", "!", "this", ".", "service", ".", "api", ".", "waiters", "[", "state", "]", ")", "{", "throw", "new", "AWS", ".", "util", ".", "error", "(", "new", "Error", "(", ")", ",", "{", "c...
Loads waiter configuration from API configuration @api private
[ "Loads", "waiter", "configuration", "from", "API", "configuration" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/resource_waiter.js#L194-L203
train
Load the waiter config for a given state
[ 30522, 3853, 7170, 29601, 29566, 2078, 8873, 2290, 1006, 2110, 1007, 1063, 2065, 1006, 999, 2023, 1012, 2326, 1012, 17928, 1012, 15610, 2015, 1031, 2110, 1033, 1007, 1063, 5466, 2047, 22091, 2015, 1012, 21183, 4014, 1012, 7561, 1006, 2047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/ValidationUtils.js
isInteger
function isInteger(value) { // Validate value is a number if (typeof (value) !== "number" || isNaN(parseInt(value, 10))) { return false; } // Validate number is an integer if (Math.floor(value) !== value) { return false; } // Validate number is finite if (!isFinite(value)) { return false; } return true; }
javascript
function isInteger(value) { // Validate value is a number if (typeof (value) !== "number" || isNaN(parseInt(value, 10))) { return false; } // Validate number is an integer if (Math.floor(value) !== value) { return false; } // Validate number is finite if (!isFinite(value)) { return false; } return true; }
[ "function", "isInteger", "(", "value", ")", "{", "// Validate value is a number", "if", "(", "typeof", "(", "value", ")", "!==", "\"number\"", "||", "isNaN", "(", "parseInt", "(", "value", ",", "10", ")", ")", ")", "{", "return", "false", ";", "}", "// V...
Used to validate whether type of unknown value is an integer. @param {*} value Value for which to validate its type @return {boolean} true if value is a finite integer
[ "Used", "to", "validate", "whether", "type", "of", "unknown", "value", "is", "an", "integer", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ValidationUtils.js#L34-L51
train
Validate value is an integer
[ 30522, 3853, 2003, 18447, 26320, 1006, 3643, 1007, 1063, 1013, 1013, 9398, 3686, 3643, 2003, 1037, 2193, 2065, 1006, 2828, 11253, 1006, 3643, 1007, 999, 1027, 1027, 1000, 2193, 1000, 1064, 1064, 3475, 2319, 1006, 11968, 20240, 3372, 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...
moment/luxon
src/datetime.js
toTechFormat
function toTechFormat(dt, format) { return dt.isValid ? Formatter.create(Locale.create("en-US"), { allowZ: true, forceSimple: true }).formatDateTimeFromString(dt, format) : null; }
javascript
function toTechFormat(dt, format) { return dt.isValid ? Formatter.create(Locale.create("en-US"), { allowZ: true, forceSimple: true }).formatDateTimeFromString(dt, format) : null; }
[ "function", "toTechFormat", "(", "dt", ",", "format", ")", "{", "return", "dt", ".", "isValid", "?", "Formatter", ".", "create", "(", "Locale", ".", "create", "(", "\"en-US\"", ")", ",", "{", "allowZ", ":", "true", ",", "forceSimple", ":", "true", "}",...
if you want to output a technical format (e.g. RFC 2822), this helper helps handle the details
[ "if", "you", "want", "to", "output", "a", "technical", "format", "(", "e", ".", "g", ".", "RFC", "2822", ")", "this", "helper", "helps", "handle", "the", "details" ]
236f2badea297ee73421aa39a83e06177c1be6d0
https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/datetime.js#L174-L181
train
Returns the Tech format string for the given date and time
[ 30522, 3853, 2000, 15007, 14192, 4017, 1006, 26718, 1010, 4289, 1007, 1063, 2709, 26718, 1012, 2003, 10175, 3593, 1029, 4289, 3334, 1012, 3443, 1006, 2334, 2063, 1012, 3443, 1006, 1000, 4372, 1011, 2149, 1000, 1007, 1010, 1063, 3499, 2480, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.commons/src/sap/ui/commons/MenuButton.js
function(oEvent){ var oItem = oEvent.getParameter("item"); this.fireItemSelected({itemId: oItem.getId(), item: oItem}); this.firePress({itemId: oItem.getId(), item: oItem}); }
javascript
function(oEvent){ var oItem = oEvent.getParameter("item"); this.fireItemSelected({itemId: oItem.getId(), item: oItem}); this.firePress({itemId: oItem.getId(), item: oItem}); }
[ "function", "(", "oEvent", ")", "{", "var", "oItem", "=", "oEvent", ".", "getParameter", "(", "\"item\"", ")", ";", "this", ".", "fireItemSelected", "(", "{", "itemId", ":", "oItem", ".", "getId", "(", ")", ",", "item", ":", "oItem", "}", ")", ";", ...
Function is called when an item in the menu was selected.
[ "Function", "is", "called", "when", "an", "item", "in", "the", "menu", "was", "selected", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuButton.js#L224-L228
train
Handles the item selection event
[ 30522, 3853, 1006, 1051, 18697, 3372, 1007, 1063, 13075, 1051, 4221, 2213, 1027, 1051, 18697, 3372, 1012, 2131, 28689, 22828, 1006, 1000, 8875, 1000, 1007, 1025, 2023, 1012, 2543, 4221, 5244, 12260, 10985, 1006, 1063, 8875, 3593, 1024, 1051...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Microsoft/vscode
build/lib/treeshaking.js
discoverAndReadFiles
function discoverAndReadFiles(options) { const FILES = {}; const in_queue = Object.create(null); const queue = []; const enqueue = (moduleId) => { if (in_queue[moduleId]) { return; } in_queue[moduleId] = true; queue.push(moduleId); }; options.entryPoints.forEach((entryPoint) => enqueue(entryPoint)); while (queue.length > 0) { const moduleId = queue.shift(); const dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts'); if (fs.existsSync(dts_filename)) { const dts_filecontents = fs.readFileSync(dts_filename).toString(); FILES[`${moduleId}.d.ts`] = dts_filecontents; continue; } const js_filename = path.join(options.sourcesRoot, moduleId + '.js'); if (fs.existsSync(js_filename)) { // This is an import for a .js file, so ignore it... continue; } let ts_filename; if (options.redirects[moduleId]) { ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts'); } else { ts_filename = path.join(options.sourcesRoot, moduleId + '.ts'); } const ts_filecontents = fs.readFileSync(ts_filename).toString(); const info = ts.preProcessFile(ts_filecontents); for (let i = info.importedFiles.length - 1; i >= 0; i--) { const importedFileName = info.importedFiles[i].fileName; if (options.importIgnorePattern.test(importedFileName)) { // Ignore vs/css! imports continue; } let importedModuleId = importedFileName; if (/(^\.\/)|(^\.\.\/)/.test(importedModuleId)) { importedModuleId = path.join(path.dirname(moduleId), importedModuleId); } enqueue(importedModuleId); } FILES[`${moduleId}.ts`] = ts_filecontents; } return FILES; }
javascript
function discoverAndReadFiles(options) { const FILES = {}; const in_queue = Object.create(null); const queue = []; const enqueue = (moduleId) => { if (in_queue[moduleId]) { return; } in_queue[moduleId] = true; queue.push(moduleId); }; options.entryPoints.forEach((entryPoint) => enqueue(entryPoint)); while (queue.length > 0) { const moduleId = queue.shift(); const dts_filename = path.join(options.sourcesRoot, moduleId + '.d.ts'); if (fs.existsSync(dts_filename)) { const dts_filecontents = fs.readFileSync(dts_filename).toString(); FILES[`${moduleId}.d.ts`] = dts_filecontents; continue; } const js_filename = path.join(options.sourcesRoot, moduleId + '.js'); if (fs.existsSync(js_filename)) { // This is an import for a .js file, so ignore it... continue; } let ts_filename; if (options.redirects[moduleId]) { ts_filename = path.join(options.sourcesRoot, options.redirects[moduleId] + '.ts'); } else { ts_filename = path.join(options.sourcesRoot, moduleId + '.ts'); } const ts_filecontents = fs.readFileSync(ts_filename).toString(); const info = ts.preProcessFile(ts_filecontents); for (let i = info.importedFiles.length - 1; i >= 0; i--) { const importedFileName = info.importedFiles[i].fileName; if (options.importIgnorePattern.test(importedFileName)) { // Ignore vs/css! imports continue; } let importedModuleId = importedFileName; if (/(^\.\/)|(^\.\.\/)/.test(importedModuleId)) { importedModuleId = path.join(path.dirname(moduleId), importedModuleId); } enqueue(importedModuleId); } FILES[`${moduleId}.ts`] = ts_filecontents; } return FILES; }
[ "function", "discoverAndReadFiles", "(", "options", ")", "{", "const", "FILES", "=", "{", "}", ";", "const", "in_queue", "=", "Object", ".", "create", "(", "null", ")", ";", "const", "queue", "=", "[", "]", ";", "const", "enqueue", "=", "(", "moduleId"...
Read imports and follow them until all files have been handled
[ "Read", "imports", "and", "follow", "them", "until", "all", "files", "have", "been", "handled" ]
693a13cd32c5be798051edc0cb43e1e39fc456d9
https://github.com/Microsoft/vscode/blob/693a13cd32c5be798051edc0cb43e1e39fc456d9/build/lib/treeshaking.js#L79-L128
train
Reads all files from the source directory
[ 30522, 3853, 7523, 5685, 16416, 20952, 9463, 2015, 1006, 7047, 1007, 1063, 9530, 3367, 6764, 1027, 1063, 1065, 1025, 9530, 3367, 1999, 1035, 24240, 1027, 4874, 1012, 3443, 1006, 19701, 1007, 1025, 9530, 3367, 24240, 1027, 1031, 1033, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jgraph/mxgraph
javascript/examples/grapheditor/www/js/Editor.js
function(editorUi) { var graph = editorUi.editor.graph; var row, td; var table = document.createElement('table'); table.style.width = '100%'; table.style.height = '100%'; var tbody = document.createElement('tbody'); row = document.createElement('tr'); td = document.createElement('td'); td.style.verticalAlign = 'top'; td.style.fontSize = '10pt'; mxUtils.write(td, mxResources.get('paperSize') + ':'); row.appendChild(td); td = document.createElement('td'); td.style.verticalAlign = 'top'; td.style.fontSize = '10pt'; var accessor = PageSetupDialog.addPageFormatPanel(td, 'pagesetupdialog', graph.pageFormat); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); mxUtils.write(td, mxResources.get('background') + ':'); row.appendChild(td); td = document.createElement('td'); td.style.whiteSpace = 'nowrap'; var backgroundInput = document.createElement('input'); backgroundInput.setAttribute('type', 'text'); var backgroundButton = document.createElement('button'); backgroundButton.style.width = '18px'; backgroundButton.style.height = '18px'; backgroundButton.style.marginRight = '20px'; backgroundButton.style.backgroundPosition = 'center center'; backgroundButton.style.backgroundRepeat = 'no-repeat'; var newBackgroundColor = graph.background; function updateBackgroundColor() { if (newBackgroundColor == null || newBackgroundColor == mxConstants.NONE) { backgroundButton.style.backgroundColor = ''; backgroundButton.style.backgroundImage = 'url(\'' + Dialog.prototype.noColorImage + '\')'; } else { backgroundButton.style.backgroundColor = newBackgroundColor; backgroundButton.style.backgroundImage = ''; } }; updateBackgroundColor(); mxEvent.addListener(backgroundButton, 'click', function(evt) { editorUi.pickColor(newBackgroundColor || 'none', function(color) { newBackgroundColor = color; updateBackgroundColor(); }); mxEvent.consume(evt); }); td.appendChild(backgroundButton); mxUtils.write(td, mxResources.get('gridSize') + ':'); var gridSizeInput = document.createElement('input'); gridSizeInput.setAttribute('type', 'number'); gridSizeInput.setAttribute('min', '0'); gridSizeInput.style.width = '40px'; gridSizeInput.style.marginLeft = '6px'; gridSizeInput.value = graph.getGridSize(); td.appendChild(gridSizeInput); mxEvent.addListener(gridSizeInput, 'change', function() { var value = parseInt(gridSizeInput.value); gridSizeInput.value = Math.max(1, (isNaN(value)) ? graph.getGridSize() : value); }); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); mxUtils.write(td, mxResources.get('image') + ':'); row.appendChild(td); td = document.createElement('td'); var changeImageLink = document.createElement('a'); changeImageLink.style.textDecoration = 'underline'; changeImageLink.style.cursor = 'pointer'; changeImageLink.style.color = '#a0a0a0'; var newBackgroundImage = graph.backgroundImage; function updateBackgroundImage() { if (newBackgroundImage == null) { changeImageLink.removeAttribute('title'); changeImageLink.style.fontSize = ''; changeImageLink.innerHTML = mxResources.get('change') + '...'; } else { changeImageLink.setAttribute('title', newBackgroundImage.src); changeImageLink.style.fontSize = '11px'; changeImageLink.innerHTML = newBackgroundImage.src.substring(0, 42) + '...'; } }; mxEvent.addListener(changeImageLink, 'click', function(evt) { editorUi.showBackgroundImageDialog(function(image) { newBackgroundImage = image; updateBackgroundImage(); }); mxEvent.consume(evt); }); updateBackgroundImage(); td.appendChild(changeImageLink); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); td.colSpan = 2; td.style.paddingTop = '16px'; td.setAttribute('align', 'right'); var cancelBtn = mxUtils.button(mxResources.get('cancel'), function() { editorUi.hideDialog(); }); cancelBtn.className = 'geBtn'; if (editorUi.editor.cancelFirst) { td.appendChild(cancelBtn); } var applyBtn = mxUtils.button(mxResources.get('apply'), function() { editorUi.hideDialog(); if (graph.gridSize !== gridSizeInput.value) { graph.setGridSize(parseInt(gridSizeInput.value)); } var change = new ChangePageSetup(editorUi, newBackgroundColor, newBackgroundImage, accessor.get()); change.ignoreColor = graph.background == newBackgroundColor; var oldSrc = (graph.backgroundImage != null) ? graph.backgroundImage.src : null; var newSrc = (newBackgroundImage != null) ? newBackgroundImage.src : null; change.ignoreImage = oldSrc === newSrc; if (graph.pageFormat.width != change.previousFormat.width || graph.pageFormat.height != change.previousFormat.height || !change.ignoreColor || !change.ignoreImage) { graph.model.execute(change); } }); applyBtn.className = 'geBtn gePrimaryBtn'; td.appendChild(applyBtn); if (!editorUi.editor.cancelFirst) { td.appendChild(cancelBtn); } row.appendChild(td); tbody.appendChild(row); table.appendChild(tbody); this.container = table; }
javascript
function(editorUi) { var graph = editorUi.editor.graph; var row, td; var table = document.createElement('table'); table.style.width = '100%'; table.style.height = '100%'; var tbody = document.createElement('tbody'); row = document.createElement('tr'); td = document.createElement('td'); td.style.verticalAlign = 'top'; td.style.fontSize = '10pt'; mxUtils.write(td, mxResources.get('paperSize') + ':'); row.appendChild(td); td = document.createElement('td'); td.style.verticalAlign = 'top'; td.style.fontSize = '10pt'; var accessor = PageSetupDialog.addPageFormatPanel(td, 'pagesetupdialog', graph.pageFormat); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); mxUtils.write(td, mxResources.get('background') + ':'); row.appendChild(td); td = document.createElement('td'); td.style.whiteSpace = 'nowrap'; var backgroundInput = document.createElement('input'); backgroundInput.setAttribute('type', 'text'); var backgroundButton = document.createElement('button'); backgroundButton.style.width = '18px'; backgroundButton.style.height = '18px'; backgroundButton.style.marginRight = '20px'; backgroundButton.style.backgroundPosition = 'center center'; backgroundButton.style.backgroundRepeat = 'no-repeat'; var newBackgroundColor = graph.background; function updateBackgroundColor() { if (newBackgroundColor == null || newBackgroundColor == mxConstants.NONE) { backgroundButton.style.backgroundColor = ''; backgroundButton.style.backgroundImage = 'url(\'' + Dialog.prototype.noColorImage + '\')'; } else { backgroundButton.style.backgroundColor = newBackgroundColor; backgroundButton.style.backgroundImage = ''; } }; updateBackgroundColor(); mxEvent.addListener(backgroundButton, 'click', function(evt) { editorUi.pickColor(newBackgroundColor || 'none', function(color) { newBackgroundColor = color; updateBackgroundColor(); }); mxEvent.consume(evt); }); td.appendChild(backgroundButton); mxUtils.write(td, mxResources.get('gridSize') + ':'); var gridSizeInput = document.createElement('input'); gridSizeInput.setAttribute('type', 'number'); gridSizeInput.setAttribute('min', '0'); gridSizeInput.style.width = '40px'; gridSizeInput.style.marginLeft = '6px'; gridSizeInput.value = graph.getGridSize(); td.appendChild(gridSizeInput); mxEvent.addListener(gridSizeInput, 'change', function() { var value = parseInt(gridSizeInput.value); gridSizeInput.value = Math.max(1, (isNaN(value)) ? graph.getGridSize() : value); }); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); mxUtils.write(td, mxResources.get('image') + ':'); row.appendChild(td); td = document.createElement('td'); var changeImageLink = document.createElement('a'); changeImageLink.style.textDecoration = 'underline'; changeImageLink.style.cursor = 'pointer'; changeImageLink.style.color = '#a0a0a0'; var newBackgroundImage = graph.backgroundImage; function updateBackgroundImage() { if (newBackgroundImage == null) { changeImageLink.removeAttribute('title'); changeImageLink.style.fontSize = ''; changeImageLink.innerHTML = mxResources.get('change') + '...'; } else { changeImageLink.setAttribute('title', newBackgroundImage.src); changeImageLink.style.fontSize = '11px'; changeImageLink.innerHTML = newBackgroundImage.src.substring(0, 42) + '...'; } }; mxEvent.addListener(changeImageLink, 'click', function(evt) { editorUi.showBackgroundImageDialog(function(image) { newBackgroundImage = image; updateBackgroundImage(); }); mxEvent.consume(evt); }); updateBackgroundImage(); td.appendChild(changeImageLink); row.appendChild(td); tbody.appendChild(row); row = document.createElement('tr'); td = document.createElement('td'); td.colSpan = 2; td.style.paddingTop = '16px'; td.setAttribute('align', 'right'); var cancelBtn = mxUtils.button(mxResources.get('cancel'), function() { editorUi.hideDialog(); }); cancelBtn.className = 'geBtn'; if (editorUi.editor.cancelFirst) { td.appendChild(cancelBtn); } var applyBtn = mxUtils.button(mxResources.get('apply'), function() { editorUi.hideDialog(); if (graph.gridSize !== gridSizeInput.value) { graph.setGridSize(parseInt(gridSizeInput.value)); } var change = new ChangePageSetup(editorUi, newBackgroundColor, newBackgroundImage, accessor.get()); change.ignoreColor = graph.background == newBackgroundColor; var oldSrc = (graph.backgroundImage != null) ? graph.backgroundImage.src : null; var newSrc = (newBackgroundImage != null) ? newBackgroundImage.src : null; change.ignoreImage = oldSrc === newSrc; if (graph.pageFormat.width != change.previousFormat.width || graph.pageFormat.height != change.previousFormat.height || !change.ignoreColor || !change.ignoreImage) { graph.model.execute(change); } }); applyBtn.className = 'geBtn gePrimaryBtn'; td.appendChild(applyBtn); if (!editorUi.editor.cancelFirst) { td.appendChild(cancelBtn); } row.appendChild(td); tbody.appendChild(row); table.appendChild(tbody); this.container = table; }
[ "function", "(", "editorUi", ")", "{", "var", "graph", "=", "editorUi", ".", "editor", ".", "graph", ";", "var", "row", ",", "td", ";", "var", "table", "=", "document", ".", "createElement", "(", "'table'", ")", ";", "table", ".", "style", ".", "widt...
Constructs a new page setup dialog.
[ "Constructs", "a", "new", "page", "setup", "dialog", "." ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Editor.js#L1291-L1493
train
Creates the page format panel
[ 30522, 3853, 1006, 3559, 10179, 1007, 1063, 13075, 10629, 1027, 3559, 10179, 1012, 3559, 1012, 10629, 1025, 13075, 5216, 1010, 14595, 1025, 13075, 2795, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1005, 2795, 1005, 1007, 1025, 2795, 1012, 28...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/_Cache.js
visitInstance
function visitInstance(oInstance, sMetaPath, sInstancePath, sContextUrl, iIndex) { var aMatches, sPredicate, oType = mTypeForMetaPath[sMetaPath], sMessageProperty = oType && oType[sMessagesAnnotation] && oType[sMessagesAnnotation].$Path, aMessages; sContextUrl = buildContextUrl(sContextUrl, oInstance["@odata.context"]); sPredicate = that.calculateKeyPredicate(oInstance, mTypeForMetaPath, sMetaPath); if (iIndex !== undefined) { sInstancePath = _Helper.buildPath(sInstancePath, sPredicate || iIndex); } else if (!bKeepTransientPath && sPredicate) { aMatches = rEndsWithTransientPredicate.exec(sInstancePath); if (aMatches) { sInstancePath = sInstancePath.slice(0, -aMatches[0].length) + sPredicate; } } if (sRootPath && !aCachePaths) { // remove messages only for the part of the cache that is updated aCachePaths = [sInstancePath]; } if (sMessageProperty) { aMessages = _Helper.drillDown(oInstance, sMessageProperty.split("/")); if (aMessages !== undefined) { addMessages(aMessages, sInstancePath, sContextUrl); } } Object.keys(oInstance).forEach(function (sProperty) { var sCount, sPropertyMetaPath = sMetaPath + "/" + sProperty, vPropertyValue = oInstance[sProperty], sPropertyPath = _Helper.buildPath(sInstancePath, sProperty); if (sProperty.endsWith("@odata.mediaReadLink")) { oInstance[sProperty] = _Helper.makeAbsolute(vPropertyValue, sContextUrl); } if (sProperty.includes("@")) { // ignore other annotations return; } if (Array.isArray(vPropertyValue)) { vPropertyValue.$created = 0; // number of (client-side) created elements // compute count vPropertyValue.$count = undefined; // see setCount sCount = oInstance[sProperty + "@odata.count"]; // Note: ignore change listeners, because any change listener that is already // registered, is still waiting for its value and gets it via fetchValue if (sCount) { setCount({}, "", vPropertyValue, sCount); } else if (!oInstance[sProperty + "@odata.nextLink"]) { // Note: This relies on the fact that $skip/$top is not used on nested lists setCount({}, "", vPropertyValue, vPropertyValue.length); } visitArray(vPropertyValue, sPropertyMetaPath, sPropertyPath, buildContextUrl(sContextUrl, oInstance[sProperty + "@odata.context"])); } else if (vPropertyValue && typeof vPropertyValue === "object") { visitInstance(vPropertyValue, sPropertyMetaPath, sPropertyPath, sContextUrl); } }); }
javascript
function visitInstance(oInstance, sMetaPath, sInstancePath, sContextUrl, iIndex) { var aMatches, sPredicate, oType = mTypeForMetaPath[sMetaPath], sMessageProperty = oType && oType[sMessagesAnnotation] && oType[sMessagesAnnotation].$Path, aMessages; sContextUrl = buildContextUrl(sContextUrl, oInstance["@odata.context"]); sPredicate = that.calculateKeyPredicate(oInstance, mTypeForMetaPath, sMetaPath); if (iIndex !== undefined) { sInstancePath = _Helper.buildPath(sInstancePath, sPredicate || iIndex); } else if (!bKeepTransientPath && sPredicate) { aMatches = rEndsWithTransientPredicate.exec(sInstancePath); if (aMatches) { sInstancePath = sInstancePath.slice(0, -aMatches[0].length) + sPredicate; } } if (sRootPath && !aCachePaths) { // remove messages only for the part of the cache that is updated aCachePaths = [sInstancePath]; } if (sMessageProperty) { aMessages = _Helper.drillDown(oInstance, sMessageProperty.split("/")); if (aMessages !== undefined) { addMessages(aMessages, sInstancePath, sContextUrl); } } Object.keys(oInstance).forEach(function (sProperty) { var sCount, sPropertyMetaPath = sMetaPath + "/" + sProperty, vPropertyValue = oInstance[sProperty], sPropertyPath = _Helper.buildPath(sInstancePath, sProperty); if (sProperty.endsWith("@odata.mediaReadLink")) { oInstance[sProperty] = _Helper.makeAbsolute(vPropertyValue, sContextUrl); } if (sProperty.includes("@")) { // ignore other annotations return; } if (Array.isArray(vPropertyValue)) { vPropertyValue.$created = 0; // number of (client-side) created elements // compute count vPropertyValue.$count = undefined; // see setCount sCount = oInstance[sProperty + "@odata.count"]; // Note: ignore change listeners, because any change listener that is already // registered, is still waiting for its value and gets it via fetchValue if (sCount) { setCount({}, "", vPropertyValue, sCount); } else if (!oInstance[sProperty + "@odata.nextLink"]) { // Note: This relies on the fact that $skip/$top is not used on nested lists setCount({}, "", vPropertyValue, vPropertyValue.length); } visitArray(vPropertyValue, sPropertyMetaPath, sPropertyPath, buildContextUrl(sContextUrl, oInstance[sProperty + "@odata.context"])); } else if (vPropertyValue && typeof vPropertyValue === "object") { visitInstance(vPropertyValue, sPropertyMetaPath, sPropertyPath, sContextUrl); } }); }
[ "function", "visitInstance", "(", "oInstance", ",", "sMetaPath", ",", "sInstancePath", ",", "sContextUrl", ",", "iIndex", ")", "{", "var", "aMatches", ",", "sPredicate", ",", "oType", "=", "mTypeForMetaPath", "[", "sMetaPath", "]", ",", "sMessageProperty", "=", ...
/* Recursively calculates the count for collection valued properties and calculates the key predicate for the given instance. @param {object} oInstance The instance @param {string} sMetaPath The meta path of the instance in mTypeForMetaPath @param {string} sInstancePath The path of the instance in the cache @param {string} sContextUrl The context URL for message longtexts @param {number} [iIndex] The index in the collection if the instance is part of a collection
[ "/", "*", "Recursively", "calculates", "the", "count", "for", "collection", "valued", "properties", "and", "calculates", "the", "key", "predicate", "for", "the", "given", "instance", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Cache.js#L1102-L1162
train
Visit the given instance
[ 30522, 3853, 3942, 7076, 26897, 1006, 1051, 7076, 26897, 1010, 15488, 12928, 15069, 1010, 15516, 26897, 15069, 1010, 8040, 30524, 1004, 1004, 27178, 18863, 1031, 15488, 7971, 13923, 11639, 17287, 3508, 1033, 1004, 1004, 27178, 18863, 1031, 15...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GeekyAnts/vue-native-core
packages/vue-native-helper/build.js
renderList
function renderList( val, render ) { var ret, i, l, keys, key; if (Array.isArray(val) || typeof val === 'string') { ret = new Array(val.length); for (i = 0, l = val.length; i < l; i++) { ret[i] = render(val[i], i); } } else if (typeof val === 'number') { ret = new Array(val); for (i = 0; i < val; i++) { ret[i] = render(i + 1, i); } } else if (isObject(val)) { keys = Object.keys(val); ret = new Array(keys.length); for (i = 0, l = keys.length; i < l; i++) { key = keys[i]; ret[i] = render(val[key], key, i); } } return ret }
javascript
function renderList( val, render ) { var ret, i, l, keys, key; if (Array.isArray(val) || typeof val === 'string') { ret = new Array(val.length); for (i = 0, l = val.length; i < l; i++) { ret[i] = render(val[i], i); } } else if (typeof val === 'number') { ret = new Array(val); for (i = 0; i < val; i++) { ret[i] = render(i + 1, i); } } else if (isObject(val)) { keys = Object.keys(val); ret = new Array(keys.length); for (i = 0, l = keys.length; i < l; i++) { key = keys[i]; ret[i] = render(val[key], key, i); } } return ret }
[ "function", "renderList", "(", "val", ",", "render", ")", "{", "var", "ret", ",", "i", ",", "l", ",", "keys", ",", "key", ";", "if", "(", "Array", ".", "isArray", "(", "val", ")", "||", "typeof", "val", "===", "'string'", ")", "{", "ret", "=", ...
/*
[ "/", "*" ]
a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e
https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-helper/build.js#L1280-L1304
train
Render a list of objects
[ 30522, 3853, 17552, 9863, 1006, 11748, 1010, 17552, 1007, 1063, 13075, 2128, 2102, 1010, 1045, 1010, 1048, 1010, 6309, 1010, 3145, 1025, 2065, 1006, 9140, 1012, 18061, 11335, 2100, 1006, 11748, 1007, 1064, 1064, 2828, 11253, 11748, 1027, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/jszip.js
stringToArrayLike
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
javascript
function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; }
[ "function", "stringToArrayLike", "(", "str", ",", "array", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "str", ".", "length", ";", "++", "i", ")", "{", "array", "[", "i", "]", "=", "str", ".", "charCodeAt", "(", "i", ")", "&", "...
Fill in an array with a string. @param {String} str the string to use. @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.
[ "Fill", "in", "an", "array", "with", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1419-L1424
train
Convert a string to an array of bytes
[ 30522, 3853, 5164, 3406, 2906, 9447, 10359, 1006, 2358, 2099, 1010, 9140, 1007, 1063, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 2358, 2099, 1012, 3091, 1025, 1009, 1009, 1045, 1007, 1063, 9140, 1031, 1045, 1033, 1027, 2358, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/view/ThemeManager.js
lessifyTheme
function lessifyTheme(content, theme) { var deferred = new $.Deferred(); less.render("#editor-holder {" + content + "\n}", { rootpath: fixPath(stylesPath), filename: fixPath(theme.file._path) }, function (err, tree) { if (err) { deferred.reject(err); } else { deferred.resolve(tree.css); } }); return deferred.promise(); }
javascript
function lessifyTheme(content, theme) { var deferred = new $.Deferred(); less.render("#editor-holder {" + content + "\n}", { rootpath: fixPath(stylesPath), filename: fixPath(theme.file._path) }, function (err, tree) { if (err) { deferred.reject(err); } else { deferred.resolve(tree.css); } }); return deferred.promise(); }
[ "function", "lessifyTheme", "(", "content", ",", "theme", ")", "{", "var", "deferred", "=", "new", "$", ".", "Deferred", "(", ")", ";", "less", ".", "render", "(", "\"#editor-holder {\"", "+", "content", "+", "\"\\n}\"", ",", "{", "rootpath", ":", "fixPa...
@private Takes the content of a file and feeds it through the less processor in order to provide support for less files. @param {string} content is the css/less string to be processed @param {Theme} theme is the object the css/less corresponds to @return {$.Promise} promise with the processed css/less as the resolved value
[ "@private", "Takes", "the", "content", "of", "a", "file", "and", "feeds", "it", "through", "the", "less", "processor", "in", "order", "to", "provide", "support", "for", "less", "files", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ThemeManager.js#L163-L178
train
Lessify theme
[ 30522, 3853, 2625, 8757, 10760, 4168, 1006, 4180, 1010, 4323, 1007, 1063, 13075, 13366, 28849, 2094, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 2625, 1012, 17552, 1006, 1000, 1001, 3559, 1011, 9111, 1063, 1000, 1009, 4180...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
thomaspark/bootswatch
docs/_vendor/popper.js/dist/popper.js
clockwise
function clockwise(placement, counter = false) { const index = validPlacements.indexOf(placement); const arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); return counter ? arr.reverse() : arr; }
javascript
function clockwise(placement, counter = false) { const index = validPlacements.indexOf(placement); const arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); return counter ? arr.reverse() : arr; }
[ "function", "clockwise", "(", "placement", ",", "counter", "=", "false", ")", "{", "const", "index", "=", "validPlacements", ".", "indexOf", "(", "placement", ")", ";", "const", "arr", "=", "validPlacements", ".", "slice", "(", "index", "+", "1", ")", "....
Given an initial placement, returns all the subsequent placements clockwise (or counter-clockwise). @method @memberof Popper.Utils @argument {String} placement - A valid placement (it accepts variations) @argument {Boolean} counter - Set to true to walk the placements counterclockwise @returns {Array} placements including their variations
[ "Given", "an", "initial", "placement", "returns", "all", "the", "subsequent", "placements", "clockwise", "(", "or", "counter", "-", "clockwise", ")", "." ]
a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd
https://github.com/thomaspark/bootswatch/blob/a913e4992dad8f7bf38df2e1d3f4cc6bfe5f26dd/docs/_vendor/popper.js/dist/popper.js#L1425-L1429
train
Get a list of placement numbers
[ 30522, 3853, 22839, 1006, 11073, 1010, 4675, 1027, 6270, 1007, 1063, 9530, 3367, 5950, 1027, 9398, 24759, 10732, 8163, 1012, 5950, 11253, 1006, 11073, 1007, 1025, 9530, 3367, 12098, 2099, 1027, 9398, 24759, 10732, 8163, 1012, 14704, 1006, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/dom/units/Rem.js
function(vRem) { assert(((typeof vRem === "string") && (vRem !== "") && !isNaN(parseFloat(vRem)) && (typeof parseFloat(vRem) === "number")) || ((typeof vRem === "number") && !isNaN(vRem)), 'Rem.toPx: either the "vRem" parameter must be an integer, or a string e.g.: "1rem"'); return parseFloat(vRem) * getRootFontSize(); }
javascript
function(vRem) { assert(((typeof vRem === "string") && (vRem !== "") && !isNaN(parseFloat(vRem)) && (typeof parseFloat(vRem) === "number")) || ((typeof vRem === "number") && !isNaN(vRem)), 'Rem.toPx: either the "vRem" parameter must be an integer, or a string e.g.: "1rem"'); return parseFloat(vRem) * getRootFontSize(); }
[ "function", "(", "vRem", ")", "{", "assert", "(", "(", "(", "typeof", "vRem", "===", "\"string\"", ")", "&&", "(", "vRem", "!==", "\"\"", ")", "&&", "!", "isNaN", "(", "parseFloat", "(", "vRem", ")", ")", "&&", "(", "typeof", "parseFloat", "(", "vR...
Convert <code>rem</code> values to <code>px</code>. @param {string|float} vRem The value in <code>rem</code>. E.g.: <code>"1rem"</code> or <code>1</code> @returns {float} The converted value in <code>px</code> units. E.g.: <code>16</code> @private @ui5-restricted sap.m
[ "Convert", "<code", ">", "rem<", "/", "code", ">", "values", "to", "<code", ">", "px<", "/", "code", ">", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/dom/units/Rem.js#L51-L54
train
Converts the specified number of pixels to pixels
[ 30522, 3853, 1006, 27830, 6633, 1007, 1063, 20865, 1006, 1006, 1006, 2828, 11253, 27830, 6633, 1027, 1027, 1027, 1000, 5164, 1000, 1007, 1004, 1004, 1006, 27830, 6633, 999, 1027, 1027, 1000, 1000, 1007, 1004, 1004, 999, 3475, 2319, 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/editor/InlineTextEditor.js
_dirtyFlagChangeHandler
function _dirtyFlagChangeHandler(event, doc) { var $dirtyIndicators = $(".inline-text-editor .dirty-indicator"), $indicator; $dirtyIndicators.each(function (index, indicator) { $indicator = $(this); if ($indicator.data("fullPath") === doc.file.fullPath) { _showDirtyIndicator($indicator, doc.isDirty); } }); }
javascript
function _dirtyFlagChangeHandler(event, doc) { var $dirtyIndicators = $(".inline-text-editor .dirty-indicator"), $indicator; $dirtyIndicators.each(function (index, indicator) { $indicator = $(this); if ($indicator.data("fullPath") === doc.file.fullPath) { _showDirtyIndicator($indicator, doc.isDirty); } }); }
[ "function", "_dirtyFlagChangeHandler", "(", "event", ",", "doc", ")", "{", "var", "$dirtyIndicators", "=", "$", "(", "\".inline-text-editor .dirty-indicator\"", ")", ",", "$indicator", ";", "$dirtyIndicators", ".", "each", "(", "function", "(", "index", ",", "indi...
Respond to dirty flag change event. If the dirty flag is associated with an inline editor, show (or hide) the dirty indicator. @private
[ "Respond", "to", "dirty", "flag", "change", "event", ".", "If", "the", "dirty", "flag", "is", "associated", "with", "an", "inline", "editor", "show", "(", "or", "hide", ")", "the", "dirty", "indicator", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/editor/InlineTextEditor.js#L55-L65
train
Change handler for dirty flag
[ 30522, 3853, 1035, 6530, 10258, 8490, 22305, 24660, 21222, 1006, 2724, 1010, 9986, 1007, 1063, 13075, 1002, 6530, 22254, 5555, 6591, 1027, 1002, 1006, 1000, 1012, 23881, 1011, 3793, 1011, 3559, 1012, 6530, 1011, 17245, 1000, 1007, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/TreeBindingCompatibilityAdapter.js
function (oBinding, oTable) { // Code necessary for ClientTreeBinding var that = oTable; jQuery.extend(oBinding, { _init: function(bExpandFirstLevel) { this._bExpandFirstLevel = bExpandFirstLevel; // load the root contexts and create the context info map this.mContextInfo = {}; this._initContexts(); // expand the first level if required if (bExpandFirstLevel && !this._bFirstLevelExpanded) { this._expandFirstLevel(); } }, _initContexts: function(bSkipFirstLevelLoad) { // load the root contexts and create the context info map entry (if missing) this.aContexts = this.getRootContexts(0, Number.MAX_VALUE); for (var i = 0, l = this.aContexts.length; i < l; i++) { var oldContextInfo = this._getContextInfo(this.aContexts[i]); this._setContextInfo({ oContext: this.aContexts[i], iLevel: 0, bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false }); } if (this._bExpandFirstLevel && !this._bFirstLevelExpanded) { this._expandFirstLevel(bSkipFirstLevelLoad); } }, _expandFirstLevel: function (bSkipFirstLevelLoad) { var that = this; if (this.aContexts && this.aContexts.length > 0) { jQuery.each(this.aContexts.slice(), function(iIndex, oContext) { if (!bSkipFirstLevelLoad) { that._loadChildContexts(oContext); } that._getContextInfo(oContext).bExpanded = true; }); this._bFirstLevelExpanded = true; } }, _fnFireFilter: oBinding._fireFilter, _fireFilter: function() { this._fnFireFilter.apply(this, arguments); this._initContexts(true); this._restoreContexts(this.aContexts); }, _fnFireChange: oBinding._fireChange, _fireChange: function() { this._fnFireChange.apply(this, arguments); this._initContexts(true); this._restoreContexts(this.aContexts); }, _restoreContexts: function(aContexts) { var that = this; var aNewChildContexts = []; jQuery.each(aContexts.slice(), function(iIndex, oContext) { var oContextInfo = that._getContextInfo(oContext); if (oContextInfo && oContextInfo.bExpanded) { aNewChildContexts.push.apply(aNewChildContexts, that._loadChildContexts(oContext)); } }); if (aNewChildContexts.length > 0) { this._restoreContexts(aNewChildContexts); } }, _loadChildContexts: function(oContext) { var oContextInfo = this._getContextInfo(oContext); var iIndex = (this.aContexts ? this.aContexts.indexOf(oContext) : -1); var aNodeContexts = this.getNodeContexts(oContext, 0, Number.MAX_VALUE); for (var i = 0, l = aNodeContexts.length; i < l; i++) { this.aContexts.splice(iIndex + i + 1, 0, aNodeContexts[i]); var oldContextInfo = this._getContextInfo(aNodeContexts[i]); this._setContextInfo({ oParentContext: oContext, oContext: aNodeContexts[i], iLevel: oContextInfo.iLevel + 1, bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false }); } return aNodeContexts; }, _getContextInfo: function(oContext) { return oContext ? this.mContextInfo[oContext.getPath()] : undefined; }, _setContextInfo: function(mData) { if (mData && mData.oContext) { this.mContextInfo[mData.oContext.getPath()] = mData; } }, getLength: function() { return this.aContexts ? this.aContexts.length : 0; }, getContexts: function(iStartIndex, iLength) { return this.aContexts.slice(iStartIndex, iStartIndex + iLength); }, getNodes: function(iStartIndex, iLength) { var aContexts = this.getContexts(iStartIndex, iStartIndex + iLength); //wrap contexts into node objects var aNodes = []; for (var i = 0; i < aContexts.length; i++) { var oContextInfo = this._getContextInfo(aContexts[i]) || {}; //empty object to make sure this does not break var oContext = aContexts[i]; aNodes.push({ context: oContext, level: oContextInfo.iLevel, parent: oContextInfo.oParentContext, nodeState: { expanded: oContextInfo.bExpanded, collapsed: !oContextInfo.bExpanded, selected: false //default should be false, correct value is given via the selection model } }); } return aNodes; }, hasChildren: function() { return true; }, nodeHasChildren: function() { return true; }, getContextByIndex: function (iRowIndex) { return this.aContexts[iRowIndex]; }, getLevel: function(oContext) { var oContextInfo = this._getContextInfo(oContext); return oContextInfo ? oContextInfo.iLevel : -1; }, isExpanded: function(iRowIndex) { var oContext = this.getContextByIndex(iRowIndex); var oContextInfo = this._getContextInfo(oContext); return oContextInfo ? oContextInfo.bExpanded : false; }, expandContext: function(oContext) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo && !oContextInfo.bExpanded) { this.storeSelection(); this._loadChildContexts(oContext); oContextInfo.bExpanded = true; this._fireChange(); this.restoreSelection(); } }, expand: function (iRowIndex) { this.expandContext(this.getContextByIndex(iRowIndex)); }, collapseContext: function(oContext, bSupressChanges) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo && oContextInfo.bExpanded) { this.storeSelection(); for (var i = this.aContexts.length - 1; i > 0; i--) { if (this._getContextInfo(this.aContexts[i]).oParentContext === oContext) { this.aContexts.splice(i, 1); } } oContextInfo.bExpanded = false; if (!bSupressChanges) { this._fireChange(); } this.restoreSelection(); } }, collapse: function (iRowIndex) { this.collapseContext(this.getContextByIndex(iRowIndex)); }, collapseToLevel: function (iLevel) { if (!iLevel || iLevel < 0) { iLevel = 0; } var aContextsCopy = this.aContexts.slice(); for (var i = aContextsCopy.length - 1; i >= 0; i--) { var iContextLevel = this.getLevel(aContextsCopy[i]); if (iContextLevel != -1 && iContextLevel >= iLevel) { this.collapseContext(aContextsCopy[i], true); } } this._fireChange(); }, toggleContext: function(oContext) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo) { if (oContextInfo.bExpanded) { this.collapseContext(oContext); } else { this.expandContext(oContext); } } }, toggleIndex: function (iRowIndex) { this.toggleContext(this.getContextByIndex(iRowIndex)); }, storeSelection: function() { var aSelectedIndices = that.getSelectedIndices(); var aSelectedContexts = []; jQuery.each(aSelectedIndices, function(iIndex, iValue) { aSelectedContexts.push(that.getContextByIndex(iValue)); }); this._aSelectedContexts = aSelectedContexts; }, restoreSelection: function() { that.clearSelection(); var _aSelectedContexts = this._aSelectedContexts; jQuery.each(this.aContexts, function(iIndex, oContext) { if (((_aSelectedContexts ? _aSelectedContexts.indexOf(oContext) : -1)) >= 0) { that.addSelectionInterval(iIndex, iIndex); } }); this._aSelectedContexts = undefined; }, attachSelectionChanged: function() { // for compatibility reasons (OData Tree Binding) return undefined; }, clearSelection: function () { that._oSelection.clearSelection(); }, attachSort: function() {}, detachSort: function() {} }); // initialize the binding oBinding._init(oTable.getExpandFirstLevel()); }
javascript
function (oBinding, oTable) { // Code necessary for ClientTreeBinding var that = oTable; jQuery.extend(oBinding, { _init: function(bExpandFirstLevel) { this._bExpandFirstLevel = bExpandFirstLevel; // load the root contexts and create the context info map this.mContextInfo = {}; this._initContexts(); // expand the first level if required if (bExpandFirstLevel && !this._bFirstLevelExpanded) { this._expandFirstLevel(); } }, _initContexts: function(bSkipFirstLevelLoad) { // load the root contexts and create the context info map entry (if missing) this.aContexts = this.getRootContexts(0, Number.MAX_VALUE); for (var i = 0, l = this.aContexts.length; i < l; i++) { var oldContextInfo = this._getContextInfo(this.aContexts[i]); this._setContextInfo({ oContext: this.aContexts[i], iLevel: 0, bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false }); } if (this._bExpandFirstLevel && !this._bFirstLevelExpanded) { this._expandFirstLevel(bSkipFirstLevelLoad); } }, _expandFirstLevel: function (bSkipFirstLevelLoad) { var that = this; if (this.aContexts && this.aContexts.length > 0) { jQuery.each(this.aContexts.slice(), function(iIndex, oContext) { if (!bSkipFirstLevelLoad) { that._loadChildContexts(oContext); } that._getContextInfo(oContext).bExpanded = true; }); this._bFirstLevelExpanded = true; } }, _fnFireFilter: oBinding._fireFilter, _fireFilter: function() { this._fnFireFilter.apply(this, arguments); this._initContexts(true); this._restoreContexts(this.aContexts); }, _fnFireChange: oBinding._fireChange, _fireChange: function() { this._fnFireChange.apply(this, arguments); this._initContexts(true); this._restoreContexts(this.aContexts); }, _restoreContexts: function(aContexts) { var that = this; var aNewChildContexts = []; jQuery.each(aContexts.slice(), function(iIndex, oContext) { var oContextInfo = that._getContextInfo(oContext); if (oContextInfo && oContextInfo.bExpanded) { aNewChildContexts.push.apply(aNewChildContexts, that._loadChildContexts(oContext)); } }); if (aNewChildContexts.length > 0) { this._restoreContexts(aNewChildContexts); } }, _loadChildContexts: function(oContext) { var oContextInfo = this._getContextInfo(oContext); var iIndex = (this.aContexts ? this.aContexts.indexOf(oContext) : -1); var aNodeContexts = this.getNodeContexts(oContext, 0, Number.MAX_VALUE); for (var i = 0, l = aNodeContexts.length; i < l; i++) { this.aContexts.splice(iIndex + i + 1, 0, aNodeContexts[i]); var oldContextInfo = this._getContextInfo(aNodeContexts[i]); this._setContextInfo({ oParentContext: oContext, oContext: aNodeContexts[i], iLevel: oContextInfo.iLevel + 1, bExpanded: oldContextInfo ? oldContextInfo.bExpanded : false }); } return aNodeContexts; }, _getContextInfo: function(oContext) { return oContext ? this.mContextInfo[oContext.getPath()] : undefined; }, _setContextInfo: function(mData) { if (mData && mData.oContext) { this.mContextInfo[mData.oContext.getPath()] = mData; } }, getLength: function() { return this.aContexts ? this.aContexts.length : 0; }, getContexts: function(iStartIndex, iLength) { return this.aContexts.slice(iStartIndex, iStartIndex + iLength); }, getNodes: function(iStartIndex, iLength) { var aContexts = this.getContexts(iStartIndex, iStartIndex + iLength); //wrap contexts into node objects var aNodes = []; for (var i = 0; i < aContexts.length; i++) { var oContextInfo = this._getContextInfo(aContexts[i]) || {}; //empty object to make sure this does not break var oContext = aContexts[i]; aNodes.push({ context: oContext, level: oContextInfo.iLevel, parent: oContextInfo.oParentContext, nodeState: { expanded: oContextInfo.bExpanded, collapsed: !oContextInfo.bExpanded, selected: false //default should be false, correct value is given via the selection model } }); } return aNodes; }, hasChildren: function() { return true; }, nodeHasChildren: function() { return true; }, getContextByIndex: function (iRowIndex) { return this.aContexts[iRowIndex]; }, getLevel: function(oContext) { var oContextInfo = this._getContextInfo(oContext); return oContextInfo ? oContextInfo.iLevel : -1; }, isExpanded: function(iRowIndex) { var oContext = this.getContextByIndex(iRowIndex); var oContextInfo = this._getContextInfo(oContext); return oContextInfo ? oContextInfo.bExpanded : false; }, expandContext: function(oContext) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo && !oContextInfo.bExpanded) { this.storeSelection(); this._loadChildContexts(oContext); oContextInfo.bExpanded = true; this._fireChange(); this.restoreSelection(); } }, expand: function (iRowIndex) { this.expandContext(this.getContextByIndex(iRowIndex)); }, collapseContext: function(oContext, bSupressChanges) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo && oContextInfo.bExpanded) { this.storeSelection(); for (var i = this.aContexts.length - 1; i > 0; i--) { if (this._getContextInfo(this.aContexts[i]).oParentContext === oContext) { this.aContexts.splice(i, 1); } } oContextInfo.bExpanded = false; if (!bSupressChanges) { this._fireChange(); } this.restoreSelection(); } }, collapse: function (iRowIndex) { this.collapseContext(this.getContextByIndex(iRowIndex)); }, collapseToLevel: function (iLevel) { if (!iLevel || iLevel < 0) { iLevel = 0; } var aContextsCopy = this.aContexts.slice(); for (var i = aContextsCopy.length - 1; i >= 0; i--) { var iContextLevel = this.getLevel(aContextsCopy[i]); if (iContextLevel != -1 && iContextLevel >= iLevel) { this.collapseContext(aContextsCopy[i], true); } } this._fireChange(); }, toggleContext: function(oContext) { var oContextInfo = this._getContextInfo(oContext); if (oContextInfo) { if (oContextInfo.bExpanded) { this.collapseContext(oContext); } else { this.expandContext(oContext); } } }, toggleIndex: function (iRowIndex) { this.toggleContext(this.getContextByIndex(iRowIndex)); }, storeSelection: function() { var aSelectedIndices = that.getSelectedIndices(); var aSelectedContexts = []; jQuery.each(aSelectedIndices, function(iIndex, iValue) { aSelectedContexts.push(that.getContextByIndex(iValue)); }); this._aSelectedContexts = aSelectedContexts; }, restoreSelection: function() { that.clearSelection(); var _aSelectedContexts = this._aSelectedContexts; jQuery.each(this.aContexts, function(iIndex, oContext) { if (((_aSelectedContexts ? _aSelectedContexts.indexOf(oContext) : -1)) >= 0) { that.addSelectionInterval(iIndex, iIndex); } }); this._aSelectedContexts = undefined; }, attachSelectionChanged: function() { // for compatibility reasons (OData Tree Binding) return undefined; }, clearSelection: function () { that._oSelection.clearSelection(); }, attachSort: function() {}, detachSort: function() {} }); // initialize the binding oBinding._init(oTable.getExpandFirstLevel()); }
[ "function", "(", "oBinding", ",", "oTable", ")", "{", "// Code necessary for ClientTreeBinding", "var", "that", "=", "oTable", ";", "jQuery", ".", "extend", "(", "oBinding", ",", "{", "_init", ":", "function", "(", "bExpandFirstLevel", ")", "{", "this", ".", ...
Adapter for TreeBindings to add the ListBinding functionality and use the tree structure in list based controls. This module is only for experimental and internal use! @alias sap.ui.model.TreeBindingCompatibilityAdapter @class @protected
[ "Adapter", "for", "TreeBindings", "to", "add", "the", "ListBinding", "functionality", "and", "use", "the", "tree", "structure", "in", "list", "based", "controls", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/TreeBindingCompatibilityAdapter.js#L20-L250
train
Creates a new binding instance
[ 30522, 3853, 1006, 27885, 22254, 2075, 1010, 27178, 3085, 1007, 1063, 1013, 1013, 3642, 4072, 2005, 7396, 13334, 8428, 4667, 13075, 2008, 1027, 27178, 3085, 1025, 1046, 4226, 2854, 1012, 7949, 1006, 27885, 22254, 2075, 1010, 1063, 1035, 199...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
dvajs/dva
examples/user-dashboard/src/pages/.umi/umi.js
render
function render() { const DvaContainer = require('./DvaContainer').default; ReactDOM.render( React.createElement( DvaContainer, null, React.createElement(require('./router').default) ), document.getElementById('root') ); }
javascript
function render() { const DvaContainer = require('./DvaContainer').default; ReactDOM.render( React.createElement( DvaContainer, null, React.createElement(require('./router').default) ), document.getElementById('root') ); }
[ "function", "render", "(", ")", "{", "const", "DvaContainer", "=", "require", "(", "'./DvaContainer'", ")", ".", "default", ";", "ReactDOM", ".", "render", "(", "React", ".", "createElement", "(", "DvaContainer", ",", "null", ",", "React", ".", "createElemen...
render
[ "render" ]
99ec56cbedbdba7e3e91befe341f109e038363c6
https://github.com/dvajs/dva/blob/99ec56cbedbdba7e3e91befe341f109e038363c6/examples/user-dashboard/src/pages/.umi/umi.js#L20-L30
train
Render the
[ 30522, 3853, 17552, 1006, 1007, 1063, 9530, 3367, 1040, 24887, 12162, 18175, 2099, 1027, 5478, 1006, 1005, 1012, 1013, 1040, 24887, 12162, 18175, 2099, 1005, 1007, 1012, 12398, 1025, 10509, 9527, 1012, 17552, 1006, 10509, 1012, 3443, 12260, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/tabview.js
tabView_open
function tabView_open() { var menuitem = new elementslib.Elem(this._controller.menus['view-menu'].menu_tabview); this._controller.click(menuitem); this.waitForOpened(); this._tabView = this.getElement({type: "tabView"}); this._tabViewDoc = this._tabView.getNode().webNavigation.document; }
javascript
function tabView_open() { var menuitem = new elementslib.Elem(this._controller.menus['view-menu'].menu_tabview); this._controller.click(menuitem); this.waitForOpened(); this._tabView = this.getElement({type: "tabView"}); this._tabViewDoc = this._tabView.getNode().webNavigation.document; }
[ "function", "tabView_open", "(", ")", "{", "var", "menuitem", "=", "new", "elementslib", ".", "Elem", "(", "this", ".", "_controller", ".", "menus", "[", "'view-menu'", "]", ".", "menu_tabview", ")", ";", "this", ".", "_controller", ".", "click", "(", "m...
Open the Tab View
[ "Open", "the", "Tab", "View" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabview.js#L86-L93
train
Open the tabview
[ 30522, 3853, 21628, 8584, 1035, 2330, 1006, 1007, 1063, 13075, 12183, 4221, 2213, 1027, 2047, 3787, 29521, 1012, 3449, 6633, 1006, 2023, 1012, 1035, 11486, 1012, 12183, 2015, 1031, 1005, 3193, 1011, 12183, 1005, 1033, 1012, 12183, 1035, 216...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/FileTreeViewModel.js
_setDirectoryOpen
function _setDirectoryOpen(treeData, path, open) { var objectPath = _filePathToObjectPath(treeData, path), directory = treeData.getIn(objectPath); if (!objectPath) { return { needsLoading: true, treeData: treeData }; } if (isFile(directory)) { return; } var alreadyOpen = directory.get("open") === true; if ((alreadyOpen && open) || (!alreadyOpen && !open)) { return; } treeData = treeData.updateIn(objectPath, function (directory) { if (open) { return directory.set("open", true); } else { return directory.delete("open"); } }); if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) { return { needsLoading: true, treeData: treeData }; } return { needsLoading: false, treeData: treeData }; }
javascript
function _setDirectoryOpen(treeData, path, open) { var objectPath = _filePathToObjectPath(treeData, path), directory = treeData.getIn(objectPath); if (!objectPath) { return { needsLoading: true, treeData: treeData }; } if (isFile(directory)) { return; } var alreadyOpen = directory.get("open") === true; if ((alreadyOpen && open) || (!alreadyOpen && !open)) { return; } treeData = treeData.updateIn(objectPath, function (directory) { if (open) { return directory.set("open", true); } else { return directory.delete("open"); } }); if (open && (directory.get("children") === null || directory.get("notFullyLoaded"))) { return { needsLoading: true, treeData: treeData }; } return { needsLoading: false, treeData: treeData }; }
[ "function", "_setDirectoryOpen", "(", "treeData", ",", "path", ",", "open", ")", "{", "var", "objectPath", "=", "_filePathToObjectPath", "(", "treeData", ",", "path", ")", ",", "directory", "=", "treeData", ".", "getIn", "(", "objectPath", ")", ";", "if", ...
@private See `FileTreeViewModel.setDirectoryOpen`
[ "@private" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/FileTreeViewModel.js#L520-L559
train
Set directory open
[ 30522, 3853, 1035, 2275, 4305, 2890, 16761, 7677, 11837, 1006, 3392, 2850, 2696, 1010, 4130, 1010, 2330, 1007, 1063, 13075, 4874, 15069, 1027, 1035, 5371, 15069, 3406, 16429, 20614, 15069, 1006, 3392, 2850, 2696, 1010, 4130, 1007, 1010, 141...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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(sServiceRootURI) { var sURI = null; if (this._sResourcePath != null) { sURI = (sServiceRootURI ? sServiceRootURI : "") + this._sResourcePath; } else if (this._oQueryResult.getParameterization()) { if (!this._oParameterizationRequest) { throw "Missing parameterization request"; } else { sURI = this._oParameterizationRequest.getURIToParameterizationEntry(sServiceRootURI) + "/" + this._oQueryResult.getParameterization().getNavigationPropertyToQueryResult(); } } else { sURI = (sServiceRootURI ? sServiceRootURI : "") + "/" + this._oQueryResult.getEntitySet().getQName(); } return sURI; }
javascript
function(sServiceRootURI) { var sURI = null; if (this._sResourcePath != null) { sURI = (sServiceRootURI ? sServiceRootURI : "") + this._sResourcePath; } else if (this._oQueryResult.getParameterization()) { if (!this._oParameterizationRequest) { throw "Missing parameterization request"; } else { sURI = this._oParameterizationRequest.getURIToParameterizationEntry(sServiceRootURI) + "/" + this._oQueryResult.getParameterization().getNavigationPropertyToQueryResult(); } } else { sURI = (sServiceRootURI ? sServiceRootURI : "") + "/" + this._oQueryResult.getEntitySet().getQName(); } return sURI; }
[ "function", "(", "sServiceRootURI", ")", "{", "var", "sURI", "=", "null", ";", "if", "(", "this", ".", "_sResourcePath", "!=", "null", ")", "{", "sURI", "=", "(", "sServiceRootURI", "?", "sServiceRootURI", ":", "\"\"", ")", "+", "this", ".", "_sResourceP...
Get the URI to locate the entity set for the query result. @param {String} sServiceRootURI (optional) Identifies the root of the OData service @returns {String} The resource path of the URI pointing to the entity set. It is a relative URI unless a service root is given, which would then prefixed in order to return a complete URL. @public @function @name sap.ui.model.analytics.odata4analytics.QueryResultRequest#getURIToQueryResultEntitySet
[ "Get", "the", "URI", "to", "locate", "the", "entity", "set", "for", "the", "query", "result", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4624-L4639
train
Returns the URI of the resource.
[ 30522, 3853, 1006, 7020, 2121, 7903, 10624, 4140, 9496, 1007, 1063, 13075, 7505, 2072, 1027, 19701, 1025, 2065, 1006, 2023, 1012, 1035, 5034, 2229, 8162, 3401, 15069, 999, 1027, 19701, 1007, 1063, 7505, 2072, 1027, 1006, 7020, 2121, 7903, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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 (lineDash) { if (lineDash instanceof Array) { this._lineDash = lineDash; this._dashIdx = 0; var lineDashSum = 0; for (var i = 0; i < lineDash.length; i++) { lineDashSum += lineDash[i]; } this._dashSum = lineDashSum; } return this; }
javascript
function (lineDash) { if (lineDash instanceof Array) { this._lineDash = lineDash; this._dashIdx = 0; var lineDashSum = 0; for (var i = 0; i < lineDash.length; i++) { lineDashSum += lineDash[i]; } this._dashSum = lineDashSum; } return this; }
[ "function", "(", "lineDash", ")", "{", "if", "(", "lineDash", "instanceof", "Array", ")", "{", "this", ".", "_lineDash", "=", "lineDash", ";", "this", ".", "_dashIdx", "=", "0", ";", "var", "lineDashSum", "=", "0", ";", "for", "(", "var", "i", "=", ...
必须在其它绘制命令前调用 Must be invoked before all other path drawing methods @return {module:zrender/core/PathProxy}
[ "必须在其它绘制命令前调用", "Must", "be", "invoked", "before", "all", "other", "path", "drawing", "methods" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/core/PathProxy.js#L301-L314
train
set lineDash
[ 30522, 3853, 1006, 7732, 11823, 1007, 1063, 2065, 1006, 7732, 11823, 6013, 11253, 9140, 1007, 1063, 2023, 1012, 1035, 7732, 11823, 1027, 7732, 11823, 1025, 2023, 1012, 1035, 11454, 3593, 2595, 1027, 1014, 1025, 13075, 7732, 30524, 1012, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
mui-org/material-ui
dangerfile.js
git
function git(args) { return new Promise((resolve, reject) => { exec(`git ${args}`, (err, stdout) => { if (err) { reject(err); } else { resolve(stdout.trim()); } }); }); }
javascript
function git(args) { return new Promise((resolve, reject) => { exec(`git ${args}`, (err, stdout) => { if (err) { reject(err); } else { resolve(stdout.trim()); } }); }); }
[ "function", "git", "(", "args", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "exec", "(", "`", "${", "args", "}", "`", ",", "(", "err", ",", "stdout", ")", "=>", "{", "if", "(", "err", ")", "{", "r...
executes a git subcommand @param {any} args
[ "executes", "a", "git", "subcommand" ]
1555e52367835946382fbf2a8f681de71318915d
https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/dangerfile.js#L15-L25
train
Git command.
[ 30522, 3853, 21025, 2102, 1006, 12098, 5620, 1007, 1063, 2709, 2047, 4872, 1006, 1006, 10663, 1010, 15454, 1007, 1027, 1028, 1063, 4654, 8586, 1006, 1036, 21025, 2102, 1002, 1063, 12098, 5620, 1065, 1036, 1010, 1006, 9413, 2099, 1010, 2358,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/foldgutter.js
updateFoldsCache
function updateFoldsCache(cm, from, linesDiff) { var oldRange, newRange; var minFoldSize = prefs.getSetting("minFoldSize") || 2; var foldedLines = Object.keys(cm._lineFolds).map(function (d) { return +d; }); var opts = cm.state.foldGutter.options || {}; var rf = opts.rangeFinder || CodeMirror.fold.auto; if (linesDiff === 0) { if (foldedLines.indexOf(from) >= 0) { newRange = rf(cm, CodeMirror.Pos(from, 0)); if (newRange && newRange.to.line - newRange.from.line >= minFoldSize) { cm._lineFolds[from] = newRange; } else { delete cm._lineFolds[from]; } } } else if (foldedLines.length) { var newFolds = {}; foldedLines.forEach(function (line) { oldRange = cm._lineFolds[line]; //update range with lines-diff newRange = moveRange(oldRange, linesDiff); // for removed lines we want to check lines that lie outside the deleted range if (linesDiff < 0) { if (line < from) { newFolds[line] = oldRange; } else if (line >= from + Math.abs(linesDiff)) { newFolds[line + linesDiff] = newRange; } } else { if (line < from) { newFolds[line] = oldRange; } else if (line >= from) { newFolds[line + linesDiff] = newRange; } } }); cm._lineFolds = newFolds; } }
javascript
function updateFoldsCache(cm, from, linesDiff) { var oldRange, newRange; var minFoldSize = prefs.getSetting("minFoldSize") || 2; var foldedLines = Object.keys(cm._lineFolds).map(function (d) { return +d; }); var opts = cm.state.foldGutter.options || {}; var rf = opts.rangeFinder || CodeMirror.fold.auto; if (linesDiff === 0) { if (foldedLines.indexOf(from) >= 0) { newRange = rf(cm, CodeMirror.Pos(from, 0)); if (newRange && newRange.to.line - newRange.from.line >= minFoldSize) { cm._lineFolds[from] = newRange; } else { delete cm._lineFolds[from]; } } } else if (foldedLines.length) { var newFolds = {}; foldedLines.forEach(function (line) { oldRange = cm._lineFolds[line]; //update range with lines-diff newRange = moveRange(oldRange, linesDiff); // for removed lines we want to check lines that lie outside the deleted range if (linesDiff < 0) { if (line < from) { newFolds[line] = oldRange; } else if (line >= from + Math.abs(linesDiff)) { newFolds[line + linesDiff] = newRange; } } else { if (line < from) { newFolds[line] = oldRange; } else if (line >= from) { newFolds[line + linesDiff] = newRange; } } }); cm._lineFolds = newFolds; } }
[ "function", "updateFoldsCache", "(", "cm", ",", "from", ",", "linesDiff", ")", "{", "var", "oldRange", ",", "newRange", ";", "var", "minFoldSize", "=", "prefs", ".", "getSetting", "(", "\"minFoldSize\"", ")", "||", "2", ";", "var", "foldedLines", "=", "Obj...
Updates the line folds cache usually when the document changes. The following cases are accounted for: 1. When the change does not add a new line to the document we check if the line being modified is folded. If that is the case, changes to this line might affect the range stored in the cache so we update the range using the range finder function. 2. If lines have been added, we need to update the records for all lines in the folds cache which are greater than the line position at which we are adding the new line(s). When existing folds are above the addition we keep the original position in the cache. 3. If lines are being removed, we need to update the records for all lines in the folds cache which are greater than the line position at which we are removing the new lines, while making sure to not include any folded lines in the cache that are part of the removed chunk. @param {!CodeMirror} cm the CodeMirror instance for the active editor @param {!number} from the line number designating the start position of the change @param {!number} linesDiff a number to show how many lines where removed or added to the document. This value is negative for deletions and positive for additions.
[ "Updates", "the", "line", "folds", "cache", "usually", "when", "the", "document", "changes", ".", "The", "following", "cases", "are", "accounted", "for", ":", "1", ".", "When", "the", "change", "does", "not", "add", "a", "new", "line", "to", "the", "docu...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js#L212-L253
train
updateFoldsCache - update folds cache
[ 30522, 3853, 10651, 10371, 15782, 5403, 1006, 4642, 1010, 2013, 1010, 3210, 4305, 4246, 1007, 1063, 13075, 2214, 24388, 2063, 1010, 2047, 24388, 2063, 1025, 13075, 8117, 10371, 5332, 4371, 1027, 3653, 10343, 1012, 4152, 18319, 3070, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js
function(oList) { var oAttr = oList._getAtt(); if (oAttr && oAttr.getChangeListener() && oAttr.getChangeListener().id === oList.getId()) { oAttr.setChangeListener(null); } }
javascript
function(oList) { var oAttr = oList._getAtt(); if (oAttr && oAttr.getChangeListener() && oAttr.getChangeListener().id === oList.getId()) { oAttr.setChangeListener(null); } }
[ "function", "(", "oList", ")", "{", "var", "oAttr", "=", "oList", ".", "_getAtt", "(", ")", ";", "if", "(", "oAttr", "&&", "oAttr", ".", "getChangeListener", "(", ")", "&&", "oAttr", ".", "getChangeListener", "(", ")", ".", "id", "===", "oList", ".",...
Removes the change listener which is attached to the lists attribute.
[ "Removes", "the", "change", "listener", "which", "is", "attached", "to", "the", "lists", "attribute", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.ux3/src/sap/ui/ux3/ExactList.js#L1441-L1446
train
Removes the listener for the list attribute
[ 30522, 3853, 1006, 19330, 2923, 1007, 1063, 13075, 1051, 19321, 2099, 1027, 19330, 2923, 1012, 1035, 2131, 19321, 1006, 1007, 1025, 2065, 1006, 1051, 19321, 2099, 1004, 1004, 1051, 19321, 2099, 1012, 2131, 22305, 29282, 6528, 2121, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws-amplify/amplify-js
packages/amazon-cognito-identity-js/src/BigInteger.js
bnpDLShiftTo
function bnpDLShiftTo(n, r) { var i; for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]; for (i = n - 1; i >= 0; --i) r[i] = 0; r.t = this.t + n; r.s = this.s; }
javascript
function bnpDLShiftTo(n, r) { var i; for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]; for (i = n - 1; i >= 0; --i) r[i] = 0; r.t = this.t + n; r.s = this.s; }
[ "function", "bnpDLShiftTo", "(", "n", ",", "r", ")", "{", "var", "i", ";", "for", "(", "i", "=", "this", ".", "t", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "r", "[", "i", "+", "n", "]", "=", "this", "[", "i", "]", ";", "for",...
(protected) r = this << n*DB
[ "(", "protected", ")", "r", "=", "this", "<<", "n", "*", "DB" ]
db55ff3dff31c64a246180f39eb0a04a89fd16e1
https://github.com/aws-amplify/amplify-js/blob/db55ff3dff31c64a246180f39eb0a04a89fd16e1/packages/amazon-cognito-identity-js/src/BigInteger.js#L316-L324
train
Shifts the sequence to the right
[ 30522, 3853, 24869, 17299, 4877, 4048, 6199, 3406, 1006, 1050, 1010, 1054, 1007, 1063, 13075, 1045, 1025, 2005, 1006, 1045, 1027, 2023, 1012, 1056, 1011, 1015, 1025, 1045, 1028, 1027, 1014, 1025, 1011, 1011, 1045, 1007, 1054, 1031, 1045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aframevr/aframe
src/utils/material.js
handleTextureEvents
function handleTextureEvents (el, texture) { if (!texture) { return; } el.emit('materialtextureloaded', {src: texture.image, texture: texture}); // Video events. if (!texture.image || texture.image.tagName !== 'VIDEO') { return; } texture.image.addEventListener('loadeddata', function emitVideoTextureLoadedDataAll () { // Check to see if we need to use iOS 10 HLS shader. // Only override the shader if it is stock shader that we know doesn't correct. if (!el.components || !el.components.material) { return; } if (texture.needsCorrectionBGRA && texture.needsCorrectionFlipY && ['standard', 'flat'].indexOf(el.components.material.data.shader) !== -1) { el.setAttribute('material', 'shader', 'ios10hls'); } el.emit('materialvideoloadeddata', {src: texture.image, texture: texture}); }); texture.image.addEventListener('ended', function emitVideoTextureEndedAll () { // Works for non-looping videos only. el.emit('materialvideoended', {src: texture.image, texture: texture}); }); }
javascript
function handleTextureEvents (el, texture) { if (!texture) { return; } el.emit('materialtextureloaded', {src: texture.image, texture: texture}); // Video events. if (!texture.image || texture.image.tagName !== 'VIDEO') { return; } texture.image.addEventListener('loadeddata', function emitVideoTextureLoadedDataAll () { // Check to see if we need to use iOS 10 HLS shader. // Only override the shader if it is stock shader that we know doesn't correct. if (!el.components || !el.components.material) { return; } if (texture.needsCorrectionBGRA && texture.needsCorrectionFlipY && ['standard', 'flat'].indexOf(el.components.material.data.shader) !== -1) { el.setAttribute('material', 'shader', 'ios10hls'); } el.emit('materialvideoloadeddata', {src: texture.image, texture: texture}); }); texture.image.addEventListener('ended', function emitVideoTextureEndedAll () { // Works for non-looping videos only. el.emit('materialvideoended', {src: texture.image, texture: texture}); }); }
[ "function", "handleTextureEvents", "(", "el", ",", "texture", ")", "{", "if", "(", "!", "texture", ")", "{", "return", ";", "}", "el", ".", "emit", "(", "'materialtextureloaded'", ",", "{", "src", ":", "texture", ".", "image", ",", "texture", ":", "tex...
Emit event on entities on texture-related events. @param {Element} el - Entity. @param {object} texture - three.js Texture.
[ "Emit", "event", "on", "entities", "on", "texture", "-", "related", "events", "." ]
24acc78a7299a4cdfe3ef617f4d40ddf6275c992
https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/utils/material.js#L132-L156
train
Handle texture events.
[ 30522, 3853, 5047, 18209, 5397, 18697, 7666, 1006, 3449, 1010, 14902, 1007, 1063, 2065, 1006, 999, 14902, 1007, 1063, 2709, 1025, 1065, 3449, 1012, 12495, 2102, 30524, 1063, 5034, 2278, 1024, 14902, 1012, 3746, 1010, 14902, 1024, 14902, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js
addCustomizing
function addCustomizing(mCode2Customizing, oContext) { var sCode = oContext.getProperty(sKeyPath), oCustomizing = { Text : oContext.getProperty(sTextPropertyPath), UnitSpecificScale : oContext.getProperty(sScalePropertyPath) }; if (sStandardPropertyPath) { oCustomizing.StandardCode = oContext.getProperty(sStandardPropertyPath); } if (oCustomizing.UnitSpecificScale === null) { Log.error("Ignoring customizing w/o unit-specific scale for code " + sCode + " from " + oCodeList.CollectionPath, oCodeList.Url, sODataMetaModel); } else { mCode2Customizing[sCode] = oCustomizing; } return mCode2Customizing; }
javascript
function addCustomizing(mCode2Customizing, oContext) { var sCode = oContext.getProperty(sKeyPath), oCustomizing = { Text : oContext.getProperty(sTextPropertyPath), UnitSpecificScale : oContext.getProperty(sScalePropertyPath) }; if (sStandardPropertyPath) { oCustomizing.StandardCode = oContext.getProperty(sStandardPropertyPath); } if (oCustomizing.UnitSpecificScale === null) { Log.error("Ignoring customizing w/o unit-specific scale for code " + sCode + " from " + oCodeList.CollectionPath, oCodeList.Url, sODataMetaModel); } else { mCode2Customizing[sCode] = oCustomizing; } return mCode2Customizing; }
[ "function", "addCustomizing", "(", "mCode2Customizing", ",", "oContext", ")", "{", "var", "sCode", "=", "oContext", ".", "getProperty", "(", "sKeyPath", ")", ",", "oCustomizing", "=", "{", "Text", ":", "oContext", ".", "getProperty", "(", "sTextPropertyPath", ...
/* Adds customizing for a single code to the result map. Ignores customizing where the unit-specific scale is missing, and logs an error for this. @param {object} mCode2Customizing Map from code to its customizing @param {sap.ui.model.odata.v4.Context} oContext Context for a single code's customizing @returns {object} <code>mCode2Customizing</code>
[ "/", "*", "Adds", "customizing", "for", "a", "single", "code", "to", "the", "result", "map", ".", "Ignores", "customizing", "where", "the", "unit", "-", "specific", "scale", "is", "missing", "and", "logs", "an", "error", "for", "this", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L2213-L2233
train
Adds customizing to mCode2Customizing
[ 30522, 3853, 5587, 7874, 20389, 6026, 1006, 11338, 10244, 2475, 7874, 20389, 6026, 1010, 1051, 8663, 18209, 1007, 1063, 13075, 8040, 10244, 1027, 1051, 8663, 18209, 1012, 2131, 21572, 4842, 3723, 1006, 15315, 3240, 15069, 1007, 1010, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airyland/vux
src/components/video/zy.media.js
_removeClass
function _removeClass(el, token) { if (el.classList) { el.classList.remove(token) } else if (_hasClass(el, token)) { el.className = el.className.replace(new RegExp('(\\s|^)' + token + '(\\s|$)'), ' ').replace(/^\s+|\s+$/g, '') } }
javascript
function _removeClass(el, token) { if (el.classList) { el.classList.remove(token) } else if (_hasClass(el, token)) { el.className = el.className.replace(new RegExp('(\\s|^)' + token + '(\\s|$)'), ' ').replace(/^\s+|\s+$/g, '') } }
[ "function", "_removeClass", "(", "el", ",", "token", ")", "{", "if", "(", "el", ".", "classList", ")", "{", "el", ".", "classList", ".", "remove", "(", "token", ")", "}", "else", "if", "(", "_hasClass", "(", "el", ",", "token", ")", ")", "{", "el...
Remove class
[ "Remove", "class" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/video/zy.media.js#L129-L135
train
Removes a class from an element
[ 30522, 3853, 1035, 6366, 26266, 1006, 3449, 1010, 19204, 1007, 1063, 2065, 1006, 3449, 1012, 2465, 9863, 1007, 1063, 3449, 1012, 2465, 9863, 1012, 6366, 1006, 19204, 1007, 1065, 2842, 2065, 1006, 1035, 2038, 26266, 1006, 3449, 1010, 19204, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/progressLinear/progress-linear.js
animateIndicator
function animateIndicator(target, value) { if (isDisabled || !mode()) return; var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [(value-100)/2, value/100]); var styles = toVendorCSS({ transform : to }); angular.element(target).css(styles); }
javascript
function animateIndicator(target, value) { if (isDisabled || !mode()) return; var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [(value-100)/2, value/100]); var styles = toVendorCSS({ transform : to }); angular.element(target).css(styles); }
[ "function", "animateIndicator", "(", "target", ",", "value", ")", "{", "if", "(", "isDisabled", "||", "!", "mode", "(", ")", ")", "return", ";", "var", "to", "=", "$mdUtil", ".", "supplant", "(", "\"translateX({0}%) scale({1},1)\"", ",", "[", "(", "value",...
Manually set CSS to animate the Determinate indicator based on the specified percentage value (0-100).
[ "Manually", "set", "CSS", "to", "animate", "the", "Determinate", "indicator", "based", "on", "the", "specified", "percentage", "value", "(", "0", "-", "100", ")", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L181-L187
train
Animate indicator to the given target
[ 30522, 3853, 2019, 21499, 22254, 5555, 4263, 1006, 4539, 1010, 3643, 1007, 1063, 2065, 1006, 2003, 10521, 3085, 2094, 1064, 1064, 999, 5549, 1006, 1007, 1007, 2709, 1025, 13075, 2000, 1027, 1002, 9108, 21823, 2140, 1012, 10514, 9397, 5802, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
immerjs/immer
src/es5.js
markChangesSweep
function markChangesSweep(drafts) { // The natural order of drafts in the `scope` array is based on when they // were accessed. By processing drafts in reverse natural order, we have a // better chance of processing leaf nodes first. When a leaf node is known to // have changed, we can avoid any traversal of its ancestor nodes. for (let i = drafts.length - 1; i >= 0; i--) { const state = drafts[i][DRAFT_STATE] if (!state.modified) { if (Array.isArray(state.base)) { if (hasArrayChanges(state)) markChanged(state) } else if (hasObjectChanges(state)) markChanged(state) } } }
javascript
function markChangesSweep(drafts) { // The natural order of drafts in the `scope` array is based on when they // were accessed. By processing drafts in reverse natural order, we have a // better chance of processing leaf nodes first. When a leaf node is known to // have changed, we can avoid any traversal of its ancestor nodes. for (let i = drafts.length - 1; i >= 0; i--) { const state = drafts[i][DRAFT_STATE] if (!state.modified) { if (Array.isArray(state.base)) { if (hasArrayChanges(state)) markChanged(state) } else if (hasObjectChanges(state)) markChanged(state) } } }
[ "function", "markChangesSweep", "(", "drafts", ")", "{", "// The natural order of drafts in the `scope` array is based on when they", "// were accessed. By processing drafts in reverse natural order, we have a", "// better chance of processing leaf nodes first. When a leaf node is known to", "// h...
This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
[ "This", "looks", "expensive", "but", "only", "proxies", "are", "visited", "and", "only", "objects", "without", "known", "changes", "are", "scanned", "." ]
4443cace6c23d14536955ce5b2aec92c8c76cacc
https://github.com/immerjs/immer/blob/4443cace6c23d14536955ce5b2aec92c8c76cacc/src/es5.js#L156-L169
train
Mark changes in the tree
[ 30522, 3853, 2928, 22305, 7971, 28394, 2361, 1006, 28967, 1007, 1063, 1013, 1013, 1996, 3019, 2344, 1997, 28967, 1999, 1996, 1036, 9531, 1036, 9140, 2003, 2241, 2006, 2043, 2027, 1013, 1013, 2020, 11570, 1012, 2011, 6364, 28967, 1999, 7901,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
zloirock/core-js
packages/core-js/modules/web.url-search-params.js
function (name) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var key = name + ''; var i = 0; while (i < entries.length) { if (entries[i].key === key) entries.splice(i, 1); else i++; } if (state.updateURL) state.updateURL(); }
javascript
function (name) { validateArgumentsLength(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var key = name + ''; var i = 0; while (i < entries.length) { if (entries[i].key === key) entries.splice(i, 1); else i++; } if (state.updateURL) state.updateURL(); }
[ "function", "(", "name", ")", "{", "validateArgumentsLength", "(", "arguments", ".", "length", ",", "1", ")", ";", "var", "state", "=", "getInternalParamsState", "(", "this", ")", ";", "var", "entries", "=", "state", ".", "entries", ";", "var", "key", "=...
`URLSearchParams.prototype.delete` method https://url.spec.whatwg.org/#dom-urlsearchparams-delete
[ "URLSearchParams", ".", "prototype", ".", "delete", "method", "https", ":", "//", "url", ".", "spec", ".", "whatwg", ".", "org", "/", "#dom", "-", "urlsearchparams", "-", "delete" ]
fe7c8511a6d27d03a9b8e075b3351416aae95c58
https://github.com/zloirock/core-js/blob/fe7c8511a6d27d03a9b8e075b3351416aae95c58/packages/core-js/modules/web.url-search-params.js#L158-L169
train
Removes an entry from the internal params array
[ 30522, 3853, 1006, 2171, 1007, 1063, 9398, 3686, 2906, 22850, 11187, 7770, 13512, 2232, 1006, 9918, 1012, 3091, 1010, 1015, 1007, 1025, 13075, 2110, 1027, 2131, 18447, 11795, 2389, 28689, 5244, 9153, 2618, 1006, 2023, 1007, 1025, 13075, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.uxap/src/sap/uxap/library.js
function (oControl) { while (oControl && !(oControl instanceof sap.uxap.ObjectPageLayout)) { oControl = oControl.getParent(); } return oControl; }
javascript
function (oControl) { while (oControl && !(oControl instanceof sap.uxap.ObjectPageLayout)) { oControl = oControl.getParent(); } return oControl; }
[ "function", "(", "oControl", ")", "{", "while", "(", "oControl", "&&", "!", "(", "oControl", "instanceof", "sap", ".", "uxap", ".", "ObjectPageLayout", ")", ")", "{", "oControl", "=", "oControl", ".", "getParent", "(", ")", ";", "}", "return", "oControl"...
Returns the reference to the <code>ObjectPageLayout</code> for a given control. @static @param {sap.ui.core.Control} oControl - the control to find ObjectPageLayout for @private @returns {*} Object Page layout referance
[ "Returns", "the", "reference", "to", "the", "<code", ">", "ObjectPageLayout<", "/", "code", ">", "for", "a", "given", "control", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/library.js#L298-L305
train
Returns the parent control of the control
[ 30522, 3853, 1006, 1051, 8663, 13181, 2140, 1007, 1063, 2096, 1006, 1051, 8663, 13181, 2140, 1004, 1004, 999, 1006, 1051, 8663, 13181, 2140, 6013, 11253, 20066, 1012, 1057, 18684, 2361, 1012, 30524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wuchangming/spy-debugger
buildin_modules/weinre/web/interfaces/interfaces.js
getJavaCallbackParameterListSimple
function getJavaCallbackParameterListSimple(parameters) { var result = [] parameters.forEach(function(parameter){ if (!parameter.out) return result.push("/*" + getJavaType(parameter.type) + " " + parameter.name + "*/ (Object) null") }) result = result.join(", ") if (result != "") result = ", " + result return result }
javascript
function getJavaCallbackParameterListSimple(parameters) { var result = [] parameters.forEach(function(parameter){ if (!parameter.out) return result.push("/*" + getJavaType(parameter.type) + " " + parameter.name + "*/ (Object) null") }) result = result.join(", ") if (result != "") result = ", " + result return result }
[ "function", "getJavaCallbackParameterListSimple", "(", "parameters", ")", "{", "var", "result", "=", "[", "]", "parameters", ".", "forEach", "(", "function", "(", "parameter", ")", "{", "if", "(", "!", "parameter", ".", "out", ")", "return", "result", ".", ...
-----------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------" ]
55c1dda0dff0c44920673711656ddfd7ff03c307
https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/interfaces/interfaces.js#L405-L418
train
getJavaCallbackParameterListSimple - returns a string
[ 30522, 3853, 2131, 3900, 24887, 8095, 5963, 28689, 22828, 27103, 5714, 10814, 1006, 11709, 1007, 1063, 13075, 2765, 1027, 1031, 1033, 11709, 1012, 18921, 6776, 1006, 3853, 1006, 16381, 1007, 1063, 2065, 1006, 999, 16381, 1012, 2041, 1007, 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...
scrumpy/tiptap
packages/tiptap-commands/src/commands/splitToDefaultListItem.js
canSplit
function canSplit(doc, pos, depth = 1, typesAfter) { const $pos = doc.resolve(pos); const base = $pos.depth - depth const innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) { const node = $pos.node(d); const index = $pos.index(d) if (node.type.spec.isolating) return false let rest = node.content.cutByIndex(index, node.childCount) const after = (typesAfter && typesAfter[i]) || node if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs)) /* Change starts from here */ // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) // return false if (!node.canReplace(index + 1, node.childCount)) return false /* Change ends here */ } const index = $pos.indexAfter(base) const baseType = typesAfter && typesAfter[0] return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type) }
javascript
function canSplit(doc, pos, depth = 1, typesAfter) { const $pos = doc.resolve(pos); const base = $pos.depth - depth const innerType = (typesAfter && typesAfter[typesAfter.length - 1]) || $pos.parent if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) { const node = $pos.node(d); const index = $pos.index(d) if (node.type.spec.isolating) return false let rest = node.content.cutByIndex(index, node.childCount) const after = (typesAfter && typesAfter[i]) || node if (after != node) rest = rest.replaceChild(0, after.type.create(after.attrs)) /* Change starts from here */ // if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) // return false if (!node.canReplace(index + 1, node.childCount)) return false /* Change ends here */ } const index = $pos.indexAfter(base) const baseType = typesAfter && typesAfter[0] return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type) }
[ "function", "canSplit", "(", "doc", ",", "pos", ",", "depth", "=", "1", ",", "typesAfter", ")", "{", "const", "$pos", "=", "doc", ".", "resolve", "(", "pos", ")", ";", "const", "base", "=", "$pos", ".", "depth", "-", "depth", "const", "innerType", ...
Since this piece of code was "borrowed" from prosemirror, ESLint rules are ignored. /* eslint-disable max-len, no-plusplus, no-undef, eqeqeq
[ "Since", "this", "piece", "of", "code", "was", "borrowed", "from", "prosemirror", "ESLint", "rules", "are", "ignored", ".", "/", "*", "eslint", "-", "disable", "max", "-", "len", "no", "-", "plusplus", "no", "-", "undef", "eqeqeq" ]
f02461cc791f9efa0d87b6e811d27b7078eb9b86
https://github.com/scrumpy/tiptap/blob/f02461cc791f9efa0d87b6e811d27b7078eb9b86/packages/tiptap-commands/src/commands/splitToDefaultListItem.js#L6-L30
train
Check if pos can be split
[ 30522, 3853, 18484, 24759, 4183, 1006, 9986, 1010, 13433, 2015, 1010, 5995, 1027, 1015, 1010, 4127, 10354, 3334, 1007, 1063, 9530, 3367, 1002, 13433, 2015, 1027, 9986, 1012, 10663, 1006, 13433, 2015, 1007, 1025, 9530, 3367, 2918, 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...
SeleniumHQ/selenium
third_party/js/mozmill/shared-modules/tabs.js
tabBrowser_closeTab
function tabBrowser_closeTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been closed var self = { closed: false }; function checkTabClosed() { self.closed = true; } this._controller.window.addEventListener("TabClose", checkTabClosed, false); switch (type) { case "closeButton": var button = this.getElement({type: "tabs_tabCloseButton", subtype: "tab", value: this.getTab()}); this._controller.click(button); break; case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_close); this._controller.click(menuitem); break; case "middleClick": var tab = this.getTab(event.index); this._controller.middleClick(tab); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "closeCmd.key"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.closed == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabClose", checkTabClosed, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
javascript
function tabBrowser_closeTab(aEvent) { var event = aEvent || { }; var type = (event.type == undefined) ? "menu" : event.type; // Disable tab closing animation for default behavior prefs.preferences.setPref(PREF_TABS_ANIMATE, false); // Add event listener to wait until the tab has been closed var self = { closed: false }; function checkTabClosed() { self.closed = true; } this._controller.window.addEventListener("TabClose", checkTabClosed, false); switch (type) { case "closeButton": var button = this.getElement({type: "tabs_tabCloseButton", subtype: "tab", value: this.getTab()}); this._controller.click(button); break; case "menu": var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_close); this._controller.click(menuitem); break; case "middleClick": var tab = this.getTab(event.index); this._controller.middleClick(tab); break; case "shortcut": var cmdKey = utils.getEntity(this.getDtds(), "closeCmd.key"); this._controller.keypress(null, cmdKey, {accelKey: true}); break; default: throw new Error(arguments.callee.name + ": Unknown event type - " + type); } try { this._controller.waitForEval("subject.tab.closed == true", TIMEOUT, 100, {tab: self}); } finally { this._controller.window.removeEventListener("TabClose", checkTabClosed, false); prefs.preferences.clearUserPref(PREF_TABS_ANIMATE); } }
[ "function", "tabBrowser_closeTab", "(", "aEvent", ")", "{", "var", "event", "=", "aEvent", "||", "{", "}", ";", "var", "type", "=", "(", "event", ".", "type", "==", "undefined", ")", "?", "\"menu\"", ":", "event", ".", "type", ";", "// Disable tab closin...
Close an open tab @param {object} aEvent The event specifies how to close a tab Elements: type - Type of event (closeButton, menu, middleClick, shortcut) [optional - default: menu]
[ "Close", "an", "open", "tab" ]
38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd
https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/tabs.js#L190-L231
train
Close a tab
[ 30522, 3853, 21628, 12618, 9333, 2121, 1035, 9346, 7875, 1006, 29347, 15338, 1007, 1063, 13075, 2724, 1027, 29347, 15338, 1064, 1064, 1063, 1065, 1025, 13075, 2828, 1027, 1006, 2724, 1012, 2828, 1027, 1027, 6151, 28344, 1007, 1029, 1000, 12...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
BrainJS/brain.js
dist/recurrent/matrix/multiply.js
multiply
function multiply(product, left, right) { var leftRows = left.rows; var leftColumns = left.columns; var rightColumns = right.columns; // loop over rows of left for (var leftRow = 0; leftRow < leftRows; leftRow++) { var leftRowBase = leftColumns * leftRow; var rightRowBase = rightColumns * leftRow; // loop over cols of right for (var rightColumn = 0; rightColumn < rightColumns; rightColumn++) { // dot product loop var dot = 0; //loop over columns of left for (var leftColumn = 0; leftColumn < leftColumns; leftColumn++) { var rightColumnBase = rightColumns * leftColumn; var leftIndex = leftRowBase + leftColumn; var rightIndex = rightColumnBase + rightColumn; dot += left.weights[leftIndex] * right.weights[rightIndex]; left.deltas[leftIndex] = 0; right.deltas[rightIndex] = 0; } product.weights[rightRowBase + rightColumn] = dot; } } }
javascript
function multiply(product, left, right) { var leftRows = left.rows; var leftColumns = left.columns; var rightColumns = right.columns; // loop over rows of left for (var leftRow = 0; leftRow < leftRows; leftRow++) { var leftRowBase = leftColumns * leftRow; var rightRowBase = rightColumns * leftRow; // loop over cols of right for (var rightColumn = 0; rightColumn < rightColumns; rightColumn++) { // dot product loop var dot = 0; //loop over columns of left for (var leftColumn = 0; leftColumn < leftColumns; leftColumn++) { var rightColumnBase = rightColumns * leftColumn; var leftIndex = leftRowBase + leftColumn; var rightIndex = rightColumnBase + rightColumn; dot += left.weights[leftIndex] * right.weights[rightIndex]; left.deltas[leftIndex] = 0; right.deltas[rightIndex] = 0; } product.weights[rightRowBase + rightColumn] = dot; } } }
[ "function", "multiply", "(", "product", ",", "left", ",", "right", ")", "{", "var", "leftRows", "=", "left", ".", "rows", ";", "var", "leftColumns", "=", "left", ".", "columns", ";", "var", "rightColumns", "=", "right", ".", "columns", ";", "// loop over...
multiply {left} and {right} matrix weights to {into} @param {Matrix} product @param {Matrix} left @param {Matrix} right
[ "multiply", "{", "left", "}", "and", "{", "right", "}", "matrix", "weights", "to", "{", "into", "}" ]
ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef
https://github.com/BrainJS/brain.js/blob/ab09bfc74a0d29d4731dcbdebfa17aeba7f7b1ef/dist/recurrent/matrix/multiply.js#L13-L39
train
multiply two centric terms
[ 30522, 3853, 4800, 22086, 1006, 4031, 1010, 2187, 1010, 2157, 1007, 1063, 13075, 2187, 10524, 2015, 1027, 2187, 1012, 10281, 1025, 13075, 2187, 25778, 2819, 3619, 1027, 2187, 1012, 7753, 1025, 13075, 2157, 25778, 2819, 3619, 1027, 2157, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js
function (sUrl, sTopicId) { this._pingUrl(sUrl).then(function success() { mLibrary.URLHelper.redirect(sUrl, true); }, function error() { jQuery.sap.log.info("Support Assistant tried to load documentation link in " + sUrl + "but fail"); sUrl = "https://ui5.sap.com/#/topic/" + sTopicId; mLibrary.URLHelper.redirect(sUrl, true); }); }
javascript
function (sUrl, sTopicId) { this._pingUrl(sUrl).then(function success() { mLibrary.URLHelper.redirect(sUrl, true); }, function error() { jQuery.sap.log.info("Support Assistant tried to load documentation link in " + sUrl + "but fail"); sUrl = "https://ui5.sap.com/#/topic/" + sTopicId; mLibrary.URLHelper.redirect(sUrl, true); }); }
[ "function", "(", "sUrl", ",", "sTopicId", ")", "{", "this", ".", "_pingUrl", "(", "sUrl", ")", ".", "then", "(", "function", "success", "(", ")", "{", "mLibrary", ".", "URLHelper", ".", "redirect", "(", "sUrl", ",", "true", ")", ";", "}", ",", "fun...
Pings the given URL to check that this is a valid path. If the ping is successful - redirects to the given URL. If something goes wrong - falls back to a default public URL. @private @param {string} sUrl URL that needs to be pinged and redirected to @param {string} sTopicId The ID of the topic to open
[ "Pings", "the", "given", "URL", "to", "check", "that", "this", "is", "a", "valid", "path", ".", "If", "the", "ping", "is", "successful", "-", "redirects", "to", "the", "given", "URL", ".", "If", "something", "goes", "wrong", "-", "falls", "back", "to",...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js#L49-L57
train
Checks if the URL is valid and redirects to the specified topic
[ 30522, 3853, 1006, 7505, 2140, 1010, 2644, 28775, 2094, 1007, 1063, 2023, 1012, 1035, 17852, 3126, 2140, 1006, 7505, 2140, 1007, 1012, 2059, 1006, 3853, 3112, 1006, 1007, 1063, 19875, 12322, 19848, 2100, 1012, 24471, 2140, 16001, 4842, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js
function(oValues) { var sHighColor = "", sMediumColor = "", sLowColor = ""; if (oValues.highCount > 0) { sHighColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR + ";"; } if (oValues.mediumCount > 0) { sMediumColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR + ";"; } if (oValues.lowCount > 0) { sLowColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR + ";"; } return oValues.name + " (<span style=\"" + sHighColor + "\"> " + oValues.highCount + " " + oValues.highName + ", </span> " + "<span style=\"" + sMediumColor + "\"> " + oValues.mediumCount + " " + oValues.mediumName + ", </span> " + "<span style=\"" + sLowColor + "\"> " + oValues.lowCount + " " + oValues.lowName + "</span> )"; }
javascript
function(oValues) { var sHighColor = "", sMediumColor = "", sLowColor = ""; if (oValues.highCount > 0) { sHighColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR + ";"; } if (oValues.mediumCount > 0) { sMediumColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR + ";"; } if (oValues.lowCount > 0) { sLowColor = "color: " + constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR + ";"; } return oValues.name + " (<span style=\"" + sHighColor + "\"> " + oValues.highCount + " " + oValues.highName + ", </span> " + "<span style=\"" + sMediumColor + "\"> " + oValues.mediumCount + " " + oValues.mediumName + ", </span> " + "<span style=\"" + sLowColor + "\"> " + oValues.lowCount + " " + oValues.lowName + "</span> )"; }
[ "function", "(", "oValues", ")", "{", "var", "sHighColor", "=", "\"\"", ",", "sMediumColor", "=", "\"\"", ",", "sLowColor", "=", "\"\"", ";", "if", "(", "oValues", ".", "highCount", ">", "0", ")", "{", "sHighColor", "=", "\"color: \"", "+", "constants", ...
Builds a string containing the formatted name e.g. (1 H, 0 M, 0 L ). @private @param {object} oValues @name sap.ui.support.IssueManager._getFormattedName @returns {string} String containing the formatted name.
[ "Builds", "a", "string", "containing", "the", "formatted", "name", "e", ".", "g", ".", "(", "1", "H", "0", "M", "0", "L", ")", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/IssueManager.js#L339-L360
train
Generates a string representation of the given values
[ 30522, 3853, 1006, 9242, 15808, 1007, 1063, 13075, 11895, 5603, 18717, 1027, 1000, 1000, 1010, 15488, 2098, 5007, 18717, 1027, 1000, 1000, 1010, 4030, 18717, 1027, 1000, 1000, 1025, 2065, 1006, 9242, 15808, 1012, 2152, 3597, 16671, 1028, 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.documentation/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js
function (event) { //TODO: global jquery call found var topicId = event.getParameter("arguments").id, topicURL = this._oConfig.docuPath + topicId + (topicId.match(/\.html/) ? "" : ".html"), htmlContent = jQuery.sap.syncGetText(topicURL).data, jsonObj; if (!htmlContent) { setTimeout(function () { this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false); }.bind(this), 0); return; } jsonObj = XML2JSONUtils.XML2JSON(htmlContent, this._oConfig); jsonObj.topicURL = topicURL; jsonObj.iframeAttribute = Device.os.name === Device.os.OS.IOS ? ' scrolling="no" ' : ""; jsonObj.bIsPhone = Device.system.phone; this.jsonDefModel.setData(jsonObj); this._scrollContentToTop(); setTimeout(window.prettyPrint, 0); this.searchResultsButtonVisibilitySwitch(this.byId("topicDetailBackToSearch")); if (this.extHookonTopicMatched) { this.extHookonTopicMatched(topicId); } }
javascript
function (event) { //TODO: global jquery call found var topicId = event.getParameter("arguments").id, topicURL = this._oConfig.docuPath + topicId + (topicId.match(/\.html/) ? "" : ".html"), htmlContent = jQuery.sap.syncGetText(topicURL).data, jsonObj; if (!htmlContent) { setTimeout(function () { this.getRouter().myNavToWithoutHash("sap.ui.documentation.sdk.view.NotFound", "XML", false); }.bind(this), 0); return; } jsonObj = XML2JSONUtils.XML2JSON(htmlContent, this._oConfig); jsonObj.topicURL = topicURL; jsonObj.iframeAttribute = Device.os.name === Device.os.OS.IOS ? ' scrolling="no" ' : ""; jsonObj.bIsPhone = Device.system.phone; this.jsonDefModel.setData(jsonObj); this._scrollContentToTop(); setTimeout(window.prettyPrint, 0); this.searchResultsButtonVisibilitySwitch(this.byId("topicDetailBackToSearch")); if (this.extHookonTopicMatched) { this.extHookonTopicMatched(topicId); } }
[ "function", "(", "event", ")", "{", "//TODO: global jquery call found", "var", "topicId", "=", "event", ".", "getParameter", "(", "\"arguments\"", ")", ".", "id", ",", "topicURL", "=", "this", ".", "_oConfig", ".", "docuPath", "+", "topicId", "+", "(", "topi...
/* =========================================================== /* begin: internal methods /* =========================================================== Binds the view to the object path and expands the aggregated line items. @function @param {sap.ui.base.Event} event pattern match event in route 'topicId' @private
[ "/", "*", "===========================================================", "/", "*", "begin", ":", "internal", "methods", "/", "*", "===========================================================", "Binds", "the", "view", "to", "the", "object", "path", "and", "expands", "the", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js#L61-L88
train
This function is called when the topic is found in the document
[ 30522, 3853, 1006, 2724, 1007, 1063, 1013, 1013, 28681, 2080, 1024, 3795, 1046, 4226, 2854, 2655, 2179, 13075, 8476, 3593, 1027, 2724, 1012, 2131, 28689, 22828, 1006, 1000, 9918, 1000, 1007, 1012, 8909, 1010, 8476, 3126, 2140, 1027, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
ElemeFE/element
build/md-loader/util.js
stripTemplate
function stripTemplate(content) { content = content.trim(); if (!content) { return content; } return content.replace(/<(script|style)[\s\S]+<\/\1>/g, '').trim(); }
javascript
function stripTemplate(content) { content = content.trim(); if (!content) { return content; } return content.replace(/<(script|style)[\s\S]+<\/\1>/g, '').trim(); }
[ "function", "stripTemplate", "(", "content", ")", "{", "content", "=", "content", ".", "trim", "(", ")", ";", "if", "(", "!", "content", ")", "{", "return", "content", ";", "}", "return", "content", ".", "replace", "(", "/", "<(script|style)[\\s\\S]+<\\/\\...
编写例子时不一定有 template。所以采取的方案是剔除其他的内容
[ "编写例子时不一定有", "template。所以采取的方案是剔除其他的内容" ]
6da04982a61a76c2fbb1de690dfb6519043f4998
https://github.com/ElemeFE/element/blob/6da04982a61a76c2fbb1de690dfb6519043f4998/build/md-loader/util.js#L15-L21
train
Strip template from content
[ 30522, 3853, 6167, 18532, 15725, 1006, 4180, 1007, 1063, 4180, 1027, 4180, 1012, 12241, 1006, 1007, 1025, 2065, 1006, 999, 4180, 1007, 1063, 2709, 4180, 1025, 1065, 2709, 4180, 1012, 5672, 1006, 1013, 1026, 1006, 5896, 1064, 2806, 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...
LLK/scratch-blocks
blocks_vertical/sensing.js
function() { this.jsonInit({ "message0": Blockly.Msg.SENSING_SETDRAGMODE, "args0": [ { "type": "field_dropdown", "name": "DRAG_MODE", "options": [ [Blockly.Msg.SENSING_SETDRAGMODE_DRAGGABLE, 'draggable'], [Blockly.Msg.SENSING_SETDRAGMODE_NOTDRAGGABLE, 'not draggable'] ] } ], "category": Blockly.Categories.sensing, "extensions": ["colours_sensing", "shape_statement"] }); }
javascript
function() { this.jsonInit({ "message0": Blockly.Msg.SENSING_SETDRAGMODE, "args0": [ { "type": "field_dropdown", "name": "DRAG_MODE", "options": [ [Blockly.Msg.SENSING_SETDRAGMODE_DRAGGABLE, 'draggable'], [Blockly.Msg.SENSING_SETDRAGMODE_NOTDRAGGABLE, 'not draggable'] ] } ], "category": Blockly.Categories.sensing, "extensions": ["colours_sensing", "shape_statement"] }); }
[ "function", "(", ")", "{", "this", ".", "jsonInit", "(", "{", "\"message0\"", ":", "Blockly", ".", "Msg", ".", "SENSING_SETDRAGMODE", ",", "\"args0\"", ":", "[", "{", "\"type\"", ":", "\"field_dropdown\"", ",", "\"name\"", ":", "\"DRAG_MODE\"", ",", "\"optio...
Block to set drag mode. @this Blockly.Block
[ "Block", "to", "set", "drag", "mode", "." ]
455b2a854435c0a67da1da92320ddc3ec3e2b799
https://github.com/LLK/scratch-blocks/blob/455b2a854435c0a67da1da92320ddc3ec3e2b799/blocks_vertical/sensing.js#L325-L341
train
Block for the set draggable mode.
[ 30522, 3853, 1006, 1007, 1063, 2023, 1012, 1046, 3385, 5498, 2102, 1006, 1063, 1000, 4471, 2692, 1000, 1024, 3796, 2135, 1012, 5796, 2290, 1012, 13851, 1035, 2275, 7265, 21693, 10244, 1010, 1000, 12098, 5620, 2692, 1000, 1024, 1031, 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...
BlackrockDigital/startbootstrap-sb-admin-2
vendor/chart.js/Chart.js
generateTicks
function generateTicks(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var MIN_SPACING = 1e-14; var stepSize = generationOptions.stepSize; var unit = stepSize || 1; var maxNumSpaces = generationOptions.maxTicks - 1; var min = generationOptions.min; var max = generationOptions.max; var precision = generationOptions.precision; var rmin = dataRange.min; var rmax = dataRange.max; var spacing = helpers$1.niceNum((rmax - rmin) / maxNumSpaces / unit) * unit; var factor, niceMin, niceMax, numSpaces; // Beyond MIN_SPACING floating point numbers being to lose precision // such that we can't do the math necessary to generate ticks if (spacing < MIN_SPACING && isNullOrUndef(min) && isNullOrUndef(max)) { return [rmin, rmax]; } numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing); if (numSpaces > maxNumSpaces) { // If the calculated num of spaces exceeds maxNumSpaces, recalculate it spacing = helpers$1.niceNum(numSpaces * spacing / maxNumSpaces / unit) * unit; } if (stepSize || isNullOrUndef(precision)) { // If a precision is not specified, calculate factor based on spacing factor = Math.pow(10, helpers$1._decimalPlaces(spacing)); } else { // If the user specified a precision, round to that number of decimal places factor = Math.pow(10, precision); spacing = Math.ceil(spacing * factor) / factor; } niceMin = Math.floor(rmin / spacing) * spacing; niceMax = Math.ceil(rmax / spacing) * spacing; // If min, max and stepSize is set and they make an evenly spaced scale use it. if (stepSize) { // If very close to our whole number, use it. if (!isNullOrUndef(min) && helpers$1.almostWhole(min / spacing, spacing / 1000)) { niceMin = min; } if (!isNullOrUndef(max) && helpers$1.almostWhole(max / spacing, spacing / 1000)) { niceMax = max; } } numSpaces = (niceMax - niceMin) / spacing; // If very close to our rounded value, use it. if (helpers$1.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) { numSpaces = Math.round(numSpaces); } else { numSpaces = Math.ceil(numSpaces); } niceMin = Math.round(niceMin * factor) / factor; niceMax = Math.round(niceMax * factor) / factor; ticks.push(isNullOrUndef(min) ? niceMin : min); for (var j = 1; j < numSpaces; ++j) { ticks.push(Math.round((niceMin + j * spacing) * factor) / factor); } ticks.push(isNullOrUndef(max) ? niceMax : max); return ticks; }
javascript
function generateTicks(generationOptions, dataRange) { var ticks = []; // To get a "nice" value for the tick spacing, we will use the appropriately named // "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks // for details. var MIN_SPACING = 1e-14; var stepSize = generationOptions.stepSize; var unit = stepSize || 1; var maxNumSpaces = generationOptions.maxTicks - 1; var min = generationOptions.min; var max = generationOptions.max; var precision = generationOptions.precision; var rmin = dataRange.min; var rmax = dataRange.max; var spacing = helpers$1.niceNum((rmax - rmin) / maxNumSpaces / unit) * unit; var factor, niceMin, niceMax, numSpaces; // Beyond MIN_SPACING floating point numbers being to lose precision // such that we can't do the math necessary to generate ticks if (spacing < MIN_SPACING && isNullOrUndef(min) && isNullOrUndef(max)) { return [rmin, rmax]; } numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing); if (numSpaces > maxNumSpaces) { // If the calculated num of spaces exceeds maxNumSpaces, recalculate it spacing = helpers$1.niceNum(numSpaces * spacing / maxNumSpaces / unit) * unit; } if (stepSize || isNullOrUndef(precision)) { // If a precision is not specified, calculate factor based on spacing factor = Math.pow(10, helpers$1._decimalPlaces(spacing)); } else { // If the user specified a precision, round to that number of decimal places factor = Math.pow(10, precision); spacing = Math.ceil(spacing * factor) / factor; } niceMin = Math.floor(rmin / spacing) * spacing; niceMax = Math.ceil(rmax / spacing) * spacing; // If min, max and stepSize is set and they make an evenly spaced scale use it. if (stepSize) { // If very close to our whole number, use it. if (!isNullOrUndef(min) && helpers$1.almostWhole(min / spacing, spacing / 1000)) { niceMin = min; } if (!isNullOrUndef(max) && helpers$1.almostWhole(max / spacing, spacing / 1000)) { niceMax = max; } } numSpaces = (niceMax - niceMin) / spacing; // If very close to our rounded value, use it. if (helpers$1.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) { numSpaces = Math.round(numSpaces); } else { numSpaces = Math.ceil(numSpaces); } niceMin = Math.round(niceMin * factor) / factor; niceMax = Math.round(niceMax * factor) / factor; ticks.push(isNullOrUndef(min) ? niceMin : min); for (var j = 1; j < numSpaces; ++j) { ticks.push(Math.round((niceMin + j * spacing) * factor) / factor); } ticks.push(isNullOrUndef(max) ? niceMax : max); return ticks; }
[ "function", "generateTicks", "(", "generationOptions", ",", "dataRange", ")", "{", "var", "ticks", "=", "[", "]", ";", "// To get a \"nice\" value for the tick spacing, we will use the appropriately named", "// \"nice number\" algorithm. See https://stackoverflow.com/questions/8506881/...
Generate a set of linear ticks @param generationOptions the options used to generate the ticks @param dataRange the range of the data @returns {number[]} array of tick values
[ "Generate", "a", "set", "of", "linear", "ticks" ]
ddfaceb4a8e65a41f163e2fdc4eab49384b810a1
https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/chart.js/Chart.js#L11268-L11338
train
Generates a series of ticks based on the given generation options and data range.
[ 30522, 3853, 9699, 26348, 2015, 1006, 4245, 7361, 9285, 1010, 2951, 24388, 2063, 1007, 1063, 13075, 16356, 2015, 1027, 1031, 1033, 1025, 1013, 1013, 2000, 2131, 1037, 1000, 3835, 1000, 3643, 2005, 1996, 16356, 12403, 6129, 1010, 2057, 2097,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util/ignored-paths.js
findFile
function findFile(cwd, name) { const ignoreFilePath = path.resolve(cwd, name); return fs.existsSync(ignoreFilePath) && fs.statSync(ignoreFilePath).isFile() ? ignoreFilePath : ""; }
javascript
function findFile(cwd, name) { const ignoreFilePath = path.resolve(cwd, name); return fs.existsSync(ignoreFilePath) && fs.statSync(ignoreFilePath).isFile() ? ignoreFilePath : ""; }
[ "function", "findFile", "(", "cwd", ",", "name", ")", "{", "const", "ignoreFilePath", "=", "path", ".", "resolve", "(", "cwd", ",", "name", ")", ";", "return", "fs", ".", "existsSync", "(", "ignoreFilePath", ")", "&&", "fs", ".", "statSync", "(", "igno...
------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------ Find a file in the current directory. @param {string} cwd Current working directory @param {string} name File name @returns {string} Path of ignore file or an empty string.
[ "------------------------------------------------------------------------------", "Helpers", "------------------------------------------------------------------------------", "Find", "a", "file", "in", "the", "current", "directory", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/ignored-paths.js#L49-L53
train
Find a file in the current project
[ 30522, 3853, 2424, 8873, 2571, 1006, 19296, 2094, 1010, 2171, 1007, 1063, 9530, 3367, 8568, 8873, 2571, 15069, 1027, 4130, 1012, 10663, 1006, 19296, 2094, 1010, 2171, 1007, 1025, 2709, 1042, 2015, 1012, 6526, 6508, 12273, 1006, 8568, 8873, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/WorkingSetSort.js
initSortMethod
function initSortMethod() { var sortMethod = PreferencesManager.getViewState(_WORKING_SET_SORT_PREF); if (!sortMethod) { sortMethod = _convertSortPref(PreferencesManager.getViewState(_LEGACY_SORT_PREF)); } if (!sortMethod) { sortMethod = Commands.CMD_WORKINGSET_SORT_BY_ADDED; } return sortMethod; }
javascript
function initSortMethod() { var sortMethod = PreferencesManager.getViewState(_WORKING_SET_SORT_PREF); if (!sortMethod) { sortMethod = _convertSortPref(PreferencesManager.getViewState(_LEGACY_SORT_PREF)); } if (!sortMethod) { sortMethod = Commands.CMD_WORKINGSET_SORT_BY_ADDED; } return sortMethod; }
[ "function", "initSortMethod", "(", ")", "{", "var", "sortMethod", "=", "PreferencesManager", ".", "getViewState", "(", "_WORKING_SET_SORT_PREF", ")", ";", "if", "(", "!", "sortMethod", ")", "{", "sortMethod", "=", "_convertSortPref", "(", "PreferencesManager", "."...
/* initializes global sort method from preference settings or the default
[ "/", "*", "initializes", "global", "sort", "method", "from", "preference", "settings", "or", "the", "default" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/project/WorkingSetSort.js#L391-L402
train
initSortMethod - Init sort method
[ 30522, 3853, 1999, 12762, 11589, 11368, 6806, 2094, 1006, 1007, 1063, 13075, 4066, 11368, 6806, 2094, 1027, 18394, 24805, 4590, 1012, 2131, 8584, 9153, 2618, 1006, 1035, 2551, 1035, 2275, 1035, 4066, 1035, 3653, 2546, 1007, 1025, 2065, 1006...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
wangfupeng1988/wangEditor
src/js/editor/index.js
function () { // 初始化配置信息 this._initConfig() // 初始化 DOM this._initDom() // 封装 command API this._initCommand() // 封装 selection range API this._initSelectionAPI() // 添加 text this._initText() // 初始化菜单 this._initMenus() // 添加 图片上传 this._initUploadImg() // 初始化选区,将光标定位到内容尾部 this.initSelection(true) // 绑定事件 this._bindEvent() }
javascript
function () { // 初始化配置信息 this._initConfig() // 初始化 DOM this._initDom() // 封装 command API this._initCommand() // 封装 selection range API this._initSelectionAPI() // 添加 text this._initText() // 初始化菜单 this._initMenus() // 添加 图片上传 this._initUploadImg() // 初始化选区,将光标定位到内容尾部 this.initSelection(true) // 绑定事件 this._bindEvent() }
[ "function", "(", ")", "{", "// 初始化配置信息", "this", ".", "_initConfig", "(", ")", "// 初始化 DOM", "this", ".", "_initDom", "(", ")", "// 封装 command API", "this", ".", "_initCommand", "(", ")", "// 封装 selection range API", "this", ".", "_initSelectionAPI", "(", ")", ...
创建编辑器
[ "创建编辑器" ]
b77696f5e81c8ec13d9d341252d6b9fa8a22db18
https://github.com/wangfupeng1988/wangEditor/blob/b77696f5e81c8ec13d9d341252d6b9fa8a22db18/src/js/editor/index.js#L304-L331
train
Initialize the language
[ 30522, 3853, 1006, 1007, 1063, 1013, 1013, 100, 100, 100, 100, 100, 1767, 100, 2023, 1012, 1035, 1999, 4183, 8663, 8873, 2290, 1006, 1007, 1013, 1013, 100, 100, 100, 14383, 2023, 1012, 1035, 1999, 4183, 9527, 1006, 1007, 1013, 1013, 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...
jgraph/mxgraph
javascript/mxClient.js
function(value, params) { var result = []; var index = null; for (var i = 0; i < value.length; i++) { var c = value.charAt(i); if (c == '{') { index = ''; } else if (index != null && c == '}') { index = parseInt(index)-1; if (index >= 0 && index < params.length) { result.push(params[index]); } index = null; } else if (index != null) { index += c; } else { result.push(c); } } return result.join(''); }
javascript
function(value, params) { var result = []; var index = null; for (var i = 0; i < value.length; i++) { var c = value.charAt(i); if (c == '{') { index = ''; } else if (index != null && c == '}') { index = parseInt(index)-1; if (index >= 0 && index < params.length) { result.push(params[index]); } index = null; } else if (index != null) { index += c; } else { result.push(c); } } return result.join(''); }
[ "function", "(", "value", ",", "params", ")", "{", "var", "result", "=", "[", "]", ";", "var", "index", "=", "null", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "value", ".", "length", ";", "i", "++", ")", "{", "var", "c", "=", "v...
Function: replacePlaceholders Replaces the given placeholders with the given parameters. Parameters: value - String that contains the placeholders. params - Array of the values for the placeholders of the form {1}...{n} to be replaced with in the resulting string.
[ "Function", ":", "replacePlaceholders" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1635-L1670
train
Returns the value of the function
[ 30522, 3853, 1006, 3643, 1010, 11498, 5244, 1007, 1063, 13075, 2765, 1027, 1031, 1033, 1025, 13075, 5950, 1027, 19701, 1025, 2005, 1006, 13075, 1045, 1027, 1014, 1025, 1045, 1026, 3643, 1012, 3091, 1025, 1045, 1009, 1009, 1007, 1063, 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...
adobe/brackets
src/view/MainViewManager.js
_closeList
function _closeList(paneId, fileList) { _forEachPaneOrPanes(paneId, function (pane) { var closedList = pane.removeViews(fileList); closedList.forEach(function (file) { _removeFileFromMRU(pane.id, file); }); exports.trigger("workingSetRemoveList", closedList, pane.id); }); }
javascript
function _closeList(paneId, fileList) { _forEachPaneOrPanes(paneId, function (pane) { var closedList = pane.removeViews(fileList); closedList.forEach(function (file) { _removeFileFromMRU(pane.id, file); }); exports.trigger("workingSetRemoveList", closedList, pane.id); }); }
[ "function", "_closeList", "(", "paneId", ",", "fileList", ")", "{", "_forEachPaneOrPanes", "(", "paneId", ",", "function", "(", "pane", ")", "{", "var", "closedList", "=", "pane", ".", "removeViews", "(", "fileList", ")", ";", "closedList", ".", "forEach", ...
Closes a list of file in the specified pane or panes @param {!string} paneId - id of the pane in which to open the document @param {!Array.<File>} fileList - files to close This function does not fail if the file is not open
[ "Closes", "a", "list", "of", "file", "in", "the", "specified", "pane", "or", "panes" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/MainViewManager.js#L1368-L1377
train
Close a list of files
[ 30522, 3853, 1035, 2485, 9863, 1006, 6090, 7416, 2094, 1010, 5371, 9863, 1007, 1063, 1035, 18921, 6776, 9739, 8780, 14536, 7231, 2015, 1006, 6090, 7416, 2094, 1010, 3853, 1006, 6090, 2063, 1007, 1063, 13075, 2701, 9863, 1027, 6090, 2063, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/tabs/js/tabsController.js
getNearestSafeIndex
function getNearestSafeIndex (newIndex) { if (newIndex === -1) return -1; var maxOffset = Math.max(ctrl.tabs.length - newIndex, newIndex), i, tab; for (i = 0; i <= maxOffset; i++) { tab = ctrl.tabs[ newIndex + i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); tab = ctrl.tabs[ newIndex - i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); } return newIndex; }
javascript
function getNearestSafeIndex (newIndex) { if (newIndex === -1) return -1; var maxOffset = Math.max(ctrl.tabs.length - newIndex, newIndex), i, tab; for (i = 0; i <= maxOffset; i++) { tab = ctrl.tabs[ newIndex + i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); tab = ctrl.tabs[ newIndex - i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); } return newIndex; }
[ "function", "getNearestSafeIndex", "(", "newIndex", ")", "{", "if", "(", "newIndex", "===", "-", "1", ")", "return", "-", "1", ";", "var", "maxOffset", "=", "Math", ".", "max", "(", "ctrl", ".", "tabs", ".", "length", "-", "newIndex", ",", "newIndex", ...
Finds the nearest tab index that is available. This is primarily used for when the active tab is removed. @param newIndex @returns {*}
[ "Finds", "the", "nearest", "tab", "index", "that", "is", "available", ".", "This", "is", "primarily", "used", "for", "when", "the", "active", "tab", "is", "removed", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L600-L611
train
Returns the index of the nearest tab in the list of tabs
[ 30522, 3853, 2131, 22084, 28533, 3736, 7959, 22254, 10288, 1006, 2047, 22254, 10288, 1007, 1063, 2065, 1006, 2047, 22254, 10288, 1027, 1027, 1027, 1011, 1015, 1007, 2709, 1011, 1015, 1025, 13075, 4098, 27475, 3388, 1027, 8785, 1012, 4098, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js
function (oPathValue) { var aPromises; // needed so that we can safely call the forEach Basics.expectType(oPathValue, "array"); aPromises = oPathValue.value.map(function (oUnused, i) { // an embedded concat must use expression binding return Expression.parameter(oPathValue, i); }); return SyncPromise.all(aPromises).then(function (aParameters) { var bExpression, aParts, oResult; bExpression = oPathValue.asExpression || aParameters.some(function (oParameter) { // if any parameter is type expression, the concat must become expression, too return oParameter.result === "expression"; }); // convert the results to strings after we know whether the result is expression aParts = aParameters.filter(function (oParameter) { // ignore null (otherwise the string 'null' would appear in expressions) return oParameter.type !== 'edm:Null'; }).map(function (oParameter) { if (bExpression) { // the expression might have a lower operator precedence than '+' Expression.wrapExpression(oParameter); } return Basics.resultToString(oParameter, bExpression, oPathValue.complexBinding); }); oResult = bExpression ? {result : "expression", value : aParts.join("+")} : {result : "composite", value : aParts.join("")}; oResult.type = "Edm.String"; return oResult; }); }
javascript
function (oPathValue) { var aPromises; // needed so that we can safely call the forEach Basics.expectType(oPathValue, "array"); aPromises = oPathValue.value.map(function (oUnused, i) { // an embedded concat must use expression binding return Expression.parameter(oPathValue, i); }); return SyncPromise.all(aPromises).then(function (aParameters) { var bExpression, aParts, oResult; bExpression = oPathValue.asExpression || aParameters.some(function (oParameter) { // if any parameter is type expression, the concat must become expression, too return oParameter.result === "expression"; }); // convert the results to strings after we know whether the result is expression aParts = aParameters.filter(function (oParameter) { // ignore null (otherwise the string 'null' would appear in expressions) return oParameter.type !== 'edm:Null'; }).map(function (oParameter) { if (bExpression) { // the expression might have a lower operator precedence than '+' Expression.wrapExpression(oParameter); } return Basics.resultToString(oParameter, bExpression, oPathValue.complexBinding); }); oResult = bExpression ? {result : "expression", value : aParts.join("+")} : {result : "composite", value : aParts.join("")}; oResult.type = "Edm.String"; return oResult; }); }
[ "function", "(", "oPathValue", ")", "{", "var", "aPromises", ";", "// needed so that we can safely call the forEach", "Basics", ".", "expectType", "(", "oPathValue", ",", "\"array\"", ")", ";", "aPromises", "=", "oPathValue", ".", "value", ".", "map", "(", "functi...
Handling of "14.5.3.1.1 Function odata.concat". @param {object} oPathValue path and value information pointing to the parameter array (see Expression object) @returns {sap.ui.base.SyncPromise} a sync promise which resolves with the result object or is rejected with an error
[ "Handling", "of", "14", ".", "5", ".", "3", ".", "1", ".", "1", "Function", "odata", ".", "concat", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js#L191-L230
train
returns a promise that resolves to the expression binding
[ 30522, 3853, 1006, 6728, 8988, 10175, 5657, 1007, 1063, 13075, 19804, 20936, 8583, 1025, 1013, 1013, 2734, 2061, 2008, 2057, 2064, 9689, 2655, 1996, 18921, 6776, 24078, 1012, 5987, 13874, 1006, 6728, 8988, 10175, 5657, 1010, 1000, 9140, 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...
uber/deck.gl
modules/core/src/shaderlib/project/project-functions.js
lngLatZToWorldPosition
function lngLatZToWorldPosition(lngLatZ, viewport, offsetMode = false) { const [longitude, latitude, z = 0] = lngLatZ; const [X, Y] = viewport.projectFlat(lngLatZ); const distanceScales = offsetMode ? getDistanceScales({longitude, latitude, scale: viewport.scale}) : viewport.getDistanceScales(); const Z = z * distanceScales.pixelsPerMeter[2]; return [X, Y, Z]; }
javascript
function lngLatZToWorldPosition(lngLatZ, viewport, offsetMode = false) { const [longitude, latitude, z = 0] = lngLatZ; const [X, Y] = viewport.projectFlat(lngLatZ); const distanceScales = offsetMode ? getDistanceScales({longitude, latitude, scale: viewport.scale}) : viewport.getDistanceScales(); const Z = z * distanceScales.pixelsPerMeter[2]; return [X, Y, Z]; }
[ "function", "lngLatZToWorldPosition", "(", "lngLatZ", ",", "viewport", ",", "offsetMode", "=", "false", ")", "{", "const", "[", "longitude", ",", "latitude", ",", "z", "=", "0", "]", "=", "lngLatZ", ";", "const", "[", "X", ",", "Y", "]", "=", "viewport...
In project.glsl, offset modes calculate z differently from LNG_LAT mode. offset modes apply the y adjustment (pixelsPerMeter2) when projecting z LNG_LAT mode only use the linear scale.
[ "In", "project", ".", "glsl", "offset", "modes", "calculate", "z", "differently", "from", "LNG_LAT", "mode", ".", "offset", "modes", "apply", "the", "y", "adjustment", "(", "pixelsPerMeter2", ")", "when", "projecting", "z", "LNG_LAT", "mode", "only", "use", ...
a2010448b7f268bbd03617b812334c68a6b9e5b2
https://github.com/uber/deck.gl/blob/a2010448b7f268bbd03617b812334c68a6b9e5b2/modules/core/src/shaderlib/project/project-functions.js#L15-L23
train
Convert lng lat z to world position
[ 30522, 3853, 1048, 3070, 20051, 2480, 18790, 2953, 6392, 26994, 1006, 1048, 3070, 20051, 2480, 1010, 3193, 6442, 1010, 16396, 5302, 3207, 1027, 6270, 1007, 1063, 9530, 3367, 1031, 20413, 1010, 15250, 1010, 1062, 30524, 3193, 6442, 1012, 262...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/JSUtils/node/TernNodeDomain.js
getRefs
function getRefs(fileInfo, offset) { var request = buildRequest(fileInfo, "refs", offset); try { ternServer.request(request, function (error, data) { if (error) { _log("Error returned from Tern 'refs' request: " + error); var response = { type: MessageIds.TERN_REFS, error: error.message }; self.postMessage(response); return; } var response = { type: MessageIds.TERN_REFS, file: fileInfo.name, offset: offset, references: data }; // Post a message back to the main thread with the results self.postMessage(response); }); } catch (e) { _reportError(e, fileInfo.name); } }
javascript
function getRefs(fileInfo, offset) { var request = buildRequest(fileInfo, "refs", offset); try { ternServer.request(request, function (error, data) { if (error) { _log("Error returned from Tern 'refs' request: " + error); var response = { type: MessageIds.TERN_REFS, error: error.message }; self.postMessage(response); return; } var response = { type: MessageIds.TERN_REFS, file: fileInfo.name, offset: offset, references: data }; // Post a message back to the main thread with the results self.postMessage(response); }); } catch (e) { _reportError(e, fileInfo.name); } }
[ "function", "getRefs", "(", "fileInfo", ",", "offset", ")", "{", "var", "request", "=", "buildRequest", "(", "fileInfo", ",", "\"refs\"", ",", "offset", ")", ";", "try", "{", "ternServer", ".", "request", "(", "request", ",", "function", "(", "error", ",...
Get all References location @param {{type: string, name: string, offsetLines: number, text: string}} fileInfo - type of update, name of file, and the text of the update. For "full" updates, the whole text of the file is present. For "part" updates, the changed portion of the text. For "empty" updates, the file has not been modified and the text is empty. @param {{line: number, ch: number}} offset - the offset into the file for cursor
[ "Get", "all", "References", "location" ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/node/TernNodeDomain.js#L252-L277
train
Get the references from the specified sector
[ 30522, 3853, 2131, 2890, 10343, 1006, 5371, 2378, 14876, 1010, 16396, 1007, 1063, 13075, 5227, 1027, 3857, 2890, 15500, 1006, 5371, 2378, 14876, 1010, 1000, 25416, 2015, 1000, 1010, 16396, 1007, 1025, 3046, 1063, 28774, 12325, 2099, 6299, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/language/JSUtils.js
_getFunctionEndOffset
function _getFunctionEndOffset(text, offsetStart) { var mode = CodeMirror.getMode({}, "javascript"); var state = CodeMirror.startState(mode), stream, style, token; var curOffset = offsetStart, length = text.length, blockCount = 0, lineStart; var foundStartBrace = false; // Get a stream for the next line, and update curOffset and lineStart to point to the // beginning of that next line. Returns false if we're at the end of the text. function nextLine() { if (stream) { curOffset++; // account for \n if (curOffset >= length) { return false; } } lineStart = curOffset; var lineEnd = text.indexOf("\n", lineStart); if (lineEnd === -1) { lineEnd = length; } stream = new CodeMirror.StringStream(text.slice(curOffset, lineEnd)); return true; } // Get the next token, updating the style and token to refer to the current // token, and updating the curOffset to point to the end of the token (relative // to the start of the original text). function nextToken() { if (curOffset >= length) { return false; } if (stream) { // Set the start of the next token to the current stream position. stream.start = stream.pos; } while (!stream || stream.eol()) { if (!nextLine()) { return false; } } style = mode.token(stream, state); token = stream.current(); curOffset = lineStart + stream.pos; return true; } while (nextToken()) { if (style !== "comment" && style !== "regexp" && style !== "string" && style !== "string-2") { if (token === "{") { foundStartBrace = true; blockCount++; } else if (token === "}") { blockCount--; } } // blockCount starts at 0, so we don't want to check if it hits 0 // again until we've actually gone past the start of the function body. if (foundStartBrace && blockCount <= 0) { return curOffset; } } // Shouldn't get here, but if we do, return the end of the text as the offset. return length; }
javascript
function _getFunctionEndOffset(text, offsetStart) { var mode = CodeMirror.getMode({}, "javascript"); var state = CodeMirror.startState(mode), stream, style, token; var curOffset = offsetStart, length = text.length, blockCount = 0, lineStart; var foundStartBrace = false; // Get a stream for the next line, and update curOffset and lineStart to point to the // beginning of that next line. Returns false if we're at the end of the text. function nextLine() { if (stream) { curOffset++; // account for \n if (curOffset >= length) { return false; } } lineStart = curOffset; var lineEnd = text.indexOf("\n", lineStart); if (lineEnd === -1) { lineEnd = length; } stream = new CodeMirror.StringStream(text.slice(curOffset, lineEnd)); return true; } // Get the next token, updating the style and token to refer to the current // token, and updating the curOffset to point to the end of the token (relative // to the start of the original text). function nextToken() { if (curOffset >= length) { return false; } if (stream) { // Set the start of the next token to the current stream position. stream.start = stream.pos; } while (!stream || stream.eol()) { if (!nextLine()) { return false; } } style = mode.token(stream, state); token = stream.current(); curOffset = lineStart + stream.pos; return true; } while (nextToken()) { if (style !== "comment" && style !== "regexp" && style !== "string" && style !== "string-2") { if (token === "{") { foundStartBrace = true; blockCount++; } else if (token === "}") { blockCount--; } } // blockCount starts at 0, so we don't want to check if it hits 0 // again until we've actually gone past the start of the function body. if (foundStartBrace && blockCount <= 0) { return curOffset; } } // Shouldn't get here, but if we do, return the end of the text as the offset. return length; }
[ "function", "_getFunctionEndOffset", "(", "text", ",", "offsetStart", ")", "{", "var", "mode", "=", "CodeMirror", ".", "getMode", "(", "{", "}", ",", "\"javascript\"", ")", ";", "var", "state", "=", "CodeMirror", ".", "startState", "(", "mode", ")", ",", ...
Given the start offset of a function definition (before the opening brace), find the end offset for the function (the closing "}"). Returns the position one past the close brace. Properly ignores braces inside comments, strings, and regexp literals.
[ "Given", "the", "start", "offset", "of", "a", "function", "definition", "(", "before", "the", "opening", "brace", ")", "find", "the", "end", "offset", "for", "the", "function", "(", "the", "closing", "}", ")", ".", "Returns", "the", "position", "one", "p...
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L174-L239
train
Get the end of the function
[ 30522, 3853, 1035, 2131, 11263, 27989, 10497, 27475, 3388, 1006, 3793, 1010, 16396, 14117, 2102, 1007, 1063, 13075, 5549, 1027, 3642, 14503, 29165, 1012, 2131, 5302, 3207, 1006, 1063, 1065, 1010, 1000, 9262, 22483, 1000, 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...
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2MetadataConverter.js
createNavigationPropertyBinding
function createNavigationPropertyBinding(oAssociationSetFrom, oAssociationSetTo) { var oEntitySet = oEntityContainer[oAssociationSetFrom.entitySetName], oToRole = oAssociation.roles[oAssociationSetTo.roleName]; if (oToRole.propertyName) { oEntitySet.$NavigationPropertyBinding = oEntitySet.$NavigationPropertyBinding || {}; oEntitySet.$NavigationPropertyBinding[oToRole.propertyName] = oAssociationSetTo.entitySetName; } }
javascript
function createNavigationPropertyBinding(oAssociationSetFrom, oAssociationSetTo) { var oEntitySet = oEntityContainer[oAssociationSetFrom.entitySetName], oToRole = oAssociation.roles[oAssociationSetTo.roleName]; if (oToRole.propertyName) { oEntitySet.$NavigationPropertyBinding = oEntitySet.$NavigationPropertyBinding || {}; oEntitySet.$NavigationPropertyBinding[oToRole.propertyName] = oAssociationSetTo.entitySetName; } }
[ "function", "createNavigationPropertyBinding", "(", "oAssociationSetFrom", ",", "oAssociationSetTo", ")", "{", "var", "oEntitySet", "=", "oEntityContainer", "[", "oAssociationSetFrom", ".", "entitySetName", "]", ",", "oToRole", "=", "oAssociation", ".", "roles", "[", ...
/* Creates a navigation property binding for the navigation property of the "from" set's type that has the "to" type as target, using the sets pointing to these types.
[ "/", "*", "Creates", "a", "navigation", "property", "binding", "for", "the", "navigation", "property", "of", "the", "from", "set", "s", "type", "that", "has", "the", "to", "type", "as", "target", "using", "the", "sets", "pointing", "to", "these", "types", ...
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_V2MetadataConverter.js#L1454-L1464
train
Creates a property binding for the given association set from to.
[ 30522, 3853, 3443, 2532, 5737, 12540, 21572, 4842, 3723, 8428, 4667, 1006, 1051, 12054, 10085, 18963, 13462, 19699, 5358, 1010, 1051, 12054, 10085, 18963, 21678, 2080, 1007, 1063, 13075, 1051, 4765, 3012, 13462, 1027, 1051, 4765, 3012, 8663, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/multiline-comment-style.js
getCommentLines
function getCommentLines(commentGroup) { if (commentGroup[0].type === "Line") { return commentGroup.map(comment => comment.value); } return commentGroup[0].value .split(astUtils.LINEBREAK_MATCHER) .map(line => line.replace(/^\s*\*?/u, "")); }
javascript
function getCommentLines(commentGroup) { if (commentGroup[0].type === "Line") { return commentGroup.map(comment => comment.value); } return commentGroup[0].value .split(astUtils.LINEBREAK_MATCHER) .map(line => line.replace(/^\s*\*?/u, "")); }
[ "function", "getCommentLines", "(", "commentGroup", ")", "{", "if", "(", "commentGroup", "[", "0", "]", ".", "type", "===", "\"Line\"", ")", "{", "return", "commentGroup", ".", "map", "(", "comment", "=>", "comment", ".", "value", ")", ";", "}", "return"...
---------------------------------------------------------------------- Helpers ---------------------------------------------------------------------- Gets a list of comment lines in a group @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment @returns {string[]} A list of comment lines
[ "----------------------------------------------------------------------", "Helpers", "----------------------------------------------------------------------", "Gets", "a", "list", "of", "comment", "lines", "in", "a", "group" ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/multiline-comment-style.js#L49-L56
train
getCommentLines - get lines from comment group
[ 30522, 3853, 2131, 9006, 3672, 12735, 1006, 7615, 17058, 1007, 1063, 2065, 1006, 7615, 17058, 1031, 1014, 1033, 1012, 2828, 1027, 1027, 1027, 1000, 2240, 1000, 1007, 1063, 2709, 7615, 17058, 1012, 4949, 1006, 7615, 1027, 1028, 7615, 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...
SheetJS/js-xlsx
bits/28_binstructs.js
parse_BrtColor
function parse_BrtColor(data/*::, length*/) { var out = {}; var d = data.read_shift(1); //var fValidRGB = d & 1; var xColorType = d >>> 1; var index = data.read_shift(1); var nTS = data.read_shift(2, 'i'); var bR = data.read_shift(1); var bG = data.read_shift(1); var bB = data.read_shift(1); data.l++; //var bAlpha = data.read_shift(1); switch(xColorType) { case 0: out.auto = 1; break; case 1: out.index = index; var icv = XLSIcv[index]; /* automatic pseudo index 81 */ if(icv) out.rgb = rgb2Hex(icv); break; case 2: /* if(!fValidRGB) throw new Error("invalid"); */ out.rgb = rgb2Hex([bR, bG, bB]); break; case 3: out.theme = index; break; } if(nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; return out; }
javascript
function parse_BrtColor(data/*::, length*/) { var out = {}; var d = data.read_shift(1); //var fValidRGB = d & 1; var xColorType = d >>> 1; var index = data.read_shift(1); var nTS = data.read_shift(2, 'i'); var bR = data.read_shift(1); var bG = data.read_shift(1); var bB = data.read_shift(1); data.l++; //var bAlpha = data.read_shift(1); switch(xColorType) { case 0: out.auto = 1; break; case 1: out.index = index; var icv = XLSIcv[index]; /* automatic pseudo index 81 */ if(icv) out.rgb = rgb2Hex(icv); break; case 2: /* if(!fValidRGB) throw new Error("invalid"); */ out.rgb = rgb2Hex([bR, bG, bB]); break; case 3: out.theme = index; break; } if(nTS != 0) out.tint = nTS > 0 ? nTS / 32767 : nTS / 32768; return out; }
[ "function", "parse_BrtColor", "(", "data", "/*::, length*/", ")", "{", "var", "out", "=", "{", "}", ";", "var", "d", "=", "data", ".", "read_shift", "(", "1", ")", ";", "//var fValidRGB = d & 1;", "var", "xColorType", "=", "d", ">>>", "1", ";", "var", ...
/* [MS-XLSB] 2.4.324 BrtColor
[ "/", "*", "[", "MS", "-", "XLSB", "]", "2", ".", "4", ".", "324", "BrtColor" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/bits/28_binstructs.js#L172-L203
train
Parse BrtColor data
[ 30522, 3853, 11968, 3366, 1035, 7987, 13535, 12898, 2099, 1006, 2951, 1013, 1008, 1024, 1024, 1010, 3091, 1008, 1013, 1007, 1063, 13075, 2041, 1027, 1063, 1065, 1025, 13075, 1040, 1027, 2951, 1012, 3191, 1035, 5670, 1006, 1015, 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...
firebase/firebase-js-sdk
scripts/docgen/generate-docs.js
moveFilesToRoot
function moveFilesToRoot(subdir) { return exec(`mv ${docPath}/${subdir}/* ${docPath}`) .then(() => { exec(`rmdir ${docPath}/${subdir}`); }) .catch(e => console.error(e)); }
javascript
function moveFilesToRoot(subdir) { return exec(`mv ${docPath}/${subdir}/* ${docPath}`) .then(() => { exec(`rmdir ${docPath}/${subdir}`); }) .catch(e => console.error(e)); }
[ "function", "moveFilesToRoot", "(", "subdir", ")", "{", "return", "exec", "(", "`", "${", "docPath", "}", "${", "subdir", "}", "${", "docPath", "}", "`", ")", ".", "then", "(", "(", ")", "=>", "{", "exec", "(", "`", "${", "docPath", "}", "${", "s...
Moves files from subdir to root. @param {string} subdir Subdir to move files out of.
[ "Moves", "files", "from", "subdir", "to", "root", "." ]
491598a499813dacc23724de5e237ec220cc560e
https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/scripts/docgen/generate-docs.js#L78-L84
train
Move files to root
[ 30522, 3853, 2693, 8873, 4244, 4263, 17206, 1006, 4942, 4305, 2099, 1007, 1063, 2709, 4654, 8586, 1006, 1036, 19842, 1002, 1063, 9986, 15069, 1065, 1013, 1002, 1063, 4942, 4305, 2099, 1065, 1013, 1008, 1002, 1063, 9986, 15069, 1065, 1036, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/EventDispatcher.js
function (events, fn) { // Wrap fn in a self-detaching handler; saved on the original fn so off() can detect it later if (!fn._eventOnceWrapper) { fn._eventOnceWrapper = function (event) { // Note: this wrapper is reused for all attachments of the same fn, so it shouldn't reference // anything from the outer closure other than 'fn' event.target.off(event.type, fn._eventOnceWrapper); fn.apply(this, arguments); }; } return this.on(events, fn._eventOnceWrapper); }
javascript
function (events, fn) { // Wrap fn in a self-detaching handler; saved on the original fn so off() can detect it later if (!fn._eventOnceWrapper) { fn._eventOnceWrapper = function (event) { // Note: this wrapper is reused for all attachments of the same fn, so it shouldn't reference // anything from the outer closure other than 'fn' event.target.off(event.type, fn._eventOnceWrapper); fn.apply(this, arguments); }; } return this.on(events, fn._eventOnceWrapper); }
[ "function", "(", "events", ",", "fn", ")", "{", "// Wrap fn in a self-detaching handler; saved on the original fn so off() can detect it later", "if", "(", "!", "fn", ".", "_eventOnceWrapper", ")", "{", "fn", ".", "_eventOnceWrapper", "=", "function", "(", "event", ")",...
Attaches a handler so it's only called once (per event in the 'events' list). @param {string} events @param {?function(!{type:string, target:!Object}, ...)} fn
[ "Attaches", "a", "handler", "so", "it", "s", "only", "called", "once", "(", "per", "event", "in", "the", "events", "list", ")", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/EventDispatcher.js#L192-L203
train
Adds an event listener to the topic
[ 30522, 3853, 1006, 2824, 1010, 1042, 2078, 1007, 1063, 1013, 1013, 10236, 1042, 2078, 1999, 1037, 2969, 1011, 20010, 21046, 3070, 28213, 1025, 5552, 2006, 1996, 2434, 1042, 2078, 2061, 2125, 1006, 1007, 2064, 11487, 2009, 2101, 2065, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
eslint/eslint
lib/rules/no-useless-return.js
getUselessReturns
function getUselessReturns(uselessReturns, prevSegments, providedTraversedSegments) { const traversedSegments = providedTraversedSegments || new WeakSet(); for (const segment of prevSegments) { if (!segment.reachable) { if (!traversedSegments.has(segment)) { traversedSegments.add(segment); getUselessReturns( uselessReturns, segment.allPrevSegments.filter(isReturned), traversedSegments ); } continue; } uselessReturns.push(...segmentInfoMap.get(segment).uselessReturns); } return uselessReturns; }
javascript
function getUselessReturns(uselessReturns, prevSegments, providedTraversedSegments) { const traversedSegments = providedTraversedSegments || new WeakSet(); for (const segment of prevSegments) { if (!segment.reachable) { if (!traversedSegments.has(segment)) { traversedSegments.add(segment); getUselessReturns( uselessReturns, segment.allPrevSegments.filter(isReturned), traversedSegments ); } continue; } uselessReturns.push(...segmentInfoMap.get(segment).uselessReturns); } return uselessReturns; }
[ "function", "getUselessReturns", "(", "uselessReturns", ",", "prevSegments", ",", "providedTraversedSegments", ")", "{", "const", "traversedSegments", "=", "providedTraversedSegments", "||", "new", "WeakSet", "(", ")", ";", "for", "(", "const", "segment", "of", "pre...
Collects useless return statements from the given previous segments. A previous segment may be an unreachable segment. In that case, the information object of the unreachable segment is not initialized because `onCodePathSegmentStart` event is not notified for unreachable segments. This goes to the previous segments of the unreachable segment recursively if the unreachable segment was generated by a return statement. Otherwise, this ignores the unreachable segment. This behavior would simulate code paths for the case that the return statement does not exist. @param {ASTNode[]} uselessReturns - The collected return statements. @param {CodePathSegment[]} prevSegments - The previous segments to traverse. @param {WeakSet<CodePathSegment>} [providedTraversedSegments] A set of segments that have already been traversed in this call @returns {ASTNode[]} `uselessReturns`.
[ "Collects", "useless", "return", "statements", "from", "the", "given", "previous", "segments", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/no-useless-return.js#L118-L138
train
getUselessReturns - returns useless returns
[ 30522, 3853, 2131, 8557, 3238, 13465, 14287, 2015, 1006, 11809, 13465, 14287, 2015, 1010, 3653, 15088, 13910, 8163, 1010, 3024, 6494, 16070, 5104, 13910, 8163, 1007, 1063, 9530, 3367, 27797, 3366, 21693, 11187, 1027, 3024, 6494, 16070, 5104, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
parcel-bundler/parcel
packages/core/parcel-bundler/src/visitors/env.js
morph
function morph(object, newProperties) { for (let key in object) { delete object[key]; } for (let key in newProperties) { object[key] = newProperties[key]; } }
javascript
function morph(object, newProperties) { for (let key in object) { delete object[key]; } for (let key in newProperties) { object[key] = newProperties[key]; } }
[ "function", "morph", "(", "object", ",", "newProperties", ")", "{", "for", "(", "let", "key", "in", "object", ")", "{", "delete", "object", "[", "key", "]", ";", "}", "for", "(", "let", "key", "in", "newProperties", ")", "{", "object", "[", "key", ...
replace object properties
[ "replace", "object", "properties" ]
84b308511f87d4b69da62bcd352f0ff2f7bd4f1b
https://github.com/parcel-bundler/parcel/blob/84b308511f87d4b69da62bcd352f0ff2f7bd4f1b/packages/core/parcel-bundler/src/visitors/env.js#L22-L30
train
morphs the properties of an object into the new properties of an object
[ 30522, 3853, 22822, 8458, 1006, 4874, 1010, 2047, 21572, 4842, 7368, 1007, 1063, 2005, 1006, 2292, 3145, 1999, 4874, 1007, 1063, 3972, 12870, 4874, 1031, 3145, 1033, 1025, 1065, 2005, 1006, 2292, 3145, 1999, 2047, 21572, 4842, 7368, 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...
juliangarnier/anime
documentation/assets/js/website.js
onScroll
function onScroll(cb) { var isTicking = false; var scrollY = 0; var body = document.body; var html = document.documentElement; var scrollHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); function scroll() { scrollY = window.scrollY; if (cb) cb(scrollY, scrollHeight); requestTick(); } function requestTick() { if (!isTicking) requestAnimationFrame(updateScroll); isTicking = true; } function updateScroll() { isTicking = false; var currentScrollY = scrollY; } scroll(); window.onscroll = scroll; }
javascript
function onScroll(cb) { var isTicking = false; var scrollY = 0; var body = document.body; var html = document.documentElement; var scrollHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); function scroll() { scrollY = window.scrollY; if (cb) cb(scrollY, scrollHeight); requestTick(); } function requestTick() { if (!isTicking) requestAnimationFrame(updateScroll); isTicking = true; } function updateScroll() { isTicking = false; var currentScrollY = scrollY; } scroll(); window.onscroll = scroll; }
[ "function", "onScroll", "(", "cb", ")", "{", "var", "isTicking", "=", "false", ";", "var", "scrollY", "=", "0", ";", "var", "body", "=", "document", ".", "body", ";", "var", "html", "=", "document", ".", "documentElement", ";", "var", "scrollHeight", "...
Better scroll events
[ "Better", "scroll", "events" ]
875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a
https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/documentation/assets/js/website.js#L66-L87
train
Function to call when the window scrolls
[ 30522, 3853, 2006, 11020, 28402, 1006, 17324, 1007, 1063, 13075, 21541, 6799, 2075, 1027, 6270, 1025, 13075, 17186, 2100, 1027, 1014, 1025, 13075, 2303, 1027, 6254, 1012, 2303, 1025, 13075, 16129, 1027, 6254, 1012, 6254, 12260, 3672, 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/core/support/techinfo/TechnicalInfo.js
function (sValue) { var oRegexpCoreURL = /^https?:\/\/(www\.)?([-a-zA-Z0-9.%_+~#=]{2,})([-a-zA-Z0-9@:%_+.~#?&/=]*)\/sap\/ui\/support\/?$/, sApplicationProtocol = window.location.protocol; if (sValue && !sValue.match(oRegexpCoreURL)) { throw new ValidateException(this._getText("TechInfo.SupportAssistantConfigPopup.URLValidationMessage")); } if (sValue && sApplicationProtocol === "https:" && !sValue.match(sApplicationProtocol)) { throw new ValidateException(this._getText("TechInfo.SupportAssistantConfigPopup.ProtocolError")); } return true; }
javascript
function (sValue) { var oRegexpCoreURL = /^https?:\/\/(www\.)?([-a-zA-Z0-9.%_+~#=]{2,})([-a-zA-Z0-9@:%_+.~#?&/=]*)\/sap\/ui\/support\/?$/, sApplicationProtocol = window.location.protocol; if (sValue && !sValue.match(oRegexpCoreURL)) { throw new ValidateException(this._getText("TechInfo.SupportAssistantConfigPopup.URLValidationMessage")); } if (sValue && sApplicationProtocol === "https:" && !sValue.match(sApplicationProtocol)) { throw new ValidateException(this._getText("TechInfo.SupportAssistantConfigPopup.ProtocolError")); } return true; }
[ "function", "(", "sValue", ")", "{", "var", "oRegexpCoreURL", "=", "/", "^https?:\\/\\/(www\\.)?([-a-zA-Z0-9.%_+~#=]{2,})([-a-zA-Z0-9@:%_+.~#?&/=]*)\\/sap\\/ui\\/support\\/?$", "/", ",", "sApplicationProtocol", "=", "window", ".", "location", ".", "protocol", ";", "if", "("...
This is a custom model type for validating a URL ending with sap/ui/support/
[ "This", "is", "a", "custom", "model", "type", "for", "validating", "a", "URL", "ending", "with", "sap", "/", "ui", "/", "support", "/" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/techinfo/TechnicalInfo.js#L451-L462
train
Validates the URL of the Support Assistant
[ 30522, 3853, 1006, 17917, 2389, 5657, 1007, 1063, 13075, 10848, 3351, 2595, 15042, 5686, 3126, 2140, 1027, 1013, 1034, 16770, 1029, 1024, 1032, 1013, 1032, 1013, 1006, 7479, 1032, 1012, 1007, 1029, 1006, 1031, 1011, 1037, 1011, 23564, 1011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Painter.js
function (zlevel, config) { if (config) { var layerConfig = this._layerConfig; if (!layerConfig[zlevel]) { layerConfig[zlevel] = config; } else { util.merge(layerConfig[zlevel], config, true); } for (var i = 0; i < this._zlevelList.length; i++) { var _zlevel = this._zlevelList[i]; if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) { var layer = this._layers[_zlevel]; util.merge(layer, layerConfig[zlevel], true); } } } }
javascript
function (zlevel, config) { if (config) { var layerConfig = this._layerConfig; if (!layerConfig[zlevel]) { layerConfig[zlevel] = config; } else { util.merge(layerConfig[zlevel], config, true); } for (var i = 0; i < this._zlevelList.length; i++) { var _zlevel = this._zlevelList[i]; if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) { var layer = this._layers[_zlevel]; util.merge(layer, layerConfig[zlevel], true); } } } }
[ "function", "(", "zlevel", ",", "config", ")", "{", "if", "(", "config", ")", "{", "var", "layerConfig", "=", "this", ".", "_layerConfig", ";", "if", "(", "!", "layerConfig", "[", "zlevel", "]", ")", "{", "layerConfig", "[", "zlevel", "]", "=", "conf...
修改指定zlevel的绘制参数 @param {string} zlevel @param {Object} config 配置对象 @param {string} [config.clearColor=0] 每次清空画布的颜色 @param {string} [config.motionBlur=false] 是否开启动态模糊 @param {number} [config.lastFrameAlpha=0.7] 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
[ "修改指定zlevel的绘制参数" ]
30321b57cba3149c30eacb0c1e18276f0f001b9f
https://github.com/ecomfe/zrender/blob/30321b57cba3149c30eacb0c1e18276f0f001b9f/src/Painter.js#L794-L812
train
Add a new record to the log
[ 30522, 3853, 1006, 1062, 20414, 2884, 1010, 9530, 8873, 2290, 1007, 1063, 2065, 1006, 9530, 8873, 2290, 1007, 1063, 13075, 6741, 8663, 8873, 2290, 1027, 2023, 1012, 1035, 6741, 8663, 8873, 2290, 1025, 2065, 1006, 999, 6741, 8663, 8873, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
aws/aws-sdk-js
lib/protocol/helpers.js
populateHostPrefix
function populateHostPrefix(request) { var enabled = request.service.config.hostPrefixEnabled; if (!enabled) return request; var operationModel = request.service.api.operations[request.operation]; //don't marshal host prefix when operation has endpoint discovery traits if (hasEndpointDiscover(request)) return request; if (operationModel.endpoint && operationModel.endpoint.hostPrefix) { var hostPrefixNotation = operationModel.endpoint.hostPrefix; var hostPrefix = expandHostPrefix(hostPrefixNotation, request.params, operationModel.input); prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix); validateHostname(request.httpRequest.endpoint.hostname); } return request; }
javascript
function populateHostPrefix(request) { var enabled = request.service.config.hostPrefixEnabled; if (!enabled) return request; var operationModel = request.service.api.operations[request.operation]; //don't marshal host prefix when operation has endpoint discovery traits if (hasEndpointDiscover(request)) return request; if (operationModel.endpoint && operationModel.endpoint.hostPrefix) { var hostPrefixNotation = operationModel.endpoint.hostPrefix; var hostPrefix = expandHostPrefix(hostPrefixNotation, request.params, operationModel.input); prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix); validateHostname(request.httpRequest.endpoint.hostname); } return request; }
[ "function", "populateHostPrefix", "(", "request", ")", "{", "var", "enabled", "=", "request", ".", "service", ".", "config", ".", "hostPrefixEnabled", ";", "if", "(", "!", "enabled", ")", "return", "request", ";", "var", "operationModel", "=", "request", "."...
Prepend prefix defined by API model to endpoint that's already constructed. This feature does not apply to operations using endpoint discovery and can be disabled. @api private
[ "Prepend", "prefix", "defined", "by", "API", "model", "to", "endpoint", "that", "s", "already", "constructed", ".", "This", "feature", "does", "not", "apply", "to", "operations", "using", "endpoint", "discovery", "and", "can", "be", "disabled", "." ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/lib/protocol/helpers.js#L10-L23
train
Populate host prefix for the given operation
[ 30522, 3853, 3769, 9869, 15006, 25856, 2890, 8873, 2595, 1006, 5227, 1007, 1063, 13075, 9124, 1027, 5227, 1012, 2326, 1012, 9530, 8873, 2290, 1012, 3677, 28139, 8873, 2595, 8189, 23242, 1025, 2065, 1006, 999, 9124, 1007, 2709, 5227, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/ExtensionUtils.js
loadStyleSheet
function loadStyleSheet(module, path) { var result = new $.Deferred(); loadFile(module, path) .done(function (content) { var url = this.url; if (url.slice(-5) === ".less") { parseLessCode(content, url) .done(function (css) { result.resolve(addEmbeddedStyleSheet(css)); }) .fail(result.reject); } else { var deferred = new $.Deferred(), link = addLinkedStyleSheet(url, deferred); deferred .done(function () { result.resolve(link); }) .fail(result.reject); } }) .fail(result.reject); // Summarize error info to console for easier debugging result.fail(function (error, textStatus, httpError) { if (error.readyState !== undefined) { // If first arg is a jQXHR object, the real error info is in the next two args console.error("[Extension] Unable to read stylesheet " + path + ":", textStatus, httpError); } else { console.error("[Extension] Unable to process stylesheet " + path, error); } }); return result.promise(); }
javascript
function loadStyleSheet(module, path) { var result = new $.Deferred(); loadFile(module, path) .done(function (content) { var url = this.url; if (url.slice(-5) === ".less") { parseLessCode(content, url) .done(function (css) { result.resolve(addEmbeddedStyleSheet(css)); }) .fail(result.reject); } else { var deferred = new $.Deferred(), link = addLinkedStyleSheet(url, deferred); deferred .done(function () { result.resolve(link); }) .fail(result.reject); } }) .fail(result.reject); // Summarize error info to console for easier debugging result.fail(function (error, textStatus, httpError) { if (error.readyState !== undefined) { // If first arg is a jQXHR object, the real error info is in the next two args console.error("[Extension] Unable to read stylesheet " + path + ":", textStatus, httpError); } else { console.error("[Extension] Unable to process stylesheet " + path, error); } }); return result.promise(); }
[ "function", "loadStyleSheet", "(", "module", ",", "path", ")", "{", "var", "result", "=", "new", "$", ".", "Deferred", "(", ")", ";", "loadFile", "(", "module", ",", "path", ")", ".", "done", "(", "function", "(", "content", ")", "{", "var", "url", ...
Loads a style sheet (CSS or LESS) relative to the extension module. @param {!module} module Module provided by RequireJS @param {!string} path Relative path from the extension folder to a CSS or LESS file @return {!$.Promise} A promise object that is resolved with an HTML node if the file can be loaded.
[ "Loads", "a", "style", "sheet", "(", "CSS", "or", "LESS", ")", "relative", "to", "the", "extension", "module", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/ExtensionUtils.js#L190-L227
train
Load a stylesheet from a file
[ 30522, 3853, 15665, 27983, 4095, 15558, 1006, 11336, 1010, 4130, 1007, 1063, 13075, 2765, 1027, 2047, 1002, 1012, 13366, 28849, 2094, 1006, 1007, 1025, 7170, 8873, 2571, 1006, 11336, 1010, 4130, 1007, 1012, 2589, 1006, 3853, 1006, 4180, 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/search/FindInFiles.js
doReplace
function doReplace(results, replaceText, options) { return FindUtils.performReplacements(results, replaceText, options).always(function () { // For UI integration testing only exports._replaceDone = true; }); }
javascript
function doReplace(results, replaceText, options) { return FindUtils.performReplacements(results, replaceText, options).always(function () { // For UI integration testing only exports._replaceDone = true; }); }
[ "function", "doReplace", "(", "results", ",", "replaceText", ",", "options", ")", "{", "return", "FindUtils", ".", "performReplacements", "(", "results", ",", "replaceText", ",", "options", ")", ".", "always", "(", "function", "(", ")", "{", "// For UI integra...
Given a set of search results, replaces them with the given replaceText, either on disk or in memory. @param {Object.<fullPath: string, {matches: Array.<{start: {line:number,ch:number}, end: {line:number,ch:number}, startOffset: number, endOffset: number, line: string}>, collapsed: boolean}>} results The list of results to replace, as returned from _doSearch.. @param {string} replaceText The text to replace each result with. @param {?Object} options An options object: forceFilesOpen: boolean - Whether to open all files in editors and do replacements there rather than doing the replacements on disk. Note that even if this is false, files that are already open in editors will have replacements done in memory. isRegexp: boolean - Whether the original query was a regexp. If true, $-substitution is performed on the replaceText. @return {$.Promise} A promise that's resolved when the replacement is finished or rejected with an array of errors if there were one or more errors. Each individual item in the array will be a {item: string, error: string} object, where item is the full path to the file that could not be updated, and error is either a FileSystem error or one of the `FindInFiles.ERROR_*` constants.
[ "Given", "a", "set", "of", "search", "results", "replaces", "them", "with", "the", "given", "replaceText", "either", "on", "disk", "or", "in", "memory", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/search/FindInFiles.js#L645-L650
train
Perform replacements for the given text
[ 30522, 3853, 2079, 2890, 24759, 10732, 1006, 3463, 1010, 5672, 18209, 1010, 7047, 1007, 1063, 2709, 2424, 21823, 4877, 1012, 4685, 2890, 24759, 10732, 8163, 1006, 3463, 1010, 5672, 18209, 1010, 7047, 1007, 1012, 2467, 1006, 3853, 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...
jgraph/mxgraph
javascript/mxClient.js
function(node) { // Only IE10- if (mxClient.IS_IE && node.innerText !== undefined) { return node.innerText; } else { return (node != null) ? node[(node.textContent === undefined) ? 'text' : 'textContent'] : ''; } }
javascript
function(node) { // Only IE10- if (mxClient.IS_IE && node.innerText !== undefined) { return node.innerText; } else { return (node != null) ? node[(node.textContent === undefined) ? 'text' : 'textContent'] : ''; } }
[ "function", "(", "node", ")", "{", "// Only IE10-", "if", "(", "mxClient", ".", "IS_IE", "&&", "node", ".", "innerText", "!==", "undefined", ")", "{", "return", "node", ".", "innerText", ";", "}", "else", "{", "return", "(", "node", "!=", "null", ")", ...
Function: getTextContent Returns the text content of the specified node. Parameters: node - DOM node to return the text content for.
[ "Function", ":", "getTextContent" ]
33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44
https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3087-L3098
train
Returns the text content of a node
[ 30522, 3853, 1006, 13045, 1007, 1063, 1013, 1013, 2069, 29464, 10790, 1011, 2065, 1006, 25630, 20464, 11638, 1012, 2003, 1035, 29464, 1004, 1004, 13045, 1012, 5110, 18209, 999, 1027, 1027, 6151, 28344, 1007, 1063, 2709, 13045, 1012, 5110, 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...
openlayers/openlayers
src/ol/tilegrid.js
resolutionsFromExtent
function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize) { const maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : DEFAULT_MAX_ZOOM; const height = getHeight(extent); const width = getWidth(extent); const tileSize = toSize(opt_tileSize !== undefined ? opt_tileSize : DEFAULT_TILE_SIZE); const maxResolution = Math.max( width / tileSize[0], height / tileSize[1]); const length = maxZoom + 1; const resolutions = new Array(length); for (let z = 0; z < length; ++z) { resolutions[z] = maxResolution / Math.pow(2, z); } return resolutions; }
javascript
function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize) { const maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : DEFAULT_MAX_ZOOM; const height = getHeight(extent); const width = getWidth(extent); const tileSize = toSize(opt_tileSize !== undefined ? opt_tileSize : DEFAULT_TILE_SIZE); const maxResolution = Math.max( width / tileSize[0], height / tileSize[1]); const length = maxZoom + 1; const resolutions = new Array(length); for (let z = 0; z < length; ++z) { resolutions[z] = maxResolution / Math.pow(2, z); } return resolutions; }
[ "function", "resolutionsFromExtent", "(", "extent", ",", "opt_maxZoom", ",", "opt_tileSize", ")", "{", "const", "maxZoom", "=", "opt_maxZoom", "!==", "undefined", "?", "opt_maxZoom", ":", "DEFAULT_MAX_ZOOM", ";", "const", "height", "=", "getHeight", "(", "extent",...
Create a resolutions array from an extent. A zoom factor of 2 is assumed. @param {import("./extent.js").Extent} extent Extent. @param {number=} opt_maxZoom Maximum zoom level (default is DEFAULT_MAX_ZOOM). @param {number|import("./size.js").Size=} opt_tileSize Tile size (default uses DEFAULT_TILE_SIZE). @return {!Array<number>} Resolutions array.
[ "Create", "a", "resolutions", "array", "from", "an", "extent", ".", "A", "zoom", "factor", "of", "2", "is", "assumed", "." ]
f366eaea522388fb575b11010e69d309164baca7
https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/tilegrid.js#L120-L138
train
Returns resolutions from extent
[ 30522, 3853, 18853, 19699, 8462, 18413, 4765, 1006, 6698, 1010, 23569, 1035, 4098, 23221, 2213, 1010, 23569, 1035, 13262, 4697, 1007, 1063, 9530, 3367, 4098, 23221, 2213, 1027, 23569, 1035, 4098, 23221, 2213, 999, 1027, 1027, 6151, 28344, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
adobe/brackets
src/utils/DropdownEventHandler.js
DropdownEventHandler
function DropdownEventHandler($list, selectionCallback, closeCallback) { this.$list = $list; this.$items = $list.find("li"); this.selectionCallback = selectionCallback; this.closeCallback = closeCallback; this.scrolling = false; /** * @private * The selected position in the list; otherwise -1. * @type {number} */ this._selectedIndex = -1; }
javascript
function DropdownEventHandler($list, selectionCallback, closeCallback) { this.$list = $list; this.$items = $list.find("li"); this.selectionCallback = selectionCallback; this.closeCallback = closeCallback; this.scrolling = false; /** * @private * The selected position in the list; otherwise -1. * @type {number} */ this._selectedIndex = -1; }
[ "function", "DropdownEventHandler", "(", "$list", ",", "selectionCallback", ",", "closeCallback", ")", "{", "this", ".", "$list", "=", "$list", ";", "this", ".", "$items", "=", "$list", ".", "find", "(", "\"li\"", ")", ";", "this", ".", "selectionCallback", ...
Object to handle events for a dropdown list. DropdownEventHandler handles these events: Mouse: - click - execute selection callback and dismiss list - mouseover - highlight item - mouseleave - remove mouse highlighting Keyboard: - Enter - execute selection callback and dismiss list - Esc - dismiss list - Up/Down - change selection - PageUp/Down - change selection Items whose <a> has the .disabled class do not respond to selection. @constructor @param {jQueryObject} $list associated list object @param {Function} selectionCallback function called when list item is selected.
[ "Object", "to", "handle", "events", "for", "a", "dropdown", "list", "." ]
d5d00d43602c438266d32b8eda8f8a3ca937b524
https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/DropdownEventHandler.js#L54-L68
train
The DropdownEventHandler class
[ 30522, 3853, 4530, 7698, 18697, 3372, 11774, 3917, 1006, 1002, 2862, 1010, 4989, 9289, 20850, 8684, 1010, 2485, 9289, 20850, 8684, 1007, 1063, 2023, 1012, 1002, 2862, 1027, 1002, 2862, 1025, 2023, 1012, 1002, 5167, 1027, 1002, 2862, 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...
SheetJS/js-xlsx
xlsx.js
parse_VtVecUnalignedLpstrValue
function parse_VtVecUnalignedLpstrValue(blob) { var length = blob.read_shift(4); var ret = []; for(var i = 0; i != length; ++i) ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0,''); return ret; }
javascript
function parse_VtVecUnalignedLpstrValue(blob) { var length = blob.read_shift(4); var ret = []; for(var i = 0; i != length; ++i) ret[i] = blob.read_shift(0, 'lpstr-cp').replace(chr0,''); return ret; }
[ "function", "parse_VtVecUnalignedLpstrValue", "(", "blob", ")", "{", "var", "length", "=", "blob", ".", "read_shift", "(", "4", ")", ";", "var", "ret", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "!=", "length", ";", "++", "i", ...
/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue
[ "/", "*", "[", "MS", "-", "OSHARED", "]", "2", ".", "3", ".", "3", ".", "1", ".", "9", "VtVecUnalignedLpstrValue" ]
9a6d8a1d3d80c78dad5201fb389316f935279cdc
https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L5012-L5017
train
Parse a vector of unaligned values
[ 30522, 3853, 11968, 3366, 1035, 28879, 3726, 10841, 12032, 23773, 2098, 14277, 3367, 26585, 5657, 1006, 1038, 4135, 2497, 1007, 1063, 13075, 3091, 1027, 1038, 4135, 2497, 1012, 3191, 1035, 5670, 1006, 1018, 1007, 1025, 13075, 2128, 2102, 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...
TryGhost/Ghost
core/server/models/base/index.js
fixBools
function fixBools(attrs) { var self = this; _.each(attrs, function each(value, key) { if (schema.tables[self.tableName].hasOwnProperty(key) && schema.tables[self.tableName][key].type === 'bool') { attrs[key] = value ? true : false; } }); return attrs; }
javascript
function fixBools(attrs) { var self = this; _.each(attrs, function each(value, key) { if (schema.tables[self.tableName].hasOwnProperty(key) && schema.tables[self.tableName][key].type === 'bool') { attrs[key] = value ? true : false; } }); return attrs; }
[ "function", "fixBools", "(", "attrs", ")", "{", "var", "self", "=", "this", ";", "_", ".", "each", "(", "attrs", ",", "function", "each", "(", "value", ",", "key", ")", "{", "if", "(", "schema", ".", "tables", "[", "self", ".", "tableName", "]", ...
Convert integers to real booleans
[ "Convert", "integers", "to", "real", "booleans" ]
bb7bb55cf3e60af99ebbc56099928827b58461bc
https://github.com/TryGhost/Ghost/blob/bb7bb55cf3e60af99ebbc56099928827b58461bc/core/server/models/base/index.js#L488-L498
train
Fix bools in the attrs object
[ 30522, 3853, 8081, 5092, 27896, 1006, 2012, 16344, 2015, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 1035, 1012, 2169, 1006, 2012, 16344, 2015, 1010, 3853, 2169, 1006, 3643, 1010, 3145, 1007, 1063, 2065, 1006, 8040, 28433, 1012, 7251, 1031, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableUtils.js
function(oTable) { return (oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowOnly) || TableGrouping.isGroupMode(oTable); }
javascript
function(oTable) { return (oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowOnly) || TableGrouping.isGroupMode(oTable); }
[ "function", "(", "oTable", ")", "{", "return", "(", "oTable", ".", "getSelectionMode", "(", ")", "!==", "SelectionMode", ".", "None", "&&", "oTable", ".", "getSelectionBehavior", "(", ")", "!==", "SelectionBehavior", ".", "RowOnly", ")", "||", "TableGrouping",...
Returns whether the table has row header cells. @param {sap.ui.table.Table} oTable Instance of the table. @returns {boolean} Whether the table has row header cells.
[ "Returns", "whether", "the", "table", "has", "row", "header", "cells", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableUtils.js#L235-L238
train
Returns true if the table is row only or not.
[ 30522, 3853, 1006, 27178, 3085, 1007, 1063, 2709, 1006, 27178, 3085, 1012, 4152, 12260, 7542, 5302, 3207, 1006, 1007, 999, 1027, 1027, 4989, 5302, 3207, 1012, 3904, 1004, 1004, 27178, 3085, 1012, 4152, 12260, 7542, 4783, 3270, 25500, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
angular/material
src/components/virtualRepeat/virtual-repeater.js
VirtualRepeatContainerDirective
function VirtualRepeatContainerDirective() { return { controller: VirtualRepeatContainerController, template: virtualRepeatContainerTemplate, compile: function virtualRepeatContainerCompile($element, $attrs) { $element .addClass('md-virtual-repeat-container') .addClass($attrs.hasOwnProperty('mdOrientHorizontal') ? 'md-orient-horizontal' : 'md-orient-vertical'); } }; }
javascript
function VirtualRepeatContainerDirective() { return { controller: VirtualRepeatContainerController, template: virtualRepeatContainerTemplate, compile: function virtualRepeatContainerCompile($element, $attrs) { $element .addClass('md-virtual-repeat-container') .addClass($attrs.hasOwnProperty('mdOrientHorizontal') ? 'md-orient-horizontal' : 'md-orient-vertical'); } }; }
[ "function", "VirtualRepeatContainerDirective", "(", ")", "{", "return", "{", "controller", ":", "VirtualRepeatContainerController", ",", "template", ":", "virtualRepeatContainerTemplate", ",", "compile", ":", "function", "virtualRepeatContainerCompile", "(", "$element", ","...
@ngdoc directive @name mdVirtualRepeatContainer @module material.components.virtualRepeat @restrict E @description `md-virtual-repeat-container` provides the scroll container for <a ng-href="api/directive/mdVirtualRepeat">md-virtual-repeat</a>. VirtualRepeat is a limited substitute for `ng-repeat` that renders only enough DOM nodes to fill the container, recycling them as the user scrolls. Once an element is not visible anymore, the Virtual Repeat recycles the element and reuses it for another visible item by replacing the previous data set with the set of currently visible elements. ### Common Issues - When having one-time bindings inside of the view template, the Virtual Repeat will not properly update the bindings for new items, since the view will be recycled. - Directives inside of a Virtual Repeat will be only compiled (linked) once, because those items will be recycled and used for other items. The Virtual Repeat just updates the scope bindings. ### Notes > The VirtualRepeat is a similar implementation to the Android [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html). <!-- This comment forces a break between blockquotes //--> > Please also review the <a ng-href="api/directive/mdVirtualRepeat">mdVirtualRepeat</a> documentation for more information. @usage <hljs lang="html"> <md-virtual-repeat-container md-top-index="topIndex"> <div md-virtual-repeat="i in items" md-item-size="20">Hello {{i}}!</div> </md-virtual-repeat-container> </hljs> @param {boolean=} md-auto-shrink When present and the container will shrink to fit the number of items in the `md-virtual-repeat`. @param {number=} md-auto-shrink-min Minimum number of items that md-auto-shrink will shrink to. Default: `0`. @param {boolean=} md-orient-horizontal Whether the container should scroll horizontally. The default is `false` which indicates vertical orientation and scrolling. @param {number=} md-top-index Binds the index of the item that is at the top of the scroll container to `$scope`. It can both read and set the scroll position.
[ "@ngdoc", "directive", "@name", "mdVirtualRepeatContainer", "@module", "material", ".", "components", ".", "virtualRepeat", "@restrict", "E", "@description", "md", "-", "virtual", "-", "repeat", "-", "container", "provides", "the", "scroll", "container", "for", "<a"...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/virtualRepeat/virtual-repeater.js#L67-L79
train
Virtual repeat container directive
[ 30522, 3853, 7484, 2890, 5051, 4017, 8663, 18249, 2121, 4305, 2890, 15277, 1006, 1007, 1063, 2709, 1063, 11486, 1024, 7484, 2890, 5051, 4017, 8663, 18249, 2121, 8663, 13181, 10820, 1010, 23561, 1024, 7484, 2890, 5051, 4017, 8663, 18249, 874...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util/source-code.js
validate
function validate(ast) { if (!ast.tokens) { throw new Error("AST is missing the tokens array."); } if (!ast.comments) { throw new Error("AST is missing the comments array."); } if (!ast.loc) { throw new Error("AST is missing location information."); } if (!ast.range) { throw new Error("AST is missing range information"); } }
javascript
function validate(ast) { if (!ast.tokens) { throw new Error("AST is missing the tokens array."); } if (!ast.comments) { throw new Error("AST is missing the comments array."); } if (!ast.loc) { throw new Error("AST is missing location information."); } if (!ast.range) { throw new Error("AST is missing range information"); } }
[ "function", "validate", "(", "ast", ")", "{", "if", "(", "!", "ast", ".", "tokens", ")", "{", "throw", "new", "Error", "(", "\"AST is missing the tokens array.\"", ")", ";", "}", "if", "(", "!", "ast", ".", "comments", ")", "{", "throw", "new", "Error"...
------------------------------------------------------------------------------ Private ------------------------------------------------------------------------------ Validates that the given AST has the required information. @param {ASTNode} ast The Program node of the AST to check. @throws {Error} If the AST doesn't contain the correct information. @returns {void} @private
[ "------------------------------------------------------------------------------", "Private", "------------------------------------------------------------------------------", "Validates", "that", "the", "given", "AST", "has", "the", "required", "information", "." ]
bc0819c94aad14f7fad3cbc2338ea15658b0f272
https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/util/source-code.js#L27-L43
train
Validate the AST
[ 30522, 3853, 9398, 3686, 1006, 2004, 2102, 1007, 1063, 2065, 1006, 999, 2004, 2102, 1012, 19204, 2015, 1007, 1063, 5466, 2047, 7561, 1006, 1000, 2004, 2102, 2003, 4394, 1996, 19204, 2015, 9140, 1012, 1000, 1007, 1025, 1065, 2065, 1006, 99...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
airyland/vux
src/components/clocker/clocker.js
function (finalDate, option) { option = option || {} this.PRECISION = option.precision || 100 // 0.1 seconds, used to update the DOM this.interval = null this.offset = {} // Register this instance this.instanceNumber = instances.length instances.push(this) // Set the final date and start this.setFinalDate(finalDate) }
javascript
function (finalDate, option) { option = option || {} this.PRECISION = option.precision || 100 // 0.1 seconds, used to update the DOM this.interval = null this.offset = {} // Register this instance this.instanceNumber = instances.length instances.push(this) // Set the final date and start this.setFinalDate(finalDate) }
[ "function", "(", "finalDate", ",", "option", ")", "{", "option", "=", "option", "||", "{", "}", "this", ".", "PRECISION", "=", "option", ".", "precision", "||", "100", "// 0.1 seconds, used to update the DOM", "this", ".", "interval", "=", "null", "this", "....
The Final Countdown
[ "The", "Final", "Countdown" ]
484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6
https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/src/components/clocker/clocker.js#L143-L153
train
Constructor for the DOM node
[ 30522, 3853, 1006, 2345, 13701, 1010, 5724, 1007, 1063, 5724, 1027, 5724, 1064, 1064, 1063, 1065, 2023, 1012, 11718, 1027, 5724, 1012, 11718, 1064, 1064, 2531, 1013, 1013, 1014, 1012, 1015, 3823, 1010, 2109, 2000, 10651, 1996, 14383, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
google/closure-library
closure/goog/html/sanitizer/noclobber.js
getterOrNull
function getterOrNull(className, property) { var ctor = goog.global[className]; if (!ctor || !ctor.prototype) { return null; } var descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, property); return (descriptor && descriptor.get) || null; }
javascript
function getterOrNull(className, property) { var ctor = goog.global[className]; if (!ctor || !ctor.prototype) { return null; } var descriptor = Object.getOwnPropertyDescriptor(ctor.prototype, property); return (descriptor && descriptor.get) || null; }
[ "function", "getterOrNull", "(", "className", ",", "property", ")", "{", "var", "ctor", "=", "goog", ".", "global", "[", "className", "]", ";", "if", "(", "!", "ctor", "||", "!", "ctor", ".", "prototype", ")", "{", "return", "null", ";", "}", "var", ...
Note about browser support: - IE 8 and 9 don't have DOM prototypes. There is no simple way of saving the methods and accessors for a clobber-safe call. - Chrome <43 doesn't have attributes on DOM prototypes, so there is no way of making clobber-safe calls for attribute descriptors. - IE 8 and 9 don't even have Node and HTMLElement, so there is no straightforward way of checking if the result was clobbered for many of the methods. - IE 8 and 9 have alternate names for getPropertyValue/setProperty in CSSStyleDeclaration. For simplicity, we don't support IE 8 and 9 for anything but the CSS methods which already had IE8 and IE9 support. Chrome 41 must still be supported. Shorthand for `Object.getOwnPropertyDescriptor(...).get` to improve readability during initialization of `Methods`. @param {string} className @param {string} property @return {?Function}
[ "Note", "about", "browser", "support", ":", "-", "IE", "8", "and", "9", "don", "t", "have", "DOM", "prototypes", ".", "There", "is", "no", "simple", "way", "of", "saving", "the", "methods", "and", "accessors", "for", "a", "clobber", "-", "safe", "call"...
97390e9ca4483cebb9628e06026139fbb3023d65
https://github.com/google/closure-library/blob/97390e9ca4483cebb9628e06026139fbb3023d65/closure/goog/html/sanitizer/noclobber.js#L57-L64
train
Returns the getter of the given property.
[ 30522, 3853, 2131, 3334, 9691, 18083, 1006, 2465, 18442, 1010, 3200, 1007, 1063, 13075, 14931, 2953, 1027, 27571, 2290, 1012, 3795, 1031, 2465, 18442, 1033, 1025, 2065, 1006, 999, 14931, 2953, 1064, 1064, 999, 14931, 2953, 1012, 8773, 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...
aws/aws-sdk-js
scripts/lib/translator.js
Translator
function Translator(api, options) { var origLength = JSON.stringify(api, null, 2).length; var debugInfo = {flattened: {}, pruned: {}}; var shapeName = 'S0'; var shapeNameMap = {}; var visitedShapes = {}; function logResults() { console.log('** Generated', api.metadata.endpointPrefix + '-' + api.metadata.apiVersion +'.min.json' + (process.env.DEBUG ? ':' : '')); if (process.env.DEBUG) { var pruned = Object.keys(debugInfo.pruned); var flattened = Object.keys(debugInfo.flattened); var newLength = JSON.stringify(api, null, 2).length; console.log('- Pruned Shapes:', pruned.length); console.log('- Flattened Shapes:', flattened.length); console.log('- Remaining Shapes:', Object.keys(api.shapes).length); console.log('- Original Size:', origLength / 1024.0, 'kb'); console.log('- Minified Size:', newLength / 1024.0, 'kb'); console.log('- Size Saving:', (origLength - newLength) / 1024.0, 'kb'); console.log(''); } } function deleteTraits(obj) { if (!options.documentation) { delete obj.documentation; delete obj.documentationUrl; delete obj.errors; delete obj.min; delete obj.max; delete obj.pattern; delete obj['enum']; delete obj.box; } } function trackShapeDeclaration(ref) { if (ref.shape && !shapeNameMap[ref.shape]) { // found a shape declaration we have not yet visited. // assign a new generated name in the shapeNameMap & visit it var oldShapeName = ref.shape; ref.shape = shapeName = nextString(shapeName); visitedShapes[shapeName] = api.shapes[oldShapeName]; shapeNameMap[oldShapeName] = {name: shapeName, refs: [ref]}; traverseShapeRef(api.shapes[oldShapeName]); } else if (ref.shape && shapeNameMap[ref.shape]) { // we visited this shape before. keep track of this ref and rename // the referenced declaration to the generated name var map = shapeNameMap[ref.shape]; map.refs.push(ref); ref.shape = map.name; } } function pruneShapes() { // prune shapes visited only once or only have type specifiers each(shapeNameMap, function(name, map) { if (Object.keys(visitedShapes[map.name]).join() === 'type' && ['structure','map','list'].indexOf(visitedShapes[map.name].type) < 0) { // flatten out the shape (only a scalar type property is on the shape) for (var i = 0; i < map.refs.length; i++) { var ref = map.refs[i]; debugInfo.flattened[name] = true; delete ref.shape; ref.type = visitedShapes[map.name].type; // string type is default, don't need to specify this if (ref.type === 'string') delete ref.type; } // we flattened all refs, we can prune the shape too delete visitedShapes[map.name]; debugInfo.pruned[name] = true; } else if (map.refs.length === 1) { // only visited once // merge shape data onto ref var shape = visitedShapes[map.name]; for (var i = 0; i < map.refs.length; i++) { delete map.refs[i].shape; for (var prop in shape) { if (shape.hasOwnProperty(prop)) { //Translator prefers timestampFormat trait in members rather than in shape if (map.refs[i].hasOwnProperty(prop) && ['timestampFormat'].indexOf(prop) >= 0) { continue; } map.refs[i][prop] = shape[prop]; } } } // delete the visited shape delete visitedShapes[map.name]; debugInfo.pruned[name] = true; } }); } function traverseShapeRef(ref) { if (!ref) return; deleteTraits(ref); traverseShapeRef(ref.key); // for maps traverseShapeRef(ref.value); // for maps traverseShapeRef(ref.member); // for lists // for structures each(ref.members || {}, function(key, value) { traverseShapeRef(value); }); // resolve shape declarations trackShapeDeclaration(ref); } function traverseOperation(op) { deleteTraits(op); delete op.name; if (op.http) { if (op.http.method === 'POST') delete op.http.method; if (op.http.requestUri === '/') delete op.http.requestUri; if (Object.keys(op.http).length === 0) delete op.http; } traverseShapeRef(op.input); traverseShapeRef(op.output); } function traverseApi() { deleteTraits(api); each(api.operations, function(name, op) { traverseOperation(op); }); api.shapes = visitedShapes; } traverseApi(); pruneShapes(); logResults(); return api; }
javascript
function Translator(api, options) { var origLength = JSON.stringify(api, null, 2).length; var debugInfo = {flattened: {}, pruned: {}}; var shapeName = 'S0'; var shapeNameMap = {}; var visitedShapes = {}; function logResults() { console.log('** Generated', api.metadata.endpointPrefix + '-' + api.metadata.apiVersion +'.min.json' + (process.env.DEBUG ? ':' : '')); if (process.env.DEBUG) { var pruned = Object.keys(debugInfo.pruned); var flattened = Object.keys(debugInfo.flattened); var newLength = JSON.stringify(api, null, 2).length; console.log('- Pruned Shapes:', pruned.length); console.log('- Flattened Shapes:', flattened.length); console.log('- Remaining Shapes:', Object.keys(api.shapes).length); console.log('- Original Size:', origLength / 1024.0, 'kb'); console.log('- Minified Size:', newLength / 1024.0, 'kb'); console.log('- Size Saving:', (origLength - newLength) / 1024.0, 'kb'); console.log(''); } } function deleteTraits(obj) { if (!options.documentation) { delete obj.documentation; delete obj.documentationUrl; delete obj.errors; delete obj.min; delete obj.max; delete obj.pattern; delete obj['enum']; delete obj.box; } } function trackShapeDeclaration(ref) { if (ref.shape && !shapeNameMap[ref.shape]) { // found a shape declaration we have not yet visited. // assign a new generated name in the shapeNameMap & visit it var oldShapeName = ref.shape; ref.shape = shapeName = nextString(shapeName); visitedShapes[shapeName] = api.shapes[oldShapeName]; shapeNameMap[oldShapeName] = {name: shapeName, refs: [ref]}; traverseShapeRef(api.shapes[oldShapeName]); } else if (ref.shape && shapeNameMap[ref.shape]) { // we visited this shape before. keep track of this ref and rename // the referenced declaration to the generated name var map = shapeNameMap[ref.shape]; map.refs.push(ref); ref.shape = map.name; } } function pruneShapes() { // prune shapes visited only once or only have type specifiers each(shapeNameMap, function(name, map) { if (Object.keys(visitedShapes[map.name]).join() === 'type' && ['structure','map','list'].indexOf(visitedShapes[map.name].type) < 0) { // flatten out the shape (only a scalar type property is on the shape) for (var i = 0; i < map.refs.length; i++) { var ref = map.refs[i]; debugInfo.flattened[name] = true; delete ref.shape; ref.type = visitedShapes[map.name].type; // string type is default, don't need to specify this if (ref.type === 'string') delete ref.type; } // we flattened all refs, we can prune the shape too delete visitedShapes[map.name]; debugInfo.pruned[name] = true; } else if (map.refs.length === 1) { // only visited once // merge shape data onto ref var shape = visitedShapes[map.name]; for (var i = 0; i < map.refs.length; i++) { delete map.refs[i].shape; for (var prop in shape) { if (shape.hasOwnProperty(prop)) { //Translator prefers timestampFormat trait in members rather than in shape if (map.refs[i].hasOwnProperty(prop) && ['timestampFormat'].indexOf(prop) >= 0) { continue; } map.refs[i][prop] = shape[prop]; } } } // delete the visited shape delete visitedShapes[map.name]; debugInfo.pruned[name] = true; } }); } function traverseShapeRef(ref) { if (!ref) return; deleteTraits(ref); traverseShapeRef(ref.key); // for maps traverseShapeRef(ref.value); // for maps traverseShapeRef(ref.member); // for lists // for structures each(ref.members || {}, function(key, value) { traverseShapeRef(value); }); // resolve shape declarations trackShapeDeclaration(ref); } function traverseOperation(op) { deleteTraits(op); delete op.name; if (op.http) { if (op.http.method === 'POST') delete op.http.method; if (op.http.requestUri === '/') delete op.http.requestUri; if (Object.keys(op.http).length === 0) delete op.http; } traverseShapeRef(op.input); traverseShapeRef(op.output); } function traverseApi() { deleteTraits(api); each(api.operations, function(name, op) { traverseOperation(op); }); api.shapes = visitedShapes; } traverseApi(); pruneShapes(); logResults(); return api; }
[ "function", "Translator", "(", "api", ",", "options", ")", "{", "var", "origLength", "=", "JSON", ".", "stringify", "(", "api", ",", "null", ",", "2", ")", ".", "length", ";", "var", "debugInfo", "=", "{", "flattened", ":", "{", "}", ",", "pruned", ...
/* End utility methods
[ "/", "*", "End", "utility", "methods" ]
c23e5f0edd150f8885267e5f7c8a564f8e6e8562
https://github.com/aws/aws-sdk-js/blob/c23e5f0edd150f8885267e5f7c8a564f8e6e8562/scripts/lib/translator.js#L15-L158
train
Translator function for the given API
[ 30522, 3853, 11403, 1006, 17928, 1010, 7047, 1007, 1063, 13075, 30524, 1025, 13075, 4338, 18442, 1027, 1005, 1055, 2692, 1005, 1025, 13075, 4338, 18442, 2863, 2361, 1027, 1063, 1065, 1025, 13075, 4716, 7377, 10374, 1027, 1063, 1065, 1025, 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...