Best JavaScript code snippet using wpt
wgclinvar.js
Source:wgclinvar.js
1widgetGenerators['clinvar'] = {2 'variant': {3 'width': 450, 4 'height': 150, 5 'function': function (div, row, tabName) {6 var id = getWidgetData(tabName, 'clinvar', row, 'id');7 if (id == null) {8 var span = getEl('span');9 span.classList.add('nodata');10 addEl(div, addEl(span, getTn('No data')));11 return;12 }13 var sig = getWidgetData(tabName, 'clinvar', row, 'sig');14 var revstat = getWidgetData(tabName, 'clinvar', row, 'rev_stat');15 addInfoLine(div, 'Significance', sig, tabName);16 addInfoLine(div, 'Review Status', revstat, tabName);17 var link = '';18 if(id != null){19 link = 'https://www.ncbi.nlm.nih.gov/clinvar/variation/'+id;20 }21 else{22 id = '';23 }24 addInfoLineLink(div, 'ClinVar ID', id, link, 10);25 var diseases = getWidgetData(tabName, 'clinvar', row, 'disease_names');26 var refs = getWidgetData(tabName, 'clinvar', row, 'disease_refs');27 var diseasels = diseases != null ? diseases.split('|') : [];28 var refsls = refs != null ? refs.split('|') : [];29 disease_objls = []30 for (var i=0;i<refsls.length;i++){31 if (refsls[i] == '.'){32 refsls[i] = null;33 }34 else{35 disease_objls.push(linkify(diseasels[i], refsls[i]))36 }37 }38 var table = getWidgetTableFrame();39 addEl(div, table);40 var thead = getWidgetTableHead(['Disease', 'Database'],41 ['70%','30%']);42 addEl(table, thead);43 var tbody = getEl('tbody');44 addEl(table, tbody);45 for (var j=0;j<disease_objls.length;j++){46 for (var ref in disease_objls[j].refs){47 var link = disease_objls[j].refs[ref];48 var tr = getWidgetTableTr([disease_objls[j].name,link], [ref]);49 addEl(tbody, tr);50 }51 addEl(div, addEl(table, tbody));52 }5354 //Returns a disease object with dictionary of db references55 function linkify(disease, db_id){56 var idls = db_id.split(',');57 var links = {};58 for (var i=0;i<idls.length;i++){59 var link = ''60 if(idls[i].startsWith('MedGen')){61 link = 'https://www.ncbi.nlm.nih.gov/medgen/'+idls[i].slice(idls[i].indexOf(':')+1);62 links.MedGen = link;63 }64 else if(idls[i].startsWith('OMIM')){65 link = 'https://www.omim.org/entry/'+idls[i].slice(idls[i].indexOf(':')+1);66 links.OMIM = link;67 }68 else if(idls[i].startsWith('EFO')){69 link = 'https://www.ebi.ac.uk/ols/ontologies/efo/terms?short_form='+idls[i].slice(idls[i].indexOf(':')+1).replace(' ','_');70 links.EFO = link;71 }72 else if(idls[i].startsWith('Human')){73 link = 'https://www.human-phenotype-ontology.org/hpoweb/showterm?id='+idls[i].slice(idls[i].indexOf(':')+1);74 links.HPO = link;75 }76 else if(idls[i].startsWith('Gene')){77 link = 'https://www.ncbi.nlm.nih.gov/gene/'+idls[i].slice(idls[i].indexOf(':')+1);78 links.Gene = link;79 }80 else if(idls[i].startsWith('Orphanet')){81 link = 'https://www.orpha.net/consor/cgi-bin/OC_Exp.php?lng=EN&Expert='+idls[i].slice(idls[i].indexOf(':')+6);82 links.Orphanet = link;83 }84 else if(idls[i].startsWith('MeSH')){85 link = 'https://meshb.nlm.nih.gov/record/ui?ui='+idls[i].slice(idls[i].indexOf(':')+1);86 links.MeSH = link;87 }88 else if(idls[i].startsWith('SNOMED')){89 link = 'https://browser.ihtsdotools.org/?perspective=full&conceptId1='+idls[i].slice(idls[i].indexOf(':')+1)+'&edition=en-edition&release=v20180731&server=https://browser.ihtsdotools.org/api/v1/snomed&langRefset=900000000000509007';90 links.SNOMED_CT = link;91 }92 }93 return disease_obj = {94 name: disease,95 refs: links96 };97 }98 }99 }
...
IDLTools.amd.js
Source:IDLTools.amd.js
1;modjewel.define("weinre/common/IDLTools", function(require, exports, module) { // Generated by CoffeeScript 1.8.02var Callback, Ex, IDLTools, IDLs, getProxyMethod;3Ex = require('./Ex');4Callback = require('./Callback');5IDLs = {};6module.exports = IDLTools = (function() {7 function IDLTools() {8 throw new Ex(arguments, "this class is not intended to be instantiated");9 }10 IDLTools.addIDLs = function(idls) {11 var idl, intf, _i, _len, _results;12 _results = [];13 for (_i = 0, _len = idls.length; _i < _len; _i++) {14 idl = idls[_i];15 _results.push((function() {16 var _j, _len1, _ref, _results1;17 _ref = idl.interfaces;18 _results1 = [];19 for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {20 intf = _ref[_j];21 IDLs[intf.name] = intf;22 _results1.push(intf.module = idl.name);23 }24 return _results1;25 })());26 }27 return _results;28 };29 IDLTools.getIDL = function(name) {30 return IDLs[name];31 };32 IDLTools.getIDLsMatching = function(regex) {33 var intf, intfName, results;34 results = [];35 for (intfName in IDLs) {36 intf = IDLs[intfName];37 if (intfName.match(regex)) {38 results.push(intf);39 }40 }41 return results;42 };43 IDLTools.validateAgainstIDL = function(klass, interfaceName) {44 var classMethod, error, errors, intf, intfMethod, messagePrefix, printName, propertyName, _i, _j, _len, _len1, _ref, _results;45 intf = IDLTools.getIDL(interfaceName);46 messagePrefix = "IDL validation for " + interfaceName + ": ";47 if (null === intf) {48 throw new Ex(arguments, messagePrefix + ("idl not found: '" + interfaceName + "'"));49 }50 errors = [];51 _ref = intf.methods;52 for (_i = 0, _len = _ref.length; _i < _len; _i++) {53 intfMethod = _ref[_i];54 classMethod = klass.prototype[intfMethod.name];55 printName = klass.name + "::" + intfMethod.name;56 if (null === classMethod) {57 errors.push(messagePrefix + ("method not implemented: '" + printName + "'"));58 continue;59 }60 if (classMethod.length !== intfMethod.parameters.length) {61 if (classMethod.length !== intfMethod.parameters.length + 1) {62 errors.push(messagePrefix + ("wrong number of parameters: '" + printName + "'"));63 continue;64 }65 }66 }67 for (propertyName in klass.prototype) {68 if (klass.prototype.hasOwnProperty(propertyName)) {69 continue;70 }71 if (propertyName.match(/^_.*/)) {72 continue;73 }74 printName = klass.name + "::" + propertyName;75 if (!intf.methods[propertyName]) {76 errors.push(messagePrefix + ("method should not be implemented: '" + printName + "'"));77 continue;78 }79 }80 if (!errors.length) {81 return;82 }83 _results = [];84 for (_j = 0, _len1 = errors.length; _j < _len1; _j++) {85 error = errors[_j];86 _results.push(require("./Weinre").logError(error));87 }88 return _results;89 };90 IDLTools.buildProxyForIDL = function(proxyObject, interfaceName) {91 var intf, intfMethod, messagePrefix, _i, _len, _ref, _results;92 intf = IDLTools.getIDL(interfaceName);93 messagePrefix = "building proxy for IDL " + interfaceName + ": ";94 if (null === intf) {95 throw new Ex(arguments, messagePrefix + ("idl not found: '" + interfaceName + "'"));96 }97 _ref = intf.methods;98 _results = [];99 for (_i = 0, _len = _ref.length; _i < _len; _i++) {100 intfMethod = _ref[_i];101 _results.push(proxyObject[intfMethod.name] = getProxyMethod(intf, intfMethod));102 }103 return _results;104 };105 return IDLTools;106})();107getProxyMethod = function(intf, method) {108 var proxyMethod, result;109 result = proxyMethod = function() {110 var args, callbackId;111 callbackId = null;112 args = [].slice.call(arguments);113 if (args.length > 0) {114 if (typeof args[args.length - 1] === "function") {115 callbackId = Callback.register(args[args.length - 1]);116 args = args.slice(0, args.length - 1);117 }118 }119 while (args.length < method.parameters.length) {120 args.push(null);121 }122 args.push(callbackId);123 return this.__invoke(intf.name, method.name, args);124 };125 result.displayName = intf.name + "__" + method.name;126 return result;127};128require("../common/MethodNamer").setNamesForClass(module.exports);...
Using AI Code Generation
1wpt.idls(function(err, data) {2 if(err){3 console.log(err);4 }5 else{6 console.log(data);7 }8});9wpt.idls(function(err, data) {10 if(err){11 console.log(err);12 }13 else{14 console.log(data);15 }16});17wpt.idls(function(err, data) {18 if(err){19 console.log(err);20 }21 else{22 console.log(data);23 }24});25wpt.idls(function(err, data) {26 if(err){27 console.log(err);28 }29 else{30 console.log(data);31 }32});33wpt.idls(function(err, data) {34 if(err){35 console.log(err);36 }37 else{38 console.log(data);39 }40});41wpt.idls(function(err, data) {42 if(err){43 console.log(err);44 }45 else{46 console.log(data);47 }48});49wpt.idls(function(err, data) {50 if(err){51 console.log(err);52 }53 else{54 console.log(data);55 }56});57wpt.idls(function(err, data) {58 if(err){59 console.log(err);60 }61 else{62 console.log(data);63 }64});65wpt.idls(function(err, data) {66 if(err){67 console.log(err);68 }69 else{70 console.log(data);71 }72});73wpt.idls(function(err, data) {74 if(err){75 console.log(err);76 }77 else{78 console.log(data);79 }80});81wpt.idls(function(err, data
Using AI Code Generation
1var idls = [ "interface Foo { void foo(); };",2 "interface Bar { void bar(); };",3 "interface FooBar : Foo, Bar { void foobar(); };",4 "interface BarFoo : Bar, Foo { void barfoo(); };"5 ];6var idl_array = new IdlArray();7idl_array.add_idls(idls);8idl_array.add_objects({ Foo: ['foo'],9 });10idl_array.test();
Using AI Code Generation
1var idls = new IdlsInterface();2idls.get(function(idl) {3 console.log(idl);4});5var idls = new IdlsInterface();6idls.get(function(idl) {7 console.log(idl);8});9var idls = new IdlsInterface();10idls.get(function(idl) {11 console.log(idl);12});13var idls = new IdlsInterface();14idls.get(function(idl) {15 console.log(idl);16});17var idls = new IdlsInterface();18idls.get(function(idl) {19 console.log(idl);20});21var idls = new IdlsInterface();22idls.get(function(idl) {23 console.log(idl);24});25var idls = new IdlsInterface();26idls.get(function(idl) {27 console.log(idl);28});29var idls = new IdlsInterface();30idls.get(function(idl) {31 console.log(idl);32});33var idls = new IdlsInterface();34idls.get(function(idl) {35 console.log(idl);36});37var idls = new IdlsInterface();38idls.get(function(idl) {39 console.log(idl);40});41var idls = new IdlsInterface();42idls.get(function(idl) {43 console.log(idl);44});45var idls = new IdlsInterface();46idls.get(function(idl) {47 console.log(idl);48});
Using AI Code Generation
1var wpt = require('wpt-driver')2var idls = wpt.idls;3idls(url, function (err, idls) {4 console.log(idls);5});6var wpt = require('wpt-driver')7var idls = wpt.idls;8idls(url, function (err, idls) {9 console.log(idls);10});11var wpt = require('wpt-driver')12var idls = wpt.idls;13idls(url, function (err, idls) {14 console.log(idls);15});16var wpt = require('wpt-driver')17var idls = wpt.idls;18idls(url, function (err, idls) {19 console.log(idls);20});21var wpt = require('wpt-driver')22var idls = wpt.idls;23idls(url, function (err, idls) {24 console.log(idls);25});26var wpt = require('wpt-driver')27var idls = wpt.idls;28idls(url, function (err, idls) {29 console.log(idls);30});31var wpt = require('wpt-driver')32var idls = wpt.idls;33idls(url, function (err, idls) {34 console.log(idls);35});36var wpt = require('wpt-driver')37var idls = wpt.idls;38idls(url, function (
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!