How to use value1 method in wpt

Best JavaScript code snippet using wpt

breakinfinity.js

Source:breakinfinity.js Github

copy

Full Screen

1;(function (globalScope) {2 'use strict';3 /*4 # logarithmica_numerus_lite.js5 My "lite" attempt to store large numbers that only uses logarithms to convert.6 The full version will release later with negative numbers support.7 This library uses Decimal which is expressed as 10^(logarithm). There is only a factor:8 - Logarithm: The logarithm of the number.9 This version is way faster and less broken than IkerStreamer's logmath.js!10 You can find his code by clicking the link: https://github.com/Ikerstreamer/RGB-Idle/blob/master/logmath.js11 It is also almost 2x faster than break_infinity.js!12 If you want to use accuracy instead of performance, please use this library from the link: https://github.com/Patashu/break_infinity.js/blob/master/break_infinity.min.js13 */14 class Decimal {15 static fromValue(value) {16 if (value==null) {17 return {logarithm:Number.NEGATIVE_INFINITY}18 } else if (value.logarithm!=undefined) {19 return value20 } else if (typeof(value)=='string') {21 var findE=value.search('e')22 if (findE==-1) {23 value=parseFloat(value)24 return {logarithm:Math.log10(value)}25 }26 var split=[value.slice(0,findE),value.slice(findE+1,value.length)]27 split[1]=parseFloat(split[1])28 if (split[0]=='') return {logarithm:split[1]}29 split[0]=parseFloat(split[0])30 return {logarithm:Math.log10(split[0])+split[1]}31 } else if (typeof(value)=='number') {32 return {logarithm:Math.log10(value)}33 } else {34 return {logarithm:Number.NEGATIVE_INFINITY}35 }36 }37 constructor(value) {38 var value=Decimal.fromValue(value)39 this.logarithm=value.logarithm40 }41 static fromNumber(value) {42 var valueTemp=new Decimal()43 valueTemp.logarithm=Math.log10(value)44 return valueTemp45 }46 fromNumber() {47 return Decimal.fromNumber(this)48 }49 static fromString(value) {50 var valueTemp=new Decimal()51 var findE=value.search('e')52 if (findE==-1) {53 value=parseFloat(value)54 return {logarithm:Math.log10(value)}55 }56 var split=[value.slice(0,findE),value.slice(findE+1,value.length)]57 split[1]=parseFloat(split[1])58 if (split[0]=='') valueTemp.logarithm=split[1]59 else {60 split[0]=parseFloat(split[0])61 valueTemp.logarithm=Math.log10(split[0])+split[1]62 }63 return valueTemp64 }65 fromString() {66 return Decimal.fromString(this)67 }68 static fromMantissaExponent(m,e) {69 var value=new Decimal()70 value.logarithm=e+Math.log10(m)71 return value72 }73 static toString(value) {74 value=new Decimal(value)75 if (value.logarithm==Number.NEGATIVE_INFINITY) return '0'76 if (value.logarithm==Number.POSITIVE_INFINITY) {77 return 'Infinity'78 }79 if (value.logarithm>=1e21||value.logarithm<=-1e21) {80 return 'e'+value.logarithm81 }82 if (value.logarithm>=21||value.logarithm<-6) {83 var logInt=Math.floor(value.logarithm)84 return Math.pow(10,value.logarithm-logInt)+'e'+logInt85 }86 return Math.pow(10,value.logarithm).toString()87 }88 toString() {89 return Decimal.toString(this)90 }91 static toNumber(value) {92 value=new Decimal(value)93 if (value.logarithm>=309) return Number.POSITIVE_INFINITY94 if (value.logarithm<=-309) return 095 return Math.pow(10,value.logarithm)96 }97 toNumber() {98 return Decimal.toNumber(this)99 }100 static toPrecision(value,dp) {101 value=new Decimal(value)102 if (value.logarithm==Number.NEGATIVE_INFINITY) return (0).toPrecision(dp)103 if (value.logarithm==Number.POSITIVE_INFINITY) {104 return 'Infinity'105 }106 if (value.logarithm>=1e21||value.logarithm<=-1e21) {107 return 'e'+value.logarithm108 }109 if (value.logarithm>=dp||value.logarithm<6) {110 var logInt=Math.floor(value.logarithm)111 return Math.pow(10,value.logarithm-logInt).toPrecision(dp)+'e'+logInt112 }113 return Math.pow(10,value.logarithm).toPrecision(dp)114 }115 toPrecision(dp) {116 return Decimal.toPrecision(this,dp)117 }118 static toFixed(value,dp) {119 value=new Decimal(value)120 if (value.logarithm<-dp-1) return (0).toFixed(dp)121 if (value.logarithm==Number.POSITIVE_INFINITY) {122 return 'Infinity'123 }124 if (value.logarithm>=1e21) {125 return 'e'+value.logarithm126 }127 if (value.logarithm>=21) {128 return Math.pow(10,value.logarithm%1).toFixed(dp)+'e'+Math.floor(value.logarithm)129 }130 return Math.pow(10,value.logarithm).toFixed(dp)131 }132 toFixed(dp) {133 return Decimal.toFixed(this,dp)134 }135 static toExponential(value,dp) {136 value=new Decimal(value)137 if (value.logarithm==Number.NEGATIVE_INFINITY) return (0).toExponential(dp)138 if (value.logarithm==Number.POSITIVE_INFINITY) {139 return 'Infinity'140 }141 if (value.logarithm>=1e21||value.logarithm<=-1e21) {142 return 'e'+value.logarithm143 }144 var logInt=Math.floor(value.logarithm)145 return Math.pow(10,value.logarithm-logInt).toFixed(dp)+'e'+logInt146 }147 toExponential(dp) {148 return Decimal.toExponential(this,dp)149 }150 static add(value1,value2) {151 value1=new Decimal(value1)152 value2=new Decimal(value2)153 var expdiff=value1.logarithm-value2.logarithm154 if (expdiff>=15||value2.logarithm==Number.NEGATIVE_INFINITY) return value1155 if (expdiff<=-15||value1.logarithm==Number.NEGATIVE_INFINITY) return value2156 value2.logarithm=value2.logarithm+Math.log10(1+Math.pow(10,expdiff))157 return value2158 }159 add(value) {160 return Decimal.add(this,value)161 }162 static plus(value1,value2) {163 return Decimal.add(value1,value2)164 }165 plus(value) {166 return Decimal.add(this,value)167 }168 static sub(value1,value2) {169 value1=new Decimal(value1)170 value2=new Decimal(value2)171 var expdiff=value1.logarithm-value2.logarithm172 if (expdiff>=15||value2.logarithm==Number.NEGATIVE_INFINITY) return value1173 value1.logarithm=value1.logarithm+Math.log10(1-Math.pow(10,-expdiff))174 return value1175 }176 sub(value) {177 return Decimal.sub(this,value)178 }179 static subtract(value1,value2) {180 return Decimal.sub(value1,value2)181 }182 subtract(value) {183 return Decimal.sub(this,value)184 }185 static minus(value1,value2) {186 return Decimal.sub(value1,value2)187 }188 minus(value) {189 return Decimal.sub(this,value)190 }191 static mul(value1,value2) {192 value1=new Decimal(value1)193 value2=new Decimal(value2)194 value1.logarithm=value1.logarithm+value2.logarithm195 return value1196 }197 mul(value) {198 return Decimal.mul(this,value)199 }200 static multiply(value1,value2) {201 return Decimal.mul(value1,value2)202 }203 multiply(value) {204 return Decimal.mul(this,value)205 }206 static times(value1,value2) {207 return Decimal.mul(value1,value2)208 }209 times(value) {210 return Decimal.mul(this,value)211 }212 static div(value1,value2) {213 value1=new Decimal(value1)214 value2=new Decimal(value2)215 value1.logarithm=value1.logarithm-value2.logarithm216 return value1217 }218 div(value) {219 return Decimal.div(this,value)220 }221 static divide(value1,value2) {222 return Decimal.div(value1,value2)223 }224 divide(value) {225 return Decimal.div(this,value)226 }227 static divideBy(value1,value2) {228 return Decimal.div(value1,value2)229 }230 divideBy(value) {231 return Decimal.div(this,value)232 }233 static dividedBy(value1,value2) {234 return Decimal.div(value1,value2)235 }236 dividedBy(value) {237 return Decimal.div(this,value)238 }239 static recip(value) {240 value=new Decimal(value)241 value.logarithm=-value.logarithm242 return value243 }244 recip() {245 return Decimal.recip(this)246 }247 static reciprocal(value) {248 return Decimal.recip(value)249 }250 reciprocal() {251 return Decimal.recip(this)252 }253 static reciprocate(value) {254 return Decimal.recip(value)255 }256 reciprocate() {257 return Decimal.recip(this)258 }259 static mod(value1,value2) {260 value1=new Decimal(value1)261 value2=new Decimal(value2)262 var expdiff=value1.logarithm-value2.logarithm263 if (expdiff<0) return value1264 if (expdiff>=15) value2.logarithm=Number.NEGATIVE_INFINITY265 else value2.logarithm=value2.logarithm+Math.log10(Math.pow(10,expdiff)%1)266 return value2267 }268 mod(value) {269 return Decimal.mod(this,value)270 }271 static remainder(value1,value2) {272 return Decimal.mod(value1,value2)273 }274 remainder(value) {275 return Decimal.mod(this,value)276 }277 static pow(value,power) {278 value=new Decimal(value)279 value.logarithm=value.logarithm*power280 return value281 }282 pow(value) {283 return Decimal.pow(this,value)284 }285 static power(value,power) {286 return Decimal.pow(value,power)287 }288 power(value) {289 return Decimal.pow(this,value)290 }291 pow_base(value) {292 return Decimal.pow(value,this)293 }294 static sqr(value) {295 value=new Decimal(value)296 value.logarithm=value.logarithm*2297 return value298 }299 sqr() {300 return Decimal.square(this)301 }302 static square(value) {303 return Decimal.sqr(value)304 }305 square() {306 return Decimal.sqr(this)307 }308 static cub(value) {309 value=new Decimal(value)310 value.logarithm=value.logarithm*3311 return value312 }313 cub() {314 return Decimal.cube(this)315 }316 static cube(value) {317 return Decimal.cub(value)318 }319 cube() {320 return Decimal.cub(this)321 }322 static exp(value) {323 value=new Decimal(value)324 value.logarithm=value.logarithm*Math.log10(Math.E)325 return value326 }327 exp() {328 return Decimal.exp(this)329 }330 static root(value,power) {331 value=new Decimal(value)332 value.logarithm=value.logarithm/power333 return value334 }335 root(value) {336 return Decimal.root(this,value)337 }338 static sqrt(value) {339 value=new Decimal(value)340 value.logarithm=value.logarithm/2341 return value342 }343 sqrt() {344 return Decimal.sqrt(this)345 }346 static cbrt(value) {347 value=new Decimal(value)348 value.logarithm=value.logarithm/3349 return value350 }351 cbrt() {352 return Decimal.cbrt(this)353 }354 static log10(value) {355 value=new Decimal(value)356 return value.logarithm357 }358 log10() {359 return this.logarithm360 }361 static log10integer(value) {362 value=new Decimal(value)363 return Math.floor(value.logarithm)364 }365 log10integer() {366 return Decimal.log10integer(this)367 }368 static log10remainder(value) {369 value=new Decimal(value)370 return value.logarithm-Math.floor(value.logarithm)371 }372 log10remainder() {373 return Decimal.log10remainder(this)374 }375 static log2(value) {376 value=new Decimal(value)377 if (value.logarithm >= 5.411595565927716e+307) {378 value.logarithm = Math.log10(value.logarithm) + Math.log10(3.32192809488736234787)379 return value380 }381 return value.logarithm*3.32192809488736234787382 }383 log2() {384 return Decimal.log2(this)385 }386 static log(value,base) {387 value=new Decimal(value)388 base=new Decimal(base)389 return value.logarithm/base.logarithm390 }391 log(base) {392 return Decimal.log(this,base)393 }394 static logarithm(value,base) {395 return Decimal.log(value,base)396 }397 logarithm(base) {398 return Decimal.log(this,base)399 }400 static ln(value) {401 value=new Decimal(value)402 return value.logarithm*2.30258509299404568402403 }404 ln() {405 return this.logarithm*2.30258509299404568402406 }407 static floor(value) {408 value=new Decimal(value)409 if (value.logarithm<0) value.logarithm=Number.NEGATIVE_INFINITY410 else if (value.logarithm<15) value.logarithm=Math.log10(Math.floor(Math.pow(10,value.logarithm)+Math.pow(10,value.logarithm-14)))411 return value412 }413 floor() {414 return Decimal.floor(this)415 }416 static ceil(value) {417 value=new Decimal(value)418 if (value.logarithm==Number.NEGATIVE_INFINITY) return value419 else if (value.logarithm<0) value.logarithm=0420 else if (value.logarithm<15) value.logarithm=Math.log10(Math.ceil(Math.pow(10,value.logarithm)-Math.pow(10,value.logarithm-14)))421 return value422 }423 ceil() {424 return Decimal.ceil(this)425 }426 static round(value) {427 value=new Decimal(value)428 if (value.logarithm<=-1) value.logarithm=Number.NEGATIVE_INFINITY429 else if (value.logarithm<15) value.logarithm=Math.log10(Math.round(Math.pow(10,value.logarithm)))430 return value431 }432 round() {433 return Decimal.round(this)434 }435 static min(value1,value2) {436 value1=new Decimal(value1)437 value2=new Decimal(value2)438 if (value1.logarithm>value2.logarithm) return value2439 return value1440 }441 min(value) {442 return Decimal.min(this,value)443 }444 static max(value1,value2) {445 value1=new Decimal(value1)446 value2=new Decimal(value2)447 if (value1.logarithm>value2.logarithm) return value1448 return value2449 }450 max(value) {451 return Decimal.max(this,value)452 }453 static cmp(value1,value2) {454 value1=new Decimal(value1)455 value2=new Decimal(value2)456 if (value1.logarithm>value2.logarithm) return 1457 if (value1.logarithm<value2.logarithm) return -1458 return 0459 }460 compareTo(value) {461 return Decimal.cmp(this,value)462 }463 static compare(value1,value2) {464 return Decimal.cmp(value1,value2)465 }466 compare(value) {467 return Decimal.cmp(this,value)468 }469 static compareTo(value1,value2) {470 return Decimal.cmp(value1,value2)471 }472 compareTo(value) {473 return Decimal.cmp(this,value)474 }475 static lt(value1,value2) {476 value1=new Decimal(value1)477 value2=new Decimal(value2)478 return value1.logarithm<value2.logarithm479 }480 lt(value) {481 return Decimal.lt(this,value)482 }483 static lte(value1,value2) {484 value1=new Decimal(value1)485 value2=new Decimal(value2)486 return value1.logarithm<=value2.logarithm487 }488 lte(value) {489 return Decimal.lte(this,value)490 }491 static eq(value1,value2) {492 value1=new Decimal(value1)493 value2=new Decimal(value2)494 return value1.logarithm==value2.logarithm495 }496 eq(value) {497 return Decimal.eq(this,value)498 }499 static equals(value1,value2) {500 return Decimal.eq(value1,value2)501 }502 equals(value) {503 return Decimal.eq(this,value)504 }505 static neq(value1,value2) {506 value1=new Decimal(value1)507 value2=new Decimal(value2)508 return value1.logarithm!=value2.logarithm509 }510 neq(value) {511 return Decimal.neq(this,value)512 }513 static notEquals(value1,value2) {514 return Decimal.neq(value1,value2)515 }516 notEquals(value) {517 return Decimal.neq(this,value)518 }519 static gte(value1,value2) {520 value1=new Decimal(value1)521 value2=new Decimal(value2)522 return value1.logarithm>=value2.logarithm523 }524 gte(value) {525 return Decimal.gte(this,value)526 }527 static gt(value1,value2) {528 value1=new Decimal(value1)529 value2=new Decimal(value2)530 return value1.logarithm>value2.logarithm531 }532 gt(value) {533 return Decimal.gt(this,value)534 }535 static isFinite(value) {536 value=new Decimal(value)537 return value.logarithm<Number.POSITIVE_INFINITY538 }539 isFinite() {540 return Decimal.isFinite(this)541 }542 get mantissaAndExponent() {543 if (this.logarithm==Number.NEGATIVE_INFINITY) return {m:0,e:0}544 var logInt=Math.floor(this.logarithm)545 return {m:Math.pow(10,this.logarithm-logInt),e:logInt}546 }547 get e() {548 if (this.logarithm==Number.NEGATIVE_INFINITY) return 0549 return Math.floor(this.logarithm)550 }551 get exponent() {return this.e;}552 get m() {553 if (this.logarithm==Number.NEGATIVE_INFINITY) return 0554 var logInt=Math.floor(this.logarithm)555 return Math.pow(10,this.logarithm-logInt)556 }557 get mantissa() {return this.m;}558 valueOf() { return this.toString(); }559 toJSON() { return this.toString(); }560 }561 //Used from Patashu's break_infinity.js (and credited the author too, https://github.com/Patashu/break_infinity.js)562 if (typeof define == 'function' && define.amd) {563 define(function () {564 return Decimal;565 });566 // Node and other environments that support module.exports.567 } else if (typeof module != 'undefined' && module.exports) {568 module.exports = Decimal;569 // Browser.570 } else {571 if (!globalScope) {572 globalScope = typeof self != 'undefined' && self && self.self == self573 ? self : Function('return this')();574 }575 var noConflict = globalScope.Decimal;576 Decimal.noConflict = function () {577 globalScope.Decimal = noConflict;578 return Decimal;579 };580 globalScope.Decimal = Decimal;581 }...

Full Screen

Full Screen

can-override.js

Source:can-override.js Github

copy

Full Screen

1var understandable = require('./properties/understandable');2function animationIterationCount(validator, value1, value2) {3 if (!understandable(validator, value1, value2, 0, true) && !(validator.isAnimationIterationCountKeyword(value2) || validator.isPositiveNumber(value2))) {4 return false;5 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {6 return true;7 }8 return validator.isAnimationIterationCountKeyword(value2) || validator.isPositiveNumber(value2);9}10function animationName(validator, value1, value2) {11 if (!understandable(validator, value1, value2, 0, true) && !(validator.isAnimationNameKeyword(value2) || validator.isIdentifier(value2))) {12 return false;13 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {14 return true;15 }16 return validator.isAnimationNameKeyword(value2) || validator.isIdentifier(value2);17}18function areSameFunction(validator, value1, value2) {19 if (!validator.isFunction(value1) || !validator.isFunction(value2)) {20 return false;21 }22 var function1Name = value1.substring(0, value1.indexOf('('));23 var function2Name = value2.substring(0, value2.indexOf('('));24 return function1Name === function2Name;25}26function backgroundPosition(validator, value1, value2) {27 if (!understandable(validator, value1, value2, 0, true) && !(validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2))) {28 return false;29 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {30 return true;31 } else if (validator.isBackgroundPositionKeyword(value2) || validator.isGlobal(value2)) {32 return true;33 }34 return unit(validator, value1, value2);35}36function backgroundSize(validator, value1, value2) {37 if (!understandable(validator, value1, value2, 0, true) && !(validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2))) {38 return false;39 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {40 return true;41 } else if (validator.isBackgroundSizeKeyword(value2) || validator.isGlobal(value2)) {42 return true;43 }44 return unit(validator, value1, value2);45}46function color(validator, value1, value2) {47 if (!understandable(validator, value1, value2, 0, true) && !validator.isColor(value2)) {48 return false;49 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {50 return true;51 } else if (!validator.colorOpacity && (validator.isRgbColor(value1) || validator.isHslColor(value1))) {52 return false;53 } else if (!validator.colorOpacity && (validator.isRgbColor(value2) || validator.isHslColor(value2))) {54 return false;55 } else if (validator.isColor(value1) && validator.isColor(value2)) {56 return true;57 }58 return sameFunctionOrValue(validator, value1, value2);59}60function components(overrideCheckers) {61 return function (validator, value1, value2, position) {62 return overrideCheckers[position](validator, value1, value2);63 };64}65function fontFamily(validator, value1, value2) {66 return understandable(validator, value1, value2, 0, true);67}68function image(validator, value1, value2) {69 if (!understandable(validator, value1, value2, 0, true) && !validator.isImage(value2)) {70 return false;71 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {72 return true;73 } else if (validator.isImage(value2)) {74 return true;75 } else if (validator.isImage(value1)) {76 return false;77 }78 return sameFunctionOrValue(validator, value1, value2);79}80function keyword(propertyName) {81 return function(validator, value1, value2) {82 if (!understandable(validator, value1, value2, 0, true) && !validator.isKeyword(propertyName)(value2)) {83 return false;84 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {85 return true;86 }87 return validator.isKeyword(propertyName)(value2);88 };89}90function keywordWithGlobal(propertyName) {91 return function(validator, value1, value2) {92 if (!understandable(validator, value1, value2, 0, true) && !(validator.isKeyword(propertyName)(value2) || validator.isGlobal(value2))) {93 return false;94 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {95 return true;96 }97 return validator.isKeyword(propertyName)(value2) || validator.isGlobal(value2);98 };99}100function propertyName(validator, value1, value2) {101 if (!understandable(validator, value1, value2, 0, true) && !validator.isIdentifier(value2)) {102 return false;103 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {104 return true;105 }106 return validator.isIdentifier(value2);107}108function sameFunctionOrValue(validator, value1, value2) {109 return areSameFunction(validator, value1, value2) ?110 true :111 value1 === value2;112}113function textShadow(validator, value1, value2) {114 if (!understandable(validator, value1, value2, 0, true) && !(validator.isUnit(value2) || validator.isColor(value2) || validator.isGlobal(value2))) {115 return false;116 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {117 return true;118 }119 return validator.isUnit(value2) || validator.isColor(value2) || validator.isGlobal(value2);120}121function time(validator, value1, value2) {122 if (!understandable(validator, value1, value2, 0, true) && !validator.isTime(value2)) {123 return false;124 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {125 return true;126 } else if (validator.isTime(value1) && !validator.isTime(value2)) {127 return false;128 } else if (validator.isTime(value2)) {129 return true;130 } else if (validator.isTime(value1)) {131 return false;132 } else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {133 return true;134 }135 return sameFunctionOrValue(validator, value1, value2);136}137function timingFunction(validator, value1, value2) {138 if (!understandable(validator, value1, value2, 0, true) && !(validator.isTimingFunction(value2) || validator.isGlobal(value2))) {139 return false;140 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {141 return true;142 }143 return validator.isTimingFunction(value2) || validator.isGlobal(value2);144}145function unit(validator, value1, value2) {146 if (!understandable(validator, value1, value2, 0, true) && !validator.isUnit(value2)) {147 return false;148 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {149 return true;150 } else if (validator.isUnit(value1) && !validator.isUnit(value2)) {151 return false;152 } else if (validator.isUnit(value2)) {153 return true;154 } else if (validator.isUnit(value1)) {155 return false;156 } else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {157 return true;158 }159 return sameFunctionOrValue(validator, value1, value2);160}161function unitOrKeywordWithGlobal(propertyName) {162 var byKeyword = keywordWithGlobal(propertyName);163 return function(validator, value1, value2) {164 return unit(validator, value1, value2) || byKeyword(validator, value1, value2);165 };166}167function unitOrNumber(validator, value1, value2) {168 if (!understandable(validator, value1, value2, 0, true) && !(validator.isUnit(value2) || validator.isNumber(value2))) {169 return false;170 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {171 return true;172 } else if ((validator.isUnit(value1) || validator.isNumber(value1)) && !(validator.isUnit(value2) || validator.isNumber(value2))) {173 return false;174 } else if (validator.isUnit(value2) || validator.isNumber(value2)) {175 return true;176 } else if (validator.isUnit(value1) || validator.isNumber(value1)) {177 return false;178 } else if (validator.isFunction(value1) && !validator.isPrefixed(value1) && validator.isFunction(value2) && !validator.isPrefixed(value2)) {179 return true;180 }181 return sameFunctionOrValue(validator, value1, value2);182}183function zIndex(validator, value1, value2) {184 if (!understandable(validator, value1, value2, 0, true) && !validator.isZIndex(value2)) {185 return false;186 } else if (validator.isVariable(value1) && validator.isVariable(value2)) {187 return true;188 }189 return validator.isZIndex(value2);190}191module.exports = {192 generic: {193 color: color,194 components: components,195 image: image,196 propertyName: propertyName,197 time: time,198 timingFunction: timingFunction,199 unit: unit,200 unitOrNumber: unitOrNumber201 },202 property: {203 animationDirection: keywordWithGlobal('animation-direction'),204 animationFillMode: keyword('animation-fill-mode'),205 animationIterationCount: animationIterationCount,206 animationName: animationName,207 animationPlayState: keywordWithGlobal('animation-play-state'),208 backgroundAttachment: keyword('background-attachment'),209 backgroundClip: keywordWithGlobal('background-clip'),210 backgroundOrigin: keyword('background-origin'),211 backgroundPosition: backgroundPosition,212 backgroundRepeat: keyword('background-repeat'),213 backgroundSize: backgroundSize,214 bottom: unitOrKeywordWithGlobal('bottom'),215 borderCollapse: keyword('border-collapse'),216 borderStyle: keywordWithGlobal('*-style'),217 clear: keywordWithGlobal('clear'),218 cursor: keywordWithGlobal('cursor'),219 display: keywordWithGlobal('display'),220 float: keywordWithGlobal('float'),221 left: unitOrKeywordWithGlobal('left'),222 fontFamily: fontFamily,223 fontStretch: keywordWithGlobal('font-stretch'),224 fontStyle: keywordWithGlobal('font-style'),225 fontVariant: keywordWithGlobal('font-variant'),226 fontWeight: keywordWithGlobal('font-weight'),227 listStyleType: keywordWithGlobal('list-style-type'),228 listStylePosition: keywordWithGlobal('list-style-position'),229 outlineStyle: keywordWithGlobal('*-style'),230 overflow: keywordWithGlobal('overflow'),231 position: keywordWithGlobal('position'),232 right: unitOrKeywordWithGlobal('right'),233 textAlign: keywordWithGlobal('text-align'),234 textDecoration: keywordWithGlobal('text-decoration'),235 textOverflow: keywordWithGlobal('text-overflow'),236 textShadow: textShadow,237 top: unitOrKeywordWithGlobal('top'),238 transform: sameFunctionOrValue,239 verticalAlign: unitOrKeywordWithGlobal('vertical-align'),240 visibility: keywordWithGlobal('visibility'),241 whiteSpace: keywordWithGlobal('white-space'),242 zIndex: zIndex243 }...

Full Screen

Full Screen

tests.js

Source:tests.js Github

copy

Full Screen

1'use strict';2module.exports = [3 {4 description: 'scalars',5 tests: [6 {7 description: 'equal numbers',8 value1: 1,9 value2: 1,10 equal: true11 },12 {13 description: 'not equal numbers',14 value1: 1,15 value2: 2,16 equal: false17 },18 {19 description: 'number and array are not equal',20 value1: 1,21 value2: [],22 equal: false23 },24 {25 description: '0 and null are not equal',26 value1: 0,27 value2: null,28 equal: false29 },30 {31 description: 'equal strings',32 value1: 'a',33 value2: 'a',34 equal: true35 },36 {37 description: 'not equal strings',38 value1: 'a',39 value2: 'b',40 equal: false41 },42 {43 description: 'empty string and null are not equal',44 value1: '',45 value2: null,46 equal: false47 },48 {49 description: 'null is equal to null',50 value1: null,51 value2: null,52 equal: true53 },54 {55 description: 'equal booleans (true)',56 value1: true,57 value2: true,58 equal: true59 },60 {61 description: 'equal booleans (false)',62 value1: false,63 value2: false,64 equal: true65 },66 {67 description: 'not equal booleans',68 value1: true,69 value2: false,70 equal: false71 },72 {73 description: '1 and true are not equal',74 value1: 1,75 value2: true,76 equal: false77 },78 {79 description: '0 and false are not equal',80 value1: 0,81 value2: false,82 equal: false83 }84 ]85 },86 {87 description: 'objects',88 tests: [89 {90 description: 'empty objects are equal',91 value1: {},92 value2: {},93 equal: true94 },95 {96 description: 'equal objects (same properties "order")',97 value1: {a: 1, b: '2'},98 value2: {a: 1, b: '2'},99 equal: true100 },101 {102 description: 'equal objects (different properties "order")',103 value1: {a: 1, b: '2'},104 value2: {b: '2', a: 1},105 equal: true106 },107 {108 description: 'not equal objects (extra property)',109 value1: {a: 1, b: '2'},110 value2: {a: 1, b: '2', c: []},111 equal: false112 },113 {114 description: 'not equal objects (different properties)',115 value1: {a: 1, b: '2', c: 3},116 value2: {a: 1, b: '2', d: 3},117 equal: false118 },119 {120 description: 'not equal objects (different properties)',121 value1: {a: 1, b: '2', c: 3},122 value2: {a: 1, b: '2', d: 3},123 equal: false124 },125 {126 description: 'equal objects (same sub-properties)',127 value1: { a: [ { b: 'c' } ] },128 value2: { a: [ { b: 'c' } ] },129 equal: true130 },131 {132 description: 'not equal objects (different sub-property value)',133 value1: { a: [ { b: 'c' } ] },134 value2: { a: [ { b: 'd' } ] },135 equal: false136 },137 {138 description: 'not equal objects (different sub-property)',139 value1: { a: [ { b: 'c' } ] },140 value2: { a: [ { c: 'c' } ] },141 equal: false142 },143 {144 description: 'empty array and empty object are not equal',145 value1: {},146 value2: [],147 equal: false148 },149 {150 description: 'object with extra undefined properties are not equal #1',151 value1: {},152 value2: {foo: undefined},153 equal: false154 },155 {156 description: 'object with extra undefined properties are not equal #2',157 value1: {foo: undefined},158 value2: {},159 equal: false160 },161 {162 description: 'object with extra undefined properties are not equal #3',163 value1: {foo: undefined},164 value2: {bar: undefined},165 equal: false166 }167 ]168 },169 {170 description: 'arrays',171 tests: [172 {173 description: 'two empty arrays are equal',174 value1: [],175 value2: [],176 equal: true177 },178 {179 description: 'equal arrays',180 value1: [1, 2, 3],181 value2: [1, 2, 3],182 equal: true183 },184 {185 description: 'not equal arrays (different item)',186 value1: [1, 2, 3],187 value2: [1, 2, 4],188 equal: false189 },190 {191 description: 'not equal arrays (different length)',192 value1: [1, 2, 3],193 value2: [1, 2],194 equal: false195 },196 {197 description: 'equal arrays of objects',198 value1: [{a: 'a'}, {b: 'b'}],199 value2: [{a: 'a'}, {b: 'b'}],200 equal: true201 },202 {203 description: 'not equal arrays of objects',204 value1: [{a: 'a'}, {b: 'b'}],205 value2: [{a: 'a'}, {b: 'c'}],206 equal: false207 },208 {209 description: 'pseudo array and equivalent array are not equal',210 value1: {'0': 0, '1': 1, length: 2},211 value2: [0, 1],212 equal: false213 }214 ]215 },216 {217 description: 'Date objects',218 tests: [219 {220 description: 'equal date objects',221 value1: new Date('2017-06-16T21:36:48.362Z'),222 value2: new Date('2017-06-16T21:36:48.362Z'),223 equal: true224 },225 {226 description: 'not equal date objects',227 value1: new Date('2017-06-16T21:36:48.362Z'),228 value2: new Date('2017-01-01T00:00:00.000Z'),229 equal: false230 },231 {232 description: 'date and string are not equal',233 value1: new Date('2017-06-16T21:36:48.362Z'),234 value2: '2017-06-16T21:36:48.362Z',235 equal: false236 },237 {238 description: 'date and object are not equal',239 value1: new Date('2017-06-16T21:36:48.362Z'),240 value2: {},241 equal: false242 }243 ]244 },245 {246 description: 'RegExp objects',247 tests: [248 {249 description: 'equal RegExp objects',250 value1: /foo/,251 value2: /foo/,252 equal: true253 },254 {255 description: 'not equal RegExp objects (different pattern)',256 value1: /foo/,257 value2: /bar/,258 equal: false259 },260 {261 description: 'not equal RegExp objects (different flags)',262 value1: /foo/,263 value2: /foo/i,264 equal: false265 },266 {267 description: 'RegExp and string are not equal',268 value1: /foo/,269 value2: 'foo',270 equal: false271 },272 {273 description: 'RegExp and object are not equal',274 value1: /foo/,275 value2: {},276 equal: false277 }278 ]279 },280 {281 description: 'sample objects',282 tests: [283 {284 description: 'big object',285 value1: {286 prop1: 'value1',287 prop2: 'value2',288 prop3: 'value3',289 prop4: {290 subProp1: 'sub value1',291 subProp2: {292 subSubProp1: 'sub sub value1',293 subSubProp2: [1, 2, {prop2: 1, prop: 2}, 4, 5]294 }295 },296 prop5: 1000,297 prop6: new Date(2016, 2, 10)298 },299 value2: {300 prop5: 1000,301 prop3: 'value3',302 prop1: 'value1',303 prop2: 'value2',304 prop6: new Date('2016/03/10'),305 prop4: {306 subProp2: {307 subSubProp1: 'sub sub value1',308 subSubProp2: [1, 2, {prop2: 1, prop: 2}, 4, 5]309 },310 subProp1: 'sub value1'311 }312 },313 equal: true314 }315 ]316 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.value1();2wpt.value2();3wpt.value3();4wpt.value4();5wpt.value5();6wpt.value6();7wpt.value7();8wpt.value8();9wpt.value9();10wpt.value10();11wpt.value11();12wpt.value12();13wpt.value13();14wpt.value14();15wpt.value15();16wpt.value16();17wpt.value17();18wpt.value18();19wpt.value19();20wpt.value20();21wpt.value21();22wpt.value22();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.value1();3var wpt = require('wpt');4wpt.value1();5var wpt = require('wpt');6wpt.value1();7var wpt = require('wpt');8wpt.value1();9var wpt = require('wpt');10wpt.value1();11var wpt = require('wpt');12wpt.value1();13var wpt = require('wpt');14wpt.value1();15var wpt = require('wpt');16wpt.value1();17var wpt = require('wpt');18wpt.value1();19var wpt = require('wpt');20wpt.value1();21var wpt = require('wpt');22wpt.value1();23var wpt = require('wpt');24wpt.value1();25var wpt = require('wpt');26wpt.value1();27var wpt = require('wpt');28wpt.value1();29var wpt = require('wpt');30wpt.value1();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.value1();3var wpt = require('wpt');4wpt.value2();5var wpt = require('wpt');6wpt.value3();7var wpt = require('wpt');8wpt.value4();9var wpt = require('wpt');10wpt.value5();11var wpt = require('wpt');12wpt.value6();13var wpt = require('wpt');14wpt.value7();15var wpt = require('wpt');16wpt.value8();17var wpt = require('wpt');18wpt.value9();19var wpt = require('wpt');20wpt.value10();21var wpt = require('wpt');22wpt.value11();23var wpt = require('wpt');24wpt.value12();25var wpt = require('wpt');26wpt.value13();27var wpt = require('wpt');28wpt.value14();29var wpt = require('wpt');30wpt.value15();31var wpt = require('wpt');32wpt.value16();

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.value1();2wpt.value2();3wpt.value3();4wpt.value1();5wpt.value2();6wpt.value3();7wpt.value1();8wpt.value2();9wpt.value3();10wpt.value1();11wpt.value2();12wpt.value3();13var wpt = {14 value1: function() {15 },16 value2: function() {17 },18 value3: function() {19 }20}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var value1 = wpt.value1();3console.log(value1);4var value1 = function() {5 return 'value1';6}7module.exports = {8}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org', 'A.a1b2c3d4e5f6g7h8i9j0');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10var wpt = new WebPageTest('www.webpagetest.org', 'A.a1b2c3d4e5f6g7h8i9j0');11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});

Full Screen

Using AI Code Generation

copy

Full Screen

1wpt.value1 = 10;2var x = wpt.value1;3console.log(x);4wpt.value2 = "Hello";5var y = wpt.value2;6console.log(y);7wpt.value3 = true;8var z = wpt.value3;9console.log(z);10wpt.value4 = [1,2,3];11var a = wpt.value4;12console.log(a);13wpt.value5 = {name:"John", age:30};14var b = wpt.value5;15console.log(b);16wpt.value6 = function (a, b) {return a * b};17var c = wpt.value6(3, 4);18console.log(c);19wpt.value7 = new Date();20var d = wpt.value7;21console.log(d);22wpt.value8 = /w3schools/i;23var e = wpt.value8;24console.log(e);25wpt.value9 = function myFunction() {console.log("Hello World")};26var f = wpt.value9();27console.log(f);28wpt.value10 = ["John", "Peter", "Sally", "Jane"];29var g = wpt.value10;30console.log(g);31wpt.value11 = ["John", 23];32var h = wpt.value11;33console.log(h);34wpt.value12 = ["John", 23];35var i = wpt.value12;36console.log(i);37wpt.value13 = ["John", 23];38var j = wpt.value13;39console.log(j);40wpt.value14 = ["John", 23];41var k = wpt.value14;42console.log(k);

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt 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