Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
check if green icon exists remove it
function handleInvalidInputStyle(inputField, i) { if (i.classList.contains(checkIcon)) { i.classList.remove(checkIcon); inputField.classList.remove("green-border"); } i.classList.add(errorIcon, "red"); inputField.classList.add("red-border"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeIcon() {\n var classes = document.querySelector('.main-weather-icon').classList;\n classes.forEach(function (value) {\n if (value.indexOf('wi-owm-') === 0) {\n classes.remove(value);\n }\n });\n }", "function clear(codes) {\n var icon;\n if (codes.w...
[ "0.6873023", "0.6596962", "0.6459816", "0.6385248", "0.63440305", "0.6327116", "0.6281128", "0.6258033", "0.6080591", "0.60659367", "0.6024034", "0.5996016", "0.59885424", "0.5977781", "0.596051", "0.5931155", "0.59262556", "0.59061986", "0.5873234", "0.5866722", "0.5842173",...
0.0
-1
requires a boxObj with the main dialogue window, and a max of 3 dialogue options for the character. Also requires a stringObj with the text for the NPC, and the player object text
function dialogueBoxes(boxObj, string, leftOffset, topOffset, size, ctx, textColor) { button.render(boxObj) wrapText( ctx, string.toString(), boxObj.left + leftOffset, boxObj.top + topOffset, boxObj.right - boxObj.left - 30, 50, size, textColor ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createPlayerOneDialog() {\n this.playerOneDialog = new Dialog({\n game: this.game,\n parent: this.game.world,\n name: 'player-one-dialog',\n options: {\n mainTextString: this.game.world.store.match.uid,\n secondaryTextString: `send this match id to a buddy${'\\n'}(they gotta pi...
[ "0.664677", "0.63976127", "0.6198172", "0.6083115", "0.5990981", "0.59305096", "0.58780956", "0.58722365", "0.5835621", "0.58279914", "0.57722867", "0.5729465", "0.5729293", "0.57028335", "0.5695204", "0.5682242", "0.56712484", "0.56617755", "0.5656474", "0.56164366", "0.5601...
0.62166345
2
x, and y can be anything... but maxWidth should not be the right side of your rectangle.
function wrapText(ctx, text, x, y, maxWidth, lineHeight, size, color) { var words = text.split(" "); var line = ""; ctx.font = size + "pt arial"; ctx.fillStyle = color; for (var n = 0; n < words.length; n++) { var testLine = line + words[n] + " "; var metrics = ctx.measureText(testLine); var testWidth = Math.abs(metrics.actualBoundingBoxLeft) + Math.abs(metrics.actualBoundingBoxRight); if (testWidth > maxWidth && n > 0) { ctx.fillText(line, x, y); line = words[n] + " "; y += lineHeight; } else { line = testLine; } } ctx.fillText(line, x, y); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleWrapping() {\n // Off the left or right\n if (this.x < 0) {\n this.x += width;\n }\n else if (this.x > width) {\n this.x -= width;\n }\n constrain(this.y, 0, height);\n }", "constrain(x, y, scale) {\n scale || (scale = this.state.scale);\n\n if (this.state.size.width * sc...
[ "0.6698688", "0.65038264", "0.649497", "0.63847077", "0.63452333", "0.62611157", "0.6204067", "0.6187502", "0.6127468", "0.612503", "0.6111942", "0.6104942", "0.6099007", "0.60744506", "0.60655034", "0.6045468", "0.5999384", "0.5980415", "0.5974906", "0.5963732", "0.59569883"...
0.0
-1
Launches Dynamics NAV desktop client and waits for it to show up on screen.
function NavLaunch() { function _NavIsRunning() { var windows = g_util.FindWindows("regex:.*Microsoft Dynamics NAV", "regex:WindowsForms10.*"); return windows.length > 0; } function _MaximizeNav() { var windows = g_util.FindWindows("regex:.*Microsoft Dynamics NAV", "regex:WindowsForms10.*"); if (windows.length > 0) { windows[0].Maximized = true; } } if (_NavIsRunning()) { Tester.Message("Dynamics NAV Client is already running"); if (!g_inTestSet) { return true; } } var pfFolder = Global.GetSpecialFolderPath("ProgramFilesX86"); var dynamicsPath100 = pfFolder + "\\Microsoft Dynamics NAV\\100\\RoleTailored Client\\Microsoft.Dynamics.Nav.Client.exe"; var dynamicsPath110 = pfFolder + "\\Microsoft Dynamics NAV\\110\\RoleTailored Client\\Microsoft.Dynamics.Nav.Client.exe"; var pathOptions = [dynamicsPath100, dynamicsPath110]; var dynamicsPath = null; for(var i = 0; i < pathOptions.length; i++) { var path = pathOptions[i]; Log("Checking " + path); if (File.Exists(path)) { dynamicsPath = path; break; } } if(!dynamicsPath) { Tester.Message("Dynamics NAV Client is not installed on this computer"); return false; } if (_NavIsRunning() && g_inTestSet) { Global.DoKillByName('Microsoft.Dynamics.Nav.Client.exe'); } Tester.Message("Dynamics NAV Client is not started."); Global.DoLaunch(dynamicsPath); // Waiting for NAV to start for(var i = 0; i < 60; i++) { var _windows = g_util.FindWindows("regex:.*Microsoft Dynamics NAV", "regex:WindowsForms10.*"); if (_windows.length > 0) { var _wnd = _windows[0]; var uiaObj = SeSGetUIAutomationObject(_wnd); var toolBar = g_UIAutomationWrapper.FindElementByPropertyValue(uiaObj, 4, "AutomationElementIdentifiers.ControlTypeProperty", "ToolBar"); if (toolBar) { _MaximizeNav(); return true; } } Global.DoSleep(1000); } Tester.Message("Dynamics NAV Client did not start"); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDialog() {\r\n\t// set server to appropriate value\r\n\tserver = window.arguments[0];\r\n\t\r\n\t// generate step list\r\n\tsetSteps();\r\n\t\r\n\t// move to center of parent window\r\n\tcenterWindowOnScreen();\r\n}", "function runDesktop() {\n distributor.run();\n bindMenu();\n }", "funct...
[ "0.6000005", "0.59584874", "0.5937641", "0.58792377", "0.58649707", "0.5819533", "0.58167946", "0.5781655", "0.57457465", "0.5722296", "0.57198775", "0.5685828", "0.56280863", "0.56045866", "0.5596938", "0.5590635", "0.55841815", "0.55714834", "0.55663425", "0.5483654", "0.54...
0.67304164
0
Returns NAV version (2017 100, 2018 110)
function NavVersion() { var pfFolder = Global.GetSpecialFolderPath("ProgramFilesX86"); var dynamicsPath100 = pfFolder + "\\Microsoft Dynamics NAV\\100\\RoleTailored Client\\Microsoft.Dynamics.Nav.Client.exe"; var dynamicsPath110 = pfFolder + "\\Microsoft Dynamics NAV\\110\\RoleTailored Client\\Microsoft.Dynamics.Nav.Client.exe"; if (File.Exists(dynamicsPath110)) { return 110; } return 100; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getVersion() {\n return this.get('pdb/meta/v1/version');\n }", "function getVersion(){return _VERSION}", "getVersion() {\n return this.version.split(this.seperator).slice(0, 3).join(this.seperator);\n }", "function getVersion(){\n return version;\n }", "function mirrorbrain_getV...
[ "0.6730418", "0.664479", "0.6611412", "0.65533495", "0.64958006", "0.62962997", "0.62794346", "0.6229501", "0.62173635", "0.6127776", "0.6124941", "0.60970175", "0.60622567", "0.6057409", "0.6036838", "0.60245293", "0.6015456", "0.5989351", "0.597836", "0.5933121", "0.5933121...
0.63760287
5
Closes Dynamics NAV desktop client.
function NavClose() { SeS("G_CloseNav").DoClick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CloseConnectionHandler()\n{\n\tif(null != g_oSAFRemoteDesktopClient)\n\t{\n\t\tg_oSAFRemoteDesktopClient.DisConnectRemoteDesktop();\n\t}\n}", "close() {\n fidl.ProtocolClient.close(this._pathClient);\n }", "close() {\n\n if (this.onClose) {\n setTimeout(() => {\n t...
[ "0.689827", "0.6757282", "0.66361046", "0.64057153", "0.63511354", "0.6245412", "0.62138325", "0.6129813", "0.6124731", "0.6105676", "0.61042273", "0.60963506", "0.6082997", "0.6070551", "0.60434043", "0.60210997", "0.60125107", "0.59882766", "0.5984562", "0.5963501", "0.5953...
0.0
-1
Navigates to a specific page using address bar.
function NavNavigate(/**string*/ page, /**string*/ company) { SeS("G_AddressBar").DoClick(); var addressEdit = SeS("G_AddressEdit"); if (!company) { var currentPage = "" + addressEdit.GetText(); company = currentPage.split("/")[0]; } addressEdit.DoSetText(company + "/" + page); addressEdit.DoSendKeys("{ENTER}"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goToPage( pageName, config )\n {\n // If no pages, just go to home\n if( pageName.length === 0 )\n return;\n \n // Add current state to history\n if( window.history.pushState && config.useHistory )\n window.history.pushState( { page: pageName }, ...
[ "0.7030589", "0.6728481", "0.6667955", "0.64770085", "0.6449415", "0.6408263", "0.63698643", "0.634865", "0.634487", "0.62852246", "0.6268784", "0.62497514", "0.6243622", "0.6242361", "0.6225444", "0.6184733", "0.6175121", "0.61739886", "0.61647666", "0.61331207", "0.61116034...
0.67993087
1
Applies a filter to table data.
function NavFilterGrid(/**string*/ value, /**string*/ field) { if (!value) { LogAssert("NavFilterGrid: value is not set"); return; } if (!field) { LogAssert("NavFilterGrid: field is not set"); return; } SeS("G_FilterValue").DoClick(); SeS("G_FilterValue").DoSetText(value); SeS("G_FilterOpen").DoClick(); SeS("G_FilterDropDown").DoSelectItem(field); SeS("G_FilterApply").DoClick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterTable() {\n \n // 8. Set the filtered data to the tableData.\n var filterData = tableData\n \n // 9. Loop through all of the filters and keep any data that\n // matches the filter values\n Object.entries(dataFilter).forEach(([key, value])=>{\n filterData = filterData.filter(r...
[ "0.75973594", "0.7070443", "0.69540876", "0.6901481", "0.6877683", "0.6804805", "0.6795132", "0.67791307", "0.6707717", "0.6683838", "0.66523194", "0.6597533", "0.6552523", "0.6536657", "0.65260494", "0.6516366", "0.64702713", "0.64654106", "0.6413455", "0.63701373", "0.63606...
0.0
-1
Selects Fast Tab with a given name.
function NavSelectFastTab(/**string*/ tab, /**boolean*/ toggleAdditionalFields, /**string*/ additionalFieldsButtonName) { if (!tab) { LogAssert("NavSelectFastTab: tab is not set"); return; } var windows = g_util.FindWindows("regex:.*", "regex:WindowsForms10.*"); if (windows.length > 0) { for(var i = 0; i < windows.length; i++) { var wnd = windows[i]; if (wnd.ProcessName.indexOf("Microsoft.Dynamics.Nav.Client") != -1) { var windowName = wnd.Text; Log(windowName); var ae = SeSGetUIAutomationObject(wnd); if (ae) { var obj = SeSUIAutomationFindByAutomationId(ae, "ContentPlaceholder", DynamicsNAVFastTabsRule); if (obj) { obj.DoSelectTab(tab, toggleAdditionalFields, additionalFieldsButtonName); return; } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jscoverage_selectTab(tab) {\n\t$(tab).tab('show');\n}", "function selectTab( name ) {\n\n // Get all elements with class=\"tabcontent\" and hide them\n\n let tabcontent = document.getElementsByClassName(\"tabcontent\");\n\n for (let i = 0; i < tabcontent.length; i++) {\n if ( tabcontent[i]...
[ "0.70152086", "0.68212795", "0.6809615", "0.6603124", "0.6571218", "0.6571218", "0.6546387", "0.65253663", "0.6461223", "0.63936466", "0.6258325", "0.62546784", "0.61930007", "0.6180969", "0.6179517", "0.61211926", "0.60409516", "0.60393304", "0.60382205", "0.60322106", "0.60...
0.6543697
7
Maximizes window with a given object.
function NavMaximizeWindow(/**objectId*/ objectId) { SeS(objectId).getDesktopWindow().Maximized = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async maximizeWindow() {\n return this.resizeWindow();\n }", "function constrain(obj) {\n if (obj.x < 0) {\n obj.x = 0;\n //the five comes from the border width\n } else if (obj.x > windowX - obj.diameter - 5) {\n obj.x = windowX - obj.diameter - 5;\n }\n if (obj.y...
[ "0.59619653", "0.58762854", "0.58754814", "0.58564436", "0.5752497", "0.5654529", "0.56461996", "0.5621655", "0.5621655", "0.5621655", "0.5620569", "0.55897766", "0.55318266", "0.550819", "0.54425085", "0.54362637", "0.5400215", "0.539367", "0.5359999", "0.5345955", "0.533755...
0.6621788
0
Builds full file path.
function NavMakeFileName(/**string*/ root, /**string*/ baseName, /**string*/ number, /**string*/ extension) { return root + "\\" + baseName + number + "." + extension; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static FilePath(file) {\n\t\tfile = file.charAt(0) == \"/\" ? file.substr(1) : file;\n\t\t\n\t\tvar path = [Net.AppPath(), file];\n\t\t\t\t\n\t\treturn path.join(\"/\");\n\t}", "function fullyQualifiedPath(filename) {\n\treturn path.join(OTRTALK_ROOT, filename);\n}", "get fullPath() {\n return path.join...
[ "0.6890731", "0.6834741", "0.6696569", "0.66571444", "0.65933967", "0.6580046", "0.65006447", "0.6359272", "0.62721187", "0.6223872", "0.6173546", "0.6162433", "0.6151421", "0.61438316", "0.60890055", "0.60409427", "0.6025332", "0.6024435", "0.5931289", "0.59081966", "0.58922...
0.0
-1
Prints/saves document to PDF into OutputFiles folder.
function NavPrintPdf(/**string*/ baseName, /**string*/ number) { SeS('G_PrintMenu').DoClick(); SeS('G_PDFMenuItem').DoClick(); SeS('G_SavePrintedDocument').DoClick(); var outputFolder = Global.GetFullPath("OutputFiles"); var filePath = NavMakeFileName(outputFolder, baseName, number, "pdf"); Tester.Message("Printing file: " + filePath); SeS('G_SaveDialogFileName').DoSendKeys(filePath); SeS('G_SaveDialogSaveButton').DoClick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save_pdf () {\n this.pdf_canvass.save(\"offer_tag_document.pdf\"); // will save the file in the current working directory\n\t}", "function RenderPdf() {\n console.log(\"Writing file....\");\n conversion({\n html: dataContent,\n pdf: {\n pageSize: 'Letter',\n print...
[ "0.66669685", "0.6274513", "0.62232", "0.60531455", "0.5991982", "0.5874803", "0.5874803", "0.5780644", "0.5668605", "0.5661981", "0.5573991", "0.55679095", "0.5554109", "0.551543", "0.5482569", "0.547929", "0.5430002", "0.5394576", "0.537884", "0.5373136", "0.53509504", "0...
0.6216627
3
Ensures that specific columns are visible. When you call this function the grid should be visible on screen.
function NavAddColumns(/**objectId*/ grid, /**string*/ list) { SeS(grid).DoRClick(); SeS("G_Choose_Columns").DoClick(); var items = list.split(","); for(var i = 0; i < items.length; i++) { var item = Global.DoTrim(items[i]); var columns = SeS('G_Available_Columns'); var index = columns.GetItemIndexByName(item); if (index >= 0) { columns.DoSelectItem(item); SeS('G_Add_Column').DoClick(); } } SeS('G_Columns_OK').DoClick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set visibleColumns(visibleColumns) {\n this._visibleColumns = visibleColumns;\n }", "get visibleColumns() {\n return this._visibleColumns;\n }", "function setColumnVisibility(columns,index,visible) {\n if(index<columns.length) {\n columns[index].visible = visible;\n }\n}", "f...
[ "0.7021732", "0.6973777", "0.69236207", "0.6890815", "0.67806596", "0.6661221", "0.66592777", "0.66036105", "0.6538971", "0.64363", "0.6370961", "0.63411266", "0.6324636", "0.6324636", "0.6254044", "0.62467706", "0.6231791", "0.6197518", "0.617568", "0.6136398", "0.6096665", ...
0.0
-1
Ensures that specific columns are NOT visible. When you call this function the grid should be visible on screen.
function NavRemoveColumns(/**objectId*/ grid, /**string*/ list) { SeS(grid).DoRClick(); SeS("G_Choose_Columns").DoClick(); var items = list.split(","); for(var i = 0; i < items.length; i++) { var item = Global.DoTrim(items[i]); var columns = SeS('G_Show_Columns'); var index = columns.GetItemIndexByName(item); if (index >= 0) { columns.DoSelectItem(item); SeS('G_Remove_Column').DoClick(); } } SeS('G_Columns_OK').DoClick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hideAllColumns(){\n\t\t\tthis.properties.forEach(function(entry){\n\t\t\t\tset(entry,'isVisible',false);\n\t\t\t});\n\t\t\tthis.handleVisibility(true);\n\t\t}", "function setGridInvisible() {\n grid.style.transition = \"none\";\n grid.style.visibility = \"hidden\";\n}", "function assert_visible_columns(aDesi...
[ "0.7009665", "0.671849", "0.6489299", "0.64390415", "0.64261806", "0.6304309", "0.6280371", "0.61885625", "0.61707515", "0.61495924", "0.61414665", "0.6080789", "0.6059737", "0.602183", "0.6007481", "0.5974017", "0.5955304", "0.59128755", "0.58927566", "0.5882405", "0.5880194...
0.0
-1
Writes key/value pair to Output.xlsx
function SetOutputValue(/**string*/ key, /**string*/ value) { Global.SetProperty(key, value, "%WORKDIR%\\Output.xlsx"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetOutputValue(/**string*/ key, /**string*/ defValue)\r\n{\r\n\treturn Global.GetProperty(key, defValue, \"%WORKDIR%\\\\Output.xlsx\");\r\n}", "function GetOutputValue(/**string*/ key, /**string*/ defValue)\r\n{\r\n\treturn Global.GetProperty(key, defValue, \"%WORKDIR%\\\\Output.xlsx\");\r\n}", "funct...
[ "0.5967647", "0.5967647", "0.5960251", "0.5863578", "0.5754181", "0.56086296", "0.5566769", "0.5564454", "0.5519575", "0.55006504", "0.5472677", "0.5408666", "0.5376704", "0.53723156", "0.53606576", "0.5356875", "0.5311346", "0.52215147", "0.5201173", "0.519983", "0.5193754",...
0.72306156
1
Reads value from Output.xlsx
function GetOutputValue(/**string*/ key, /**string*/ defValue) { return Global.GetProperty(key, defValue, "%WORKDIR%\\Output.xlsx"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readTextFile(address_of_cell)\r\n{\r\nif(typeof require !== 'undefined') XLSX = require('xlsx');\r\nvar workbook = XLSX.readFile('users.xlsx');\r\nvar first_sheet_name = workbook.SheetNames[0];\r\nvar worksheet = workbook.Sheets[first_sheet_name];\r\nvar desired_cell = worksheet[address_of_cell];\r\nvar d...
[ "0.6875597", "0.58114046", "0.58114046", "0.5795402", "0.5729074", "0.56231225", "0.55404246", "0.55056584", "0.54448014", "0.54431045", "0.54337615", "0.54273885", "0.534754", "0.53386384", "0.53066933", "0.51853144", "0.5173703", "0.5157729", "0.5127182", "0.5089614", "0.50...
0.73445314
1
Scales the vector x by a constant c, without making a new vector.
function vecScale(x, c) { for (var i = 0; i < x.length; i++) { x[i] *= c; }; return x; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scaleToLength(x, c) {\n var norm = l2norm(x);\n for (var i = 0; i < x.length; i++) {\n c * x[i] / norm;\n };\n return x;\n}", "static scale(c,v) {\n try {\n if (!(typeof(c) === \"number\") || !(v instanceof Vector))\n throw \"Vector.scale: malformed parameter\";\n...
[ "0.7172556", "0.6901361", "0.68987393", "0.6890781", "0.62872046", "0.626055", "0.6194341", "0.6152622", "0.6124915", "0.592144", "0.5903154", "0.58779746", "0.5867658", "0.5861009", "0.5786418", "0.57699054", "0.5728986", "0.56805044", "0.56771976", "0.56415755", "0.56208646...
0.8047045
0
In place scales x to be length c
function scaleToLength(x, c) { var norm = l2norm(x); for (var i = 0; i < x.length; i++) { c * x[i] / norm; }; return x; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vecScale(x, c) {\n for (var i = 0; i < x.length; i++) {\n x[i] *= c;\n };\n return x;\n}", "function rescale(x, a,b, c,d) {\n if (abs(a-b) < 1e-7) return x <= (a+b)/2 ? c : d // avoid division by 0\n return c + (x-a)/(b-a)*(d-c)\n}", "static scale(p, c) {\n return {x: (c * p.x), y: (c * p.y...
[ "0.6643712", "0.6642108", "0.6470534", "0.62736326", "0.6267319", "0.6211961", "0.6177407", "0.6163881", "0.61566776", "0.61549944", "0.61160874", "0.61149037", "0.6095336", "0.60949224", "0.60704595", "0.6057193", "0.6051336", "0.60351753", "0.5988444", "0.59764487", "0.5957...
0.74863464
0
a < a + b
function vecAddInPlace(a, b) { for (var i = 0; i < a.length; i++) { a[i] += b[i]; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function value(a,b) {\r\na = a[1]+a[0];\r\nb = b[1]+b[0];\r\nreturn a == b ? 0 : (a < b ? -1 : 1)\r\n}", "function trueOrFalse(a , b) {\r\n return a < b;\r\n}", "function leq(a, b) {\n\t return a < b || eq(a, b);\n\t}", "function caml_lessthan (x, y) { return +(caml_compare(x,y,false) < 0); }", "func...
[ "0.7480131", "0.72488934", "0.70138186", "0.7001488", "0.69295", "0.6922856", "0.6857376", "0.6840853", "0.6807872", "0.67854613", "0.67831695", "0.6754036", "0.6751464", "0.6732615", "0.67323667", "0.66767365", "0.6668829", "0.6648537", "0.66417205", "0.66417205", "0.6641720...
0.0
-1
Takes a nutrient vector and returns its color as a hex string ffffff
function nutrientColor(nut) { return colorToString(colorLerp(nut, CHEMICAL_COLORS)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getHexColorValue() {\n let hexRepresentation = _.map(_.slice(this.props.value, 0, 3), (val)=>{\n let hexVal = val.toString(16);\n return hexVal.length === 1 ? '0' + hexVal : hexVal;\n }).join('');\n return '#' + hexRepresentation;\n }", "function fullColorString(clr, a) {\n return \"#\" + ...
[ "0.7085386", "0.68464106", "0.67952985", "0.6710052", "0.66278106", "0.65814584", "0.6578032", "0.64902115", "0.6478208", "0.6455905", "0.6450244", "0.6421787", "0.6400383", "0.63754636", "0.63610995", "0.6335178", "0.6311356", "0.6306497", "0.62757516", "0.6259985", "0.62478...
0.644181
11
Given a numerical color 0x012345, returns its magnitude from 0 to 1
function colorMagnitude(color) { var r = (color & 0xFF0000) >>> 16; var g = (color & 0x00FF00) >>> 8; var b = (color & 0x0000FF); return (r+g+b) / (3*0xFF); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function magnitudeColors(color) {\n if (color < 1){return \"red\"}\n else if (color < 2){return \"orange\"}\n else if (color < 3){return \"yellow\"}\n else if (color < 4){return \"green\"} \n else if (color < 5 ){return \"blue\"}\n else {return \"indigo\"}\n}", "function getColor(magnitude) {\n if (magn...
[ "0.7078998", "0.6669759", "0.66650087", "0.66583747", "0.65490395", "0.6540675", "0.6501001", "0.6496558", "0.6482208", "0.6479344", "0.64791155", "0.64752406", "0.6473931", "0.6472916", "0.6468841", "0.6461499", "0.64570177", "0.64557225", "0.64205796", "0.6407454", "0.64029...
0.830881
0
Modifiers have the ability to execute arbitrary code before the first update cycle runs. They will be executed in the same order as the update cycle. This is useful when a modifier adds some persistent data that other modifiers need to use, but the modifier is run after the dependent one.
function runModifierEffects() { state.orderedModifiers.forEach(function (_ref3) { var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect; if (typeof effect === 'function') { var cleanupFn = effect({ state: state, name: name, instance: instance, options: options }); var noopFn = function noopFn() {}; effectCleanupFns.push(cleanupFn || noopFn); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runModifierEffects(){state.orderedModifiers.forEach(function(_ref3){var name=_ref3.name,_ref3$options=_ref3.options,options=_ref3$options===void 0?{}:_ref3$options,effect=_ref3.effect;if(typeof effect==='function'){var cleanupFn=effect({state:state,name:name,instance:instance,options:options});var noopFn=...
[ "0.6899217", "0.6899217", "0.6899217", "0.65973413", "0.6554783", "0.65511376", "0.65511376", "0.6528902", "0.6522295", "0.5640873", "0.5548874", "0.54205", "0.5367152", "0.5282087", "0.5209293", "0.514531", "0.5135397", "0.51228476", "0.50885075", "0.50815284", "0.5081525", ...
0.6535009
28
clipping (or hiding) overflowing elements with a position different from `initial`
function getClippingParents(element) { var clippingParents = Object(_listScrollParents_js__WEBPACK_IMPORTED_MODULE_3__["default"])(Object(_getParentNode_js__WEBPACK_IMPORTED_MODULE_9__["default"])(element)); var canEscapeClipping = ['absolute', 'fixed'].indexOf(Object(_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_6__["default"])(element).position) >= 0; var clipperElement = canEscapeClipping && Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__["isHTMLElement"])(element) ? Object(_getOffsetParent_js__WEBPACK_IMPORTED_MODULE_4__["default"])(element) : element; if (!Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__["isElement"])(clipperElement)) { return []; } // $FlowFixMe: https://github.com/facebook/flow/issues/1414 return clippingParents.filter(function (clippingParent) { return Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_7__["isElement"])(clippingParent) && Object(_contains_js__WEBPACK_IMPORTED_MODULE_10__["default"])(clippingParent, clipperElement) && Object(_getNodeName_js__WEBPACK_IMPORTED_MODULE_11__["default"])(clippingParent) !== 'body'; }); } // Gets the maximum area that the element is visible in due to any number of
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetHiddenItemSize() {\n TweenLite.to(_element, 0, {scale: 1});\n }", "revertPosition() {\n const context = this.context,\n original = context.originalPosition; // revert to correct location\n\n if (original.next) {\n const isNoop = original.next && original.next.previousSib...
[ "0.53922856", "0.53344685", "0.5275839", "0.52355707", "0.5219449", "0.51921", "0.51732665", "0.51599693", "0.51430035", "0.5067564", "0.5045697", "0.5044952", "0.5035299", "0.50279516", "0.502498", "0.50069106", "0.4977868", "0.4969717", "0.49689186", "0.49627694", "0.496190...
0.47067252
59
Returns the composite rect of an element relative to its offsetParent. Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { if (isFixed === void 0) { isFixed = false; } var documentElement = Object(_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_5__["default"])(offsetParent); var rect = Object(_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(elementOrVirtualElement); var isOffsetParentAnElement = Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__["isHTMLElement"])(offsetParent); var scroll = { scrollLeft: 0, scrollTop: 0 }; var offsets = { x: 0, y: 0 }; if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (Object(_getNodeName_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 Object(_isScrollParent_js__WEBPACK_IMPORTED_MODULE_6__["default"])(documentElement)) { scroll = Object(_getNodeScroll_js__WEBPACK_IMPORTED_MODULE_1__["default"])(offsetParent); } if (Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__["isHTMLElement"])(offsetParent)) { offsets = Object(_getBoundingClientRect_js__WEBPACK_IMPORTED_MODULE_0__["default"])(offsetParent); offsets.x += offsetParent.clientLeft; offsets.y += offsetParent.clientTop; } else if (documentElement) { offsets.x = Object(_getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_4__["default"])(documentElement); } } return { x: rect.left + scroll.scrollLeft - offsets.x, y: rect.top + scroll.scrollTop - offsets.y, width: rect.width, height: rect.height }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCompositeRect$1(elementOrVirtualElement,offsetParent,isFixed){if(isFixed===void 0){isFixed=false;}var documentElement=getDocumentElement$1(offsetParent);var rect=getBoundingClientRect$1(elementOrVirtualElement);var isOffsetParentAnElement=isHTMLElement$1(offsetParent);var scroll={scrollLeft:0,scrollTop...
[ "0.7891602", "0.77760273", "0.77760273", "0.7752504", "0.7752504", "0.7725987", "0.7713349", "0.7690697", "0.7690697", "0.7666688", "0.7666688", "0.7666688", "0.7666688", "0.7664581", "0.7625197", "0.76134926", "0.76134926", "0.76134926", "0.76093906", "0.7569486", "0.7538812...
0.7628378
18
Gets the entire size of the scrollable document area, even extending outside of the `` and `` rect bounds if horizontally scrollable
function getDocumentRect(element) { var html = Object(_getDocumentElement_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var winScroll = Object(_getWindowScroll_js__WEBPACK_IMPORTED_MODULE_3__["default"])(element); var body = element.ownerDocument.body; var width = Math.max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); var height = Math.max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); var x = -winScroll.scrollLeft + Object(_getWindowScrollBarX_js__WEBPACK_IMPORTED_MODULE_2__["default"])(element); var y = -winScroll.scrollTop; if (Object(_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_1__["default"])(body || html).direction === 'rtl') { x += Math.max(html.clientWidth, body ? body.clientWidth : 0) - width; } return { width: width, height: height, x: x, y: y }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function f_documentSize() {\n\n var n_scrollX = 0,\n n_scrollY = 0;\n\n if (typeof (window.pageYOffset) == 'number') {\n n_scrollX = window.pageXOffset;\n n_scrollY = window.pageYOffset;\n }\n else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {\n n...
[ "0.7022485", "0.68761426", "0.6817225", "0.6808684", "0.67120975", "0.67102104", "0.65767074", "0.6525715", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64900756", "0.64710325", ...
0.6241363
42
Returns the layout rect of an element relative to its offsetParent. Layout means it doesn't take into account transforms.
function getLayoutRect(element) { return { x: element.offsetLeft, y: element.offsetTop, width: element.offsetWidth, height: element.offsetHeight }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n if (Math.abs(clien...
[ "0.7596064", "0.75740224", "0.75492454", "0.75492454", "0.7531196", "0.74806494", "0.74806494", "0.74806494", "0.7473557", "0.7473557", "0.7473557", "0.7473557", "0.7459579", "0.7459579", "0.7459579", "0.7459579", "0.7425433", "0.7425433", "0.7415084", "0.69288355", "0.691940...
0.74802
13
return the containing block
function getContainingBlock(element) { var currentNode = Object(_getParentNode_js__WEBPACK_IMPORTED_MODULE_5__["default"])(element); while (Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__["isHTMLElement"])(currentNode) && ['html', 'body'].indexOf(Object(_getNodeName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(currentNode)) < 0) { var css = Object(_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(currentNode); // This is non-exhaustive but covers the most common CSS properties that // create a containing block. if (css.transform !== 'none' || css.perspective !== 'none' || css.willChange && css.willChange !== 'auto') { return currentNode; } else { currentNode = currentNode.parentNode; } } return null; } // Gets the closest ancestor positioned element. Handles some edge cases,
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getContainingBlock(element) {\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;\n var currentNode = Object(_getParentNode_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(element);\n\n while (Object(_instanceOf_js__WEBPACK_IMPORTED_MODULE_3__[\"isHTMLElement\"])(currentNode) &...
[ "0.6571231", "0.65461355", "0.65461355", "0.65461355", "0.6516638", "0.6516638", "0.65010834", "0.64936745", "0.64802283", "0.6474632", "0.64665604", "0.64612967", "0.6339487", "0.633014", "0.63266474", "0.62810093", "0.627958", "0.627958", "0.627958", "0.627958", "0.62716997...
0.6577409
1
such as table ancestors and cross browser bugs.
function getOffsetParent(element) { var window = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var offsetParent = getTrueOffsetParent(element); while (offsetParent && Object(_isTableElement_js__WEBPACK_IMPORTED_MODULE_4__["default"])(offsetParent) && Object(_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent(offsetParent); } if (offsetParent && Object(_getNodeName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(offsetParent) === 'body' && Object(_getComputedStyle_js__WEBPACK_IMPORTED_MODULE_2__["default"])(offsetParent).position === 'static') { return window; } return offsetParent || getContainingBlock(element) || window; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function k(e,t){return c(e,\"table\")&&c(11!==t.nodeType?t:t.firstChild,\"tr\")&&me(\">tbody\",e)[0]||e}", "function gtGrdObj(tdObj) { try { var ele = tdObj.parentNode.parentNode.parentNode; if (ele.tagName.toLowerCase() == \"tbody\") le = ele.parentNode; return ele; } catch (e) { return null; } }", "function ...
[ "0.644592", "0.60404134", "0.58399045", "0.5824815", "0.5816764", "0.58050925", "0.58031654", "0.5723343", "0.5681813", "0.56641525", "0.55932623", "0.55502594", "0.5542227", "0.55275595", "0.55019903", "0.5501747", "0.54964644", "0.54465336", "0.5414919", "0.53851664", "0.53...
0.0
-1
:: declare function isElement(node: mixed): boolean %checks(node instanceof Element);
function isElement(node) { var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node).Element; return node instanceof OwnElement || node instanceof Element; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isElement(node) {\r\n return (node && node.nodeType === node_types.ELEMENT_NODE) || false;\r\n }", "function isElement(value) {\n return isType(value, 'Element');\n}", "function isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node insta...
[ "0.8382677", "0.8284299", "0.82442254", "0.82442254", "0.82243174", "0.820981", "0.8030375", "0.7993636", "0.79593444", "0.7908723", "0.79004717", "0.7876576", "0.77236146", "0.77236146", "0.77236146", "0.77236146", "0.77236146", "0.77236146", "0.77236146", "0.77236146", "0.7...
0.8041029
9
:: declare function isHTMLElement(node: mixed): boolean %checks(node instanceof HTMLElement);
function isHTMLElement(node) { var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node).HTMLElement; return node instanceof OwnElement || node instanceof HTMLElement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement;\n }", "function isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n }", "function isHTMLEleme...
[ "0.8737659", "0.8675658", "0.86612", "0.86612", "0.86612", "0.86612", "0.86612", "0.86612", "0.7916347", "0.7902608", "0.7893526", "0.78727096", "0.7868743", "0.78667384", "0.7830389", "0.7815138", "0.7805558", "0.7801422", "0.7790422", "0.7715513", "0.76926965", "0.7688362...
0.86149305
11
:: declare function isShadowRoot(node: mixed): boolean %checks(node instanceof ShadowRoot);
function isShadowRoot(node) { var OwnElement = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__["default"])(node).ShadowRoot; return node instanceof OwnElement || node instanceof ShadowRoot; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isShadowRoot(node) {\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}", "function isShadowRoot(node) {\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}", "functio...
[ "0.8680744", "0.8680744", "0.8680744", "0.8438347", "0.76588", "0.7561594", "0.7287328", "0.6510092", "0.6408967", "0.63789946", "0.6372652", "0.6343795", "0.6338062", "0.6338062", "0.6333699", "0.6287767", "0.6284319", "0.6242045", "0.6234838", "0.6234838", "0.6209619", "0...
0.85925835
4
given a DOM element, return the list of all scroll parents, up the list of ancesors until we get to the top window object. This list is what we attach scroll listeners to, because if any of these parent elements scroll, we'll need to recalculate the reference element's position.
function listScrollParents(element, list) { if (list === void 0) { list = []; } var scrollParent = Object(_getScrollParent_js__WEBPACK_IMPORTED_MODULE_0__["default"])(element); var isBody = Object(_getNodeName_js__WEBPACK_IMPORTED_MODULE_2__["default"])(scrollParent) === 'body'; var win = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_3__["default"])(scrollParent); var target = isBody ? [win].concat(win.visualViewport || [], Object(_isScrollParent_js__WEBPACK_IMPORTED_MODULE_4__["default"])(scrollParent) ? scrollParent : []) : scrollParent; var updatedList = list.concat(target); return isBody ? updatedList : // $FlowFixMe: isBody tells us target will be an HTMLElement here updatedList.concat(listScrollParents(Object(_getParentNode_js__WEBPACK_IMPORTED_MODULE_1__["default"])(target))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listScrollParents(element,list){var _element$ownerDocumen;if(list===void 0){list=[];}var scrollParent=getScrollParent(element);var isBody=scrollParent===((_element$ownerDocumen=element.ownerDocument)==null?void 0:_element$ownerDocumen.body);var win=getWindow(scrollParent);var target=isBody?[win].concat(wi...
[ "0.7336887", "0.7336887", "0.7206998", "0.7164338", "0.71565545", "0.70627344", "0.70627344", "0.6962485", "0.6962485", "0.6962485", "0.6908932", "0.68747437", "0.68747437", "0.68747437", "0.68747437", "0.6838458", "0.6838458", "0.6838458", "0.6838458", "0.6838458", "0.682464...
0.68420655
17
Round the offsets to the nearest suitable subpixel based on the DPR. Zooming can change the DPR, but it seems to report a value that will cleanly divide the values into the appropriate subpixels.
function roundOffsets(_ref) { var x = _ref.x, y = _ref.y; var win = window; var dpr = win.devicePixelRatio || 1; return { x: Math.round(x * dpr) / dpr || 0, y: Math.round(y * dpr) / dpr || 0 }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundOffsetsByDPR(_ref){var x=_ref.x,y=_ref.y;var win=window;var dpr=win.devicePixelRatio||1;return {x:round(round(x*dpr)/dpr)||0,y:round(round(y*dpr)/dpr)||0};}", "function roundOffsetsByDPR(_ref){var x=_ref.x,y=_ref.y;var win=window;var dpr=win.devicePixelRatio||1;return {x:round(round(x*dpr)/dpr)||0,...
[ "0.76612175", "0.76612175", "0.7594366", "0.7575892", "0.75079095", "0.7487574", "0.7478452", "0.7478452", "0.7478452", "0.7478452", "0.7478452", "0.74562436", "0.74562436", "0.7409175", "0.7368129", "0.7309801", "0.7309801", "0.7309801", "0.7267761", "0.7250976", "0.7250976"...
0.6730193
30
On visiting object, check for its dependencies and visit them recursively
function sort(modifier) { visited.add(modifier.name); var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); requires.forEach(function (dep) { if (!visited.has(dep)) { var depModifier = map.get(dep); if (depModifier) { sort(depModifier); } } }); result.push(modifier); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function traverse(object, ancestors, visitor) {\n var key, child, tempList;\n\n visitor.call(null, object);\n for (key in object) {\n if (object.hasOwnProperty(key)) {\n child = object[key];\n if (typeof child === 'object' && chi...
[ "0.67661756", "0.650305", "0.65017045", "0.6474099", "0.64717424", "0.6372098", "0.6370522", "0.6334102", "0.6309952", "0.6289112", "0.6213317", "0.6195653", "0.61104006", "0.6004782", "0.60006046", "0.5977171", "0.5937908", "0.5914214", "0.5798761", "0.5770098", "0.576878", ...
0.0
-1
Creates a `Ref` whose value is updated in an effect, ensuring the most recent value is the one rendered with. Generally only required for Concurrent mode usage where previous work in `render()` may be discarded befor being used. This is safe to access in an event handler.
function useCommittedRef(value) { var ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value); Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () { ref.current = value; }, [value]); return ref; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useLiveRef(value) {\n var ref = React.useRef(value);\n useIsomorphicEffect.useIsomorphicEffect(function () {\n ref.current = value;\n });\n return ref;\n}", "function useCommittedRef(value) {\n var ref = React.useRef(value);\n React.useEffect(function () {\n ref.current = value;\n }...
[ "0.67974037", "0.6466358", "0.6451719", "0.6444151", "0.637012", "0.637012", "0.63682795", "0.633751", "0.633751", "0.633751", "0.633751", "0.6208342", "0.6153886", "0.6145445", "0.6145445", "0.60857815", "0.60857815", "0.60857815", "0.60857815", "0.60857815", "0.60857815", ...
0.64727104
9
Returns a controller object for setting a timeout that is properly cleaned up once the component unmounts. New timeouts cancel and replace existing ones.
function useTimeout() { var isMounted = Object(_useMounted__WEBPACK_IMPORTED_MODULE_1__["default"])(); // types are confused between node and web here IDK var handleRef = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(); Object(_useWillUnmount__WEBPACK_IMPORTED_MODULE_2__["default"])(function () { return clearTimeout(handleRef.current); }); return Object(react__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(function () { var clear = function clear() { return clearTimeout(handleRef.current); }; function set(fn, delayMs) { if (delayMs === void 0) { delayMs = 0; } if (!isMounted()) return; clear(); if (delayMs <= MAX_DELAY_MS) { // For simplicity, if the timeout is short, just set a normal timeout. handleRef.current = setTimeout(fn, delayMs); } else { setChainedTimeout(handleRef, fn, Date.now() + delayMs); } } return { set: set, clear: clear }; }, []); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useTimeout () {\n let timer = null;\n const vm = vue.getCurrentInstance();\n\n function removeTimeout () {\n if (timer !== null) {\n clearTimeout(timer);\n timer = null;\n }\n }\n\n vue.onDeactivated(removeTimeout);\n vue.onBeforeUnmount(removeTimeout);\n\n ret...
[ "0.596109", "0.57444125", "0.5604639", "0.55776453", "0.5489882", "0.5364564", "0.5273213", "0.51571137", "0.5132006", "0.5114074", "0.5092859", "0.5088637", "0.502055", "0.50077134", "0.49874976", "0.4986683", "0.4975233", "0.49454844", "0.49365404", "0.49332735", "0.4918398...
0.53817475
8
Returns a ref that is immediately updated with the new value
function useUpdatedRef(value) { var valueRef = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value); valueRef.current = value; return valueRef; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Fay$$writeRef(ref,x){\n ref.value = x;\n}", "function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n }", "function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {...
[ "0.7064152", "0.69760835", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206", "0.68480206",...
0.6431853
34
Attach a callback that fires when a component unmounts
function useWillUnmount(fn) { var onUnmount = Object(_useUpdatedRef__WEBPACK_IMPORTED_MODULE_0__["default"])(fn); Object(react__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () { return function () { return onUnmount.current(); }; }, []); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentWillUnmount() {\n Object.keys(this.eventCallbacks).forEach((key) => {\n const eventName = key.substring(2).toLowerCase();\n const handler = this.eventCallbacks[key];\n\n this.pathNavigator.off(eventName, handler);\n });\n\n this.pathNavigator.destroy();\n this.pathNavigator = nu...
[ "0.7068645", "0.698156", "0.6972224", "0.69700706", "0.6899089", "0.6889604", "0.6862923", "0.6822245", "0.6822245", "0.6779256", "0.6756549", "0.6749718", "0.67334867", "0.6694612", "0.6587781", "0.65849453", "0.6564476", "0.6563503", "0.6563503", "0.6562787", "0.65611184", ...
0.0
-1
Throws a `Cancel` if cancellation has been requested.
function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async cancel() {\n throw new Error(this.cancelMessage);\n }", "cancel() {\n throw new Error(\"Not implemented.\")\n }", "isCanceled(cancelled) {\n if (cancelled) {\n throw new Error(\"Cancelled request\");\n }\n }", "function throwIfCancellationRequested(config) {\n ...
[ "0.79471016", "0.7735734", "0.75341254", "0.74463314", "0.7423634", "0.73854464", "0.73854464", "0.73854464", "0.73854464", "0.73854464", "0.7205521", "0.71672016", "0.71622115", "0.7161273", "0.71419287", "0.71383584", "0.71383584", "0.71383584", "0.71383584", "0.71383584", ...
0.0
-1
Determine if we're running in a standard browser environment This allows axios to run in a web worker, and reactnative. Both environments support XMLHttpRequest, but not fully standard globals. web workers: typeof window > undefined typeof document > undefined reactnative: navigator.product > 'ReactNative' nativescript navigator.product > 'NativeScript' or 'NS'
function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n ...
[ "0.8075931", "0.8071856", "0.80613434", "0.80405647", "0.80330795", "0.80330795", "0.80309546", "0.80201286" ]
0.0
-1
Return the actively focused element safely.
function activeElement(doc) { if (doc === void 0) { doc = Object(_ownerDocument__WEBPACK_IMPORTED_MODULE_0__["default"])(); } // Support: IE 9 only // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> try { var active = doc.activeElement; // IE11 returns a seemingly empty object in some cases when accessing // document.activeElement from an <iframe> if (!active || !active.nodeName) return null; return active; } catch (e) { /* ie throws if no active element */ return doc.body; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function safeActiveElement(){try{return document.activeElement;}catch(err){}}", "function safeActiveElement(){try{return document.activeElement;}catch(err){}}", "function safeActiveElement(){try{return document.activeElement;}catch(err){}}", "function safeActiveElement(){try{return document.activeElement;}ca...
[ "0.82683074", "0.82683074", "0.82683074", "0.82683074", "0.82683074", "0.82683074", "0.82683074", "0.81972605", "0.8183395", "0.8183395", "0.8183395", "0.8183395", "0.8183395", "0.8183395", "0.8183395", "0.8183395", "0.8159494", "0.8159494", "0.8159494", "0.8159494", "0.81594...
0.0
-1
An `addEventListener` ponyfill, supports the `once` option
function addEventListener(node, eventName, handler, options) { if (options && typeof options !== 'boolean' && !onceSupported) { var once = options.once, capture = options.capture; var wrappedHandler = handler; if (!onceSupported && once) { wrappedHandler = handler.__once || function onceHandler(event) { this.removeEventListener(eventName, onceHandler, capture); handler.call(this, event); }; handler.__once = wrappedHandler; } node.addEventListener(eventName, wrappedHandler, optionsSupported ? options : capture); } node.addEventListener(eventName, handler, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "registerOnce(event, listener){\n this._emiter.once(event, listener);\n }", "function _once (event, listener) {\n _on(event, function fn () {\n _removeListener(event, fn);\n listener.apply(this, arguments);\n });\n }", "function _once(event) {\n return function (listener) {\n...
[ "0.7667989", "0.7317466", "0.71819603", "0.70380247", "0.68628764", "0.6858734", "0.67149496", "0.6625332", "0.65739715", "0.65739715", "0.6571784", "0.6569037", "0.6553543", "0.6553543", "0.6436535", "0.63431466", "0.63421875", "0.6338894", "0.6230122", "0.6202916", "0.61572...
0.6540209
24
eslintdisable nobitwise, nocondassign HTML DOM and SVG DOM may have different support levels, so we need to check on context instead of a document root element.
function contains(context, node) { if (context.contains) return context.contains(node); if (context.compareDocumentPosition) return context === node || !!(context.compareDocumentPosition(node) & 16); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contains(context, node) {\n // HTML DOM and SVG DOM may have different support levels,\n // so we need to check on context instead of a document root element.\n if (context.contains) return context.contains(node);\n if (context.compareDocumentPosition) return context === node || !!(context.compareDocu...
[ "0.6394065", "0.61764586", "0.61672187", "0.61672187", "0.61672187", "0.60401005", "0.60401005", "0.60401005", "0.6004046", "0.5974265", "0.5952056", "0.59448713", "0.59185284", "0.58944297", "0.5856123", "0.5784176", "0.57125485", "0.57125485", "0.57125485", "0.57125485", "0...
0.5355999
73
This needs to be done on mousedown and touchstart instead of click so that it precedes the focus event.
function checkPointerDown(e) { if (container.contains(e.target)) return; if (config.clickOutsideDeactivates) { deactivate({ returnFocus: !tabbable.isFocusable(e.target) }); } else { e.preventDefault(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onFocus() {\r\n // Stub\r\n }", "focus() {}", "focus() {}", "function focus(){}", "focus() { }", "focus() {\n this.setFocus(0, 1);\n }", "doFocus() {\n this.__focusOnLast();\n }", "onFocusIn() {\n this.updateFocused(true);\n }", "afterOp() {\n if ( focusedNode &...
[ "0.7445436", "0.73821896", "0.73821896", "0.73257065", "0.72273356", "0.71740615", "0.716548", "0.7134499", "0.70795846", "0.7069849", "0.7037213", "0.7002982", "0.70009285", "0.6994331", "0.6958366", "0.6958366", "0.69429827", "0.69429827", "0.6937126", "0.69316477", "0.6887...
0.0
-1
In case focus escapes the trap for some strange reason, pull it back in.
function checkFocusIn(e) { // In Firefox when you Tab out of an iframe the Document is briefly focused. if (container.contains(e.target) || e.target instanceof Document) { return; } e.stopImmediatePropagation(); tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FocusTrapInertStrategy() { }", "_trapFocus(focusTrap, event) {\n const target = event.target;\n const focusTrapRoot = focusTrap._element;\n // Don't refocus if target was in an overlay, because the overlay might be associated\n // with an element inside the FocusTrap, ex. mat...
[ "0.6933518", "0.6797391", "0.6797391", "0.6797391", "0.677122", "0.67646724", "0.64911526", "0.64911526", "0.6395061", "0.6395061", "0.6191497", "0.618375", "0.61421394", "0.6076689", "0.6076689", "0.605026", "0.604297", "0.604297", "0.604297", "0.59816426", "0.5965978", "0...
0.56125623
67
Hijack Tab events on the first and last focusable nodes of the trap, in order to prevent focus from escaping. If it escapes for even a moment it can end up scrolling the page and causing confusion so we kind of need to capture the action at the keydown phase.
function checkTab(e) { updateTabbableNodes(); if (e.shiftKey && e.target === state.firstTabbableNode) { e.preventDefault(); tryFocus(state.lastTabbableNode); return; } if (!e.shiftKey && e.target === state.lastTabbableNode) { e.preventDefault(); tryFocus(state.firstTabbableNode); return; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function trapTabKey(obj, event){\n\tif (event.which == 9) {\n\t\tlet o = obj.find('*');\n\t\tlet focusableItems;\n\t\tfocusableItems = o.filter(focusableElementsString).filter(':visible');\n\t\tlet focusedItem;\n\t\tfocusedItem = $(':focus');\n\t\tlet numberOfFocusableItems;\n\t\tnumberOfFocusableItems = focusable...
[ "0.70259047", "0.6983775", "0.6779201", "0.6731606", "0.6729657", "0.6697942", "0.66869223", "0.66326076", "0.6534568", "0.6490828", "0.6467861", "0.6437364", "0.6418009", "0.637409", "0.6359752", "0.63358855", "0.6317459", "0.6299809", "0.62643164", "0.62643164", "0.62643164...
0.67445916
6
Returns true if the HTML5 history API is supported. Taken from Modernizr. changed to avoid false negatives for Windows Phones:
function supportsHistory() { var ua = window.navigator.userAgent; if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; return window.history && 'pushState' in window.history; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function supportsHistory() { // 60\n var ua = navigator.userAgent; // 61\n if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf(...
[ "0.8457442", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "0.8437014", "...
0.8341028
98
Returns true if browser fires popstate on hash change. IE10 and IE11 do not.
function supportsPopStateOnHashChange() { return window.navigator.userAgent.indexOf('Trident') === -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function supportsPopStateOnHashChange(){return window.navigator.userAgent.indexOf('Trident')===-1;}", "function supportsPopStateOnHashChange() {\n return window.navigator.userAgent.indexOf('Trident') === -1;\n }", "function supportsHashChange(documentMode, global) {\n return 'onhashchange' i...
[ "0.85098773", "0.8429124", "0.7344682", "0.7344682", "0.7344682", "0.7344682", "0.732546", "0.7243496", "0.7106196", "0.6864233", "0.6818202", "0.6818202", "0.6818202", "0.68038857", "0.67743653", "0.67629844", "0.67335546", "0.6707158", "0.66608274", "0.66576296", "0.6567578...
0.82997197
58
Returns false if using go(n) with hash history causes a full page reload.
function supportsGoWithoutReloadUsingHash() { return window.navigator.userAgent.indexOf('Firefox') === -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "changed()\n {\n if (window.location.hash !== this.lastHash)\n {\n this.lastHash = window.location.hash;\n return true;\n }\n else\n {\n return false;\n }\n }", "function checkHash() {\r\n if (location.hash && $this.find(l...
[ "0.68522537", "0.6624795", "0.6168934", "0.6121144", "0.61205816", "0.6108571", "0.6105173", "0.6104327", "0.60937566", "0.6088778", "0.6069899", "0.6030687", "0.6027372", "0.6025207", "0.59982675", "0.59982675", "0.59982675", "0.59982675", "0.59982675", "0.59982675", "0.5998...
0.5997922
98
Returns true if a given popstate event is an extraneous WebKit event. Accounts for the fact that Chrome on iOS fires real popstate events containing undefined state when pressing the back button.
function isExtraneousPopstateEvent(event) { return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isExtraneousPopstateEvent(event){event.state===undefined&&navigator.userAgent.indexOf('CriOS')===-1;}", "function isExtraneousPopstateEvent(event) {\n event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;\n}", "function isExtraneousPopstateEvent(event) {\n event.state === undefin...
[ "0.8189633", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8106464", "0.8076116", "0.7768142", "0.65637994", "0.65342957", "0.65262496", "0.65262496", "0.65262496", "0.65262496", "0.6526249...
0.8111777
47
Creates a history object that uses the HTML5 history API including pushState, replaceState, and the popstate event.
function createBrowserHistory(props) { if (props === void 0) { props = {}; } !canUseDOM ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false, 'Browser history needs a DOM') : undefined : void 0; var globalHistory = window.history; var canUseHistory = supportsHistory(); var needsHashChangeListener = !supportsPopStateOnHashChange(); var _props = props, _props$forceRefresh = _props.forceRefresh, forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; function getDOMLocation(historyState) { var _ref = historyState || {}, key = _ref.key, state = _ref.state; var _window$location = window.location, pathname = _window$location.pathname, search = _window$location.search, hash = _window$location.hash; var path = pathname + search + hash; true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : undefined; if (basename) path = stripBasename(path, basename); return createLocation(path, state, key); } function createKey() { return Math.random().toString(36).substr(2, keyLength); } var transitionManager = createTransitionManager(); function setState(nextState) { Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); history.length = globalHistory.length; transitionManager.notifyListeners(history.location, history.action); } function handlePopState(event) { // Ignore extraneous popstate events in WebKit. if (isExtraneousPopstateEvent(event)) return; handlePop(getDOMLocation(event.state)); } function handleHashChange() { handlePop(getDOMLocation(getHistoryState())); } var forceNextPop = false; function handlePop(location) { if (forceNextPop) { forceNextPop = false; setState(); } else { var action = 'POP'; transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (ok) { setState({ action: action, location: location }); } else { revertPop(location); } }); } } function revertPop(fromLocation) { var toLocation = history.location; // TODO: We could probably make this more reliable by // keeping a list of keys we've seen in sessionStorage. // Instead, we just default to 0 for keys we don't know. var toIndex = allKeys.indexOf(toLocation.key); if (toIndex === -1) toIndex = 0; var fromIndex = allKeys.indexOf(fromLocation.key); if (fromIndex === -1) fromIndex = 0; var delta = toIndex - fromIndex; if (delta) { forceNextPop = true; go(delta); } } var initialLocation = getDOMLocation(getHistoryState()); var allKeys = [initialLocation.key]; // Public interface function createHref(location) { return basename + createPath(location); } function push(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'PUSH'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var href = createHref(location); var key = location.key, state = location.state; if (canUseHistory) { globalHistory.pushState({ key: key, state: state }, null, href); if (forceRefresh) { window.location.href = href; } else { var prevIndex = allKeys.indexOf(history.location.key); var nextKeys = allKeys.slice(0, prevIndex + 1); nextKeys.push(location.key); allKeys = nextKeys; setState({ action: action, location: location }); } } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : undefined; window.location.href = href; } }); } function replace(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'REPLACE'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var href = createHref(location); var key = location.key, state = location.state; if (canUseHistory) { globalHistory.replaceState({ key: key, state: state }, null, href); if (forceRefresh) { window.location.replace(href); } else { var prevIndex = allKeys.indexOf(history.location.key); if (prevIndex !== -1) allKeys[prevIndex] = location.key; setState({ action: action, location: location }); } } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : undefined; window.location.replace(href); } }); } function go(n) { globalHistory.go(n); } function goBack() { go(-1); } function goForward() { go(1); } var listenerCount = 0; function checkDOMListeners(delta) { listenerCount += delta; if (listenerCount === 1 && delta === 1) { window.addEventListener(PopStateEvent, handlePopState); if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange); } else if (listenerCount === 0) { window.removeEventListener(PopStateEvent, handlePopState); if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange); } } var isBlocked = false; function block(prompt) { if (prompt === void 0) { prompt = false; } var unblock = transitionManager.setPrompt(prompt); if (!isBlocked) { checkDOMListeners(1); isBlocked = true; } return function () { if (isBlocked) { isBlocked = false; checkDOMListeners(-1); } return unblock(); }; } function listen(listener) { var unlisten = transitionManager.appendListener(listener); checkDOMListeners(1); return function () { checkDOMListeners(-1); unlisten(); }; } var history = { length: globalHistory.length, action: 'POP', location: initialLocation, createHref: createHref, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, block: block, listen: listen }; return history; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBrowserHistory() {\r\n\t var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\r\n\t\r\n\t !_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'Browser history needs a DOM') : _invariant2['default'](false) : unde...
[ "0.7363717", "0.73296857", "0.73296857", "0.7308878", "0.7308878", "0.7308878", "0.7308878", "0.73070294", "0.73040956", "0.730119", "0.729325", "0.7287951", "0.72879344", "0.7282965", "0.72828287", "0.72828287", "0.72828287", "0.72828287", "0.72828287", "0.7254779", "0.72541...
0.6787952
100
Creates a history object that stores locations in memory.
function createMemoryHistory(props) { if (props === void 0) { props = {}; } var _props = props, getUserConfirmation = _props.getUserConfirmation, _props$initialEntries = _props.initialEntries, initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries, _props$initialIndex = _props.initialIndex, initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; var transitionManager = createTransitionManager(); function setState(nextState) { Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); history.length = history.entries.length; transitionManager.notifyListeners(history.location, history.action); } function createKey() { return Math.random().toString(36).substr(2, keyLength); } var index = clamp(initialIndex, 0, initialEntries.length - 1); var entries = initialEntries.map(function (entry) { return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); }); // Public interface var createHref = createPath; function push(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'PUSH'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var prevIndex = history.index; var nextIndex = prevIndex + 1; var nextEntries = history.entries.slice(0); if (nextEntries.length > nextIndex) { nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); } else { nextEntries.push(location); } setState({ action: action, location: location, index: nextIndex, entries: nextEntries }); }); } function replace(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'REPLACE'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; history.entries[history.index] = location; setState({ action: action, location: location }); }); } function go(n) { var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); var action = 'POP'; var location = history.entries[nextIndex]; transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (ok) { setState({ action: action, location: location, index: nextIndex }); } else { // Mimic the behavior of DOM histories by // causing a render after a cancelled POP. setState(); } }); } function goBack() { go(-1); } function goForward() { go(1); } function canGo(n) { var nextIndex = history.index + n; return nextIndex >= 0 && nextIndex < history.entries.length; } function block(prompt) { if (prompt === void 0) { prompt = false; } return transitionManager.setPrompt(prompt); } function listen(listener) { return transitionManager.appendListener(listener); } var history = { length: entries.length, action: 'POP', location: entries[index], index: index, entries: entries, createHref: createHref, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, canGo: canGo, block: block, listen: listen }; return history; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMemoryHistory(base = '') {\n let listeners = [];\n let queue = [START];\n let position = 0;\n function setLocation(location) {\n position++;\n if (position === queue.length) {\n // we are at the end, we can simply append a new entry\n queue.push(locati...
[ "0.67093724", "0.6660363", "0.66349125", "0.6514125", "0.6496346", "0.6491885", "0.6476713", "0.64495486", "0.6401474", "0.6383285", "0.6383285", "0.6383285", "0.6383285", "0.6383285", "0.6383285", "0.6377784", "0.63725656", "0.6372155", "0.63628995", "0.63628995", "0.6362899...
0.6322891
58
The public API for prompting the user before navigating away from a screen.
function Prompt(_ref) { var message = _ref.message, _ref$when = _ref.when, when = _ref$when === void 0 ? true : _ref$when; return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { !context ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false, "You should not use <Prompt> outside a <Router>") : undefined : void 0; if (!when || context.staticContext) return null; var method = context.history.block; return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Lifecycle, { onMount: function onMount(self) { self.release = method(message); }, onUpdate: function onUpdate(self, prevProps) { if (prevProps.message !== message) { self.release(); self.release = method(message); } }, onUnmount: function onUnmount(self) { self.release(); }, message: message }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function navigateAway() {\n switch (document.body.id) {\n case 'options':\n chrome.runtime.sendMessage({\n 'name': 'OptionsSave',\n 'excludes': gTplData.options.globalExcludesStr.trim(),\n 'useCodeMirror': gTplData.options.useCodeMirror,\n }, logUnhandledError);\n break;\n ...
[ "0.635917", "0.6337324", "0.6293868", "0.6037227", "0.60223913", "0.6019256", "0.5973522", "0.595812", "0.5906849", "0.59040695", "0.589938", "0.58895904", "0.58619976", "0.5861335", "0.5848037", "0.5846685", "0.5827347", "0.5801943", "0.58009577", "0.5794085", "0.57781357", ...
0.0
-1
Public API for generating a URL pathname from a path and parameters.
function generatePath(path, params) { if (path === void 0) { path = "/"; } if (params === void 0) { params = {}; } return path === "/" ? path : compilePath(path)(params, { pretty: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makePath(var_args){\n\t var result = join(slice(arguments), '/');\n\t // need to disconsider duplicate '/' after protocol (eg: 'http://')\n\t return result.replace(/([^:\\/]|^)\\/{2,}/g, '$1/');\n\t }", "function makePath(var_args){\n var result = join(slice(arguments), '/...
[ "0.72512805", "0.7178873", "0.7178873", "0.68712044", "0.68696356", "0.6721023", "0.6654717", "0.65425456", "0.644447", "0.6395405", "0.63352627", "0.63270307", "0.628425", "0.62621105", "0.62249243", "0.61872166", "0.6135351", "0.61011547", "0.609315", "0.6084816", "0.608481...
0.6648755
42
The public API for navigating programmatically with a component.
function Redirect(_ref) { var computedMatch = _ref.computedMatch, to = _ref.to, _ref$push = _ref.push, push = _ref$push === void 0 ? false : _ref$push; return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { !context ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false, "You should not use <Redirect> outside a <Router>") : undefined : void 0; var history = context.history, staticContext = context.staticContext; var method = push ? history.push : history.replace; var location = Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, to, { pathname: generatePath(to.pathname, computedMatch.params) }) : to); // When rendering in a static context, // set the new location immediately. if (staticContext) { method(location); return null; } return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Lifecycle, { onMount: function onMount() { method(location); }, onUpdate: function onUpdate(self, prevProps) { var prevLocation = Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(prevProps.to); if (!Object(history__WEBPACK_IMPORTED_MODULE_3__["locationsAreEqual"])(prevLocation, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, location, { key: prevLocation.key }))) { method(location); } }, to: to }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "navigateToComponent(event) {\n let contractCode = event.currentTarget.dataset.item;\n // eslint-disable-next-line no-console\n console.log('contractcode:'+contractCode);\n this[NavigationMixin.Navigate]({\n type: 'standard__component',\n attributes: {\n ...
[ "0.61909544", "0.58901256", "0.5834737", "0.5770242", "0.56208116", "0.5563699", "0.55466664", "0.55171984", "0.5478709", "0.54625344", "0.5461492", "0.5452722", "0.54364544", "0.5411622", "0.54054534", "0.5397201", "0.5391978", "0.53629184", "0.5354345", "0.53436154", "0.534...
0.0
-1
Public API for matching a URL pathname to a path.
function matchPath(pathname, options) { if (options === void 0) { options = {}; } if (typeof options === "string" || Array.isArray(options)) { options = { path: options }; } var _options = options, path = _options.path, _options$exact = _options.exact, exact = _options$exact === void 0 ? false : _options$exact, _options$strict = _options.strict, strict = _options$strict === void 0 ? false : _options$strict, _options$sensitive = _options.sensitive, sensitive = _options$sensitive === void 0 ? false : _options$sensitive; var paths = [].concat(path); return paths.reduce(function (matched, path) { if (!path && path !== "") return null; if (matched) return matched; var _compilePath = compilePath$1(path, { end: exact, strict: strict, sensitive: sensitive }), regexp = _compilePath.regexp, keys = _compilePath.keys; var match = regexp.exec(pathname); if (!match) return null; var url = match[0], values = match.slice(1); var isExact = pathname === url; if (exact && !isExact) return null; return { path: path, // the path used to match url: path === "/" && url === "" ? "/" : url, // the matched portion of the URL isExact: isExact, // whether or not we matched exactly params: keys.reduce(function (memo, key, index) { memo[key.name] = values[index]; return memo; }, {}) }; }, null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matchPath(pathname,options){if(options===void 0){options={};}if(typeof options===\"string\")options={path:options};var _options=options,path=_options.path,_options$exact=_options.exact,exact=_options$exact===void 0?false:_options$exact,_options$strict=_options.strict,strict=_options$strict===void 0?false:...
[ "0.7498882", "0.6678314", "0.6661474", "0.6661474", "0.6661474", "0.6661474", "0.6661474", "0.6661474", "0.6661474", "0.6660707", "0.66498595", "0.6639335", "0.6639335", "0.6639335", "0.65086794", "0.64705783", "0.63369954", "0.61034983", "0.6070344", "0.6049082", "0.6049082"...
0.6640138
37
A public higherorder component to access the imperative API
function withRouter(Component) { var displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; var C = function C(props) { var wrappedComponentRef = props.wrappedComponentRef, remainingProps = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_10__["default"])(props, ["wrappedComponentRef"]); return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { !context ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false, "You should not use <" + displayName + " /> outside a <Router>") : undefined : void 0; return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Component, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, remainingProps, context, { ref: wrappedComponentRef })); }); }; C.displayName = displayName; C.WrappedComponent = Component; if (true) { C.propTypes = { wrappedComponentRef: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object]) }; } return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_11___default()(C, Component); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FunctionalComponent() {}", "function higherOrder(a) {\n a(); \n}", "function purchaseItem(...fns) => fns.reduce(compose)\n\n{} // so I have to make sure that I have returned in here this property", "_isolatedComputeForWrapper(component) {\n const computations = ReactInterpreter.computations(...
[ "0.6069312", "0.57844883", "0.57722145", "0.5677805", "0.56025374", "0.5341893", "0.5338482", "0.5236804", "0.51687837", "0.51687837", "0.51687837", "0.51687837", "0.51505935", "0.50862324", "0.50576675", "0.5054869", "0.5033653", "0.5029701", "0.50271124", "0.5022082", "0.50...
0.0
-1
This is done to register the method called with moment() without creating circular dependencies.
function setHookCallback (callback) { hookCallback = callback; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(moment) {\n this.moment = moment;\n }", "moment(date) {\n return moment(date);\n }", "viewDateMoment () {\n const m = moment(this.props.viewDate)\n return function () {\n return m.clone()\n }\n }", "function Sb(a,b){return function(c,d){var e,f;\n//invert the arguments,...
[ "0.6808176", "0.61082673", "0.59246933", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5740086", "0.5740086", "0.5740086", "0.5735562", "0.5735562", ...
0.0
-1
compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs+...
[ "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.79984933", "0.79866725", "0.79537725", "0.7922521", "0.77097225", "0.75572866", "0.75463253", "0.75318825", "0.7503132", ...
0.0
-1
format date using native date object
function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toI...
[ "0.75320816", "0.7421278", "0.7386446", "0.7386206", "0.73497903", "0.7336332", "0.73048234", "0.7300858", "0.7292591", "0.7292591", "0.7292591", "0.7221218", "0.7213261", "0.7210653", "0.7188191", "0.71826464", "0.71783525", "0.71683335", "0.71673006", "0.71582985", "0.71363...
0.0
-1
pick the locale from the array try ['enau', 'engb'] as 'enau', 'engb', 'en', as in move through the list trying each substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return globalLocale; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n \n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : nu...
[ "0.70815086", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", "0.7076946", ...
0.0
-1
This function will load locale and then set the global locale. If no arguments are passed in, it will simply return the current global locale key.
function getSetGlobalLocale (key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } else { if ((typeof console !== 'undefined') && console.warn) { //warn user if arguments are passed but the locale could not be set console.warn('Locale ' + key + ' not found. Did you forget to load it?'); } } } return globalLocale._abbr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are p...
[ "0.73265904", "0.729834", "0.72949797", "0.72495294", "0.72495294", "0.72495294", "0.72495294", "0.72495294", "0.72495294", "0.7241661", "0.7241661", "0.72304165", "0.7218095", "0.7214398", "0.7210484", "0.7210484", "0.7210484", "0.7210484", "0.72065747", "0.72061956", "0.720...
0.0
-1
Pick the first defined of two or three arguments.
function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pick() {\n\tvar args = arguments,\n\t\ti,\n\t\targ,\n\t\tlength = args.length;\n\tfor (i = 0; i < length; i++) {\n\t\targ = args[i];\n\t\tif (typeof arg !== 'undefined' && arg !== null) {\n\t\t\treturn arg;\n\t\t}\n\t}\n}", "function pick() {\n\t\tvar args = arguments,\n\t\t\ti,\n\t\t\targ,\n\t\t\tlengt...
[ "0.7629042", "0.75575334", "0.74523604", "0.7447829", "0.6875494", "0.6672635", "0.6649544", "0.66400206", "0.65779024", "0.6487554", "0.64760274", "0.64054173", "0.62996894", "0.62969613", "0.62835485", "0.61632556", "0.61517835", "0.5961853", "0.59598327", "0.5933788", "0.5...
0.0
-1
convert an array to a date. the array should mirror the parameters below note: all values past the year are optional and will default to the lowest possible value. [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { getParsingFlags(config).weekdayMismatch = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, inp...
[ "0.7055193", "0.7055193", "0.69697016", "0.6847807", "0.66343343", "0.64591527", "0.612902", "0.612504", "0.6066711", "0.60143846", "0.60143846", "0.60143846", "0.60143846", "0.60143846", "0.5960663", "0.5960663", "0.5960663", "0.589971", "0.5884706", "0.58757216", "0.5868448...
0.0
-1
date from iso format
function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date...
[ "0.7161587", "0.7084152", "0.69561076", "0.68181574", "0.66757625", "0.66372114", "0.6559707", "0.6525335", "0.6466161", "0.6465599", "0.644205", "0.64171946", "0.6406543", "0.6406543", "0.6406543", "0.6406543", "0.63656497", "0.63241196", "0.6322188", "0.62742394", "0.626350...
0.0
-1
date and time from ref 2822 format
function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)); if (match) { var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDrupalDateFromPieces(date, hour, minute, marker) {\n //Build time\n var time = hour + ':' + minute + ' ' + marker;\n //Build full date\n var dateTime = moment(date + ' ' + time, 'YYYY-MM-DD hh:mm A');\n //Return date in 24-hour format\n return moment(dateTime);\n }",...
[ "0.653082", "0.63895303", "0.6154629", "0.6096161", "0.60804975", "0.605977", "0.60540193", "0.605324", "0.605324", "0.605324", "0.605324", "0.6040541", "0.6028883", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6...
0.0
-1
date from iso format or fallback
function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } // Final attempt, use Input Fallback hooks.createFromInputFallback(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSett...
[ "0.69151974", "0.66991687", "0.6643978", "0.65537083", "0.65537083", "0.6520427", "0.6492825", "0.64871174", "0.6448661", "0.64316744", "0.64316744", "0.64103484", "0.64103484", "0.6407205", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "0.64045346", "...
0.0
-1
date from string and format string
function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, // 'regex', getParseRegexForToken(token, config)); if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); configFromArray(config); checkOverflow(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n ...
[ "0.7544057", "0.7378126", "0.71777546", "0.71777546", "0.71777546", "0.71777546", "0.71671367", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.71498096", "0.71486294", "0.71486294", "0.71486294", "0.70893186", "0.7086403", "0.70293576", "0.70293576", "0.7...
0.0
-1
date from string and array of format strings
function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (!isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < format...
[ "0.6992324", "0.6912437", "0.6811143", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67109895", "0.67109895", "0.67109895", "0.66975677", "0.65970886", "0.65863997", "0.65863997", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", ...
0.0
-1
Pick a moment m from moments so that m[fn](other) is true for all other. This relies on the function fn to be transitive. moments should either be an array of moment objects or an array, whose first element is an array of moment objects.
function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return moment();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n ...
[ "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "0.7611965", "...
0.0
-1
TODO: Use [].sort instead?
function min () { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sort() {\n\t}", "sort() {\n\t}", "function Sort() {}", "sort(){\n\n }", "function sortItems(arr) {\r\n return arr.sort();\r\n}", "function sort(theArray){\n\n}", "function arrangeElements( array ) {\r\n\tarray = array.sort();\r\n\treturn array;\r\n}", "function alfa (arr){\n\tfor (var i = 0; i<...
[ "0.76898605", "0.76898605", "0.7431569", "0.73816824", "0.722597", "0.70467216", "0.70034754", "0.698132", "0.69408303", "0.6881676", "0.6873754", "0.6873754", "0.683487", "0.6828153", "0.6822689", "0.68005455", "0.678884", "0.6772283", "0.6722359", "0.6710714", "0.6707308", ...
0.0
-1
Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeAs(input, model) {\n\t return model._isUTC ? moment(input).zone(model._offset || 0) :\n\t moment(input).local();\n\t }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "funct...
[ "0.8501202", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.84184194", "0.7951035", "0.7933913", ...
0.0
-1
MOMENTS keepLocalTime = true means only change the timezone, without affecting the local hour. So 5:31:26 +0300 [utcOffset(2, true)]> 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset +0200, so we adjust the time as needed, to be valid. Keeping the time actually adds/subtracts (one hour) from the actual represented time. That is why we call updateOffset a second time. In case it wants us to change the offset again _changeInProgress == true case, then we have to adjust, because there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetOffset(input,keepLocalTime){var offset=this._offset||0,localAdjust;if(!this.isValid()){return input!=null?this:NaN;}if(input!=null){if(typeof input==='string'){input=offsetFromString(matchShortOffset,input);}else if(Math.abs(input)<16){input=input*60;}if(!this._isUTC&&keepLocalTime){localAdjust=getD...
[ "0.6657817", "0.6657817", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", "0.66170067", ...
0.0
-1
TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setName(name) { }", "constructor(name) {\n super(name);\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "construct...
[ "0.67782986", "0.6759405", "0.67381084", "0.67381084", "0.67381084", "0.67381084", "0.6733258", "0.6733258", "0.67120683", "0.66484624", "0.6612438", "0.6540716", "0.65202653", "0.65195", "0.6489472", "0.6465985", "0.6462259", "0.6415414", "0.6381141", "0.6297654", "0.6276111...
0.0
-1
Return a human readable representation of a moment that can also be evaluated to get a new moment which is the same
function inspect () { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment'; var zone = ''; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } var prefix = '[' + func + '("]'; var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; var datetime = '-MM-DD[T]HH:mm:ss.SSS'; var suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inspect(){if(!this.isValid()){return'moment.invalid(/* '+this._i+' */)';}var func='moment';var zone='';if(!this.isLocal()){func=this.utcOffset()===0?'moment.utc':'moment.parseZone';zone='Z';}var prefix='['+func+'(\"]';var year=0<=this.year()&&this.year()<=9999?'YYYY':'YYYYYY';var datetime='-MM-DD[T]HH:mm:...
[ "0.7134383", "0.7134383", "0.71187127", "0.7092415", "0.70798695", "0.70798695", "0.70798695", "0.70798695", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595", "0.705595...
0.0
-1
If passed a locale key, it will set the locale for this instance. Otherwise, it will return the locale configuration variables for this instance.
function locale (key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;}return this;}}", "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(...
[ "0.72865367", "0.72865367", "0.7233091", "0.72062045", "0.72062045", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125", "0.7091125",...
0.0
-1
actual modulo handles negative numbers (for dates before 1970):
function mod$1(dividend, divisor) { return (dividend % divisor + divisor) % divisor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mod (x, y) {return x < 0? y - (-x % y) : x % y;}", "function testRemainder_17() {\n assertEquals(-0, -0 % Number.MAX_VALUE);\n}", "function moduloWithNegativeZeroDividend(a, b, c)\n{\n var temp = a * b;\n return temp % c;\n}", "function modulo(dividend, divisor)\n{\n var epsilon = divisor ...
[ "0.70117265", "0.6988928", "0.67461944", "0.6723841", "0.6723841", "0.6723841", "0.67018896", "0.6668628", "0.66457236", "0.66426545", "0.66215557", "0.66181666", "0.6584474", "0.65667367", "0.6554036", "0.6554036", "0.6554036", "0.6545891", "0.6529448", "0.64940953", "0.6485...
0.0
-1
() (5) (fmt, 5) (fmt) (true) (true, 5) (true, fmt, 5) (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } var i; var out = []; for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function foo5(a /* : number */, a2 /* : number */) /* : string => boolean => Foo */ {\n return s => b => ({\n moom: b,\n soup: s,\n nmb: a + a2 + 1\n })\n}", "function P$4(t){return t?[l$b(t[0]),l$b(t[1]),l$b(t[2]),l$b(t[3]),l$b(t[4]),l$b(t[5])]:[l$b(),l$b(),l$b(),l$b(),l$b(),l$b()]}", "funct...
[ "0.5453178", "0.5412745", "0.5401303", "0.53011155", "0.52496463", "0.5142132", "0.51295114", "0.50904226", "0.49952832", "0.49947372", "0.4975102", "0.49657133", "0.4916076", "0.49160433", "0.49117443", "0.49099278", "0.49099278", "0.49099278", "0.49099278", "0.49099278", "0...
0.0
-1
supports only 2.0style add(1, 's') or add(duration)
function add$1 (input, value) { return addSubtract$1(this, input, value, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Duration(time) {\n var d = document.createElement('span');\n d.classList.add('duration');\n d.innerText = time;\n return d;\n}", "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "function duration_add_subt...
[ "0.643023", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.6106225", "0.60827976", "0.6059368", "0.6012889", "0.6012889", "0.60102654", "0.5892436", "0.5892436", "0.5892436", ...
0.0
-1
supports only 2.0style subtract(1, 's') or subtract(duration)
function subtract$1 (input, value) { return addSubtract$1(this, input, value, -1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function durati...
[ "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.73991525", "0.7379139", "0.73621875", "0.73621875", "0.72727096", "0.72727096", "0.72727096", "0.72727096", "0.72727096",...
0.0
-1
helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration...
[ "0.6559185", "0.6559185", "0.6559185", "0.6559185", "0.6476999", "0.6382618", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.6326723", "0.621574", "0.61228406", "0.61228406", "0.6096944", "0.6096944", "0.6096944", ...
0.0
-1
This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding (roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function duration_humanize__getSetRelativeTimeRounding (roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof(roundingFunction) === 'function') {\n round = roundingFunction;\n return true;\n }\n ...
[ "0.72622484", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174"...
0.0
-1
This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold (threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetRelativeTimeThreshold (threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshol...
[ "0.6977598", "0.69336283", "0.6906506", "0.6906506", "0.6906506", "0.6906506", "0.6906506", "0.6906506", "0.6900698", "0.6900698", "0.6900698", "0.6900698", "0.6900698", "0.6900698", "0.6894468", "0.6885829", "0.6872021", "0.68407196", "0.68244886", "0.68244886", "0.68244886"...
0.0
-1
Expose a method for transforming tokens into the path function.
function tokensToFunction (tokens, options) { // Compile all the tokens into regexps. var matches = new Array(tokens.length) // Compile all the patterns before compilation. for (var i = 0; i < tokens.length; i++) { if (typeof tokens[i] === 'object') { matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)) } } return function (obj, opts) { var path = '' var data = obj || {} var options = opts || {} var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent for (var i = 0; i < tokens.length; i++) { var token = tokens[i] if (typeof token === 'string') { path += token continue } var value = data[token.name] var segment if (value == null) { if (token.optional) { // Prepend partial segment prefixes. if (token.partial) { path += token.prefix } continue } else { throw new TypeError('Expected "' + token.name + '" to be defined') } } if (isarray(value)) { if (!token.repeat) { throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') } if (value.length === 0) { if (token.optional) { continue } else { throw new TypeError('Expected "' + token.name + '" to not be empty') } } for (var j = 0; j < value.length; j++) { segment = encode(value[j]) if (!matches[i].test(segment)) { throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') } path += (j === 0 ? token.prefix : token.delimiter) + segment } continue } segment = token.asterisk ? encodeAsterisk(value) : encode(value) if (!matches[i].test(segment)) { throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') } path += token.prefix + segment } return path } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n const matches = new Array(tokens.length)\n\n // Compile all the patterns before compilation.\n for (let i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^...
[ "0.6188158", "0.6012426", "0.59892875", "0.5987317", "0.5987317", "0.5987317", "0.5987317", "0.5987317", "0.5987317", "0.5960351", "0.5960351", "0.5960351", "0.5960351", "0.5960351", "0.59280986", "0.59222007", "0.5903951", "0.5897069", "0.5897069", "0.5897069", "0.5897069", ...
0.5796183
76
Updates the position of the popper, computing the new offsets and applying the new style. Prefer `scheduleUpdate` over `update` because of performance reasons.
function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement` data.originalPlacement = data.placement; data.positionFixed = this.options.positionFixed; // compute the popper offsets data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; // run the modifiers data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback // the other ones will call `onUpdate` callback if (!this.state.isCreated) { this.state.isCreated = true; this.options.onCreate(data); } else { this.options.onUpdate(data); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n\t // if popper is destroyed, don't perform any further update\n\t if (this.state.isDestroyed) {\n\t return;\n\t }\n\t\n\t var data = {\n\t instance: this,\n\t styles: {},\n\t arrowStyles: {},\n\t attributes: {},\n\t flipped: false,\n\t offsets: {}\n\t };\n\t\n\t // ...
[ "0.812336", "0.8095888", "0.80919594", "0.80919594", "0.80919594", "0.80919594", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", "0.8074055", ...
0.0
-1
Setup needed event listeners used to update the popper position
function setupEventListeners(reference, options, state, updateBound) { // Resize event listener on window state.updateBound = updateBound; getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); // Scroll event listener on scroll parents var scrollElement = getScrollParent(reference); attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); state.scrollElement = scrollElement; state.eventsEnabled = true; return state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function g(e){if(Q.popperInstance?(y()||Q.popperInstance.scheduleUpdate(),Q.props.livePlacement&&!y()&&Q.popperInstance.enableEventListeners()):(Q.popperInstance=v(),Q.props.livePlacement||Q.popperInstance.disableEventListeners())\n/**\n * If the instance previously had followCursor behavior, it will be\n ...
[ "0.67695594", "0.6420096", "0.6403713", "0.6225101", "0.6185677", "0.6182807", "0.61679745", "0.61568534", "0.6139762", "0.6105795", "0.6095973", "0.607976", "0.6069184", "0.60660064", "0.60343856", "0.60328144", "0.60272366", "0.6027115", "0.6025439", "0.60178673", "0.601786...
0.0
-1
It will add resize/scroll events and start recalculating position of the popper element when they are triggered.
function enableEventListeners() { if (!this.state.eventsEnabled) { this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "adoptPositionOnResize() {\n if (this.adoptOnResize) {\n\n /**\n * Get app event manager\n * @type {ApplicationEventManager|{subscribe, eventList}}\n */\n const appEventManager = this.view.controller.root().eventManager;\n\n appEventManager.subscribe({\n event: {name: appE...
[ "0.6574355", "0.6568465", "0.65395826", "0.64589787", "0.64420676", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", "0.64285433", ...
0.0
-1
Remove event listeners used to update the popper position
function removeEventListeners(reference, state) { // Remove resize event listener on window getWindow(reference).removeEventListener('resize', state.updateBound); // Remove scroll event listener on scroll parents state.scrollParents.forEach(function (target) { target.removeEventListener('scroll', state.updateBound); }); // Reset state state.updateBound = null; state.scrollParents = []; state.scrollElement = null; state.eventsEnabled = false; return state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeEvents () {\n this.container.classList.remove(\"tooltiped\");\n\n this.container.removeEventListener(\"mouseenter\", this._mouseOver);\n this.container.removeEventListener(\"mousemove\", this._mouseMove);\n this.container.removeEventListener(\"mouseleave\", this._mouseOut);\n ...
[ "0.6902162", "0.6785765", "0.6785765", "0.6785765", "0.6770545", "0.6743059", "0.6592434", "0.6507296", "0.6457278", "0.6452451", "0.6450113", "0.64127916", "0.63347775", "0.629248", "0.62742007", "0.62729037", "0.6259061", "0.62421805", "0.6237802", "0.62315637", "0.62195307...
0.0
-1
It will remove resize/scroll events and won't recalculate popper position when they are triggered. It also won't trigger `onUpdate` callback anymore, unless you call `update` method manually.
function disableEventListeners() { if (this.state.eventsEnabled) { cancelAnimationFrame(this.scheduleUpdate); this.state = removeEventListeners(this.reference, this.state); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(){ // if popper is destroyed, don't perform any further update\nif(this.state.isDestroyed){return;}var data={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:false,offsets:{}}; // compute reference element offsets\ndata.offsets.reference = getReferenceOffsets(this.state,this.popper,this...
[ "0.7489982", "0.73384917", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", "0.7307538", ...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
Copyright 2013present, Facebook, Inc. All rights reserved. This source code is licensed under the BSDstyle license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. Mostly taken from ReactPropTypes.
function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { var componentNameSafe = componentName || '<<anonymous>>'; var propFullNameSafe = propFullName || propName; if (props[propName] == null) { if (isRequired) { return new Error('Required ' + location + ' `' + propFullNameSafe + '` was not specified ' + ('in `' + componentNameSafe + '`.')); } return null; } for (var _len = arguments.length, args = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) { args[_key - 6] = arguments[_key]; } return validate.apply(undefined, [props, propName, componentNameSafe, location, propFullNameSafe].concat(args)); } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get propTypes() {\n return {\n config: React.PropTypes.object,\n test: React.PropTypes.string,\n };\n }", "function isReactPropTypes(path) {\n return (\n (path.node.object.type === 'MemberExpression' &&\n path.node.object.object &&\n path.node.object.object.name ==...
[ "0.69605863", "0.67468566", "0.6628833", "0.6464124", "0.6229379", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.6206012", "0.60928804", "0.60928804", "0.60928804", "0.60928804", "0.60928804", "0.609288...
0.0
-1
inlined Object.is polyfill to avoid requiring consumers ship their own /eslintdisable noselfcompare
function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isObject$1(obj) {\n // incase of arrow function and array\n return Object(obj) === obj && String(obj) === '[object Object]' && !isFunction(obj) && !isArray(obj);\n }", "function isObject$1(obj) {\n ...
[ "0.6730523", "0.66329944", "0.6610388", "0.6600516", "0.6599237", "0.65664077", "0.65055287", "0.6468159", "0.64624006", "0.641155", "0.63705426", "0.63652676", "0.63652676", "0.63652676", "0.63652676", "0.6357186", "0.632667", "0.6322181", "0.63220984", "0.62959194", "0.6295...
0.0
-1
Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sc_typeof( x ) {\n return typeof x;\n}", "static type(arg)\n {\n const types = [\n 'array', 'boolean', 'function', 'number',\n 'null', 'object', 'regexp', 'symbol', 'string',\n 'undefined'\n ]\n\n var type = Object.prototype.toString.call(arg),\...
[ "0.6911626", "0.67766434", "0.66100645", "0.654038", "0.6495285", "0.6489846", "0.6489846", "0.64507556", "0.64507556", "0.6431194", "0.64299774", "0.64064825", "0.64064825", "0.63977975", "0.63977975", "0.63977975", "0.63977975", "0.63977975", "0.63977975", "0.63977975", "0....
0.0
-1
This handles more types than `getPropType`. Only used for error messages. See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPropType(propValue) {\n\t\t var propType = typeof propValue;\n\t\t if (Array.isArray(propValue)) {\n\t\t return 'array';\n\t\t }\n\t\t if (propValue instanceof RegExp) {\n\t\t // Old webkits (at least until Android 4.0) return 'function' rather than\n\t\t // 'object' for type...
[ "0.6876261", "0.6852896", "0.6852896", "0.6852896", "0.6852896", "0.6851662", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0.68460876", "0...
0.0
-1
Returns a string that is postfixed to a warning about an invalid type. For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _undefinedCoerce() {\n return '';\n}", "function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case \"array\":\n case \"object\":\n return \"an \" + type;\n case \"boolean\":\n ...
[ "0.6599482", "0.65679044", "0.65622234", "0.65622234", "0.65622234", "0.65622234", "0.6525046", "0.65242517", "0.65087306", "0.65087306", "0.65087306", "0.65087306", "0.65087306", "0.65039986", "0.6492512", "0.6480518", "0.6480518", "0.6480518", "0.6480518", "0.6480518", "0.6...
0.0
-1
Returns class name of the object, if any.
function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getClassName(obj) {\n var funcNameRegex = /function\\s+(.+?)\\s*\\(/;\n var results = funcNameRegex.exec(obj['constructor'].toString());\n return (results && results.length > 1) ? results[1] : '';\n }", "getClassName() {\n return this.constructor\n .className;\n...
[ "0.7730571", "0.74697196", "0.74697196", "0.74258965", "0.7164231", "0.71448183", "0.7083163", "0.7080694", "0.6995368", "0.6971116", "0.6901662", "0.6883398", "0.67147285", "0.66557264", "0.6639163", "0.6611592", "0.6611592", "0.6611592", "0.6611592", "0.6600893", "0.6599787...
0.0
-1
Iterates through children that are typically specified as `props.children`, but only maps over children that are "valid elements". The mapFunction provided index will be normalised to the components mapped, so an invalid component would not increase the index.
function map(children, func) { var index = 0; return react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.map(children, function (child) { return react__WEBPACK_IMPORTED_MODULE_0___default.a.isValidElement(child) ? func(child, index++) : child; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function map(children, func) {\n var index = 0;\n return __WEBPACK_IMPORTED_MODULE_0_react___default.a.Children.map(children, function (child) {\n return __WEBPACK_IMPORTED_MODULE_0_react___default.a.isValidElement(child) ? func(child, index++) : child;\n });\n}", "function map(children, func) {\n var ind...
[ "0.8085546", "0.8085546", "0.8000892", "0.79522616", "0.78987634", "0.6855412", "0.6855412", "0.6821118", "0.6821118", "0.6821118", "0.6821118", "0.6821118", "0.6821118", "0.6821118", "0.6821118", "0.6807006", "0.6803972", "0.68027747", "0.6395794", "0.6358235", "0.6332384", ...
0.8055414
9
Iterates through children that are "valid elements". The provided forEachFunc(child, index) will be called for each leaf child with the index reflecting the position relative to "valid components".
function forEach(children, func) { var index = 0; react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.forEach(children, function (child) { if (react__WEBPACK_IMPORTED_MODULE_0___default.a.isValidElement(child)) func(child, index++); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forEach(children, func) {\n let index = 0;\n React.Children.forEach(children, child => {\n if ( /*#__PURE__*/React.isValidElement(child)) func(child, index++);\n });\n}", "function forEach(children, func) {\n var index = 0;\n __WEBPACK_IMPORTED_MODULE_0_react___default.a.Children.forEach(childre...
[ "0.75489044", "0.75472116", "0.75472116", "0.7534625", "0.7462396", "0.61719793", "0.61454564", "0.60228586", "0.6020845", "0.596845", "0.585655", "0.58508164", "0.5779022", "0.5706016", "0.567445", "0.55288815", "0.5502953", "0.5458454", "0.5440849", "0.5391554", "0.5366952"...
0.7503897
11
React's built version is broken: for cases when the trigger is disabled and mouseOut/Over can cause flicker moving from one child element to another.
function handleMouseOverOut(handler, args, relatedNative) { var e = args[0]; var target = e.currentTarget; var related = e.relatedTarget || e.nativeEvent[relatedNative]; if ((!related || related !== target) && !Object(dom_helpers_contains__WEBPACK_IMPORTED_MODULE_3__["default"])(target, related)) { handler.apply(void 0, args); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateTrigger$2(PortalComponent) {\n var Trigger = /*#__PURE__*/function (_React$Component) {\n (0, _inherits2.default)(Trigger, _React$Component);\n\n var _super = (0, _createSuper2.default)(Trigger);\n\n function Trigger(props) {\n var _this;\n\n (0, _classCallCheck2.default)(this,...
[ "0.60197717", "0.60001194", "0.5980883", "0.5940208", "0.59395945", "0.5919945", "0.58831406", "0.58402807", "0.5829305", "0.58265626", "0.58265626", "0.5800753", "0.5800428", "0.57929593", "0.578527", "0.578527", "0.57761455", "0.5767679", "0.57676435", "0.5764646", "0.57510...
0.0
-1
Validate that children, if any, are instances of ``.
function onlyProgressBar(props, propName, componentName) { var children = props[propName]; if (!children) { return null; } var error = null; react__WEBPACK_IMPORTED_MODULE_3___default.a.Children.forEach(children, function (child) { if (error) { return; } /** * Compare types in a way that works with libraries that patch and proxy * components like react-hot-loader. * * see https://github.com/gaearon/react-hot-loader#checking-element-types */ var element = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(ProgressBar, null); if (child.type === element.type) return; var childType = child.type; var childIdentifier = react__WEBPACK_IMPORTED_MODULE_3___default.a.isValidElement(child) ? childType.displayName || childType.name || childType : child; error = new Error("Children of " + componentName + " can contain only ProgressBar " + ("components. Found " + childIdentifier + ".")); }); return error; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "childrenValidation() {\n const isChildren = Array.isArray(this.props.children);\n if (isChildren) {\n throw new Error('<Hello> component doen not support multiple children');\n } else if (!this.props.children) {\n throw new Error('<Hello> component cannot ben empty');\n }\n }", "hasValidCh...
[ "0.7083619", "0.6617665", "0.6392238", "0.60621476", "0.60621476", "0.60621476", "0.60621476", "0.60621476", "0.60621476", "0.6042598", "0.5989525", "0.5980775", "0.59798163", "0.59605354", "0.588464", "0.58601123", "0.5825246", "0.5811257", "0.5780012", "0.57676", "0.57676",...
0.0
-1