How to use hasOwn method in Playwright Internal

Best JavaScript code snippet using playwright-internal

styleCompat.js

Source:styleCompat.js Github

copy

Full Screen

...52 // But in this case we do not compat (difficult to detect and rare case):53 // Becuse custom series and graphic component support "merge", users may firstly54 // only set `textStrokeWidth` style or secondly only set `text`.55 return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan' // Difficult to detect whether legacy for a "text" el.56 && (elType === 'text' || hasOwn(style, 'text')));57}58/**59 * `EC4CompatibleStyle` is style that might be in echarts4 format or echarts5 format.60 * @param hostStyle The properties might be modified.61 * @return If be text el, `textContentStyle` and `textConfig` will not be retured.62 * Otherwise a `textContentStyle` and `textConfig` will be created, whose props area63 * retried from the `hostStyle`.64 */65export function convertFromEC4CompatibleStyle(hostStyle, elType, isNormal) {66 var srcStyle = hostStyle;67 var textConfig;68 var textContent;69 var textContentStyle;70 if (elType === 'text') {71 textContentStyle = srcStyle;72 } else {73 textContentStyle = {};74 hasOwn(srcStyle, 'text') && (textContentStyle.text = srcStyle.text);75 hasOwn(srcStyle, 'rich') && (textContentStyle.rich = srcStyle.rich);76 hasOwn(srcStyle, 'textFill') && (textContentStyle.fill = srcStyle.textFill);77 hasOwn(srcStyle, 'textStroke') && (textContentStyle.stroke = srcStyle.textStroke);78 hasOwn(srcStyle, 'fontFamily') && (textContentStyle.fontFamily = srcStyle.fontFamily);79 hasOwn(srcStyle, 'fontSize') && (textContentStyle.fontSize = srcStyle.fontSize);80 hasOwn(srcStyle, 'fontStyle') && (textContentStyle.fontStyle = srcStyle.fontStyle);81 hasOwn(srcStyle, 'fontWeight') && (textContentStyle.fontWeight = srcStyle.fontWeight);82 textContent = {83 type: 'text',84 style: textContentStyle,85 // ec4 do not support rectText trigger.86 // And when text postion is different in normal and emphasis87 // => hover text trigger emphasis;88 // => text position changed, leave mouse pointer immediately;89 // That might cause state incorrect.90 silent: true91 };92 textConfig = {};93 var hasOwnPos = hasOwn(srcStyle, 'textPosition');94 if (isNormal) {95 textConfig.position = hasOwnPos ? srcStyle.textPosition : 'inside';96 } else {97 hasOwnPos && (textConfig.position = srcStyle.textPosition);98 }99 hasOwn(srcStyle, 'textPosition') && (textConfig.position = srcStyle.textPosition);100 hasOwn(srcStyle, 'textOffset') && (textConfig.offset = srcStyle.textOffset);101 hasOwn(srcStyle, 'textRotation') && (textConfig.rotation = srcStyle.textRotation);102 hasOwn(srcStyle, 'textDistance') && (textConfig.distance = srcStyle.textDistance);103 }104 convertEC4CompatibleRichItem(textContentStyle, hostStyle);105 each(textContentStyle.rich, function (richItem) {106 convertEC4CompatibleRichItem(richItem, richItem);107 });108 return {109 textConfig: textConfig,110 textContent: textContent111 };112}113/**114 * The result will be set to `out`.115 */116function convertEC4CompatibleRichItem(out, richItem) {117 if (!richItem) {118 return;119 } // (1) For simplicity, make textXXX properties (deprecated since ec5) has120 // higher priority. For example, consider in ec4 `borderColor: 5, textBorderColor: 10`121 // on a rect means `borderColor: 4` on the rect and `borderColor: 10` on an attached122 // richText in ec5.123 // (2) `out === richItem` if and only if `out` is text el or rich item.124 // So we can overwite existing props in `out` since textXXX has higher priority.125 richItem.font = richItem.textFont || richItem.font;126 hasOwn(richItem, 'textStrokeWidth') && (out.lineWidth = richItem.textStrokeWidth);127 hasOwn(richItem, 'textAlign') && (out.align = richItem.textAlign);128 hasOwn(richItem, 'textVerticalAlign') && (out.verticalAlign = richItem.textVerticalAlign);129 hasOwn(richItem, 'textLineHeight') && (out.lineHeight = richItem.textLineHeight);130 hasOwn(richItem, 'textWidth') && (out.width = richItem.textWidth);131 hasOwn(richItem, 'textHeight') && (out.height = richItem.textHeight);132 hasOwn(richItem, 'textBackgroundColor') && (out.backgroundColor = richItem.textBackgroundColor);133 hasOwn(richItem, 'textPadding') && (out.padding = richItem.textPadding);134 hasOwn(richItem, 'textBorderColor') && (out.borderColor = richItem.textBorderColor);135 hasOwn(richItem, 'textBorderWidth') && (out.borderWidth = richItem.textBorderWidth);136 hasOwn(richItem, 'textBorderRadius') && (out.borderRadius = richItem.textBorderRadius);137 hasOwn(richItem, 'textBoxShadowColor') && (out.shadowColor = richItem.textBoxShadowColor);138 hasOwn(richItem, 'textBoxShadowBlur') && (out.shadowBlur = richItem.textBoxShadowBlur);139 hasOwn(richItem, 'textBoxShadowOffsetX') && (out.shadowOffsetX = richItem.textBoxShadowOffsetX);140 hasOwn(richItem, 'textBoxShadowOffsetY') && (out.shadowOffsetY = richItem.textBoxShadowOffsetY);141}142/**143 * Convert to pure echarts4 format style.144 * `itemStyle` will be modified, added with ec4 style properties from145 * `textStyle` and `textConfig`.146 *147 * [Caveat]: For simplicity, `insideRollback` in ec4 does not compat, where148 * `styleEmphasis: {textFill: 'red'}` will remove the normal auto added stroke.149 */150export function convertToEC4StyleForCustomSerise(itemStl, txStl, txCfg) {151 var out = itemStl; // See `custom.ts`, a trick to set extra `textPosition` firstly.152 out.textPosition = out.textPosition || txCfg.position || 'inside';153 txCfg.offset != null && (out.textOffset = txCfg.offset);154 txCfg.rotation != null && (out.textRotation = txCfg.rotation);155 txCfg.distance != null && (out.textDistance = txCfg.distance);156 var isInside = out.textPosition.indexOf('inside') >= 0;157 var hostFill = itemStl.fill || '#000';158 convertToEC4RichItem(out, txStl);159 var textFillNotSet = out.textFill == null;160 if (isInside) {161 if (textFillNotSet) {162 out.textFill = txCfg.insideFill || '#fff';163 !out.textStroke && txCfg.insideStroke && (out.textStroke = txCfg.insideStroke);164 !out.textStroke && (out.textStroke = hostFill);165 out.textStrokeWidth == null && (out.textStrokeWidth = 2);166 }167 } else {168 if (textFillNotSet) {169 out.textFill = itemStl.fill || txCfg.outsideFill || '#000';170 }171 !out.textStroke && txCfg.outsideStroke && (out.textStroke = txCfg.outsideStroke);172 }173 out.text = txStl.text;174 out.rich = txStl.rich;175 each(txStl.rich, function (richItem) {176 convertToEC4RichItem(richItem, richItem);177 });178 return out;179}180function convertToEC4RichItem(out, richItem) {181 if (!richItem) {182 return;183 }184 hasOwn(richItem, 'fill') && (out.textFill = richItem.fill);185 hasOwn(richItem, 'stroke') && (out.textStroke = richItem.fill);186 hasOwn(richItem, 'lineWidth') && (out.textStrokeWidth = richItem.lineWidth);187 hasOwn(richItem, 'font') && (out.font = richItem.font);188 hasOwn(richItem, 'fontStyle') && (out.fontStyle = richItem.fontStyle);189 hasOwn(richItem, 'fontWeight') && (out.fontWeight = richItem.fontWeight);190 hasOwn(richItem, 'fontSize') && (out.fontSize = richItem.fontSize);191 hasOwn(richItem, 'fontFamily') && (out.fontFamily = richItem.fontFamily);192 hasOwn(richItem, 'align') && (out.textAlign = richItem.align);193 hasOwn(richItem, 'verticalAlign') && (out.textVerticalAlign = richItem.verticalAlign);194 hasOwn(richItem, 'lineHeight') && (out.textLineHeight = richItem.lineHeight);195 hasOwn(richItem, 'width') && (out.textWidth = richItem.width);196 hasOwn(richItem, 'height') && (out.textHeight = richItem.height);197 hasOwn(richItem, 'backgroundColor') && (out.textBackgroundColor = richItem.backgroundColor);198 hasOwn(richItem, 'padding') && (out.textPadding = richItem.padding);199 hasOwn(richItem, 'borderColor') && (out.textBorderColor = richItem.borderColor);200 hasOwn(richItem, 'borderWidth') && (out.textBorderWidth = richItem.borderWidth);201 hasOwn(richItem, 'borderRadius') && (out.textBorderRadius = richItem.borderRadius);202 hasOwn(richItem, 'shadowColor') && (out.textBoxShadowColor = richItem.shadowColor);203 hasOwn(richItem, 'shadowBlur') && (out.textBoxShadowBlur = richItem.shadowBlur);204 hasOwn(richItem, 'shadowOffsetX') && (out.textBoxShadowOffsetX = richItem.shadowOffsetX);205 hasOwn(richItem, 'shadowOffsetY') && (out.textBoxShadowOffsetY = richItem.shadowOffsetY);206 hasOwn(richItem, 'textShadowColor') && (out.textShadowColor = richItem.textShadowColor);207 hasOwn(richItem, 'textShadowBlur') && (out.textShadowBlur = richItem.textShadowBlur);208 hasOwn(richItem, 'textShadowOffsetX') && (out.textShadowOffsetX = richItem.textShadowOffsetX);209 hasOwn(richItem, 'textShadowOffsetY') && (out.textShadowOffsetY = richItem.textShadowOffsetY);210}211export function warnDeprecated(deprecated, insteadApproach) {212 if (process.env.NODE_ENV !== 'production') {213 var key = deprecated + '^_^' + insteadApproach;214 if (!deprecatedLogs[key]) {215 console.warn("[ECharts] DEPRECATED: \"" + deprecated + "\" has been deprecated. " + insteadApproach);216 deprecatedLogs[key] = true;217 }218 }...

Full Screen

Full Screen

Object.hasOwn.js

Source:Object.hasOwn.js Github

copy

Full Screen

...24 },25 obj2 = {};26 /*jshint +W001 */27 it('defined on object "toString"', function () {28 expect(reiterate.$.hasOwn(obj, 'toString')).to.be.ok();29 });30 it('defined on object "toLocaleString"', function () {31 expect(reiterate.$.hasOwn(obj, 'toLocaleString')).to.be.ok();32 });33 it('defined on object "valueOf"', function () {34 expect(reiterate.$.hasOwn(obj, 'valueOf')).to.be.ok();35 });36 it('defined on object "hasOwnProperty"', function () {37 expect(reiterate.$.hasOwn(obj, 'hasOwnProperty')).to.be.ok();38 });39 it('defined on object "isPrototypeOf"', function () {40 expect(reiterate.$.hasOwn(obj, 'isPrototypeOf')).to.be.ok();41 });42 it('defined on object "propertyIsEnumerable"', function () {43 expect(reiterate.$.hasOwn(obj, 'propertyIsEnumerable')).to.be.ok();44 });45 it('defined on object "constructor"', function () {46 expect(reiterate.$.hasOwn(obj, 'constructor')).to.be.ok();47 });48 it('properties that are not defined', function () {49 expect(reiterate.$.hasOwn(obj, 'foo')).to.not.be.ok();50 expect(reiterate.$.hasOwn(obj, 'bar')).to.not.be.ok();51 expect(reiterate.$.hasOwn(obj, 'fuz')).to.not.be.ok();52 });53 it('not defined on object "toString"', function () {54 expect(reiterate.$.hasOwn(obj2, 'toString')).to.not.be.ok();55 });56 it('not defined on object "toLocaleString"', function () {57 expect(reiterate.$.hasOwn(obj2, 'toLocaleString')).to.not.be.ok();58 });59 it('not defined on object "valueOf"', function () {60 expect(reiterate.$.hasOwn(obj2, 'valueOf')).to.not.be.ok();61 });62 it('not defined on object "hasOwnProperty"', function () {63 expect(reiterate.$.hasOwn(obj2, 'hasOwnProperty')).to.not.be.ok();64 });65 it('not defined on object "isPrototypeOf"', function () {66 expect(reiterate.$.hasOwn(obj2, 'isPrototypeOf')).to.not.be.ok();67 });68 it('not defined on object "propertyIsEnumerable"', function () {69 expect(reiterate.$.hasOwn(obj2, 'propertyIsEnumerable')).to.not.be.ok();70 });71 it('not defined on object "constructor"', function () {72 expect(reiterate.$.hasOwn(obj2, 'constructor')).to.not.be.ok();73 });74 it('not defined on object should be not ok in each case', function () {75 expect(reiterate.$.hasOwn(obj2, 'foo')).to.not.be.ok();76 expect(reiterate.$.hasOwn(obj2, 'bar')).to.not.be.ok();77 expect(reiterate.$.hasOwn(obj2, 'fuz')).to.not.be.ok();78 });79 it('defined on object with "undefined" value "toString"', function () {80 expect(reiterate.$.hasOwn({81 toString: undefined82 }, 'toString')).to.be.ok();83 });84 it('defined on object with "undefined" value "toLocaleString"', function () {85 expect(reiterate.$.hasOwn({86 toLocaleString: undefined87 }, 'toLocaleString')).to.be.ok();88 });89 it('defined on object with "undefined" value "valueOf"', function () {90 expect(reiterate.$.hasOwn({91 valueOf: undefined92 }, 'valueOf')).to.be.ok();93 });94 it('defined on object with "undefined" value "hasOwnProperty"', function () {95 /*jshint -W001 */96 expect(reiterate.$.hasOwn({97 hasOwnProperty: undefined98 }, 'hasOwnProperty')).to.be.ok();99 /*jshint +W001 */100 });101 it('defined on object with "undefined" value "isPrototypeOf"', function () {102 expect(reiterate.$.hasOwn({103 isPrototypeOf: undefined104 }, 'isPrototypeOf')).to.be.ok();105 });106 it(107 'defined on object with "undefined" value "propertyIsEnumerable"',108 function () {109 expect(reiterate.$.hasOwn({110 propertyIsEnumerable: undefined111 }, 'propertyIsEnumerable')).to.be.ok();112 }113 );114 it('defined on object with "undefined" value "constructor"', function () {115 expect(reiterate.$.hasOwn({116 constructor: undefined117 }, 'constructor')).to.be.ok();118 });119 it('string defined', function () {120 var str = 'abc';121 expect(reiterate.$.hasOwn(str, '0')).to.be.ok();122 expect(reiterate.$.hasOwn(str, '1')).to.be.ok();123 expect(reiterate.$.hasOwn(str, '2')).to.be.ok();124 });125 it('string not-defined', function () {126 var str = 'abc';127 expect(reiterate.$.hasOwn(str, '3')).to.not.be.ok();128 });129 it('string object defined', function () {130 var strObj = Object('abc');131 expect(reiterate.$.hasOwn(strObj, '0')).to.be.ok();132 expect(reiterate.$.hasOwn(strObj, '1')).to.be.ok();133 expect(reiterate.$.hasOwn(strObj, '2')).to.be.ok();134 });135 it('string object not-defined', function () {136 var strObj = Object('abc');137 expect(reiterate.$.hasOwn(strObj, '3')).to.not.be.ok();138 });139 it('arguments defined', function () {140 var args = reiterate.$.returnArgs(false, undefined, null, '', 0);141 expect(reiterate.$.hasOwn(args, '0')).to.be.ok();142 expect(reiterate.$.hasOwn(args, '1')).to.be.ok();143 expect(reiterate.$.hasOwn(args, '2')).to.be.ok();144 expect(reiterate.$.hasOwn(args, '3')).to.be.ok();145 expect(reiterate.$.hasOwn(args, '4')).to.be.ok();146 });147 it('arguments not-defined', function () {148 var args = reiterate.$.returnArgs(false, undefined, null, '', 0);149 expect(reiterate.$.hasOwn(args, '5')).to.not.be.ok();150 });151 it('should not list prototype or constructor', function () {152 function Constructor() {153 this.constructor = this.prototype = 1;154 }155 Constructor.prototype.constructor = 1;156 expect(reiterate.$.hasOwn(Constructor, 'constructor')).to.not.be.ok();157 });158 it('should list prototype and constructor', function () {159 function Constructor() {160 this.constructor = this.prototype = 1;161 }162 Constructor.prototype.constructor = 1;163 expect(reiterate.$.hasOwn(Constructor, 'prototype')).to.be.ok();164 expect(reiterate.$.hasOwn(Constructor.prototype, 'constructor'))165 .to.be.ok();166 expect(reiterate.$.hasOwn(new Constructor(), 'prototype')).to.be.ok();167 expect(reiterate.$.hasOwn(new Constructor(), 'constructor')).to.be.ok();168 });169 });...

Full Screen

Full Screen

chat.websocketServerController.js

Source:chat.websocketServerController.js Github

copy

Full Screen

...9 */10controller.call = async (frame) => {11 // add time to frame12 frame.time = new Date();13 if (Object.hasOwn(frame, "control")) {14 switch (frame.control) {15 case "assign": {16 if (typeof frame.name === "string") {17 let res = await Model.call(1, frame);18 if (res !== null) {19 delete res.assign;20 delete res._id;21 res.control = "assign";22 controller.emit("assignReturn", res);23 }24 }25 break;26 }27 // get User's profile info28 case "get": {29 if (30 Object.hasOwn(frame, "name") &&31 Object.hasOwn(frame, "type") &&32 Object.hasOwn(frame, "destination") &&33 Object.hasOwn(frame, "from")34 ) {35 // typecheck36 if (37 typeof frame.name !== "string" ||38 typeof frame.type !== "string" ||39 !Array.isArray(frame.destination) ||40 typeof frame.from !== "number"41 ) {42 break;43 } else if (44 frame.type.length > 20 ||45 frame.destination[0].length > 2046 ) {47 break;48 }49 if (Number.isInteger(frame.from)) {50 let ret = await Model.call(2, frame);51 if (ret) {52 delete ret._id;53 let mes = {54 origin: frame.name,55 message: ret,56 control: "get",57 type: frame.type,58 };59 controller.emit("getReturn", mes);60 }61 } else {62 let mes = {63 origin: frame.name,64 message: "error",65 };66 controller.emit("getReturn", mes);67 }68 }69 break;70 }71 case "message": {72 if (73 Object.hasOwn(frame, "name") &&74 Object.hasOwn(frame, "type") &&75 Object.hasOwn(frame, "destination") &&76 Object.hasOwn(frame, "message")77 ) {78 if (79 typeof frame.name !== "string" ||80 typeof frame.type !== "string" ||81 !Array.isArray(frame.destination) ||82 typeof frame.message !== "string" ||83 frame.destination.some((ob) => ob.length > 20)84 ) {85 break;86 } else if (frame.type.length > 20 || frame.message.length > 500) {87 break;88 }89 controller.emit("messageReturn", frame);90 await Model.call(3, frame);91 }92 break;93 }94 case "delete": {95 if (96 Object.hasOwn(frame, "name") &&97 Object.hasOwn(frame, "type") &&98 Object.hasOwn(frame, "destination")99 ) {100 if (101 typeof frame.name !== "string" ||102 typeof frame.type !== "string" ||103 !Array.isArray(frame.destination)104 ) {105 break;106 } else if (107 frame.type.length > 20 ||108 frame.destination[0].length > 20109 ) {110 break;111 }112 let res = await Model.call(4, frame);113 if (res) {114 let mes = {115 members: res,116 frame: frame,117 };118 controller.emit("deleteReturn", mes);119 }120 }121 break;122 }123 case "create": {124 if (125 Object.hasOwn(frame, "name") &&126 Object.hasOwn(frame, "type") &&127 Object.hasOwn(frame, "destination")128 ) {129 if (130 typeof frame.name !== "string" ||131 typeof frame.type !== "string" ||132 !Array.isArray(frame.destination)133 ) {134 break;135 } else if (136 frame.type.length > 20 ||137 frame.destination[0].length > 20138 ) {139 break;140 }141 let res = await Model.call(5, frame);142 if (res) {143 controller.emit("createReturn", frame);144 }145 }146 break;147 }148 case "invite": {149 if (150 Object.hasOwn(frame, "name") &&151 Object.hasOwn(frame, "destination")152 ) {153 if (154 typeof frame.name !== "string" ||155 !Array.isArray(frame.destination)156 ) {157 break;158 } else if (frame.destination[0].length > 20) {159 break;160 }161 let res = await Model.call(6, frame);162 if (res) {163 let mes = {164 members: [frame.destination[1], ...res],165 frame: frame,166 };167 controller.emit("inviteReturn", mes);168 }169 }170 break;171 }172 case "escape": {173 if (174 Object.hasOwn(frame, "name") &&175 Object.hasOwn(frame, "destination")176 ) {177 if (178 typeof frame.name !== "string" ||179 !Array.isArray(frame.destination)180 ) {181 break;182 } else if (frame.destination[0].length > 20) {183 break;184 }185 let res = await Model.call(7, frame);186 if (res) {187 let mes = {188 members: res,189 frame: frame,190 };191 controller.emit("escapeReturn", mes);192 }193 }194 break;195 }196 case "avatarupload": {197 if (Object.hasOwn(frame, "name") && Object.hasOwn(frame, "filename")) {198 if (frame.name.length > 20) {199 break;200 }201 await Model.call(8, frame);202 }203 break;204 }205 case "getavatar": {206 if (Object.hasOwn(frame, "name") && Object.hasOwn(frame, "who")) {207 if (208 typeof frame.name !== "string" ||209 !Array.isArray(frame.who) ||210 frame.who.some((x) => x.length > 20)211 ) {212 break;213 }214 let res = await Model.call(9, frame);215 if (res) {216 let mes = {217 name: frame.name,218 control: frame.control,219 avatarlist: res,220 };...

Full Screen

Full Screen

pingpp-pc.js

Source:pingpp-pc.js Github

copy

Full Screen

1(function(){2var3 version = "2.0.8",4 hasOwn = {}.hasOwnProperty,5 PingppSDK = function(){},6 cfg = {7 PINGPP_NOTIFY_URL: 'https://api.pingxx.com/notify/charges/',8 PINGPP_MOCK_URL: 'http://sissi.pingxx.com/mock.php',9 ALIPAY_PC_DIRECT_URL: 'https://mapi.alipay.com/gateway.do',10 UPACP_PC_URL: 'https://gateway.95516.com/gateway/api/frontTransReq.do',11 CP_B2B_URL: 'https://payment.chinapay.com/CTITS/service/rest/page/nref/000000000017/0/0/0/0/0'12 },13 channels = {14 alipay_pc_direct: 'alipay_pc_direct',15 upacp_pc: 'upacp_pc',16 cp_b2b: 'cp_b2b'17 };18PingppSDK.prototype = {19 version: version,20 _resultCallback: undefined,21 _debug: false,22 createPayment: function(charge_json, callback, debug) {23 if (typeof callback == "function") {24 this._resultCallback = callback;25 }26 if (typeof debug == "boolean") {27 this._debug = debug;28 }29 var charge;30 if(typeof charge_json == "string"){31 try{32 charge = JSON.parse(charge_json);33 }catch(err){34 this._innerCallback("fail", this._error("json_decode_fail"));35 return;36 }37 }else{38 charge = charge_json;39 }40 if(typeof charge == "undefined"){41 this._innerCallback("fail", this._error("json_decode_fail"));42 return;43 }44 if(!hasOwn.call(charge, 'id')){45 this._innerCallback("fail", this._error("invalid_charge", "no_charge_id"));46 return;47 }48 if(!hasOwn.call(charge, 'channel')){49 this._innerCallback("fail", this._error("invalid_charge", "no_channel"));50 return;51 }52 var channel = charge['channel'];53 if(!hasOwn.call(charge, 'credential')){54 this._innerCallback("fail", this._error("invalid_charge", "no_credential"));55 return;56 }57 if (!charge['credential']) {58 this._innerCallback("fail", this._error("invalid_credential", "credential_is_undefined"));59 return;60 }61 if (!hasOwn.call(channels, channel)) {62 this._innerCallback("fail", this._error("invalid_charge", "no_such_channel:" + channel));63 return;64 }65 if (!hasOwn.call(charge['credential'], channel)) {66 this._innerCallback("fail", this._error("invalid_credential", "no_valid_channel_credential"));67 return;68 }69 if(!hasOwn.call(charge, 'livemode')){70 this._innerCallback("fail", this._error("invalid_charge", "no_livemode"));71 return;72 }73 if (charge['livemode'] == false) {74 this._testModeNotify(charge);75 return;76 }77 var credential = charge['credential'][channel];78 if (channel == channels.upacp_pc) {79 form_submit(cfg.UPACP_PC_URL, 'post', credential);80 } else if (channel == channels.alipay_pc_direct) {81 if (!hasOwn.call(credential, "_input_charset")) {82 credential["_input_charset"] = 'utf-8';83 }84 var query = stringify_data(credential, channel, true);85 window.location.href = cfg.ALIPAY_PC_DIRECT_URL + "?" + query;86 } else if (channel == channels.cp_b2b) {87 form_submit(cfg.CP_B2B_URL, 'post', credential);88 }89 },90 _error: function(msg, extra) {91 msg = (typeof msg == "undefined") ? "" : msg;92 extra = (typeof extra == "undefined") ? "" : extra;93 return {94 msg:msg,95 extra:extra96 };97 },98 _innerCallback: function(result, err) {99 if (typeof this._resultCallback == "function") {100 if (typeof err == "undefined") {101 err = this._error();102 }103 this._resultCallback(result, err);104 }105 },106 _testModeNotify: function(charge) {107 var params = {108 'ch_id': charge['id'],109 'scheme': 'http',110 'channel': charge['channel']111 };112 if (hasOwn.call(charge, 'order_no')) {113 params['order_no'] = charge['order_no'];114 } else if (hasOwn.call(charge, 'orderNo')) {115 params['order_no'] = charge['orderNo'];116 }117 if (hasOwn.call(charge, 'time_expire')) {118 params['time_expire'] = charge['time_expire'];119 } else if (hasOwn.call(charge, 'timeExpire')) {120 params['time_expire'] = charge['timeExpire'];121 }122 if (hasOwn.call(charge, 'extra')) {123 params['extra'] = encodeURIComponent(JSON.stringify(charge['extra']));124 }125 location.href = cfg.PINGPP_MOCK_URL+'?'+stringify_data(params);126 }127};128function form_submit(url, method, params) {129 var form = document.createElement("form");130 form.setAttribute("method", method);131 form.setAttribute("action", url);132 for (var key in params) {133 if (hasOwn.call(params, key)) {134 var hiddenField = document.createElement("input");135 hiddenField.setAttribute("type", "hidden");136 hiddenField.setAttribute("name", key);137 hiddenField.setAttribute("value", params[key]);138 form.appendChild(hiddenField);139 }140 }141 document.body.appendChild(form);142 form.submit();143}144function stringify_data(data, channel, urlencode) {145 if (typeof urlencode == "undefined") {146 urlencode = false;147 }148 var output = [];149 for (var i in data) {150 if (channel == "bfb_wap" && i == "url") {151 continue;152 }153 if (channel == "yeepay_wap" && i == "mode") {154 continue;155 }156 output.push(i + '=' + (urlencode ? encodeURIComponent(data[i]) : data[i]));157 }158 return output.join('&');159}160PingppSDK.prototype.payment = PingppSDK.prototype.createPayment;161window.pingppPc = new PingppSDK();...

Full Screen

Full Screen

getProperty.js

Source:getProperty.js Github

copy

Full Screen

1"use strict";2Object.defineProperty(exports, "__esModule", {3 value: true4});5exports["default"] = exports.getProp = exports.getProperty = void 0;6var _type = require("../type/type.js");7var _isObjectParameter = require("../object/isObjectParameter.js");8var _has2 = require("../object/has.js");9var _splitDotItems2 = require("../string/splitDotItems.js");10var _getProperty2 = require("../object/_getProperty.js");11/**12 * getProperty13 */14var getProperty = function getProperty(object, propertyPath) {15 var hasOwn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;16 var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;17 if ((0, _isObjectParameter.isObjectParameter)(object, 'object, propertyPath', 'hasOwn, detail')) {18 var _object = object;19 object = _object.object;20 propertyPath = _object.propertyPath;21 var _object$hasOwn = _object.hasOwn;22 hasOwn = _object$hasOwn === void 0 ? true : _object$hasOwn;23 var _object$detail = _object.detail;24 detail = _object$detail === void 0 ? false : _object$detail;25 } else if ((0, _isObjectParameter.isObjectParameter)(propertyPath, 'propertyPath', 'hasOwn, detail')) {26 var _propertyPath = propertyPath;27 propertyPath = _propertyPath.propertyPath;28 var _propertyPath$hasOwn = _propertyPath.hasOwn;29 hasOwn = _propertyPath$hasOwn === void 0 ? true : _propertyPath$hasOwn;30 var _propertyPath$detail = _propertyPath.detail;31 detail = _propertyPath$detail === void 0 ? false : _propertyPath$detail;32 } else if ((0, _isObjectParameter.isObjectParameter)(hasOwn, '', 'hasOwn, detail', 1)) {33 var _hasOwn = hasOwn;34 var _hasOwn$hasOwn = _hasOwn.hasOwn;35 hasOwn = _hasOwn$hasOwn === void 0 ? true : _hasOwn$hasOwn;36 var _hasOwn$detail = _hasOwn.detail;37 detail = _hasOwn$detail === void 0 ? false : _hasOwn$detail;38 } else if ((0, _isObjectParameter.isObjectParameter)(detail, 'detail')) {39 var _detail = detail;40 detail = _detail.detail;41 }42 if (!(0, _type.isObjectLike)(object)) {43 throw new TypeError('getProperty args(object) is not object');44 }45 if (!(0, _type.isString)(propertyPath)) {46 throw new TypeError('getProperty args(propertyPath) is not string');47 }48 if (!(0, _type.isBoolean)(hasOwn)) {49 throw new TypeError('getProperty args(hasOwn) is not boolean');50 }51 if (!(0, _type.isBoolean)(detail)) {52 throw new TypeError('getProperty args(detail) is not boolean');53 }54 return (0, _getProperty2._getProperty)(object, propertyPath, hasOwn, detail);55};56exports.getProperty = getProperty;57var getProp = getProperty;58exports.getProp = getProp;59var _default = {60 getProperty: getProperty,61 getProp: getProp62};...

Full Screen

Full Screen

spec-hasOwn.js

Source:spec-hasOwn.js Github

copy

Full Screen

1define(['mout/object/hasOwn'], function (hasOwn) {2 describe('object/hasOwn()', function () {3 it('should check if object hasOwnProperty', function () {4 var obj = {5 a: 1,6 b: 'foo'7 };8 expect( hasOwn(obj, 'a') ).toBe( true );9 expect( hasOwn(obj, 'b') ).toBe( true );10 expect( hasOwn(obj, 'hasOwnProperty') ).toBe( false );11 expect( hasOwn(obj, 'toString') ).toBe( false );12 expect( hasOwn(obj, 'toLocaleString') ).toBe( false );13 expect( hasOwn(obj, 'valueOf') ).toBe( false );14 expect( hasOwn(obj, 'isPrototypeOf') ).toBe( false );15 expect( hasOwn(obj, 'propertyIsEnumerable') ).toBe( false );16 expect( hasOwn(obj, 'constructor') ).toBe( false );17 });18 it('should work even if overwrite prototype properties, including hasOwnProperty', function () {19 var obj = {20 a: 1,21 b: 'foo',22 hasOwnProperty : 'yes',23 toString : 'lorem ipsum'24 };25 expect( hasOwn(obj, 'a') ).toBe( true );26 expect( hasOwn(obj, 'b') ).toBe( true );27 expect( hasOwn(obj, 'hasOwnProperty') ).toBe( true );28 expect( hasOwn(obj, 'toString') ).toBe( true );29 expect( hasOwn(obj, 'toLocaleString') ).toBe( false );30 expect( hasOwn(obj, 'valueOf') ).toBe( false );31 expect( hasOwn(obj, 'isPrototypeOf') ).toBe( false );32 expect( hasOwn(obj, 'propertyIsEnumerable') ).toBe( false );33 expect( hasOwn(obj, 'constructor') ).toBe( false );34 });35 });...

Full Screen

Full Screen

shimmed.js

Source:shimmed.js Github

copy

Full Screen

1'use strict';2require('../auto');3var test = require('tape');4var defineProperties = require('define-properties');5var callBind = require('call-bind');6var isEnumerable = Object.prototype.propertyIsEnumerable;7var functionsHaveNames = require('functions-have-names')();8var hasStrictMode = require('has-strict-mode')();9var runTests = require('./tests');10test('shimmed', function (t) {11 t.equal(Object.hasOwn.length, 2, 'Relect.hasOwn has a length of 2');12 t.test('Function name', { skip: !functionsHaveNames }, function (st) {13 st.equal(Object.hasOwn.name, 'hasOwn', 'Object.hasOwn has name "hasOwn"');14 st.end();15 });16 t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {17 et.equal(false, isEnumerable.call(Object, 'hasOwn'), 'Object.hasOwn is not enumerable');18 et.end();19 });20 t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {21 st['throws'](function () { return Object.hasOwn.call(undefined); }, TypeError, 'undefined is not an object');22 st['throws'](function () { return Object.hasOwn.call(null); }, TypeError, 'null is not an object');23 st.end();24 });25 runTests(callBind(Object.hasOwn, Object), t);26 t.end();...

Full Screen

Full Screen

es.object.has-own.js

Source:es.object.has-own.js Github

copy

Full Screen

...4 assert.arity(hasOwn, 2);5 assert.name(hasOwn, 'hasOwn');6 assert.looksNative(hasOwn);7 assert.nonEnumerable(Object, 'hasOwn');8 assert.same(hasOwn({ q: 42 }, 'q'), true);9 assert.same(hasOwn({ q: 42 }, 'w'), false);10 assert.same(hasOwn(create({ q: 42 }), 'q'), false);11 assert.same(hasOwn(Object.prototype, 'hasOwnProperty'), true);12 let called = false;13 try {14 hasOwn(null, { toString() { called = true; } });15 } catch { /* empty */ }16 assert.same(called, false, 'modern behaviour');17 assert.throws(() => hasOwn(null, 'foo'), TypeError, 'throws on null');18 assert.throws(() => hasOwn(undefined, 'foo'), TypeError, 'throws on undefined');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const {hasOwn} = require('playwright/lib/utils/utils');2const obj = {a: 1};3const {isString} = require('playwright/lib/utils/utils');4const str = 'test';5const num = 1;6const {isNumber} = require('playwright/lib/utils/utils');7const str = 'test';8const num = 1;9const {isObject} = require('playwright/lib/utils/utils');10const obj = {a: 1};11const num = 1;12const {isBoolean} = require('playwright/lib/utils/utils');13const bool = true;14const num = 1;15const {isRegExp} = require('playwright/lib/utils/utils');16const regex = /test/;17const str = 'test';18const {isStringArray} = require('playwright/lib/utils/utils');19const arr = ['test'];20const str = 'test';21const {isRegExpArray} = require('playwright/lib/utils/utils');22const arr = [/test/];23const regex = /test/;24const {isBooleanArray} = require('playwright/lib/utils/utils');25const arr = [true];26const bool = true;

Full Screen

Using AI Code Generation

copy

Full Screen

1const { helper } = require('@playwright/test');2const obj = { foo: 'bar' };3const hasOwn = helper.hasOwn;4const { helper } = require('@playwright/test');5const obj = { foo: 'bar' };6const hasOwn = helper.hasOwn;7const { helper } = require('@playwright/test');8const obj = { foo: 'bar' };9const hasOwn = helper.hasOwn;10const { helper } = require('@playwright/test');11const obj = { foo: 'bar' };12const hasOwn = helper.hasOwn;13const { helper } = require('@playwright/test');14const obj = { foo: 'bar' };15const hasOwn = helper.hasOwn;16const { helper } = require('@playwright/test');17const obj = { foo: 'bar' };18const hasOwn = helper.hasOwn;19const { helper } = require('@playwright/test');20const obj = { foo: 'bar' };21const hasOwn = helper.hasOwn;22const { helper } = require('@playwright/test');23const obj = { foo: 'bar' };24const hasOwn = helper.hasOwn;

Full Screen

Using AI Code Generation

copy

Full Screen

1const obj = { a: 1 };2const obj = { a: 1 };3const obj = { a: 1 };4const obj = { a: 1 };5const obj = { a: 1 };6const obj = { a: 1 };7const obj = { a: 1 };8const obj = { a: 1 };9const obj = { a: 1 };10const obj = { a: 1 };11const obj = { a: 1 };

Full Screen

Playwright tutorial

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.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful