Best JavaScript code snippet using wpt
i18n_en.js
Source: i18n_en.js
1// Action2ifLocale.setValues(GAddLayerAction, IFLocale.Language.English, ["title"], ["Add Layer"]);3ifLocale.setValues(GAddPageAction, IFLocale.Language.English, ["title"], ["Add Page"]);4ifLocale.setValues(GAlignAction, IFLocale.Language.English, ["title.align-left", "title.align-center", "title.align-right", "title.align-top", "title.align-middle", "title.align-bottom", "title.align-justify-horizontal", "title.align-justify-vertical"], ["Align Left", "Align Center", "Align Right", "Align Top", "Align Middle", "Align Bottom", "Justify Horizontal", "Justify Vertical"]);5ifLocale.setValues(GCloneAction, IFLocale.Language.English, ["title"], ["Clone"]);6ifLocale.setValues(GCloseAction, IFLocale.Language.English, ["title"], ["Close"]);7ifLocale.setValues(GCloseAllAction, IFLocale.Language.English, ["title"], ["Close All"]);8ifLocale.setValues(GCopyAction, IFLocale.Language.English, ["title"], ["Copy"]);9ifLocale.setValues(GCopyAttributesAction, IFLocale.Language.English, ["title"], ["Copy Attributes"]);10ifLocale.setValues(GCutAction, IFLocale.Language.English, ["title"], ["Cut"]);11ifLocale.setValues(GDeleteAction, IFLocale.Language.English, ["title"], ["Delete"]);12ifLocale.setValues(GDeleteLayerAction, IFLocale.Language.English, ["title"], ["Delete Layer"]);13ifLocale.setValues(GDeletePageAction, IFLocale.Language.English, ["title"], ["Delete Page"]);14ifLocale.setValues(GDistributeAction, IFLocale.Language.English, ["title.horizontal", "title.vertical"], ["Distribute Horizontally", "Distribute Vertically"]);15ifLocale.setValues(GDuplicateAction, IFLocale.Language.English, ["title"], ["Duplicate"]);16ifLocale.setValues(GFitAllAction, IFLocale.Language.English, ["title"], ["Fit All"]);17ifLocale.setValues(GFitCurrentLayerAction, IFLocale.Language.English, ["title"], ["Fit Layer"]);18ifLocale.setValues(GFitCurrentPageAction, IFLocale.Language.English, ["title"], ["Fit Page"]);19ifLocale.setValues(GFitSelectionAction, IFLocale.Language.English, ["title"], ["Fit Selection"]);20ifLocale.setValues(GGroupAction, IFLocale.Language.English, ["title"], ["Group Selection"]);21ifLocale.setValues(GPlaceImageAction, IFLocale.Language.English, ["title"], ["Place Image..."]);22ifLocale.setValues(GInvertSelectionAction, IFLocale.Language.English, ["title"], ["Invert Selection"]);23ifLocale.setValues(GLayerTypeAction, IFLocale.Language.English, ["title"], ["%name% Layer"]);24ifLocale.setValues(GNewAction, IFLocale.Language.English, ["title"], ["New..."]);25ifLocale.setValues(GNewWindowAction, IFLocale.Language.English, ["title"], ["New Window"]);26ifLocale.setValues(GOpenAction, IFLocale.Language.English, ["title"], ["Open..."]);27ifLocale.setValues(GArrangeAction, IFLocale.Language.English, ["title.send-front", "title.bring-forward", "title.send-backward", "title.send-back"], ["Send To Front", "Bring Forward", "Send Backward", "Send To Back"]);28ifLocale.setValues(GOriginalViewAction, IFLocale.Language.English, ["title"], ["Original-View"]);29ifLocale.setValues(GPaintModeAction, IFLocale.Language.English, ["title"], ["%name% View"]);30ifLocale.setValues(GPasteAction, IFLocale.Language.English, ["title"], ["Paste"]);31ifLocale.setValues(GPasteInPlaceAction, IFLocale.Language.English, ["title"], ["Paste In Place"]);32ifLocale.setValues(GPasteInsideAction, IFLocale.Language.English, ["title"], ["Paste Inside Selection"]);33ifLocale.setValues(GPasteAttributesAction, IFLocale.Language.English, ["title"], ["Paste Attributes"]);34ifLocale.setValues(GPixelPreviewAction, IFLocale.Language.English, ["title"], ["Pixel Preview"]);35ifLocale.setValues(GRedoAction, IFLocale.Language.English, ["title"], ["Redo"]);36ifLocale.setValues(GSaveAction, IFLocale.Language.English, ["title"], ["Save"]);37ifLocale.setValues(GSaveAllAction, IFLocale.Language.English, ["title"], ["Save All"]);38ifLocale.setValues(GSaveAsAction, IFLocale.Language.English, ["title"], ["Save As..."]);39ifLocale.setValues(GShowRulersAction, IFLocale.Language.English, ["title"], ["Show Rulers"]);40ifLocale.setValues(GSelectAllAction, IFLocale.Language.English, ["title"], ["Select All"]);41ifLocale.setValues(GShowAllPagesAction, IFLocale.Language.English, ["title"], ["All Pages visible"]);42ifLocale.setValues(GShowGridAction, IFLocale.Language.English, ["title"], ["Show Grid"]);43ifLocale.setValues(GSliceFromSelectionAction, IFLocale.Language.English, ["title"], ["Create Slice from Selection"]);44ifLocale.setValues(GSnapUnitAction, IFLocale.Language.English, ["title.full", "title.half"], ["Snap to full units", "Snap to half units"]);45ifLocale.setValues(GTransformAction, IFLocale.Language.English, ["title.rotate-45-left", "title.rotate-90-left", "title.rotate-180-left", "title.rotate-45-right", "title.rotate-90-right", "title.rotate-180-right", "title.flip-vertical", "title.flip-horizontal"], ["Rotate 45° Left", "Rotate 90° Left", "Rotate 180° Left", "Rotate 45° Right", "Rotate 90° Right", "Rotate 180° Right", "Flip Vertical", "Flip Horizontal"]);46ifLocale.setValues(GUndoAction, IFLocale.Language.English, ["title"], ["Undo"]);47ifLocale.setValues(GUngroupAction, IFLocale.Language.English, ["title"], ["Ungroup Selection"]);48ifLocale.setValues(GZoomInAction, IFLocale.Language.English, ["title"], ["Zoom in"]);49ifLocale.setValues(GZoomOutAction, IFLocale.Language.English, ["title"], ["Zoom out"]);50// Color51ifLocale.setValues(GAnalogousMatcher, IFLocale.Language.English, ["title"], ["Analogous"]);52ifLocale.setValues(GComplementaryMatcher, IFLocale.Language.English, ["title"], ["Complementary"]);53// Palette54ifLocale.setValues(GExportPalette, IFLocale.Language.English, ["title"], ["Export"]);55ifLocale.setValues(GStylePalette, IFLocale.Language.English, ["title"], ["Style"]);56// Panel57ifLocale.setValues(GPropertiesPanel, IFLocale.Language.English, ["title"], ["Properties"]);58ifLocale.setValues(GTransformPanel, IFLocale.Language.English, ["title"], ["Transform"]);59// Sidebar60ifLocale.setValues(GStylesSwatchesSidebar, IFLocale.Language.English, ["title"], ["Styles & Swatches"]);...
Set.js
Source: Set.js
1const {InstanceError} = require("./errors/InstanceError");2const {TypeError} = require("./errors/TypeError");3const {CallbackError} = require("./errors/CallBackError");4const {ThisArgsError} = require("./errors/ThisArgsError");5const {EmptyArgsError} = require("./errors/EmptyArgsError");6class mySet {7 #setValues;8 constructor(iterableObj) {9 this.#setValues = this.fillSet(iterableObj);10 }11 getSize() {12 return this.#setValues.length13 }14 add(addValue) {15 if(arguments.length === 0) {16 throw new EmptyArgsError("Add")17 }18 let isInSet = this.#setValues.some((el) => el === addValue)19 if (!isInSet) {20 this.#setValues.push(addValue)21 }22 return this23 }24 has(searchValue) {25 if(arguments.length === 0) {26 throw new EmptyArgsError("Has")27 }28 for (let e of this) {29 if (e === searchValue) {30 return true;31 }32 }33 return false;34 }35 delete(deletedValue) {36 if(arguments.length === 0) {37 throw new EmptyArgsError("Delete")38 }39 this.#setValues.forEach((el, index) => {40 if (el === deletedValue) {41 this.#setValues.splice(index, 1);42 }43 })44 return this;45 }46 multiply(insertedSet) {47 if (!(insertedSet instanceof mySet)) {48 throw new InstanceError(insertedSet)49 }50 let newSet = new mySet()51 if (insertedSet.#setValues.length === 0) {52 return new mySet()53 }54 for (let el of insertedSet) {55 if (this.#setValues.includes(el)) {56 newSet.add(el)57 }58 }59 return newSet;60 }61 plus(unionSet) {62 if (!(unionSet instanceof mySet)) {63 throw new InstanceError(unionSet)64 }65 let newSet = new mySet()66 for (let el of this) {67 newSet.add(el);68 }69 for (let el of unionSet) {70 if (!(this.#setValues.includes(el))) {71 newSet.add(el)72 }73 }74 return newSet;75 }76 minus(minusSet) {77 if (!(minusSet instanceof mySet)) {78 throw new InstanceError(minusSet)79 }80 let newSet = new mySet();81 for (let el of this) {82 if (!(minusSet.#setValues.includes(el))) {83 newSet.add(el)84 }85 }86 return newSet87 }88 include(includedSet) {89 if (!(includedSet instanceof mySet)) {90 throw new InstanceError(includedSet);91 }92 let isInclude = includedSet.#setValues.every((el => this.#setValues.includes(el)))93 if ((isInclude || includedSet.#setValues.length === 0) && this.#setValues.length !== 0) {94 return true95 }96 if (this.#setValues.length === 0 || !isInclude) {97 return false98 }99 }100 filter(callback, thisArgs) {101 if (typeof (callback) !== "function") {102 throw new CallbackError("forEach", typeof (callback));103 }104 if(thisArgs && (typeof thisArgs!=="object")){105 throw new ThisArgsError("forEach", typeof (thisArgs))106 }107 let newSet = new mySet();108 for (let el of this) {109 let isFilter = callback.call(thisArgs, el, this)110 if (isFilter) {111 newSet.add(el)112 }113 }114 return newSet115 }116 forEach(callback, thisArgs) {117 if (typeof (callback) !== "function") {118 throw new CallbackError("forEach", typeof (callback));119 }120 if(thisArgs && (typeof thisArgs!=="object")){121 throw new ThisArgsError("forEach", typeof (thisArgs))122 }123 for (let el of this) {124 callback.call(thisArgs, el, this)125 }126 }127 fillSet(obj) {128 let newSetValue = [];129 if (typeof (obj) === "undefined") {130 return []131 } else if (!(typeof obj[Symbol.iterator] === 'function')) {132 throw new TypeError(obj)133 }134 for (let el of obj) {135 if (!newSetValue.includes(el)) {136 newSetValue.push(el);137 }138 }139 return newSetValue;140 }141 * [Symbol.iterator]() {142 for (let el of this.#setValues) {143 yield el144 }145 }146}147module.exports = {148 mySet...
Check out the latest blogs from LambdaTest on this topic:
Testing is a critical step in any web application development process. However, it can be an overwhelming task if you don’t have the right tools and expertise. A large percentage of websites still launch with errors that frustrate users and negatively affect the overall success of the site. When a website faces failure after launch, it costs time and money to fix.
We launched LT Browser in 2020, and we were overwhelmed by the response as it was awarded as the #5 product of the day on the ProductHunt platform. Today, after 74,585 downloads and 7,000 total test runs with an average of 100 test runs each day, the LT Browser has continued to help developers build responsive web designs in a jiffy.
Smartphones have changed the way humans interact with technology. Be it travel, fitness, lifestyle, video games, or even services, it’s all just a few touches away (quite literally so). We only need to look at the growing throngs of smartphone or tablet users vs. desktop users to grasp this reality.
As part of one of my consulting efforts, I worked with a mid-sized company that was looking to move toward a more agile manner of developing software. As with any shift in work style, there is some bewilderment and, for some, considerable anxiety. People are being challenged to leave their comfort zones and embrace a continuously changing, dynamic working environment. And, dare I say it, testing may be the most ‘disturbed’ of the software roles in agile development.
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!!