How to use headerNames method in wpt

Best JavaScript code snippet using wpt

DataGridRenderer.js

Source:DataGridRenderer.js Github

copy

Full Screen

1// 2// DataGridRenderer.js3// Part of Mr-Data-Converter4// 5// Created by Shan Carter on 2010-10-18.6// 7var DataGridRenderer = {8 9 //---------------------------------------10 // Actionscript11 //---------------------------------------12 13 as: function (dataGrid, headerNames, headerTypes, indent, newLine) {14 //inits...15 var commentLine = "//";16 var commentLineEnd = "";17 var outputText = "[";18 var numRows = dataGrid.length;19 var numColumns = headerNames.length;20 21 //begin render loops22 for (var i=0; i < numRows; i++) {23 var row = dataGrid[i];24 outputText += "{";25 for (var j=0; j < numColumns; j++) {26 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {27 var rowOutput = row[j] || "null";28 } else {29 var rowOutput = '"'+( row[j] || "" )+'"';30 }; 31 outputText += (headerNames[j] + ":" + rowOutput)32 if (j < (numColumns-1)) {outputText+=","};33 };34 outputText += "}";35 if (i < (numRows-1)) {outputText += ","+newLine};36 };37 outputText += "];";38 39 40 return outputText;41 },42 43 44 //---------------------------------------45 // ASP / VBScript46 //---------------------------------------47 48 asp: function (dataGrid, headerNames, headerTypes, indent, newLine) {49 //inits...50 var commentLine = "'";51 var commentLineEnd = "";52 var outputText = "";53 var numRows = dataGrid.length;54 var numColumns = headerNames.length;55 56 //begin render loop57 for (var i=0; i < numRows; i++) {58 var row = dataGrid[i];59 for (var j=0; j < numColumns; j++) {60 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {61 var rowOutput = row[j] || "null";62 } else {63 var rowOutput = '"'+( row[j] || "" )+'"';64 };65 outputText += 'myArray('+j+','+i+') = '+rowOutput+newLine; 66 };67 };68 outputText = 'Dim myArray('+(j-1)+','+(i-1)+')'+newLine+outputText;69 70 return outputText;71 },72 73 74 //---------------------------------------75 // HTML Table76 //---------------------------------------77 78 html: function (dataGrid, headerNames, headerTypes, indent, newLine) {79 //inits...80 var commentLine = "<!--";81 var commentLineEnd = "-->";82 var outputText = "";83 var numRows = dataGrid.length;84 var numColumns = headerNames.length;85 86 //begin render loop87 outputText += "<table>"+newLine;88 outputText += indent+"<thead>"+newLine;89 outputText += indent+indent+"<tr>"+newLine;90 91 for (var j=0; j < numColumns; j++) {92 outputText += indent+indent+indent+'<th class="'+headerNames[j]+'-cell">'; 93 outputText += headerNames[j];94 outputText += '</th>'+newLine;95 };96 outputText += indent+indent+"</tr>"+newLine;97 outputText += indent+"</thead>"+newLine;98 outputText += indent+"<tbody>"+newLine;99 for (var i=0; i < numRows; i++) {100 var row = dataGrid[i];101 var rowClassName = ""102 if (i === numRows-1) {103 rowClassName = ' class="lastRow"';104 } else if (i === 0){105 rowClassName = ' class="firstRow"';106 }107 outputText += indent+indent+"<tr"+rowClassName+">"+newLine;108 for (var j=0; j < numColumns; j++) {109 outputText += indent+indent+indent+'<td class="'+headerNames[j]+'-cell">'; 110 outputText += row[j]111 outputText += '</td>'+newLine112 };113 outputText += indent+indent+"</tr>"+newLine;114 };115 outputText += indent+"</tbody>"+newLine;116 outputText += "</table>";117 118 return outputText;119 },120 121 122 //---------------------------------------123 // JSON properties124 //---------------------------------------125 126 json: function (dataGrid, headerNames, headerTypes, indent, newLine) {127 //inits...128 var commentLine = "//";129 var commentLineEnd = "";130 var outputText = "[";131 var numRows = dataGrid.length;132 var numColumns = headerNames.length;133 134 //begin render loop135 for (var i=0; i < numRows; i++) {136 var row = dataGrid[i];137 outputText += "{";138 for (var j=0; j < numColumns; j++) {139 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {140 var rowOutput = row[j] || "null";141 } else {142 var rowOutput = '"' + ( row[j] || "" ) + '"';143 };144 145 outputText += ('"'+headerNames[j] +'"' + ":" + rowOutput );146 147 if (j < (numColumns-1)) {outputText+=","};148 };149 outputText += "}";150 if (i < (numRows-1)) {outputText += ","+newLine};151 };152 outputText += "]";153 154 return outputText;155 },156 157 //---------------------------------------158 // JSON Array of Columns159 //---------------------------------------160 jsonArrayCols: function (dataGrid, headerNames, headerTypes, indent, newLine) {161 //inits...162 var commentLine = "//";163 var commentLineEnd = "";164 var outputText = "";165 var numRows = dataGrid.length;166 var numColumns = headerNames.length;167 168 //begin render loop169 outputText += "{"+newLine;170 for (var i=0; i < numColumns; i++) {171 outputText += indent+'"'+headerNames[i]+'":[';172 for (var j=0; j < numRows; j++) {173 if ((headerTypes[i] == "int")||(headerTypes[i] == "float")) {174 outputText += dataGrid[j][i] || 0;175 } else {176 outputText += '"'+(dataGrid[j][i] || "")+'"' ;177 }178 if (j < (numRows-1)) {outputText+=","};179 };180 outputText += "]";181 if (i < (numColumns-1)) {outputText += ","+newLine};182 };183 outputText += newLine+"}";184 185 186 return outputText;187 },188 189 190 //---------------------------------------191 // JSON Array of Rows192 //---------------------------------------193 jsonArrayRows: function (dataGrid, headerNames, headerTypes, indent, newLine) {194 //inits...195 var commentLine = "//";196 var commentLineEnd = "";197 var outputText = "";198 var numRows = dataGrid.length;199 var numColumns = headerNames.length;200 201 //begin render loop202 outputText += "["+newLine;203 for (var i=0; i < numRows; i++) {204 outputText += indent+"[";205 for (var j=0; j < numColumns; j++) {206 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {207 outputText += dataGrid[i][j] || 0;208 } else {209 outputText += '"'+(dataGrid[i][j] || "")+'"' ;210 }211 if (j < (numColumns-1)) {outputText+=","};212 };213 outputText += "]";214 if (i < (numRows-1)) {outputText += ","+newLine};215 };216 outputText += newLine+"]";217 218 219 return outputText;220 },221 222 223 //---------------------------------------224 // JSON Dictionary225 //---------------------------------------226 jsonDict: function(dataGrid, headerNames, headerTypes, indent, newLine) {227 //inits...228 var commentLine = "//";229 var commentLineEnd = "";230 var outputText = "";231 var numRows = dataGrid.length;232 var numColumns = headerNames.length;233 //begin render loop234 outputText += "{" + newLine;235 for (var i = 0; i < numRows; i++) {236 outputText += indent + '"' + dataGrid[i][0] + '": ';237 if (numColumns == 2) {238 outputText += _fmtVal(i, 1, dataGrid);239 } else {240 outputText += '{ ';241 for (var j = 1; j < numColumns; j++) {242 if (j > 1) outputText += ', ';243 outputText += '"' + headerNames[j] + '"' + ":" + _fmtVal(i, j, dataGrid);244 }245 outputText += '}';246 }247 if (i < (numRows - 1)) {248 outputText += "," + newLine;249 }250 }251 outputText += newLine + "}";252 function _fmtVal(i, j) {253 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {254 return dataGrid[i][j] || 0;255 } else {256 return '"'+(dataGrid[i][j] || "")+'"' ;257 }258 }259 return outputText;260 },261 //---------------------------------------262 // MYSQL263 //---------------------------------------264 mysql: function (dataGrid, headerNames, headerTypes, indent, newLine) {265 //inits...266 var commentLine = "/*";267 var commentLineEnd = "*/";268 var outputText = "";269 var numRows = dataGrid.length;270 var numColumns = headerNames.length;271 var tableName = "MrDataConverter"272 273 //begin render loop274 outputText += 'CREATE TABLE '+tableName+' (' + newLine;275 outputText += indent+"id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"+newLine;276 for (var j=0; j < numColumns; j++) {277 var dataType = "VARCHAR(255)";278 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {279 dataType = headerTypes[j].toUpperCase();280 };281 outputText += indent+""+headerNames[j]+" "+dataType;282 if (j < numColumns - 1) {outputText += ","};283 outputText += newLine;284 };285 outputText += ');' + newLine;286 outputText += "INSERT INTO "+tableName+" "+newLine+indent+"(";287 for (var j=0; j < numColumns; j++) {288 outputText += headerNames[j];289 if (j < numColumns - 1) {outputText += ","};290 };291 outputText += ") "+newLine+"VALUES "+newLine;292 for (var i=0; i < numRows; i++) {293 outputText += indent+"(";294 for (var j=0; j < numColumns; j++) {295 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {296 outputText += dataGrid[i][j] || "null";297 } else {298 outputText += "'"+( dataGrid[i][j] || "" )+"'";299 };300 301 if (j < numColumns - 1) {outputText += ","};302 };303 outputText += ")";304 if (i < numRows - 1) {outputText += ","+newLine;};305 };306 outputText += ";";307 308 return outputText;309 },310 311 312 //---------------------------------------313 // PHP314 //---------------------------------------315 php: function (dataGrid, headerNames, headerTypes, indent, newLine) {316 //inits...317 var commentLine = "//";318 var commentLineEnd = "";319 var outputText = "";320 var numRows = dataGrid.length;321 var numColumns = headerNames.length;322 var tableName = "MrDataConverter"323 324 //begin render loop325 outputText += "array(" + newLine;326 for (var i=0; i < numRows; i++) {327 var row = dataGrid[i];328 outputText += indent + "array(";329 for (var j=0; j < numColumns; j++) {330 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {331 var rowOutput = row[j] || "null";332 } else {333 var rowOutput = '"'+(row[j] || "")+'"';334 }; 335 outputText += ('"'+headerNames[j]+'"' + "=>" + rowOutput)336 if (j < (numColumns-1)) {outputText+=","};337 };338 outputText += ")";339 if (i < (numRows-1)) {outputText += ","+newLine};340 };341 outputText += newLine + ");";342 343 return outputText;344 },345 346 //---------------------------------------347 // Python dict348 //---------------------------------------349 350 python: function (dataGrid, headerNames, headerTypes, indent, newLine) {351 //inits...352 var commentLine = "//";353 var commentLineEnd = "";354 var outputText = "[";355 var numRows = dataGrid.length;356 var numColumns = headerNames.length;357 358 //begin render loop359 for (var i=0; i < numRows; i++) {360 var row = dataGrid[i];361 outputText += "{";362 for (var j=0; j < numColumns; j++) {363 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {364 var rowOutput = row[j] || "None";365 } else {366 var rowOutput = '"'+(row[j] || "")+'"';367 };368 369 outputText += ('"'+headerNames[j] +'"' + ":" + rowOutput );370 371 if (j < (numColumns-1)) {outputText+=","};372 };373 outputText += "}";374 if (i < (numRows-1)) {outputText += ","+newLine};375 };376 outputText += "];";377 378 return outputText;379 },380 381 382 //---------------------------------------383 // Ruby384 //---------------------------------------385 ruby: function (dataGrid, headerNames, headerTypes, indent, newLine) {386 //inits...387 var commentLine = "#";388 var commentLineEnd = "";389 var outputText = "";390 var numRows = dataGrid.length;391 var numColumns = headerNames.length;392 var tableName = "MrDataConverter"393 394 //begin render loop395 outputText += "[";396 for (var i=0; i < numRows; i++) {397 var row = dataGrid[i];398 outputText += "{";399 for (var j=0; j < numColumns; j++) {400 if ((headerTypes[j] == "int")||(headerTypes[j] == "float")) {401 var rowOutput = row[j] || "nil"402 } else {403 var rowOutput = '"'+(row[j] || "")+'"';404 }; 405 outputText += ('"'+headerNames[j]+'"' + "=>" + rowOutput)406 if (j < (numColumns-1)) {outputText+=","};407 };408 outputText += "}";409 if (i < (numRows-1)) {outputText += ","+newLine};410 };411 outputText += "];";412 413 return outputText;414 },415 416 417 //---------------------------------------418 // XML Nodes419 //---------------------------------------420 xml: function (dataGrid, headerNames, headerTypes, indent, newLine) {421 //inits...422 var commentLine = "<!--";423 var commentLineEnd = "-->";424 var outputText = "";425 var numRows = dataGrid.length;426 var numColumns = headerNames.length;427 428 //begin render loop429 outputText = '<?xml version="1.0" encoding="UTF-8"?>' + newLine;430 outputText += "<rows>"+newLine;431 for (var i=0; i < numRows; i++) {432 var row = dataGrid[i];433 outputText += indent+"<row>"+newLine;434 for (var j=0; j < numColumns; j++) {435 outputText += indent+indent+'<'+headerNames[j]+'>'; 436 outputText += row[j] || ""437 outputText += '</'+headerNames[j]+'>'+newLine438 };439 outputText += indent+"</row>"+newLine;440 };441 outputText += "</rows>";442 443 return outputText;444 445 },446 447 448 449 //---------------------------------------450 // XML properties451 //---------------------------------------452 xmlProperties: function (dataGrid, headerNames, headerTypes, indent, newLine) {453 //inits...454 var commentLine = "<!--";455 var commentLineEnd = "-->";456 var outputText = "";457 var numRows = dataGrid.length;458 var numColumns = headerNames.length;459 460 //begin render loop461 outputText = '<?xml version="1.0" encoding="UTF-8"?>' + newLine;462 outputText += "<rows>"+newLine;463 for (var i=0; i < numRows; i++) {464 var row = dataGrid[i];465 outputText += indent+"<row ";466 for (var j=0; j < numColumns; j++) {467 outputText += headerNames[j]+'='; 468 outputText += '"' + row[j] + '" ';469 };470 outputText += "></row>"+newLine;471 };472 outputText += "</rows>";473 474 return outputText;475 476 },477 478 //---------------------------------------479 // XML Illustrator480 //---------------------------------------481 xmlIllustrator: function (dataGrid, headerNames, headerTypes, indent, newLine) {482 //inits...483 var commentLine = "<!--";484 var commentLineEnd = "-->";485 var outputText = "";486 var numRows = dataGrid.length;487 var numColumns = headerNames.length;488 489 //begin render loop490 outputText = '<?xml version="1.0" encoding="utf-8"?>' + newLine;491 outputText += '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd" [' + newLine;492 outputText += indent+'<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">' + newLine;493 outputText += indent+'<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">' + newLine;494 outputText += indent+'<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">' + newLine;495 outputText += indent+'<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">' + newLine;496 outputText += indent+'<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">' + newLine;497 outputText += indent+'<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">' + newLine;498 outputText += ']>' + newLine;499 outputText += '<svg>' + newLine;500 outputText += '<variableSets xmlns="&ns_vars;">' + newLine;501 outputText += indent+'<variableSet varSetName="binding1" locked="none">' + newLine;502 outputText += indent+indent+'<variables>' + newLine;503 for (var i=0; i < numColumns; i++) {504 outputText += indent+indent+indent+'<variable varName="'+headerNames[i]+'" trait="textcontent" category="&ns_flows;"></variable>' + newLine;505 };506 outputText += indent+indent+'</variables>' + newLine;507 outputText += indent+indent+'<v:sampleDataSets xmlns:v="http://ns.adobe.com/Variables/1.0/" xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/">' + newLine;508 509 for (var i=0; i < numRows; i++) {510 var row = dataGrid[i];511 outputText += indent+indent+indent+'<v:sampleDataSet dataSetName="' + row[0] + '">'+newLine;512 for (var j=0; j < numColumns; j++) {513 outputText += indent+indent+indent+indent+'<'+headerNames[j]+'>'+newLine; 514 outputText += indent+indent+indent+indent+indent+'<p>' + row[j] + '</p>' +newLine;515 outputText += indent+indent+indent+indent+'</'+headerNames[j]+'>'+newLine516 };517 outputText += indent+indent+indent+'</v:sampleDataSet>'+newLine;518 };519 520 outputText += indent+indent+'</v:sampleDataSets>' + newLine;521 outputText += indent+'</variableSet>' + newLine;522 outputText += '</variableSets>' + newLine;523 outputText += '</svg>' + newLine;524 525 526 return outputText;527 528 },529 //---------------------------------------530 // JSON simple -- a one-off for sample data, 2013-09-11531 //---------------------------------------532 533 jsonSimple: function (dataGrid, headerNames, headerTypes, indent, newLine) {534 //inits...535 var commentLine = "//";536 var commentLineEnd = "";537 var outputText = "["+newLine;538 var numRows = dataGrid.length;539 var numColumns = headerNames.length;540 541 //begin render loop542 for (var i=0; i < numRows; i++) {543 var row = dataGrid[i];544 outputText += "{";545 // field name546 outputText += '"' + row[0] + '"' + ': ';547 var data = row[1];548 if (data == '')549 {550 outputText += ' null ';551 }552 else if (data.indexOf(";") != -1)553 {554 var vals = data.split(";");555 var numVals = vals.length;556 outputText += "[";557 for (var j=0; j < numVals; j++) {558 outputText += '"' + vals[j] + '"';559 if (j < (numVals-1)) {outputText += ", "};560 }561 outputText += "]";562 }563 else564 {565 outputText += '"' + data + '"';566 }567 568 outputText += "}";569 if (i < (numRows-1)) {outputText += ","+newLine};570 };571 outputText += newLine+"]";572 573 return outputText;574 },575 //---------------------------------------576 // YAML577 //---------------------------------------578 yaml: function (dataGrid, headerNames, headerTypes, indent, newLine) {579 //inits...580 var commentLine = "#";581 var commentLineEnd = "";582 var outputText = "";583 var numRows = dataGrid.length;584 var numColumns = headerNames.length;585 indent = ' ';586 //begin render loop587 for (var i=0; i < numRows; i++) {588 var row = dataGrid[i];589 outputText += newLine+"---"+newLine;590 for (var j=0; j < numColumns; j++) {591 outputText += headerNames[j]+': ';592 if (String(row[j]).indexOf("\n") > 0) {593 outputText += "|"+newLine+indent;594 var data = row[j];595 data = data.replace(/\\n/g,"\n");596 data = data.replace(/\n/g,newLine+indent);597 outputText += data;598 } else {599 outputText += row[j];600 }601 outputText += newLine602 };603 };604 return outputText;605 },606 //---------------------------------------607 // Jira table608 //---------------------------------------609 jiratable: function (dataGrid, headerNames, headerTypes, indent, newLine) {610 //inits...611 var outputText = "";612 var numRows = dataGrid.length;613 var numColumns = headerNames.length;614 var indent = "";615 // header row 616 if (headerNames[0] != "val0") {617 outputText += indent;618 for (var j=0; j < numColumns; j++) {619 outputText += "||" + headerNames[j];620 };621 outputText += "||" + newLine;622 };623 //begin render loop624 for (var i=0; i < numRows; i++) {625 outputText += indent+"| ";626 for (var j=0; j < numColumns; j++) {627 cellData = dataGrid[i][j];628 if (String(cellData).indexOf("\\n") > 0) {629 cellData = cellData.replace(/\\n/g,' ; ');630 }631 if (String(cellData).indexOf("\n") > 0) {632 cellData = cellData.replace(/\n/g,' ; ');633 }634 outputText += cellData;635 if (j < (numColumns-1)) {outputText+=" | "};636 };637 outputText += " |" + newLine;638 };639 return outputText;640 },641 //---------------------------------------642 // Redmine table643 //---------------------------------------644 rmtable: function (dataGrid, headerNames, headerTypes, indent, newLine) {645 //inits...646 var outputText = "";647 var numRows = dataGrid.length;648 var numColumns = headerNames.length;649 var indent = "";650 // header row 651 if (headerNames[0] != "val0") {652 outputText += indent+"|";653 for (var j=0; j < numColumns; j++) {654 outputText += "_." + headerNames[j];655 if (j < (numColumns-1)) {outputText+=" |"};656 };657 outputText += " |" + newLine;658 };659 660 //begin render loop661 for (var i=0; i < numRows; i++) {662 outputText += indent+"| ";663 for (var j=0; j < numColumns; j++) {664 cellData = dataGrid[i][j];665 // textile can handle line breaks, so translate \n back to a newline:666 if (String(cellData).indexOf("\\n") > 0) {667 cellData = cellData.replace(/\\n/g,"\n");668 }669 outputText += cellData;670 if (j < (numColumns-1)) {outputText+=" | "};671 };672 outputText += " |" + newLine;673 };674 675 return outputText;676 }677 ...

Full Screen

Full Screen

tableColumns.models.js

Source:tableColumns.models.js Github

copy

Full Screen

1import { headerNames, syncColumns } from 'Table/redux/Table.reducers';2import { setExploreColumns, getExploreColumns } from 'utils/explore/general.utils';3export function appColumns () {4 const columnOptions = [5 headerNames.APP,6 headerNames.PUBLISHER,7 headerNames.PLATFORM,8 headerNames.MOBILE_PRIORITY,9 // headerNames.FORTUNE_RANK,10 headerNames.AD_NETWORKS,11 headerNames.FIRST_SEEN_ADS,12 headerNames.LAST_SEEN_ADS,13 headerNames.AD_SDKS,14 headerNames.USER_BASE,15 headerNames.AD_SPEND,16 headerNames.CATEGORY,17 headerNames.PERMISSIONS,18 headerNames.DOWNLOADS,19 headerNames.RANK,20 headerNames.WEEKLY_CHANGE,21 headerNames.MONTHLY_CHANGE,22 headerNames.ENTERED_CHART,23 headerNames.RATING,24 headerNames.RATINGS_COUNT,25 headerNames.RELEASE_DATE,26 headerNames.LAST_UPDATED,27 headerNames.MAU,28 headerNames.MAU_CHANGE,29 ];30 const initialColumns = [31 headerNames.APP,32 headerNames.PUBLISHER,33 headerNames.PLATFORM,34 headerNames.MOBILE_PRIORITY,35 headerNames.USER_BASE,36 headerNames.CATEGORY,37 headerNames.RELEASE_DATE,38 headerNames.LAST_UPDATED,39 ];40 const lockedColumns = [41 headerNames.APP,42 ];43 const savedColumns = getExploreColumns('app');44 const finalColumns = syncColumns(savedColumns, columnOptions, initialColumns, lockedColumns);45 setExploreColumns('app', finalColumns);46 return finalColumns;47}48export function publisherColumns () {49 const columnOptions = [50 headerNames.PUBLISHER,51 headerNames.PLATFORM,52 headerNames.NUM_APPS,53 headerNames.FORTUNE_RANK,54 headerNames.AD_NETWORKS,55 headerNames.FIRST_SEEN_ADS,56 headerNames.LAST_SEEN_ADS,57 headerNames.LOCATIONS,58 headerNames.DOMAINS,59 headerNames.RATING,60 headerNames.RATINGS_COUNT,61 headerNames.DOWNLOADS,62 headerNames.LAST_UPDATED,63 headerNames.TOTAL_CONTACTS,64 ];65 const initialColumns = [66 headerNames.PUBLISHER,67 headerNames.PLATFORM,68 headerNames.NUM_APPS,69 headerNames.LOCATIONS,70 headerNames.DOMAINS,71 headerNames.RATING,72 headerNames.RATINGS_COUNT,73 headerNames.DOWNLOADS,74 headerNames.LAST_UPDATED,75 ];76 const lockedColumns = [77 headerNames.PUBLISHER,78 headerNames.PLATFORM,79 headerNames.NUM_APPS,80 headerNames.LAST_UPDATED,81 ];82 const savedColumns = getExploreColumns('publisher');83 const finalColumns = syncColumns(savedColumns, columnOptions, initialColumns, lockedColumns);84 setExploreColumns('publisher', finalColumns);85 return finalColumns;...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1import {default as commander} from 'commander';2import {default as http} from 'http';3import {readFile} from './fs';4import {openOrCreatePems, authorize} from './utils';5commander.option('-c, --configuration [path]', 'path of the configuration file').parse(process.argv);6let _conf;7let _pems;8let server = new http.Server();9server.on('request', (request, response) => {10 try {11 let verb = request.headers[_conf.headerNames.method];12 let path = request.headers[_conf.headerNames.uri];13 let token = request.headers.authorization.split(' ')[1];14 authorize(_conf, _pems, token, path, verb).then(result => {15 if (result.authorized) {16 response.statusCode = 200;17 response.setHeader(_conf.headerNames.id, result.id);18 response.setHeader(_conf.headerNames.groups, result.groups.join(','));19 } else {20 response.statusCode = 403;21 }22 console.log(`${(new Date()).toISOString()}\t${response.statusCode}\t${verb}\t${path}\t${_conf.headerNames.id}:${result.id};${_conf.headerNames.groups}:${result.groups.join(',')}`);23 response.end();24 }).catch(err => {25 console.dir(err);26 response.statusCode = 500;27 response.end();28 });29 } catch (error) {30 console.dir(error);31 response.statusCode = 500;32 response.end();33 }34});35readFile(commander.configuration).then(data => {36 _conf = JSON.parse(data);37 if (typeof _conf.headerNames == 'undefined') {38 _conf.headerNames = {};39 }40 _conf.headerNames.method = _conf.headerNames.method || 'x-forwarded-method';41 _conf.headerNames.uri = _conf.headerNames.uri || 'x-forwarded-uri';42 _conf.headerNames.id = _conf.headerNames.id || 'x-id';43 _conf.headerNames.groups = _conf.headerNames.groups || 'x-groups';44 return openOrCreatePems(_conf.pemsPath, _conf.keyUrl);45}).then(pems => {46 _pems = pems;47 server.listen(8888);48}).catch(error => {49 console.log(error);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.getLocations(function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var wpt = new WebPageTest('www.webpagetest.org');9wpt.getTesters(function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var wpt = new WebPageTest('www.webpagetest.org');15wpt.getTestStatus('170330_4K_1b8a1d9a4e2e2c2c8b8a2f2a2f2f2e2e', function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.getTestResults('170330_4K_1b8a1d9a4e2e2c2c8b8a2f2a2f2f2e2e', function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27wpt.getTestResults('170330_4K_1b8a1d9a4e2e2c2c8b8a2f2a2f2f2e

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.headerNames('www.google.com', function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var wpt = new WebPageTest('www.webpagetest.org');9wpt.headerValues('www.google.com', function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var wpt = new WebPageTest('www.webpagetest.org');15wpt.cookies('www.google.com', function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.requests('www.google.com', function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27wpt.requestHeaders('www.google.com', function(err, data) {28 if (err) return console.error(err);29 console.log(data);30});31var wpt = require('webpagetest');32var wpt = new WebPageTest('www.webpagetest.org');33wpt.requestBodies('www.google.com', function(err, data) {34 if (err) return console.error(err);35 console.log(data);36});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.headerNames('www.google.com', function(err, data) {3 console.log(data);4});5var wpt = require('wpt');6wpt.headerNames('www.google.com', function(err, data) {7 console.log(data);8});9var wpt = require('wpt');10wpt.headerValues('www.google.com', function(err, data) {11 console.log(data);12});13var wpt = require('wpt');14wpt.headerValues('www.google.com', function(err, data) {15 console.log(data);16});17var wpt = require('wpt');18wpt.headers('www.google.com', function(err, data) {19 console.log(data);20});21var wpt = require('wpt');22wpt.headers('www.google.com', function(err, data) {23 console.log(data);24});25var wpt = require('wpt');26wpt.har('www.google.com', function(err, data) {27 console.log(data);28});29var wpt = require('wpt');30wpt.har('www.google.com', function(err, data) {31 console.log(data);32});33var wpt = require('wpt');34wpt.htmlbody('www.google.com', function(err, data) {35 console.log(data);36});37var wpt = require('wpt');38wpt.htmlbody('www.google.com', function(err, data) {39 console.log(data);40});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt-api');2var options = {3};4wpt.headerNames(options, function (err, data) {5 if (err) {6 console.log(err);7 } else {8 console.log(data);9 }10});11var wpt = require('wpt-api');12var options = {13};14wpt.har(options, function (err, data) {15 if (err) {16 console.log(err);17 } else {18 console.log(data);19 }20});21var wpt = require('wpt-api');22var options = {23};24wpt.pagespeed(options, function (err, data) {25 if (err) {26 console.log(err);27 } else {28 console.log(data);29 }30});31var wpt = require('wpt-api');32var options = {33};34wpt.requests(options, function (err, data) {35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var wpt = require('wpt-api');42var options = {43};44wpt.screenshot(options, function (err, data) {45 if (err) {46 console.log(err);47 } else {48 console.log(data);49 }50});51var wpt = require('wpt-api');52var options = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var WPT = require('webpagetest');2var wpt = new WPT('API_KEY');3 console.log(data);4});5{6 "data": {7 "headers": {8 "Content-Type": "text/html; charset=ISO-8859-1",9 "X-XSS-Protection": "1; mode=block",10 "Set-Cookie": "PREF=ID=7b5c8e0d7e1c5d5b:FF=0:TM=1376853015:LM=1376853015:S=Z8P3bq3qZ1x0gV1r; expires=Wed, 19-Aug-15 19:10:15 GMT; path=/; domain=.google.com, NID=67=Zu8YzN0mZoI5vT9XkW8BhjJZb6fZv6cGwW8n0Jj1s2Qyv6Ug4W8Q4H4iR6Zn4p0nDwS8i6q3j6y1m0XUW8Q4H4iR6Zn4p0nDwS8i6q3j6y1m0XUW8Q4H4iR6Zn4p0nDwS8i6q3j6y1m0XUW8Q4H4iR6Zn4p0nDwS8i6q3j6y1m0XUW8Q4H4iR6Zn4p0nDwS8i6q3j6y1m0XUW

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wptObj = new wpt();3wptObj.headerNames(function(err, data){4 if(err){5 console.log("Error: " + err);6 }7 else{8 console.log(data);9 }10});11var wpt = require('wpt');12var wptObj = new wpt();13 if(err){14 console.log("Error: " + err);15 }16 else{17 console.log(data);18 }19});20var wpt = require('wpt');21var wptObj = new wpt();22 if(err){23 console.log("Error: " + err);24 }25 else{26 console.log(data);27 }28});29var wpt = require('wpt');30var wptObj = new wpt();31 if(err){32 console.log("Error: " + err);33 }34 else{35 console.log(data);36 }37});38var wpt = require('wpt');39var wptObj = new wpt();40 if(err){41 console.log("Error: " +

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4wpt.runTest(options, function(err, data) {5 if(err) return console.log(err);6 wpt.getTestResults(data.data.testId, function(err, data) {7 if(err) return console.log(err);8 console.log(data.data.response.headers.headerNames);9 });10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest('www.webpagetest.org', options.key);5wpt.runTest('www.google.com', function(err, data) {6 if (err) return console.log(err);7 var testId = data.data.testId;8 wpt.getTestResults(testId, function(err, data) {9 if (err) return console.log(err);10 console.log(data.data.median.firstView.headerSize);11 });12});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful