Best JavaScript code snippet using wpt
Glyph.js
Source:Glyph.js
...32 * @param {String/Number} glyph33 * If a `string` is passed, it may be the character itself, or the unicode codepoint.34 * for example:35 *36 * new Ext.Glyph('H'); // the "home" icon in the default (Pictos) font.37 * new Ext.Glyph('x48'); // the "home" icon in the default (Pictos) font.38 * new Ext.Glyph(72); // the "home" icon in the default (Pictos) font.39 *40 * An `@` separator may be used to denote the font:41 *42 * new Ext.Glyph('xf015@FontAwesome'); // The "home" icon in the FontAwesome font.43 */44 constructor: function(glyph) {45 glyph && this.setGlyph(glyph);46 },47 /**48 * 49 * @param {String/Number} glyph50 * If a `string` is passed, it may be the character itself, or the unicode codepoint.51 * for example:52 *53 * myGlyph.setGlyph('H'); // the "home" icon in the default (Pictos) font.54 * myGlyph.setGlyph('x48'); // the "home" icon in the default (Pictos) font.55 * myGlyph.setGlyph(72); // the "home" icon in the default (Pictos) font.56 *57 * An `@` separator may be used to denote the font:58 *59 * myGlyph.setGlyph('xf015@FontAwesome'); // The "home" icon in the FontAwesome font.60 *61 */62 setGlyph: function(glyph) {63 var glyphParts;64 this.glyphConfig = glyph;65 if (typeof glyph === 'string') {66 glyphParts = glyph.split('@');67 // If the glyph specification cannot be parsed as a number68 // we use the codepoint of the first character.69 // If the raw string isNaN, we prepend '0' so that a possible 'xf005' will parse as hex,70 // otherwise parse it as decimal.71 if (isNaN(glyph = isNaN(glyphParts[0]) ? parseInt('0' + glyphParts[0], 16) : parseInt(glyphParts[0], 10)) || !glyph) {72 glyph = glyphParts[0].charCodeAt(0);73 }74 this.fontFamily = glyphParts[1] || Ext._glyphFontFamily;75 } else {76 this.fontFamily = Ext._glyphFontFamily;77 }78 this.codepoint = glyph;79 this.character = Ext.String.fromCodePoint(this.codepoint);80 return this;81 },82 getStyle: function() {83 return {84 'font-family': this.fontFamily85 };86 },87 isEqual: function(other) {88 return other && other.isGlyph && other.codepoint === this.codepoint && other.fontFamily === this.fontFamily;89 },90 statics: (function() {91 var instance;92 return {93 /**94 * @static95 * Returns a static, *singleton* `Glyph` instance encapsulating the passed configuration.96 * See {@link #method-setGlyph}97 *98 * Note that the returned `Glyph` is reused upon each call, so only use this whwn the encapsulated99 * information is consumed immediately. For a persistent `Glyph` instance, instantiate a new one.100 *101 * @param {String/Number} glyph102 * If a `string` is passed, it may be the character itself, or the unicode codepoint.103 * for example:104 *105 * Ext.Glyph.fly('H'); // the "home" icon in the default (Pictos) font.106 * Ext.Glyph.fly('x48'); // the "home" icon in the default (Pictos) font.107 * Ext.Glyph.fly(72); // the "home" icon in the default (Pictos) font.108 *109 * An `@` separator may be used to denote the font:110 *111 * Ext.Glyph.fly('xf015@FontAwesome'); // The "home" icon in the FontAwesome font.112 *113 * @returns {Ext.Glyph} A static `Glyph` instance encapsulating the passed configuration.114 */115 fly: function(glyph) {116 return glyph.isGlyph ? glyph : (instance || (instance = new Ext.Glyph())).setGlyph(glyph);117 }118 };119 })()...
Using AI Code Generation
1var wptools = require('wptools');2var wiki = wptools.page('Glyph_(comics)');3wiki.get(function(err, resp) {4 if (!err) {5 console.log(resp);6 }7});8var wptools = require('wptools');9var wiki = wptools.page('Glyph_(comics)');10wiki.get(function(err, resp) {11 if (!err) {12 console.log(resp);13 }14});15var wptools = require('wptools');16var wiki = wptools.page('Glyph_(comics)');17wiki.get(function(err, resp) {18 if (!err) {19 console.log(resp);20 }21});22var wptools = require('wptools');23var wiki = wptools.page('Glyph_(comics)');24wiki.get(function(err, resp) {25 if (!err) {26 console.log(resp);27 }28});29var wptools = require('wptools');30var wiki = wptools.page('Glyph_(comics)');31wiki.get(function(err, resp) {32 if (!err) {33 console.log(resp);34 }35});36var wptools = require('wptools');37var wiki = wptools.page('Glyph_(comics)');38wiki.get(function(err, resp) {39 if (!err) {40 console.log(resp);41 }42});43var wptools = require('wptools');44var wiki = wptools.page('Glyph_(comics)');45wiki.get(function(err, resp) {46 if (!err) {47 console.log(resp);48 }49});50var wptools = require('wptools');51var wiki = wptools.page('Glyph_(comics)');52wiki.get(function(err, resp) {53 if (!err) {54 console.log(resp);55 }56});
Using AI Code Generation
1var wptools = require('./index.js');2page.get(function(err, resp) {3 console.log(resp);4});5var wptools = require('./index.js');6page.get(function(err, resp) {7 console.log(resp);8});
Using AI Code Generation
1var wptools = require('wptools');2var glyph = wptools.glyph('en.wikipedia.org', 'Glyph');3glyph.get(function(err, resp){4 console.log(resp);5});6### wptools.page([language], [title])7var wptools = require('wptools');8var page = wptools.page('en.wikipedia.org', 'Page');9### page.get([options], callback)
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!!