Best JavaScript code snippet using playwright-internal
formula.js
Source:formula.js
1import katex from 'katex'2function kt (string) {3 return katex.renderToString(string, {4 throwOnError: false5 })6}7class Expression {8 constructor () {9 this.depth = 110 }11 printStyled () {12 if (this.style !== undefined) {13 return `<span class='${this.style}'>${this.printUnicode()}</span>`14 }15 return this.printSubStyled()16 }17 printKatexStyled () {18 const string = this.printStyled()19 const index1 = string.indexOf('<span')20 if (index1 === -1) {21 return kt(string)22 }23 const index2 = string.indexOf('\'>', index1)24 const index3 = string.indexOf('</span>', index2)25 return `${kt(string.substring(0, index1))}<span class='${this.style}'>${kt(string.substring(index2 + 2, index3))}</span>${kt(string.substring(index3 + 7))}`26 }27}28export class ParenthesisGroup extends Expression {29 constructor (parenthesisLeft, parenthesisRight, expression) {30 super()31 this.expression = expression32 this.parenthesisLeft = parenthesisLeft33 this.parenthesisRight = parenthesisRight34 this.setDepth(this.depth)35 }36 printUnicode () {37 return `${this.parenthesisLeft}${this.expression.printUnicode()}${this.parenthesisRight}`38 }39 printSubStyled () {40 return `${this.parenthesisLeft}${this.expression.printStyled()}${this.parenthesisRight}`41 }42 length () {43 if (this.expression === undefined) {44 return 245 }46 return 2 + this.expression.length()47 }48 setDepth (depth) {49 this.depth = depth50 if (this.expression !== undefined) {51 this.expression.setDepth(this.depth + 1)52 }53 }54}55export class Literal extends Expression {56 constructor (expression) {57 super()58 this.expression = expression59 }60 printUnicode () {61 return `${this.expression}`62 }63 printSubStyled () {64 return `${this.expression}`65 }66 length () {67 return 168 }69 setDepth (depth) {70 this.depth = depth71 }72}73export class UnaryOperator extends Expression {74 constructor (operator, expression) {75 super()76 this.operator = operator77 this.expression = expression78 this.setDepth(this.depth)79 }80 printUnicode () {81 return `${this.operator}${this.expression.printUnicode()}`82 }83 printSubStyled () {84 return `${this.operator}${this.expression.printStyled()}`85 }86 length () {87 return this.operator.length + this.expression.length()88 }89 setDepth (depth) {90 this.depth = depth91 if (this.expression !== null) {92 this.expression.setDepth(this.depth + 1)93 }94 }95}96export class BinaryOperator extends Expression {97 constructor (operator, lhe, rhe) {98 super()99 this.operator = operator100 this.lhe = lhe101 this.rhe = rhe102 this.setDepth(this.depth)103 }104 flatten () {105 const expressions = []106 let leftExp = this.lhe107 expressions.push(this.rhe)108 while (leftExp instanceof BinaryOperator) {109 if (leftExp.operator === this.operator) {110 expressions.unshift(leftExp.rhe)111 } else {112 break113 }114 leftExp = leftExp.lhe115 }116 expressions.unshift(leftExp)117 return new FlattenedSummation(this.operator, expressions)118 }119 setDepth (depth) {120 this.depth = depth121 if (this.lhe !== null) {122 this.lhe.setDepth(this.depth + 1)123 }124 if (this.rhe !== null) {125 this.rhe.setDepth(this.depth + 1)126 }127 }128 printUnicode () {129 return `${this.lhe.printUnicode()}${this.operator}${this.rhe.printUnicode()}`130 }131 printSubStyled () {132 return `${this.lhe.printStyled()}${this.operator}${this.rhe.printStyled()}`133 }134 length () {135 if (this.rhe !== null) {136 return 1 + this.lhe.length() + this.rhe.length()137 }138 return 1 + this.lhe.length()139 }140}141export class TernaryOperator extends Expression {142 constructor (operator, e1, e2, e3) {143 super()144 this.operator = operator145 this.e1 = e1146 this.e2 = e2147 this.e3 = e3148 this.setDepth(this.depth)149 }150 setDepth (depth) {151 this.depth = depth152 if (this.e1 !== null) {153 this.e1.setDepth(this.depth + 1)154 }155 if (this.e2 !== null) {156 this.e2.setDepth(this.depth + 1)157 }158 if (this.e3 !== null) {159 this.e3.setDepth(this.depth + 1)160 }161 }162 printUnicode () {163 return `${this.operator.o1}${this.e1.printUnicode()}${this.operator.o2}${this.e2.printUnicode()}${this.operator.o3}${this.e3.printUnicode()}`164 }165 printSubStyled () {166 return `${this.operator.o1}${this.e1.printStyled()}${this.operator.o2}${this.e2.printStyled()}${this.operator.o3}${this.e3.printStyled()}`167 }168 length () {169 return 3 + this.e1.length() + this.e2.length() + this.e3.length()170 }171}172class FlattenedSummation extends Expression {173 constructor (operator, expressions) {174 super()175 this.operator = operator176 this.expressions = expressions177 this.setDepth(this.depth)178 }179 printUnicode () {180 const exp = this.expressions.map(e => e.printUnicode())181 const reducer = (accumulator, currentValue) => `${accumulator}${this.operator}${currentValue}`182 return exp.reduce(reducer)183 }184 printSubStyled () {185 const exp = this.expressions.map(e => e.printStyled())186 const reducer = (accumulator, currentValue) => `${accumulator}${this.operator}${currentValue}`187 return exp.reduce(reducer)188 }189 printStyled () {190 if (this.style !== undefined) {191 const exp = this.expressions.map(e => e.printUnicode())192 const reducer = (accumulator, currentValue, currentIndex) => {193 if (currentIndex === this.firstDifferenceIndex && currentIndex === this.lastDifferenceIndex) {194 return `${accumulator}${this.operator}${this.expressions[currentIndex].printStyled()}`195 } else if (currentIndex === this.firstDifferenceIndex) {196 return `${accumulator}${this.operator}<span class='${this.style}'>${currentValue}`197 } else if (currentIndex === this.lastDifferenceIndex) {198 return `${accumulator}${this.operator}${currentValue}</span>`199 } else {200 return `${accumulator}${this.operator}${currentValue}`201 }202 }203 if (this.firstDifferenceIndex === 0) {204 if (this.lastDifferenceIndex === 0) {205 exp[0] = this.expressions[0].printStyled()206 } else {207 exp[0] = `<span class='${this.style}'>${exp[0]}`208 }209 }210 return exp.reduce(reducer)211 }212 return this.printSubStyled()213 }214 setDepth (depth) {215 this.depth = depth216 for (const expression of this.expressions) {217 expression.setDepth(this.depth + 1)218 }219 }220}221const baseOptions = {222 unaryOperators: [],223 binaryOperators: [],224 ternaryOperators: [],225 implicitAssociativeBinaryOperators: [],226 firstOrderOperators: [],227 implicitPrecendence: [],228 literals: [],229 leftParentheses: ['('], // Index must match the right parenthesis230 rightParentheses: [')']231}232function matchesStart (options, string) {233 // See if the start of string matches one of the strings in options. This allows operators with multiple characters234 for (const option of options) {235 if (option === string.substring(0, option.length)) {236 return string.substring(0, option.length)237 }238 }239 return null240}241export class Formula {242 constructor (formula, options) {243 this.options = Object.assign({}, baseOptions, options)244 this.error = null245 this.result = this.parse(formula, 0)246 }247 parse (expressionString, givenContextIndex) {248 let leftExpression = null249 let contextIndex = null250 while (expressionString && expressionString.length > 0 && this.error === null) {251 if (leftExpression === null) {252 contextIndex = givenContextIndex + 1253 } else {254 contextIndex = givenContextIndex + leftExpression.length() + 1255 }256 // Unary257 if (matchesStart(this.options.unaryOperators, expressionString) !== null) {258 if (leftExpression !== null) {259 this.error = {260 message: 'Missing operator',261 key: 'shared.syntaxError.missingOperator',262 params: {263 index: contextIndex,264 length: 0265 }266 }267 return268 }269 const op = matchesStart(this.options.unaryOperators, expressionString)270 const unaryExpression = this.findFirstExpression(expressionString.substring(op.length), contextIndex + op.length)271 leftExpression = new UnaryOperator(op, unaryExpression.exp)272 expressionString = unaryExpression.tailString273 continue274 }275 // Binary276 if (this.options.binaryOperators.includes(expressionString[0])) {277 if (leftExpression === null) {278 this.error = {279 message: 'Missing operand',280 key: 'shared.syntaxError.missingOperand',281 params: {282 index: contextIndex,283 length: 0284 }285 }286 return287 }288 if (leftExpression instanceof BinaryOperator) {289 const lho = leftExpression.operator290 const rho = expressionString[0]291 if (this.options.implicitPrecendence.some(e => e.weak === rho && e.strong === lho)) {292 const rightExpression = this.findFirstExpression(expressionString.substring(1), contextIndex + 1)293 leftExpression.rhe = new BinaryOperator(expressionString[0], leftExpression.rhe, rightExpression.exp)294 expressionString = rightExpression.tailString295 continue296 }297 if (this.options.implicitPrecendence.some(e => e.strong === rho && e.weak === lho)) {298 const rightExpression = this.findFirstExpression(expressionString.substring(1), contextIndex + 1)299 leftExpression = new BinaryOperator(expressionString[0], leftExpression, rightExpression.exp)300 expressionString = rightExpression.tailString301 continue302 }303 if (lho !== rho || !this.options.implicitAssociativeBinaryOperators.includes(rho)) {304 this.error = {305 message: 'Ambiguous associativity',306 key: 'shared.syntaxError.ambiguougAssoc',307 params: {308 index: contextIndex,309 length: 1310 }311 }312 return313 }314 if (lho !== rho && this.options.firstOrderOperators.includes(expressionString[0])) {315 this.error = {316 message: 'Operator out of order',317 key: 'shared.syntaxError.nestedFirstOrderOperator',318 params: {319 index: contextIndex,320 length: 1321 }322 }323 return324 }325 }326 const rightExpression = this.findFirstExpression(expressionString.substring(1), contextIndex + 1)327 leftExpression = new BinaryOperator(expressionString[0], leftExpression, rightExpression.exp)328 expressionString = rightExpression.tailString329 continue330 }331 // Ternary332 if (this.options.ternaryOperators.map(x => x.o1).includes(expressionString[0])) {333 const operator = this.options.ternaryOperators[this.options.ternaryOperators.map(x => x.o1).indexOf(expressionString[0])]334 if (!this.options.literals.includes(expressionString[1])) {335 this.error = {336 message: 'Invalid operand',337 key: 'shared.syntaxError.invalidOperand',338 params: {339 index: contextIndex + 1,340 length: 0341 }342 }343 return344 }345 if (expressionString[2] !== operator.o2) {346 this.error = {347 message: 'Missing operator',348 key: 'shared.syntaxError.missingOperator',349 params: {350 index: contextIndex + 2,351 length: 0352 }353 }354 return355 }356 if (!this.options.literals.includes(expressionString[3])) {357 this.error = {358 message: 'Invalid operand',359 key: 'shared.syntaxError.invalidOperand',360 params: {361 index: contextIndex + 3,362 length: 0363 }364 }365 return366 }367 if (expressionString[4] !== operator.o3) {368 this.error = {369 message: 'Missing operator',370 key: 'shared.syntaxError.missingOperator',371 params: {372 index: contextIndex + 4,373 length: 0374 }375 }376 return377 }378 const e1 = new Literal(expressionString[1])379 const e2 = new Literal(expressionString[3])380 const e3 = this.findFirstExpression(expressionString.substring(5), contextIndex + 5)381 leftExpression = new TernaryOperator(operator, e1, e2, e3.exp)382 expressionString = e3.tailString383 continue384 }385 // Literal386 if (this.options.literals.includes(expressionString[0])) {387 if (leftExpression !== null) {388 this.error = {389 message: 'Missing operator',390 key: 'shared.syntaxError.missingOperator',391 params: {392 index: contextIndex,393 length: 0394 }395 }396 return397 }398 const rightExpression = expressionString.substring(1)399 leftExpression = new Literal(expressionString[0])400 expressionString = rightExpression401 continue402 }403 // Parenthesis404 if (this.options.leftParentheses.includes(expressionString[0])) {405 const leftParenthesis = expressionString[0]406 const rightParenthesis = this.options.rightParentheses[this.options.leftParentheses.indexOf(leftParenthesis)]407 if (leftExpression !== null) {408 this.error = {409 message: 'Missing operator',410 key: 'shared.syntaxError.missingOperator',411 params: {412 index: contextIndex,413 length: 0414 }415 }416 return417 }418 let i = 1419 let numLeft = 1420 while (numLeft > 0) {421 if (i > expressionString.length) {422 this.error = {423 message: 'Missing closing parenthesis',424 key: 'shared.syntaxError.missingClose',425 params: {426 index: contextIndex,427 length: 1428 }429 }430 return431 }432 if (expressionString[i] === leftParenthesis) {433 numLeft += 1434 }435 if (expressionString[i] === rightParenthesis) {436 numLeft -= 1437 }438 i++439 }440 if (i === 2) {441 this.error = {442 message: 'Empty parentheses',443 key: 'shared.syntaxError.emptyParentheses',444 params: {445 index: contextIndex,446 length: 0447 }448 }449 return450 }451 leftExpression = new ParenthesisGroup(leftParenthesis, rightParenthesis, this.parse(expressionString.substring(1, i - 1), contextIndex))452 if (leftExpression.expression instanceof BinaryOperator && this.options.firstOrderOperators.includes(leftExpression.expression.operator)) {453 this.error = {454 message: 'Operator out of order',455 key: 'shared.syntaxError.nestedFirstOrderOperator',456 params: {457 index: contextIndex + leftExpression.expression.lhe.length() + 1,458 length: 1459 }460 }461 return462 }463 expressionString = expressionString.substring(i)464 continue465 }466 // Parenthesis467 if (this.options.rightParentheses.includes(expressionString[0])) {468 this.error = {469 message: 'Missing open parenthesis',470 key: 'shared.syntaxError.missingOpen',471 params: {472 index: contextIndex,473 length: 1474 }475 }476 return477 }478 // Error479 this.error = {480 message: 'Unexpected character',481 key: 'shared.syntaxError.unexpectedChar',482 params: {483 index: contextIndex,484 length: 1485 }486 }487 return488 }489 return leftExpression490 }491 findFirstExpression (expressionString, contextIndex) {492 // Unary493 if (matchesStart(this.options.unaryOperators, expressionString) !== null) {494 const op = matchesStart(this.options.unaryOperators, expressionString)495 const unaryExpression = this.findFirstExpression(expressionString.substring(op.length), contextIndex + op.length)496 const leftExpression = new UnaryOperator(op, unaryExpression.exp)497 return {498 exp: leftExpression,499 tailString: unaryExpression.tailString500 }501 }502 // Literals503 if (this.options.literals.includes(expressionString[0])) {504 return {505 exp: new Literal(expressionString[0]),506 tailString: expressionString.substring(1)507 }508 }509 // Ternary510 if (this.options.ternaryOperators.map(x => x.o1).includes(expressionString[0])) {511 const operator = this.options.ternaryOperators[this.options.ternaryOperators.map(x => x.o1).indexOf(expressionString[0])]512 if (!this.options.literals.includes(expressionString[1])) {513 this.error = {514 message: 'Invalid operand',515 key: 'shared.syntaxError.invalidOperand',516 params: {517 index: contextIndex + 1,518 length: 0519 }520 }521 return {522 exp: null,523 tailString: ''524 }525 }526 if (expressionString[2] !== operator.o2) {527 this.error = {528 message: 'Missing operator',529 key: 'shared.syntaxError.missingOperator',530 params: {531 index: contextIndex + 2,532 length: 0533 }534 }535 return {536 exp: null,537 tailString: ''538 }539 }540 if (!this.options.literals.includes(expressionString[3])) {541 this.error = {542 message: 'Invalid operand',543 key: 'shared.syntaxError.invalidOperand',544 params: {545 index: contextIndex + 3,546 length: 0547 }548 }549 return {550 exp: null,551 tailString: ''552 }553 }554 if (expressionString[4] !== operator.o3) {555 this.error = {556 message: 'Missing operator',557 key: 'shared.syntaxError.missingOperator',558 params: {559 index: contextIndex + 4,560 length: 0561 }562 }563 return {564 exp: null,565 tailString: ''566 }567 }568 const e1 = new Literal(expressionString[1])569 const e2 = new Literal(expressionString[3])570 const e3 = this.findFirstExpression(expressionString.substring(5), contextIndex + 5)571 return {572 exp: new TernaryOperator(operator, e1, e2, e3.exp),573 tailString: e3.tailString574 }575 }576 // Parenthesis577 if (this.options.leftParentheses.includes(expressionString[0])) {578 const leftParenthesis = expressionString[0]579 const rightParenthesis = this.options.rightParentheses[this.options.leftParentheses.indexOf(leftParenthesis)]580 let i = 1581 let numLeft = 1582 while (numLeft > 0) {583 if (i > expressionString.length) {584 this.error = {585 message: 'Missing closing parenthesis',586 key: 'shared.syntaxError.missingClose',587 params: {588 index: contextIndex,589 length: 1590 }591 }592 return {593 exp: null,594 tailString: ''595 }596 }597 if (expressionString[i] === leftParenthesis) {598 numLeft += 1599 }600 if (expressionString[i] === rightParenthesis) {601 numLeft -= 1602 }603 i++604 }605 if (i === 2) {606 this.error = {607 message: 'Empty parentheses',608 key: 'shared.syntaxError.emptyParentheses',609 params: {610 index: contextIndex + 1,611 length: 0612 }613 }614 return {615 exp: null,616 tailString: ''617 }618 }619 const parenthesisContents = this.parse(expressionString.substring(1, i - 1), contextIndex)620 if (parenthesisContents instanceof BinaryOperator && this.options.firstOrderOperators.includes(parenthesisContents.operator)) {621 this.error = {622 message: 'Operator out of order',623 key: 'shared.syntaxError.nestedFirstOrderOperator',624 params: {625 index: contextIndex + parenthesisContents.lhe.length() + 1,626 length: 1627 }628 }629 return {630 exp: null,631 tailString: ''632 }633 }634 return {635 exp: new ParenthesisGroup(leftParenthesis, rightParenthesis, parenthesisContents),636 tailString: expressionString.substring(i)637 }638 }639 this.error = {640 message: 'Missing operand',641 key: 'shared.syntaxError.missingOperand',642 params: {643 index: contextIndex,644 length: 0645 }646 }647 return {648 exp: null,649 tailString: ''650 }651 }...
ReactMount.js
Source:ReactMount.js
...28 var ELEMENT_NODE_TYPE = 1;29 var DOC_NODE_TYPE = 9;30 var DOCUMENT_FRAGMENT_NODE_TYPE = 11;31 var instancesByReactRootID = {};32 function firstDifferenceIndex(string1, string2) {33 var minLen = Math.min(string1.length, string2.length);34 for (var i = 0; i < minLen; i++) {35 if (string1.charAt(i) !== string2.charAt(i)) {36 return i;37 }38 }39 return string1.length === string2.length ? -1 : minLen;40 }41 function getReactRootElementInContainer(container) {42 if (!container) {43 return null;44 }45 if (container.nodeType === DOC_NODE_TYPE) {46 return container.documentElement;47 } else {48 return container.firstChild;49 }50 }51 function internalGetID(node) {52 return node.getAttribute && node.getAttribute(ATTR_NAME) || '';53 }54 function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {55 var markerName;56 if (ReactFeatureFlags.logTopLevelRenders) {57 var wrappedElement = wrapperInstance._currentElement.props;58 var type = wrappedElement.type;59 markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);60 console.time(markerName);61 }62 var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context);63 if (markerName) {64 console.timeEnd(markerName);65 }66 wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;67 ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);68 }69 function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {70 var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);71 transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);72 ReactUpdates.ReactReconcileTransaction.release(transaction);73 }74 function unmountComponentFromNode(instance, container, safely) {75 if (process.env.NODE_ENV !== 'production') {76 ReactInstrumentation.debugTool.onBeginFlush();77 }78 ReactReconciler.unmountComponent(instance, safely);79 if (process.env.NODE_ENV !== 'production') {80 ReactInstrumentation.debugTool.onEndFlush();81 }82 if (container.nodeType === DOC_NODE_TYPE) {83 container = container.documentElement;84 }85 while (container.lastChild) {86 container.removeChild(container.lastChild);87 }88 }89 function hasNonRootReactChild(container) {90 var rootEl = getReactRootElementInContainer(container);91 if (rootEl) {92 var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);93 return !!(inst && inst._hostParent);94 }95 }96 function getHostRootInstanceInContainer(container) {97 var rootEl = getReactRootElementInContainer(container);98 var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);99 return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;100 }101 function getTopLevelWrapperInContainer(container) {102 var root = getHostRootInstanceInContainer(container);103 return root ? root._hostContainerInfo._topLevelWrapper : null;104 }105 var topLevelRootCounter = 1;106 var TopLevelWrapper = function() {107 this.rootID = topLevelRootCounter++;108 };109 TopLevelWrapper.prototype.isReactComponent = {};110 if (process.env.NODE_ENV !== 'production') {111 TopLevelWrapper.displayName = 'TopLevelWrapper';112 }113 TopLevelWrapper.prototype.render = function() {114 return this.props;115 };116 var ReactMount = {117 TopLevelWrapper: TopLevelWrapper,118 _instancesByReactRootID: instancesByReactRootID,119 scrollMonitor: function(container, renderCallback) {120 renderCallback();121 },122 _updateRootComponent: function(prevComponent, nextElement, nextContext, container, callback) {123 ReactMount.scrollMonitor(container, function() {124 ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement, nextContext);125 if (callback) {126 ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);127 }128 });129 return prevComponent;130 },131 _renderNewRootComponent: function(nextElement, container, shouldReuseMarkup, context) {132 process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;133 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : _prodInvariant('37') : void 0;134 ReactBrowserEventEmitter.ensureScrollValueMonitoring();135 var componentInstance = instantiateReactComponent(nextElement, false);136 ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, container, shouldReuseMarkup, context);137 var wrapperID = componentInstance._instance.rootID;138 instancesByReactRootID[wrapperID] = componentInstance;139 if (process.env.NODE_ENV !== 'production') {140 ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID);141 }142 return componentInstance;143 },144 renderSubtreeIntoContainer: function(parentComponent, nextElement, container, callback) {145 !(parentComponent != null && ReactInstanceMap.has(parentComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : _prodInvariant('38') : void 0;146 return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);147 },148 _renderSubtreeIntoContainer: function(parentComponent, nextElement, container, callback) {149 ReactUpdateQueue.validateCallback(callback, 'ReactDOM.render');150 !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : _prodInvariant('39', typeof nextElement === 'string' ? ' Instead of passing a string like \'div\', pass ' + 'React.createElement(\'div\') or <div />.' : typeof nextElement === 'function' ? ' Instead of passing a class like Foo, pass ' + 'React.createElement(Foo) or <Foo />.' : nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : void 0;151 process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;152 var nextWrappedElement = ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);153 var nextContext;154 if (parentComponent) {155 var parentInst = ReactInstanceMap.get(parentComponent);156 nextContext = parentInst._processChildContext(parentInst._context);157 } else {158 nextContext = emptyObject;159 }160 var prevComponent = getTopLevelWrapperInContainer(container);161 if (prevComponent) {162 var prevWrappedElement = prevComponent._currentElement;163 var prevElement = prevWrappedElement.props;164 if (shouldUpdateReactComponent(prevElement, nextElement)) {165 var publicInst = prevComponent._renderedComponent.getPublicInstance();166 var updatedCallback = callback && function() {167 callback.call(publicInst);168 };169 ReactMount._updateRootComponent(prevComponent, nextWrappedElement, nextContext, container, updatedCallback);170 return publicInst;171 } else {172 ReactMount.unmountComponentAtNode(container);173 }174 }175 var reactRootElement = getReactRootElementInContainer(container);176 var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);177 var containerHasNonRootReactChild = hasNonRootReactChild(container);178 if (process.env.NODE_ENV !== 'production') {179 process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;180 if (!containerHasReactMarkup || reactRootElement.nextSibling) {181 var rootElementSibling = reactRootElement;182 while (rootElementSibling) {183 if (internalGetID(rootElementSibling)) {184 process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : void 0;185 break;186 }187 rootElementSibling = rootElementSibling.nextSibling;188 }189 }190 }191 var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;192 var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, nextContext)._renderedComponent.getPublicInstance();193 if (callback) {194 callback.call(component);195 }196 return component;197 },198 render: function(nextElement, container, callback) {199 return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);200 },201 unmountComponentAtNode: function(container) {202 process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : void 0;203 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : _prodInvariant('40') : void 0;204 var prevComponent = getTopLevelWrapperInContainer(container);205 if (!prevComponent) {206 var containerHasNonRootReactChild = hasNonRootReactChild(container);207 var isContainerReactRoot = container.nodeType === 1 && container.hasAttribute(ROOT_ATTR_NAME);208 if (process.env.NODE_ENV !== 'production') {209 process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;210 }211 return false;212 }213 delete instancesByReactRootID[prevComponent._instance.rootID];214 ReactUpdates.batchedUpdates(unmountComponentFromNode, prevComponent, container, false);215 return true;216 },217 _mountImageIntoNode: function(markup, container, instance, shouldReuseMarkup, transaction) {218 !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : _prodInvariant('41') : void 0;219 if (shouldReuseMarkup) {220 var rootElement = getReactRootElementInContainer(container);221 if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {222 ReactDOMComponentTree.precacheNode(instance, rootElement);223 return;224 } else {225 var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);226 rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);227 var rootMarkup = rootElement.outerHTML;228 rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);229 var normalizedMarkup = markup;230 if (process.env.NODE_ENV !== 'production') {231 var normalizer;232 if (container.nodeType === ELEMENT_NODE_TYPE) {233 normalizer = document.createElement('div');234 normalizer.innerHTML = markup;235 normalizedMarkup = normalizer.innerHTML;236 } else {237 normalizer = document.createElement('iframe');238 document.body.appendChild(normalizer);239 normalizer.contentDocument.write(markup);240 normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;241 document.body.removeChild(normalizer);242 }243 }244 var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);245 var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);246 !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s', difference) : _prodInvariant('42', difference) : void 0;247 if (process.env.NODE_ENV !== 'production') {248 process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : void 0;249 }250 }251 }252 !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but you didn\'t use server rendering. We can\'t do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('43') : void 0;253 if (transaction.useCreateElement) {254 while (container.lastChild) {255 container.removeChild(container.lastChild);256 }257 DOMLazyTree.insertTreeBefore(container, markup, null);258 } else {...
autocorrect.js
Source:autocorrect.js
...206 * @param {string} a207 * @param {string} b208 * @returns {number}209 */210function firstDifferenceIndex(a, b) {211 if (a === b) {212 return -1;213 }214 let i = 0;215 while (a[i] === b[i]) {216 ++i;217 }218 return i;219}220/**221 * Autocorrect on text input even by evaluating the keys and replacing the characters/string.222 *223 * @param {Object} event224 * @returns {void}225 */226function autocorrect(event) {227 // console.log('beforeinput', event.inputType, event.data);228 if (!(event.inputType === "insertText" || event.inputType === "insertCompositionText" || event.inputType === "insertParagraph" || event.inputType === "insertLineBreak")) {229 return;230 }231 if (!symbolpatterns) {232 throw new Error("Emoji autocorrect settings have not been received. Do not autocorrect.");233 }234 const target = event.target;235 const caretposition = getCaretPosition(target);236 if (caretposition) {237 const value = target.value || target.innerText;238 let deletecount = 0;239 let insert = event.inputType === "insertLineBreak" || event.inputType === "insertParagraph" ? "\n" : event.data;240 const inserted = insert;241 let output = false;242 // Use Unicode smart quotes243 if (quotes && (insert === "'" || insert === '"')) {244 const previouschar = value.slice(caretposition < 1 ? 0 : caretposition - 1, caretposition);245 // White space246 const re = /^\s*$/;247 if (insert === "'") {248 insert = re.test(previouschar) ? "â" : "â";249 } else if (insert === '"') {250 insert = re.test(previouschar) ? "â" : "â";251 }252 output = true;253 }254 const previousText = value.slice(caretposition < longest ? 0 : caretposition - longest, caretposition);255 const regexResult = symbolpatterns.exec(previousText);256 // Autocorrect Unicode Symbols257 if (regexResult) {258 const length = longest - 1;259 const text = value.slice(caretposition < length ? 0 : caretposition - length, caretposition) + inserted;260 const aregexResult = symbolpatterns.exec(text);261 const aaregexResult = antipatterns.exec(text);262 if (!aaregexResult && (!aregexResult || (caretposition <= longest ? regexResult.index < aregexResult.index : regexResult.index <= aregexResult.index))) {263 insert = autocorrections[regexResult[0]] + inserted;264 deletecount = regexResult[0].length;265 output = true;266 }267 } else {268 // Convert fractions and mathematical constants to Unicode characters269 if (!output && fracts) {270 // Numbers regular expression: https://regex101.com/r/7jUaSP/10271 // Do not match version numbers: https://github.com/rugk/unicodify/issues/40272 const numberRegex = /(?<!\.)\d+(?<fractionpart>\.\d+)?$/;273 const previousText = value.slice(0, caretposition);274 const regexResult = numberRegex.exec(previousText);275 if (regexResult && insert !== ".") {276 const text = value.slice(0, caretposition) + inserted;277 const aregexResult = numberRegex.exec(text);278 if (!aregexResult) {279 const label = outputLabel(regexResult[0], regexResult.groups.fractionpart);280 const index = firstDifferenceIndex(label, regexResult[0]);281 if (index >= 0) {282 insert = label.slice(index) + inserted;283 deletecount = regexResult[0].length - index;284 output = true;285 }286 }287 }288 }289 }290 if (output) {291 event.preventDefault();292 const text = deletecount ? value.slice(caretposition - deletecount, caretposition) : "";293 if (text) {294 deleteCaret(target, text);...
flat1.js
Source:flat1.js
...33var ELEMENT_NODE_TYPE = 1;34var DOC_NODE_TYPE = 9;35var DOCUMENT_FRAGMENT_NODE_TYPE = 11;36var instancesByReactRootID = {};37function firstDifferenceIndex(string1, string2) {/* ... */}38/* ä»å®¹å¨è·å React æ ¹å
ç´ */39function getReactRootElementInContainer(container) {/* ... */}40/* è·åå
ç´ ID */41function internalGetID(node) {/* ... */}42function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {/* ... */}43function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {/* ... */}44function unmountComponentFromNode(instance, container, safely) {/* ... */}45/* æ£æ¥æ¯å¦åå¨å®ä¾ */ 46function hasNonRootReactChild(container) {/* ... */}47function nodeIsRenderedByOtherInstance(container) {/* ... */}48/* æ ¡éª DOM å
ç´ å®¹å¨ */49function isValidContainer(node) {/* ... */}50function isReactNode(node) {/* ... */}51/* ä»å®¹å¨è·åå®¿ä¸»æ ¹å
ç´ å®ä¾ */...
showdiff.js
Source:showdiff.js
1import { Formula, ParenthesisGroup, Literal, UnaryOperator, BinaryOperator } from './model/shared/formula.js'2const hl = 'formula-highlight'3function checkDifferences (oldSub, newSub) {4 switch (true) {5 case oldSub instanceof ParenthesisGroup:6 if (!(newSub instanceof ParenthesisGroup)) {7 newSub.style = hl8 } else {9 [oldSub.expression, newSub.expression] = checkDifferences(oldSub.expression, newSub.expression)10 }11 break12 case oldSub instanceof Literal:13 if (!(newSub instanceof Literal)) {14 newSub.style = hl15 }16 if (oldSub.expression !== newSub.expression) {17 newSub.style = hl18 }19 break20 case oldSub instanceof UnaryOperator:21 if (!(newSub instanceof UnaryOperator)) {22 newSub.style = hl23 } else {24 [oldSub.expression, newSub.expression] = checkDifferences(oldSub.expression, newSub.expression)25 }26 break27 case oldSub instanceof BinaryOperator:28 if (!(newSub instanceof BinaryOperator)) {29 newSub.style = hl30 } else if (newSub.operator !== oldSub.operator) {31 newSub.style = hl32 } else {33 // Check binary operator34 const oldSub2 = oldSub.flatten()35 const newSub2 = newSub.flatten()36 let i = 037 while ((i < oldSub2.expressions.length && i < newSub2.expressions.length)) {38 if (oldSub2.expressions[i].printUnicode() !== newSub2.expressions[i].printUnicode()) {39 break40 }41 i++42 }43 const firstDifferenceIndex = i44 i = 045 while ((i < oldSub2.expressions.length && i < newSub2.expressions.length)) {46 if (oldSub2.expressions[oldSub2.expressions.length - 1 - i].printUnicode() !== newSub2.expressions[newSub2.expressions.length - 1 - i].printUnicode()) {47 break48 }49 i++50 }51 const lastDifferenceIndex = newSub2.expressions.length - 1 - i52 if (firstDifferenceIndex === lastDifferenceIndex) {53 const index = firstDifferenceIndex54 const result = checkDifferences(oldSub2.expressions[index], newSub2.expressions[index])55 oldSub2.expressions[index] = result[0]56 newSub2.expressions[index] = result[1]57 }58 if (firstDifferenceIndex <= lastDifferenceIndex) {59 newSub2.style = hl60 newSub2.firstDifferenceIndex = firstDifferenceIndex61 newSub2.lastDifferenceIndex = lastDifferenceIndex62 }63 return [oldSub2, newSub2]64 }65 break66 }67 return [oldSub, newSub]68}69export function showdiff (oldString, newString, options) {70 const oldFormula = new Formula(oldString, options).result71 const newFormula = new Formula(newString, options).result72 const result = checkDifferences(oldFormula, newFormula)73 return result[1]...
index.js
Source:index.js
1import convertReference from '../ling-ref.js';2import { fileURLToPath } from 'url';3import fs from 'fs';4import path from 'path';5import yaml from 'yaml';6const { readFile } = fs.promises;7const currentDir = path.dirname(fileURLToPath(import.meta.url));8const bibliographyPath = path.join(currentDir, `bibliography.html`);9const referencesPath = path.join(currentDir, `references.yml`);10const contextChars = 50;11void async function test() {12 const yamlReferences = await readFile(referencesPath, `utf8`);13 let bibliography = await readFile(bibliographyPath, `utf8`);14 const references = yaml.parse(yamlReferences);15 bibliography = bibliography16 .replace(/\r\n/gu, `\n`)17 .normalize()18 .trim();19 const citations = references20 .map(convertReference)21 .map(citation => `<li><p>${citation}</p></li>`);22 const referenceList = citations.join(`\n`).normalize();23 const testString = `<ul>\n${referenceList}\n</ul>`;24 const noChange = testString === bibliography;25 if (noChange) {26 console.info(`Test passed!`);27 return process.exit(0);28 }29 const bibliographyChars = Array.from(bibliography);30 const firstDifferenceIndex = Array.from(testString)31 .findIndex((char, i) => bibliographyChars[i] !== char);32 const bibliographyContext = bibliography.slice(33 Math.max(firstDifferenceIndex - contextChars, 0),34 Math.min(firstDifferenceIndex + contextChars, bibliography.length),35 );36 const testStringContext = testString.slice(37 Math.max(firstDifferenceIndex - contextChars, 0),38 Math.min(firstDifferenceIndex + contextChars, testString.length),39 );40 console.info(`Differences found:41 expected: ${bibliographyContext}42 actual: ${testStringContext}43 `);44 process.exit(1);...
complex.js
Source:complex.js
...4 * that's not common between the two given strings.5 *6 * @return {number} the index of the character where the strings diverge7 */8function firstDifferenceIndex(string1, string2) {9 var minLen = Math.min(string1.length, string2.length);10 for (var i = 0; i < minLen; i++) {11 if (string1.charAt(i) !== string2.charAt(i)) {12 return i;13 }14 }15 return string1.length === string2.length ? -1 : minLen;16}17/***/ (function(module, exports) {18// removed by extract-text-webpack-plugin19module.exports = {"table":"a","key":"e"};20/***/ }),21/* 523 */22/***/ (function(module, exports, __webpack_require__) {...
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/utils/stackTrace');2const stack1 = new Error().stack;3const stack2 = new Error().stack;4console.log(firstDifferenceIndex(stack1, stack2));5const { getCallerLocation } = require('playwright/lib/utils/stackTrace');6const stack = new Error().stack;7console.log(getCallerLocation(stack));8const { getCallerFile } = require('playwright/lib/utils/stackTrace');9console.log(getCallerFile());10const { getCallerLocation } = require('playwright/lib/utils/stackTrace');11const stack = new Error().stack;12console.log(getCallerLocation(stack));13const { getCallerLocation } = require('playwright/lib
Using AI Code Generation
1const { firstDifferenceIndex } = require('@playwright/test/lib/utils/utils');2const { expect } = require('@playwright/test');3const { test, expect } = require('@playwright/test');4test('firstDifferenceIndex', async ({}) => {5 expect(firstDifferenceIndex('abcdef', 'abcde')).toBe(5);6 expect(firstDifferenceIndex('abcdef', 'abcde')).toBe(6);7});
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/utils/utils');2const { expect } = require('chai');3describe('firstDifferenceIndex', function() {4 it('should return the index of the first difference', function() {5 expect(firstDifferenceIndex('hello', 'hella')).to.equal(4);6 });7});
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/utils/utils');2const { expect } = require('@playwright/test');3const a = 'Hello';4const b = 'Hella';5const index = firstDifferenceIndex(a, b);6console.log(index);7test('first difference index', async ({ page }) => {8 expect(index).toBe(4);9});
Using AI Code Generation
1const { firstDifferenceIndex } = require("playwright");2const { expect } = require("chai");3describe("firstDifferenceIndex", function () {4 it("should return the index of the first difference", function () {5 const a = "hello";6 const b = "hell";7 expect(firstDifferenceIndex(a, b)).to.equal(4);8 });9});10const { firstDifferenceIndex } = require("playwright");11const { expect } = require("chai");12describe("firstDifferenceIndex", function () {13 it("should return the index of the first difference", function () {14 const a = "hello";15 const b = "hell";16 expect(firstDifferenceIndex(a, b)).to.equal(3);17 });18});
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/internal/inspectorInstrumentation');2const { test } = require('playwright/lib/test');3const { expect } = require('playwright/lib/utils/expect');4test('firstDifferenceIndex', async ({ page }) => {5 const text = await page.innerText('.navbar__inner');6 const expected = 'Hello World';7 const index = firstDifferenceIndex(text, expected);8 expect(index).toBe(0);9 expect(text).toBe(expected);10});11module.exports = {12 use: {13 },14 {15 use: {16 viewport: { width: 1280, height: 720 },17 },18 },19};20{21 "compilerOptions": {22 },23}24{25 "scripts": {26 },27 "devDependencies": {28 }
Using AI Code Generation
1const {firstDifferenceIndex} = require('playwright/lib/server/utils');2const s1 = 'abcd';3const s2 = 'abc';4const index = firstDifferenceIndex(s1, s2);5console.log(index);6const {firstLineBreakIndex} = require('playwright/lib/server/utils');7efgh';8const index = firstLineBreakIndex(s);9console.log(index);10const {firstNonWhitespaceIndex} = require('playwright/lib/server/utils');11efgh';12const index = firstNonWhitespaceIndex(s);13console.log(index);14const {
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/utils/utils');2const firstDifferenceIndex = firstDifferenceIndex('Hello World', 'Hello World');3console.log(firstDifferenceIndex);4const { firstDifferenceIndex } = require('playwright/lib/utils/utils');5const firstDifferenceIndex = firstDifferenceIndex('Hello World', 'Hello Playwright');6console.log(firstDifferenceIndex);7const { firstDifferenceIndex } = require('playwright/lib/utils/utils');8const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello World');9console.log(firstDifferenceIndex);10const { firstDifferenceIndex } = require('playwright/lib/utils/utils');11const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello Playwright');12console.log(firstDifferenceIndex);13const { firstDifferenceIndex } = require('playwright/lib/utils/utils');14const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello Playwright');15console.log(firstDifferenceIndex);16const { firstDifferenceIndex } = require('playwright/lib/utils/utils');17const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello Playwright');18console.log(firstDifferenceIndex);19const { firstDifferenceIndex } = require('playwright/lib/utils/utils');20const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello Playwright');21console.log(firstDifferenceIndex);22const { firstDifferenceIndex } = require('playwright/lib/utils/utils');23const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', 'Hello Playwright');24console.log(firstDifferenceIndex);25const { firstDifferenceIndex } = require('playwright/lib/utils/utils');26const firstDifferenceIndex = firstDifferenceIndex('Hello Playwright', '
Using AI Code Generation
1const { firstDifferenceIndex } = require('playwright/lib/utils/utils');2const assert = require('assert');3describe('Test', () => {4 it('test', () => {5 const a = 'Hello';6 const b = 'Hello World';7 assert.equal(firstDifferenceIndex(a, b), a.length);8 });9});10{11 "scripts": {12 },13 "dependencies": {14 }15}16 at Context.<anonymous> (test.js:11:16)17 at processImmediate (internal/timers.js:456:21) {18}19const { firstDifferenceIndex } = require('playwright/lib/utils/utils');20const { firstDifferenceIndex } = require('playwright/lib/utils/utils');21const { firstDifferenceIndex } = require('playwright/lib/utils/utils');22const { first
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!