Best JavaScript code snippet using wpt
test_dedupeLogins.js
Source:test_dedupeLogins.js
1/*2 * Test LoginHelper.dedupeLogins3 */4"use strict";5Cu.import("resource://gre/modules/LoginHelper.jsm");6const DOMAIN1_HTTP_TO_HTTP_U1_P1 = TestData.formLogin({7 timePasswordChanged: 3000,8 timeLastUsed: 2000,9});10const DOMAIN1_HTTP_TO_HTTP_U1_P2 = TestData.formLogin({11 password: "password two",12});13const DOMAIN1_HTTP_TO_HTTP_U2_P2 = TestData.formLogin({14 password: "password two",15 username: "username two",16});17const DOMAIN1_HTTPS_TO_HTTPS_U1_P1 = TestData.formLogin({18 formSubmitURL: "http://www.example.com",19 hostname: "https://www3.example.com",20 timePasswordChanged: 4000,21 timeLastUsed: 1000,22});23const DOMAIN1_HTTPS_TO_EMPTY_U1_P1 = TestData.formLogin({24 formSubmitURL: "",25 hostname: "https://www3.example.com",26});27const DOMAIN1_HTTPS_TO_EMPTYU_P1 = TestData.formLogin({28 hostname: "https://www3.example.com",29 username: "",30});31const DOMAIN1_HTTP_AUTH = TestData.authLogin({32 hostname: "http://www3.example.com",33});34const DOMAIN1_HTTPS_AUTH = TestData.authLogin({35 hostname: "https://www3.example.com",36});37add_task(function test_dedupeLogins() {38 // [description, expectedOutput, dedupe arg. 0, dedupe arg 1, ...]39 let testcases = [40 [41 "exact dupes",42 [DOMAIN1_HTTP_TO_HTTP_U1_P1],43 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],44 undefined,45 [], // force no resolveBy logic to test behavior of preferring the first..46 ],47 [48 "default uniqueKeys is un + pw",49 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P2],50 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P2],51 undefined,52 [],53 ],54 [55 "same usernames, different passwords, dedupe username only",56 [DOMAIN1_HTTP_TO_HTTP_U1_P1],57 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P2],58 ["username"],59 [],60 ],61 [62 "same un+pw, different scheme",63 [DOMAIN1_HTTP_TO_HTTP_U1_P1],64 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],65 undefined,66 [],67 ],68 [69 "same un+pw, different scheme, reverse order",70 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],71 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],72 undefined,73 [],74 ],75 [76 "same un+pw, different scheme, include hostname",77 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],78 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],79 ["hostname", "username", "password"],80 [],81 ],82 [83 "empty username is not deduped with non-empty",84 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_EMPTYU_P1],85 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_EMPTYU_P1],86 undefined,87 [],88 ],89 [90 "empty username is deduped with same passwords",91 [DOMAIN1_HTTPS_TO_EMPTYU_P1],92 [DOMAIN1_HTTPS_TO_EMPTYU_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],93 ["password"],94 [],95 ],96 [97 "mix of form and HTTP auth",98 [DOMAIN1_HTTP_TO_HTTP_U1_P1],99 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTP_AUTH],100 undefined,101 [],102 ],103 ];104 for (let tc of testcases) {105 let description = tc.shift();106 let expected = tc.shift();107 let actual = LoginHelper.dedupeLogins(...tc);108 Assert.strictEqual(actual.length, expected.length, `Check: ${description}`);109 for (let [i, login] of expected.entries()) {110 Assert.strictEqual(actual[i], login, `Check index ${i}`);111 }112 }113});114add_task(function* test_dedupeLogins_resolveBy() {115 Assert.ok(DOMAIN1_HTTP_TO_HTTP_U1_P1.timeLastUsed > DOMAIN1_HTTPS_TO_HTTPS_U1_P1.timeLastUsed,116 "Sanity check timeLastUsed difference");117 Assert.ok(DOMAIN1_HTTP_TO_HTTP_U1_P1.timePasswordChanged < DOMAIN1_HTTPS_TO_HTTPS_U1_P1.timePasswordChanged,118 "Sanity check timePasswordChanged difference");119 let testcases = [120 [121 "default resolveBy is timeLastUsed",122 [DOMAIN1_HTTP_TO_HTTP_U1_P1],123 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],124 ],125 [126 "default resolveBy is timeLastUsed, reversed input",127 [DOMAIN1_HTTP_TO_HTTP_U1_P1],128 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],129 ],130 [131 "resolveBy timeLastUsed + timePasswordChanged",132 [DOMAIN1_HTTP_TO_HTTP_U1_P1],133 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],134 undefined,135 ["timeLastUsed", "timePasswordChanged"],136 ],137 [138 "resolveBy timeLastUsed + timePasswordChanged, reversed input",139 [DOMAIN1_HTTP_TO_HTTP_U1_P1],140 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],141 undefined,142 ["timeLastUsed", "timePasswordChanged"],143 ],144 [145 "resolveBy timePasswordChanged",146 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],147 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],148 undefined,149 ["timePasswordChanged"],150 ],151 [152 "resolveBy timePasswordChanged, reversed",153 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],154 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],155 undefined,156 ["timePasswordChanged"],157 ],158 [159 "resolveBy timePasswordChanged + timeLastUsed",160 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],161 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],162 undefined,163 ["timePasswordChanged", "timeLastUsed"],164 ],165 [166 "resolveBy timePasswordChanged + timeLastUsed, reversed",167 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],168 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],169 undefined,170 ["timePasswordChanged", "timeLastUsed"],171 ],172 [173 "resolveBy scheme + timePasswordChanged, prefer HTTP",174 [DOMAIN1_HTTP_TO_HTTP_U1_P1],175 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],176 undefined,177 ["scheme", "timePasswordChanged"],178 DOMAIN1_HTTP_TO_HTTP_U1_P1.hostname,179 ],180 [181 "resolveBy scheme + timePasswordChanged, prefer HTTP, reversed input",182 [DOMAIN1_HTTP_TO_HTTP_U1_P1],183 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],184 undefined,185 ["scheme", "timePasswordChanged"],186 DOMAIN1_HTTP_TO_HTTP_U1_P1.hostname,187 ],188 [189 "resolveBy scheme + timePasswordChanged, prefer HTTPS",190 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],191 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],192 undefined,193 ["scheme", "timePasswordChanged"],194 DOMAIN1_HTTPS_TO_HTTPS_U1_P1.hostname,195 ],196 [197 "resolveBy scheme + timePasswordChanged, prefer HTTPS, reversed input",198 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],199 [DOMAIN1_HTTP_TO_HTTP_U1_P1, DOMAIN1_HTTPS_TO_HTTPS_U1_P1],200 undefined,201 ["scheme", "timePasswordChanged"],202 DOMAIN1_HTTPS_TO_HTTPS_U1_P1.hostname,203 ],204 [205 "resolveBy scheme HTTP auth",206 [DOMAIN1_HTTPS_AUTH],207 [DOMAIN1_HTTP_AUTH, DOMAIN1_HTTPS_AUTH],208 undefined,209 ["scheme"],210 DOMAIN1_HTTPS_AUTH.hostname,211 ],212 [213 "resolveBy scheme HTTP auth, reversed input",214 [DOMAIN1_HTTPS_AUTH],215 [DOMAIN1_HTTPS_AUTH, DOMAIN1_HTTP_AUTH],216 undefined,217 ["scheme"],218 DOMAIN1_HTTPS_AUTH.hostname,219 ],220 [221 "resolveBy scheme, empty form submit URL",222 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1],223 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTPS_TO_EMPTY_U1_P1],224 undefined,225 ["scheme"],226 DOMAIN1_HTTPS_TO_HTTPS_U1_P1.hostname,227 ],228 ];229 for (let tc of testcases) {230 let description = tc.shift();231 let expected = tc.shift();232 let actual = LoginHelper.dedupeLogins(...tc);233 Assert.strictEqual(actual.length, expected.length, `Check: ${description}`);234 for (let [i, login] of expected.entries()) {235 Assert.strictEqual(actual[i], login, `Check index ${i}`);236 }237 }238});239add_task(function* test_dedupeLogins_preferredOriginMissing() {240 let testcases = [241 [242 "resolveBy scheme + timePasswordChanged, missing preferredOrigin",243 /preferredOrigin/,244 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],245 undefined,246 ["scheme", "timePasswordChanged"],247 ],248 [249 "resolveBy timePasswordChanged + scheme, missing preferredOrigin",250 /preferredOrigin/,251 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],252 undefined,253 ["timePasswordChanged", "scheme"],254 ],255 [256 "resolveBy scheme + timePasswordChanged, empty preferredOrigin",257 /preferredOrigin/,258 [DOMAIN1_HTTPS_TO_HTTPS_U1_P1, DOMAIN1_HTTP_TO_HTTP_U1_P1],259 undefined,260 ["scheme", "timePasswordChanged"],261 "",262 ],263 ];264 for (let tc of testcases) {265 let description = tc.shift();266 let expectedException = tc.shift();267 Assert.throws(() => {268 LoginHelper.dedupeLogins(...tc);269 }, expectedException, `Check: ${description}`);270 }...
dygraph-smooth-plotter.js
Source:dygraph-smooth-plotter.js
1var smoothPlotter = (function() {2"use strict";3/**4 * Given three sequential points, p0, p1 and p2, find the left and right5 * control points for p1.6 *7 * The three points are expected to have x and y properties.8 *9 * The alpha parameter controls the amount of smoothing.10 * If α=0, then both control points will be the same as p1 (i.e. no smoothing).11 *12 * Returns [l1x, l1y, r1x, r1y]13 *14 * It's guaranteed that the line from (l1x, l1y)-(r1x, r1y) passes through p1.15 * Unless allowFalseExtrema is set, then it's also guaranteed that:16 * l1y â [p0.y, p1.y]17 * r1y â [p1.y, p2.y]18 *19 * The basic algorithm is:20 * 1. Put the control points l1 and r1 α of the way down (p0, p1) and (p1, p2).21 * 2. Shift l1 and r2 so that the line l1âr1 passes through p122 * 3. Adjust to prevent false extrema while keeping p1 on the l1âr1 line.23 *24 * This is loosely based on the HighCharts algorithm.25 */26function getControlPoints(p0, p1, p2, opt_alpha, opt_allowFalseExtrema) {27 var alpha = (opt_alpha !== undefined) ? opt_alpha : 1/3; // 0=no smoothing, 1=crazy smoothing28 var allowFalseExtrema = opt_allowFalseExtrema || false;29 if (!p2) {30 return [p1.x, p1.y, null, null];31 }32 // Step 1: Position the control points along each line segment.33 var l1x = (1 - alpha) * p1.x + alpha * p0.x,34 l1y = (1 - alpha) * p1.y + alpha * p0.y,35 r1x = (1 - alpha) * p1.x + alpha * p2.x,36 r1y = (1 - alpha) * p1.y + alpha * p2.y;37 // Step 2: shift the points up so that p1 is on the l1âr1 line.38 if (l1x != r1x) {39 // This can be derived w/ some basic algebra.40 var deltaY = p1.y - r1y - (p1.x - r1x) * (l1y - r1y) / (l1x - r1x);41 l1y += deltaY;42 r1y += deltaY;43 }44 // Step 3: correct to avoid false extrema.45 if (!allowFalseExtrema) {46 if (l1y > p0.y && l1y > p1.y) {47 l1y = Math.max(p0.y, p1.y);48 r1y = 2 * p1.y - l1y;49 } else if (l1y < p0.y && l1y < p1.y) {50 l1y = Math.min(p0.y, p1.y);51 r1y = 2 * p1.y - l1y;52 }53 if (r1y > p1.y && r1y > p2.y) {54 r1y = Math.max(p1.y, p2.y);55 l1y = 2 * p1.y - r1y;56 } else if (r1y < p1.y && r1y < p2.y) {57 r1y = Math.min(p1.y, p2.y);58 l1y = 2 * p1.y - r1y;59 }60 }61 return [l1x, l1y, r1x, r1y];62}63// A plotter which uses splines to create a smooth curve.64// See tests/plotters.html for a demo.65// Can be controlled via smoothPlotter.smoothing66function smoothPlotter(e) {67 var ctx = e.drawingContext,68 points = e.points;69 ctx.beginPath();70 ctx.moveTo(points[0].canvasx, points[0].canvasy);71 // right control point for previous point72 var lastRightX = points[0].canvasx, lastRightY = points[0].canvasy;73 var isOK = Dygraph.isOK; // i.e. is none of (null, undefined, NaN)74 for (var i = 1; i < points.length; i++) {75 var p0 = points[i - 1],76 p1 = points[i],77 p2 = points[i + 1];78 p0 = p0 && isOK(p0.canvasy) ? p0 : null;79 p1 = p1 && isOK(p1.canvasy) ? p1 : null;80 p2 = p2 && isOK(p2.canvasy) ? p2 : null;81 if (p0 && p1) {82 var controls = getControlPoints({x: p0.canvasx, y: p0.canvasy},83 {x: p1.canvasx, y: p1.canvasy},84 p2 && {x: p2.canvasx, y: p2.canvasy},85 smoothPlotter.smoothing);86 // Uncomment to show the control points:87 // ctx.lineTo(lastRightX, lastRightY);88 // ctx.lineTo(controls[0], controls[1]);89 // ctx.lineTo(p1.canvasx, p1.canvasy);90 lastRightX = (lastRightX !== null) ? lastRightX : p0.canvasx;91 lastRightY = (lastRightY !== null) ? lastRightY : p0.canvasy;92 ctx.bezierCurveTo(lastRightX, lastRightY,93 controls[0], controls[1],94 p1.canvasx, p1.canvasy);95 lastRightX = controls[2];96 lastRightY = controls[3];97 } else if (p1) {98 // We're starting again after a missing point.99 ctx.moveTo(p1.canvasx, p1.canvasy);100 lastRightX = p1.canvasx;101 lastRightY = p1.canvasy;102 } else {103 lastRightX = lastRightY = null;104 }105 }106 ctx.stroke();107}108smoothPlotter.smoothing = 1/3;109smoothPlotter._getControlPoints = getControlPoints; // for testing110return smoothPlotter;...
B2y.ts
Source:B2y.ts
1const v_cgh = JSON.parse(2 '[[1,3,10],[1,5,16],[1,5,19],[1,9,29],[1,11,6],[1,11,16],[1,19,3],[1,21,20],[1,27,27],[2,5,15],[2,5,21],[2,7,7],[2,7,9],[2,7,25],[2,9,15],[2,15,17],[2,15,25],[2,21,9],[3,1,14],[3,3,26],[3,3,28],[3,3,29],[3,5,20],[3,5,22],[3,5,25],[3,7,29],[3,13,7],[3,23,25],[3,25,24],[3,27,11],[4,3,17],[4,3,27],[4,5,15],[5,3,21],[5,7,22],[5,9,7],[5,9,28],[5,9,31],[5,13,6],[5,15,17],[5,17,13],[5,21,12],[5,27,8],[5,27,21],[5,27,25],[5,27,28],[6,1,11],[6,3,17],[6,17,9],[6,21,7],[6,21,13],[7,1,9],[7,1,18],[7,1,25],[7,13,25],[7,17,21],[7,25,12],[7,25,20],[8,7,23],[8,9,23],[9,5,14],[9,5,25],[9,11,19],[9,21,16],[10,9,21],[10,9,25],[11,7,12],[11,7,16],[11,17,13],[11,21,13],[12,9,23],[13,3,17],[13,3,27],[13,5,19],[13,17,15],[14,1,15],[14,13,15],[15,1,29],[17,15,20],[17,15,23],[17,15,26]]',3 ),4 v_dgh = [5 (p1: number, p2: number, p3: number, p4: number): number => {6 p1 ^= p1 << p2;7 p1 ^= p1 >>> p3;8 p1 ^= p1 << p4;9 return p1;10 },11 (p1: number, p2: number, p3: number, p4: number): number => {12 p1 ^= p1 << p4;13 p1 ^= p1 >>> p3;14 p1 ^= p1 << p2;15 return p1;16 },17 (p1: number, p2: number, p3: number, p4: number): number => {18 p1 ^= p1 >>> p2;19 p1 ^= p1 << p3;20 p1 ^= p1 >>> p4;21 return p1;22 },23 (p1: number, p2: number, p3: number, p4: number): number => {24 p1 ^= p1 >>> p4;25 p1 ^= p1 << p3;26 p1 ^= p1 >>> p2;27 return p1;28 },29 (p1: number, p2: number, p3: number, p4: number): number => {30 p1 ^= p1 << p2;31 p1 ^= p1 << p4;32 p1 ^= p1 >>> p3;33 return p1;34 },35 (p1: number, p2: number, p3: number, p4: number): number => {36 p1 ^= p1 >>> p2;37 p1 ^= p1 >>> p4;38 p1 ^= p1 << p3;39 return p1;40 },41 ],42 v_ggh = 2463534242;43export default class B2y {44 public static b6o = v_cgh.length;45 public static b6b = v_dgh.length;46 public static b4v = v_cgh.length * v_dgh.length;47 private v_kgh = 0;48 private v_jgh = v_ggh;49 private v_lgh = v_cgh[74][this.v_kgh++];50 private v_mgh = v_cgh[74][this.v_kgh++];51 private v_ngh = v_cgh[74][this.v_kgh++];52 private v_ogh = v_dgh[0];53 public b9es(EEyY_: number, LEyY_: number): void {54 this.v_jgh = v_ggh;55 const v_pgh = v_cgh[EEyY_];56 let v_qgh = 0;57 this.v_lgh = v_pgh[v_qgh++];58 this.v_mgh = v_pgh[v_qgh++];59 this.v_ngh = v_pgh[v_qgh];60 this.v_ogh = v_dgh[LEyY_];61 }62 // tslint:disable-next-line:function-name63 public B0o(p1: number): void {64 const v_rgh = p1 >>> 0;65 this.v_jgh = v_rgh || v_ggh;66 }67 public b4K(p1: number): number {68 if (p1 <= 1) return 0;69 const v_vgh = 4294967295 - p1;70 let v_sgh,71 v_tgh,72 v_ugh = this.v_jgh;73 do {74 v_ugh = this.v_ogh(v_ugh, this.v_lgh, this.v_mgh, this.v_ngh) >>> 0;75 v_tgh = v_ugh - 1;76 v_sgh = v_tgh % p1;77 } while (v_vgh < v_tgh - v_sgh);78 this.v_jgh = v_ugh;79 return v_sgh;80 }...
view_utils.d.ts
Source:view_utils.d.ts
1import { ViewEncapsulation } from '../metadata/view';2import { RenderComponentType, RootRenderer } from '../render/api';3import { SanitizationService } from '../security';4export declare class ViewUtils {5 private _renderer;6 private _appId;7 sanitizer: SanitizationService;8 private _nextCompTypeId;9 constructor(_renderer: RootRenderer, _appId: string, sanitizer: SanitizationService);10 /**11 * Used by the generated code12 */13 createRenderComponentType(templateUrl: string, slotCount: number, encapsulation: ViewEncapsulation, styles: Array<string | any[]>, animations: {14 [key: string]: Function;15 }): RenderComponentType;16}17export declare function flattenNestedViewRenderNodes(nodes: any[]): any[];18export declare function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][];19export declare const MAX_INTERPOLATION_VALUES: number;20export declare function interpolate(valueCount: number, c0: string, a1: any, c1: string, a2?: any, c2?: string, a3?: any, c3?: string, a4?: any, c4?: string, a5?: any, c5?: string, a6?: any, c6?: string, a7?: any, c7?: string, a8?: any, c8?: string, a9?: any, c9?: string): string;21export declare function checkBinding(throwOnChange: boolean, oldValue: any, newValue: any): boolean;22export declare function castByValue<T>(input: any, value: T): T;23export declare const EMPTY_ARRAY: any[];24export declare const EMPTY_MAP: {};25export declare function pureProxy1<P0, R>(fn: (p0: P0) => R): (p0: P0) => R;26export declare function pureProxy2<P0, P1, R>(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P1) => R;27export declare function pureProxy3<P0, P1, P2, R>(fn: (p0: P0, p1: P1, p2: P2) => R): (p0: P0, p1: P1, p2: P2) => R;28export declare function pureProxy4<P0, P1, P2, P3, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3) => R): (p0: P0, p1: P1, p2: P2, p3: P3) => R;29export declare function pureProxy5<P0, P1, P2, P3, P4, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R;30export declare function pureProxy6<P0, P1, P2, P3, P4, P5, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R;31export declare function pureProxy7<P0, P1, P2, P3, P4, P5, P6, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R;32export declare function pureProxy8<P0, P1, P2, P3, P4, P5, P6, P7, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R;33export declare function pureProxy9<P0, P1, P2, P3, P4, P5, P6, P7, P8, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R;...
Using AI Code Generation
1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log(data);5});6### WebPageTest(host, port, apiKey)7### WebPageTest.prototype.runTest(url, options, callback)8Default: `{}`9### WebPageTest.prototype.getTestStatus(testId, callback)10### WebPageTest.prototype.getTestResults(testId, callback)11MIT © [James Talmage](
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5 console.log('Test ID:', data.data.testId);6 console.log('Test URL:', data.data.userUrl);7});
Using AI Code Generation
1var wpt = require('wpt');2var options = {3};4wpt.runTest(options, function(err, data) {5 if (err) {6 console.log(err);7 } else {8 console.log(data);9 }10});11### runTest(options, callback)
Using AI Code Generation
1var wpt = require('wpt');2wpt.p1(function (err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});
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!!