How to use copyMap method in Jest

Best JavaScript code snippet using jest

DefaultLib.js

Source:DefaultLib.js Github

copy

Full Screen

...204 // Hard copy current to hardcode+url-state205 // console.log("Summaries start:",JSON.stringify(setup.fragments),206 // JSON.stringify(state.Database.fragments));207 // Copy setup if available208 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStatePath);209 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateData);210 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateTrash);211 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateOther);212 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateHome);213 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateVisible);214// state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateCustom);215 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateThr);216 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateColors);217 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateTooltip);218 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateTooltips);219 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateFocus);220 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateFilm);221 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateURL);222 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateOrder);223 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateLooks);224 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.setup, this.toStateSvg);225 };226 // finally execute next callback227 state.File.next(state,"",callbacks);228 }229 }.bind(this);230 // initial state before url is loaded231 this.storeInitState=function(state, response, callbacks) { // executed before URL is loaded...232 if (this.debug) {console.log("Storing init state.");};233 if (state.Utils.isEmpty(state.Default.config.init)) {234 state.Default.config.init={};235 //console.log("Initing:",JSON.stringify(state.Default.config.init));236 // soft copy hardcode-state to init (fillStateDefaults2)237 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.statePath);238 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateData);239 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateTrash);240 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateOther);241 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateHome);242 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateVisible);243// state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateCustom);244 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateThr);245 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateColors);246 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateTooltip);247 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateTooltips);248 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateFocus);249 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateFilm);250 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateURL);251 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateOrder);252 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateLooks);253 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.init, this.stateSvg);254 //console.log("Done:",JSON.stringify(state.Default.config.init.visible));255 //console.log("State:",JSON.stringify(state.Settings.visible));256 //state.Default.save(state);257 };258 //console.log(">>>>>>>>>>>State:",JSON.stringify(state.Layout.state));259 //console.log(">>>>>>>>>>>Init:",JSON.stringify(state.Default.config.init.Layout.state));260 state.File.next(state,"",callbacks);261 }.bind(this);262 // load url parameters263 this.loadUrl=function(state, response, callbacks) {264 if (this.debug) {console.log("Processing URL.");};265 var url=state.Utils.getUrlVars();266 //console.log("Url:",JSON.stringify(url));267 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.statePath);268 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateData);269 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateTrash);270 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateOther);271 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateHome);272 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateVisible);273 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateThr);274 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateColors);275 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateTooltips);276 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateFocus);277 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateOrder);278 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateLooks);279 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateFilm);280 state.Utils.copyMap(state,state.Utils.type.fill,url,state.Default.config.url,this.stateURL);281 state.File.next(state,"",callbacks);282 }.bind(this);283 this.useUrl=function(state,par) {284 if (state.Default.url[par]===undefined || state.Default.url[par]) {285 return true;286 } else {287 return false;288 };289 };290 this.pushUrl=function(state) {291 var url={};292 if (this.useUrl(state,"Path")) {293 state.Utils.pushChanged(state,url,this.statePath);294 };295 if (this.useUrl(state,"Data")) {296 //console.log("Url:",JSON.stringify(url));297 // ,state.Utils.type.splice298 state.Utils.pushChanged(state,url,this.stateData);299 };300 if (this.useUrl(state,"Trash")) {301 state.Utils.pushChanged(state,url,this.stateTrash);302 };303 if (this.useUrl(state,"Other")) {304 state.Utils.pushChanged(state,url,this.stateOther);305 };306 if (this.useUrl(state,"Home")) {307 state.Utils.pushChanged(state,url,this.stateHome);308 };309 if (this.useUrl(state,"Visible")) {310 state.Utils.pushChanged(state,url,this.stateVisible);311 };312 if (this.useUrl(state,"Thresholds")) {313 //console.log("Url:",JSON.stringify(url));314 // ,state.Utils.type.splice315 state.Utils.pushChanged(state,url,this.stateThr);316 };317 if (this.useUrl(state,"Colors")) {318 state.Utils.pushChanged(state,url,this.stateColors);319 };320 if (this.useUrl(state,"Tooltips")) {321 state.Utils.pushChanged(state,url,this.stateTooltips);322 };323 if (this.useUrl(state,"Focus")) {324 state.Utils.pushChanged(state,url,this.stateFocus);325 };326 if (this.useUrl(state,"Order")) {327 state.Utils.pushChanged(state,url,this.stateOrder);328 };329 if (this.useUrl(state,"Looks")) {330 state.Utils.pushChanged(state,url,this.stateLooks);331 };332 if (this.useUrl(state,"Film")) {333 state.Utils.pushChanged(state,url,this.stateFilm);334 };335 if (this.useUrl(state,"Url")) {336 state.Utils.pushChanged(state,url,this.stateURL);337 };338 return url;339 }.bind(this);340 this.pushQRUrl=function(state) {341 var url={};342 if (this.useUrl(state,"Path")) {343 state.Utils.pushChanged(state,url,this.statePath);344 //console.log("Url:",JSON.stringify(url));345 };346 if (this.useUrl(state,"Data")) {347 state.Utils.pushChanged(state,url,this.stateData);348 };349 if (this.useUrl(state,"Trash")) {350 state.Utils.pushChanged(state,url,this.stateTrash);351 };352 if (this.useUrl(state,"Other")) {353 state.Utils.pushChanged(state,url,this.stateOther);354 };355 if (this.useUrl(state,"Home")) {356 state.Utils.pushChanged(state,url,this.stateHome);357 };358 if (this.useUrl(state,"Visible")) {359 state.Utils.pushChanged(state,url,this.stateVisible);360 };361 if (this.useUrl(state,"Thresholds")) {362 //console.log("Url:",JSON.stringify(url));363 state.Utils.pushChanged(state,url,this.stateThr);364 };365 if (this.useUrl(state,"Colors")) {366 state.Utils.pushChanged(state,url,this.stateColors);367 };368 if (this.useUrl(state,"Tooltips")) {369 state.Utils.pushChanged(state,url,this.stateTooltips);370 };371 if (this.useUrl(state,"Focus")) {372 state.Utils.pushChanged(state,url,this.stateFocus);373 };374 if (this.useUrl(state,"Order")) {375 //state.Utils.pushChanged(state,url,this.stateOrder);376 };377 if (this.useUrl(state,"Looks")) {378 state.Utils.pushChanged(state,url,this.stateLooks);379 };380 if (this.useUrl(state,"Film")) {381 state.Utils.pushChanged(state,url,this.stateFilm);382 };383 if (this.useUrl(state,"Url")) {384 state.Utils.pushChanged(state,url,this.stateURL);385 };386 return url;387 }.bind(this);388 // combine available information389 this.mergeState=function(state, response, callbacks) {390 if (this.debug) {console.log("Merging state.");};391 var merge={};392 // fill merge with setup393 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.statePath);394 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateData);395 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateTrash);396 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateOther);397 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateHome);398 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateVisible);399// state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateCustom);400 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateThr);401 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateColors);402 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateTooltip);403 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateTooltips);404 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateFocus);405 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateFilm);406 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateURL);407 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateOrder);408 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateLooks);409 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.init, merge, this.stateSvg);410 //411 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.statePath);412 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateData);413 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateTrash);414 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateOther);415 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateHome);416 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateVisible);417// state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateCustom);418 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateThr);419 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateColors);420 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateTooltip);421 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateTooltips);422 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateFocus);423 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateFilm);424 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateURL);425 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateOrder);426 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateLooks);427 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.setup, merge, this.stateSvg);428 // fill merge with available url data429 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.statePath);430 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateData);431 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateTrash);432 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateOther);433 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateHome);434 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateVisible);435 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateThrs);436 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateColors);437 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateTooltips);438 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateFocus);439 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateOrder);440 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateLooks);441 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateFilm);442 state.Utils.copyMap(state, state.Utils.type.any, state.Default.config.url, merge, this.stateURL);443 //console.log("Summaries url:",JSON.stringify(state.Database.fragments));444 if (state.Default.config.start !== undefined) { // get previous values445 // copy previous state...446 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.statePath);447 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateData);448 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateTrash);449 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateOther);450 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateHome);451 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateVisible);452// state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateCustom);453 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateThr);454 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateColors);455 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateTooltip);456 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateTooltips);457 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateFocus);458 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateFilm);459 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateURL);460 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateOrder);461 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateLooks);462 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, merge, this.stateSvg);463 }464 // soft copy current to merge (state.Default.fillStateDefaults)465 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.statePath);466 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateData);467 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateOther);468 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateHome);469 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateVisible);470// state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateCustom);471 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateThr);472 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateColors);473 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateTooltips);474 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateOrder);475 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateLooks);476 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, merge, this.stateSvg);477 //console.log("SETUP: ",JSON.stringify(setup.visible));478 //console.log("CURRENT:",JSON.stringify(state.Default.config.current.Settings.visible));479 //console.log("STATE: ",JSON.stringify(state.Settings.visible));480 // fill merge with init481 // fill state with merge482 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.statePath);483 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateData);484 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateTrash);485 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateOther);486 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateHome);487 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateVisible);488// state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateCustom);489 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateThr);490 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateColors);491 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateTooltips);492 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateFocus);493 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateFilm);494 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateURL);495 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateOrder);496 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateLooks);497 state.Utils.copyMap(state, state.Utils.type.force, merge, state, this.stateSvg);498 state.File.next(state,"",callbacks);499 }.bind(this);500 // replace critical objects after URL has been loaded...501 this.checkState=function(state,response,callbacks) {502 if (this.debug) {console.log("Checking state.");};503 //console.log("Checkstate A:",JSON.stringify(state.Settings.visible));504 //console.log("Path Start",JSON.stringify(state.Path.keys),JSON.stringify(state.Path.select));505 //console.log("Filling blanks...",JSON.stringify(state.Default.config.start));506 // replace any critical objects removed by the url...507 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.start, state);508 //console.log("Filling blanks done...");509 //console.log("Path Done",JSON.stringify(state.Path.keys),JSON.stringify(state.Path.select));510 //console.log("Checkstate B:",JSON.stringify(state.Settings.visible));511 state.File.next(state,"",callbacks);512 }.bind(this);513 this.storeHomeState=function(state,response,callbacks) {514 if (this.debug) {console.log("Storing home state.");};515 if (state.Utils.isEmpty(state.Default.config.home)) {516 state.Default.config.home={};517 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.home, this.statePath);518 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.home, this.stateOther);519 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.home, this.stateTrash);520 //console.log("Home:",JSON.stringify(state.Default.config.home));521 };522 state.File.next(state,"",callbacks);523 }.bind(this);524 this.goHome=function(state) {525 //console.log("Home:",JSON.stringify(state.Default.config.home));526 if (state.Default.config.home !== undefined) {527 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.home, state, this.statePath);528 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.home, state, this.stateOther);529 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.home, state, this.stateTrash);530 };531 }.bind(this);532 // copy state as soon as first dataset is loaded...533 this.storeStartState=function(state) { // executed before URL is loaded...534 if (this.debug) {console.log("Storing start state.");};535 if (state.Utils.isEmpty(state.Default.config.start)) {536 state.Default.config.start={};537 //console.log("Starting:",JSON.stringify(state.Default.config.start));538 // soft copy hardcode-state to start (fillStateDefaults2)539 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.statePath);540 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateData);541 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateTrash);542 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateOther);543 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateHome);544 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateVisible);545// state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateCustom);546 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateThr);547 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateColors);548 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateTooltip);549 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateTooltips);550 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateFocus);551 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateFilm);552 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateURL);553 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateOrder);554 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateLooks);555 state.Utils.copyMap(state, state.Utils.type.force, state, state.Default.config.start, this.stateSvg);556 //console.log("Done:",JSON.stringify(state.Default.config.start.visible));557 //console.log("State:",JSON.stringify(state.Settings.visible));558 //state.Default.save(state);559 };560 //console.log(">>>>>>>>>>>State:",JSON.stringify(state.Layout.state));561 //console.log(">>>>>>>>>>>Start:",JSON.stringify(state.Default.config.start.Layout.state));562 }.bind(this);563 this.stageSetup=function(state,setup) {564 //console.log("Staging changes");565 state.Default.config.stage=setup;566 };567 this.commitSetup=function(state) {568 //console.log("Commiting changes");569 this.setSetup(state,state.Default.config.stage);570 }.bind(this);571 this.resetSetup=function(state,response,callbacks) {572 try {573 var setup = JSON.parse(response);574 } catch (e) {575 alert("Default '"+state.Default.setup+"' contains Invalid SETUP:"+e.name+":"+e.message);576 };577 this.setSetup(state,setup);578 }.bind(this);579 this.setSetup=function(state,setup) {580 if (setup !== undefined && state.Default.config.start !== undefined) {581 //console.log("Reset state:",JSON.stringify(state.Path));582 state.Default.config.current={};583 // soft copy setup to current (state.Default.fillToStateDefaults)584 state.Utils.copyMap( state, state.Utils.type.fill, setup, state.Default.config.current, this.toStatePath);585 state.Utils.copyMap( state, state.Utils.type.fill, setup, state.Default.config.current, this.toStateData);586 state.Utils.copyMap( state, state.Utils.type.fill, setup, state.Default.config.current, this.toStateTrash);587 state.Utils.copyMap( state, state.Utils.type.fill, setup, state.Default.config.current, this.toStateOther);588 // hard copy setup to current (state.Default.forceToStateDefaults)589 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateVisible);590// state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateCustom);591 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateThr);592 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateColors);593 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateTooltip);594 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateHome);595 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateFocus);596 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateFilm);597 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateURL);598 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateOrder);599 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateLooks);600 state.Utils.copyMap(state, state.Utils.type.force, setup, state.Default.config.current, this.toStateSvg);601 // soft copy start to current (state.Default.fillStateDefaults)602 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.statePath);603 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateData);604 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateTrash);605 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateOther);606 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateVisible);607// state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateCustom);608 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateThr);609 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateColors);610 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateTooltips);611 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateHome);612 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateFocus);613 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateFilm);614 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateURL);615 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateOrder);616 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateLooks);617 state.Utils.copyMap( state, state.Utils.type.fill, state.Default.config.start,state.Default.config.current,this.stateSvg);618 // soft copy current to state (focus)619 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, state, this.stateFocus);620 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, state, this.stateFilm);621 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, state, this.stateURL);622 // hard copy current to state (state.Default.fillStateDefaults)623 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.statePath);624 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateData);625 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateTrash);626 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateOther);627 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateHome);628 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateVisible);629 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateThr);630 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateColors);631 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateTooltips);632 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateFocus);633 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateLooks);634// state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateCustom);635 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateFilm);636 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateURL);637 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateOrder);638 state.Utils.copyMap(state, state.Utils.type.force, state.Default.config.current, state, this.stateSvg);639 //console.log("SETUP:",JSON.stringify(setup.visible));640 //console.log("Default:",JSON.stringify(state.Default.Settings.visible));641 state.Database.dbReset(state);642 //console.log("Reset State:",JSON.stringify(state.Settings.visible));643 state.Html.broadcast(state,"New setup is ready.");644 };645 }.bind(this);646 this.getSetup=function(state) {647 // get updated information648 var setup={};649 var current={};650 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.statePath);651 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateData);652 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateOther);653 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateTrash);654 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateVisible);655// state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateCustom);656 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateThr);657 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateColors);658 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateTooltips);659 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateHome);660 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateOrder);661 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateLooks);662 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.current, current, this.stateSvg);663 //664 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.statePath);665 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateData);666 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateTrash);667 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateOther);668 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateHome);669 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateVisible);670// state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateCustom);671 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateThr);672 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateColors);673 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateTooltip);674 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateTooltips);675 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateFocus);676 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateFilm);677 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateURL);678 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateOrder);679 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateLooks);680 state.Utils.copyMap(state, state.Utils.type.fill, state.Default.config.setup, current, this.stateSvg);681 //console.log("Current:",JSON.stringify(state.Default.config.current));682 // soft copy current to local (state.Default.fillStateDefaults)683 // hard copy state to local (state.Default.forceToStateTrash)684 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateThr);685 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateTrash);686 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateHome);687 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateFilm);688 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateURL);689 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateThr);690 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateColors);691 state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateData);692// state.Utils.copyMap(state, state.Utils.type.force, state, current, this.stateCustom);693 //console.log("Current:",JSON.stringify(current));694 //console.log("keys:",JSON.stringify(state.Path.keys));695 //console.log("trash:",JSON.stringify(state.Path.trash));696 // hard copy local to setup (state.Default.forceToStateDefaults)697 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateThr);698 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateColors);699 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateTooltip);700 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateVisible);701// state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateCustom);702 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateHome);703 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateFocus);704 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateFilm);705 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateURL);706 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateOrder);707 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateLooks);708 state.Utils.copyMap(state, state.Utils.type.force, current, setup, this.fromStateSvg);709 // soft copy local to setup (state.Default.fillToStateDefaults)710 state.Utils.copyMap(state, state.Utils.type.fill, current, setup, this.fromStateData);711 state.Utils.copyMap(state, state.Utils.type.fill, current, setup, this.fromStateOther);712 state.Utils.copyMap(state, state.Utils.type.fill, current, setup, this.fromStateTrash);713 state.Utils.copyMap(state, state.Utils.type.fill, current, setup, this.fromStateVisible);714// state.Utils.copyMap(state, state.Utils.type.fill, current, setup, this.fromStateCustom);715 //if (state.Default.config.current.Settings!==undefined) {console.log("Current:",JSON.stringify(state.Default.config.current.Settings.visible));}716 //if (current.Settings!==undefined) {console.log("Setup: ",JSON.stringify(current.Settings.visible));};717 //JSON.stringify(setup, null, " ");718 return setup;719 }.bind(this);720 this.saveSetup=function(state) {721 var setup=state.Utils.prettyJson(state.Default.getSetup(state));722 //console.log("Setup:",setup);723 //console.log("Select:",JSON.stringify(state.Default.config.current));724 var file=state.Default.setup||"setup.json";725 state.Utils.save(setup,file,"json");726 state.Html.broadcast(state,"Setup was downloaded.");727 };728 this.hasChanged=function(state,pth) {...

Full Screen

Full Screen

CubeData.js

Source:CubeData.js Github

copy

Full Screen

...34 PERCENTINVINCIBILITY: "percentinvincibility",35 IGNOREDAMAGE: "ignoredamage",36 FILLER: "filler"37}38function copyMap(lineOptions) {39 let newMap = new Map()40 lineOptions.forEach(line => {41 newMap.set(line.line, new Line(line.line, line.value, line.weight))42 })43 return newMap44}45let emblemMpotLegTier4 = new Map()46let emblemMpotLegTier3 = new Map()47let emblemMpotUniTier4 = new Map()48let emblemMpotUniTier3 = new Map()49let emblemBpotLegTier4 = new Map()50let emblemBpotLegTier3 = new Map()51let emblemBpotUniTier4 = new Map()52let emblemBpotUniTier3 = new Map()53emblemMpotLegTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 13, 4))54emblemMpotLegTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 13, 4))55emblemMpotLegTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 13, 4))56emblemMpotLegTier4.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 13, 2))57emblemMpotLegTier4.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 13, 2))58emblemMpotLegTier4.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 13, 2))59emblemMpotLegTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 10, 3))60emblemMpotLegTier4.set(Lines.ATTACKPER10, new Line(Lines.ATTACKPER10, 1, 2))61emblemMpotLegTier4.set(Lines.NONPRIMEIGNOREDEFENSE, new Line(Lines.NONPRIMEIGNOREDEFENSE, 35, 2))62emblemMpotLegTier4.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 40, 2))63emblemMpotLegTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))64emblemMpotLegTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 12, 4))65emblemMpotLegTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 12, 4))66emblemMpotLegTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 12, 4))67emblemMpotLegTier3.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 12, 2))68emblemMpotLegTier3.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 12, 2))69emblemMpotLegTier3.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 12, 2))70emblemMpotLegTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 9, 3))71emblemMpotLegTier3.set(Lines.ATTACKPER10, new Line(Lines.ATTACKPER10, 1, 2))72emblemMpotLegTier3.set(Lines.NONPRIMEIGNOREDEFENSE, new Line(Lines.NONPRIMEIGNOREDEFENSE, 35, 2))73emblemMpotLegTier3.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 40, 2))74emblemMpotLegTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))75emblemMpotUniTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 10, 5))76emblemMpotUniTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 10, 5))77emblemMpotUniTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 10, 5))78emblemMpotUniTier4.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 10, 3))79emblemMpotUniTier4.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 10, 4))80emblemMpotUniTier4.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 10, 3))81emblemMpotUniTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 7, 4))82emblemMpotUniTier4.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 30, 3))83emblemMpotUniTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))84emblemMpotUniTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 9, 5))85emblemMpotUniTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 9, 5))86emblemMpotUniTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 9, 5))87emblemMpotUniTier3.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 9, 3))88emblemMpotUniTier3.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 9, 4))89emblemMpotUniTier3.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 9, 3))90emblemMpotUniTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 6, 4))91emblemMpotUniTier3.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 30, 3))92emblemMpotUniTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))93emblemBpotLegTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 13, 3))94emblemBpotLegTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 13, 3))95emblemBpotLegTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 13, 3))96emblemBpotLegTier4.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 13, 2))97emblemBpotLegTier4.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 13, 2))98emblemBpotLegTier4.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 13, 1))99emblemBpotLegTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 10, 2))100emblemBpotLegTier4.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 2, 2))101emblemBpotLegTier4.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 2, 2))102emblemBpotLegTier4.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 2, 2))103emblemBpotLegTier4.set(Lines.ATTACKPER10, new Line(Lines.ATTACKPER10, 1, 1))104emblemBpotLegTier4.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 5, 1))105emblemBpotLegTier4.set(Lines.HP, new Line(Lines.HP, 10, 3))106emblemBpotLegTier4.set(Lines.MP, new Line(Lines.MP, 10, 3))107emblemBpotLegTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 9))108emblemBpotLegTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 12, 3))109emblemBpotLegTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 12, 3))110emblemBpotLegTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 12, 3))111emblemBpotLegTier3.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 12, 2))112emblemBpotLegTier3.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 12, 2))113emblemBpotLegTier3.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 12, 1))114emblemBpotLegTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 9, 2))115emblemBpotLegTier3.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 2, 2))116emblemBpotLegTier3.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 2, 2))117emblemBpotLegTier3.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 2, 2))118emblemBpotLegTier3.set(Lines.ATTACKPER10, new Line(Lines.ATTACKPER10, 1, 1))119emblemBpotLegTier3.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 5, 1))120emblemBpotLegTier3.set(Lines.HP, new Line(Lines.HP, 10, 3))121emblemBpotLegTier3.set(Lines.MP, new Line(Lines.MP, 10, 3))122emblemBpotLegTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 9))123emblemBpotUniTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 10, 3))124emblemBpotUniTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 10, 3))125emblemBpotUniTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 10, 3))126emblemBpotUniTier4.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 10, 2))127emblemBpotUniTier4.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 10, 2))128emblemBpotUniTier4.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 10, 1))129emblemBpotUniTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 1, 2))130emblemBpotUniTier4.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 2))131emblemBpotUniTier4.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 2))132emblemBpotUniTier4.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 2))133emblemBpotUniTier4.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 4, 1))134emblemBpotUniTier4.set(Lines.HP, new Line(Lines.HP, 7, 3))135emblemBpotUniTier4.set(Lines.MP, new Line(Lines.MP, 7, 3))136emblemBpotUniTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 13))137emblemBpotUniTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 9, 3))138emblemBpotUniTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 9, 3))139emblemBpotUniTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 9, 3))140emblemBpotUniTier3.set(Lines.ATTACKPERCENT, new Line(Lines.ATTACKPERCENT, 9, 2))141emblemBpotUniTier3.set(Lines.CRITRATE, new Line(Lines.CRITRATE, 9, 2))142emblemBpotUniTier3.set(Lines.DAMAGE, new Line(Lines.DAMAGE, 9, 1))143emblemBpotUniTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 1, 2))144emblemBpotUniTier3.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 2))145emblemBpotUniTier3.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 2))146emblemBpotUniTier3.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 2))147emblemBpotUniTier3.set(Lines.PRIMEIGNOREDEFENSE, new Line(Lines.PRIMEIGNOREDEFENSE, 4, 1))148emblemBpotUniTier3.set(Lines.HP, new Line(Lines.HP, 7, 3))149emblemBpotUniTier3.set(Lines.MP, new Line(Lines.MP, 7, 3))150emblemBpotUniTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 13))151let weaponMpotLegTier4 = copyMap(emblemMpotLegTier4)152let weaponMpotLegTier3 = copyMap(emblemMpotLegTier3)153let weaponMpotUniTier4 = copyMap(emblemMpotUniTier4)154let weaponMpotUniTier3 = copyMap(emblemMpotUniTier3)155let weaponBpotLegTier4 = copyMap(emblemBpotLegTier4)156let weaponBpotLegTier3 = copyMap(emblemBpotLegTier3)157let weaponBpotUniTier4 = copyMap(emblemBpotUniTier4)158let weaponBpotUniTier3 = copyMap(emblemBpotUniTier3)159weaponMpotLegTier4.set(Lines.NONPRIMEBOSSDAMAGE, new Line(Lines.NONPRIMEBOSSDAMAGE, 30, 2))160weaponMpotLegTier4.set(Lines.HALFPRIMEBOSSDAMAGE, new Line(Lines.HALFPRIMEBOSSDAMAGE, 35, 2))161weaponMpotLegTier4.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 40, 2))162weaponMpotLegTier3.set(Lines.NONPRIMEBOSSDAMAGE, new Line(Lines.NONPRIMEBOSSDAMAGE, 30, 2))163weaponMpotLegTier3.set(Lines.HALFPRIMEBOSSDAMAGE, new Line(Lines.HALFPRIMEBOSSDAMAGE, 35, 2))164weaponMpotLegTier3.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 40, 2))165weaponMpotUniTier4.set(Lines.NONPRIMEBOSSDAMAGE, new Line(Lines.NONPRIMEBOSSDAMAGE, 20, 3))166weaponMpotUniTier4.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 30, 2))167weaponMpotUniTier3.set(Lines.NONPRIMEBOSSDAMAGE, new Line(Lines.NONPRIMEBOSSDAMAGE, 20, 3))168weaponMpotUniTier3.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 30, 2))169weaponBpotLegTier4.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 18, 1))170weaponBpotLegTier3.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 18, 1))171weaponBpotUniTier4.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 12, 1))172weaponBpotUniTier3.set(Lines.PRIMEBOSSDAMAGE, new Line(Lines.PRIMEBOSSDAMAGE, 12, 1))173let secondaryMpotLegTier4 = copyMap(weaponMpotLegTier4)174let secondaryMpotLegTier3 = copyMap(weaponMpotLegTier3)175let secondaryMpotUniTier4 = copyMap(weaponMpotUniTier4)176let secondaryMpotUniTier3 = copyMap(weaponMpotUniTier3)177let secondaryBpotLegTier4 = copyMap(weaponBpotLegTier4)178let secondaryBpotLegTier3 = copyMap(weaponBpotLegTier3)179let secondaryBpotUniTier4 = copyMap(weaponBpotUniTier4)180let secondaryBpotUniTier3 = copyMap(weaponBpotUniTier3)181secondaryMpotLegTier4.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 6))182secondaryMpotLegTier3.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 6))183secondaryMpotUniTier4.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 8))184secondaryMpotUniTier3.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 8))185secondaryBpotLegTier4.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 1, 2))186secondaryBpotLegTier3.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 1, 2))187let armorMpotLegTier4 = new Map()188let armorMpotLegTier3 = new Map()189let armorMpotUniTier4 = new Map()190let armorMpotUniTier3 = new Map()191let armorBpotLegTier4 = new Map()192let armorBpotLegTier3 = new Map()193let armorBpotUniTier4 = new Map()194let armorBpotUniTier3 = new Map()195armorMpotLegTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 13, 4))196armorMpotLegTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 13, 4))197armorMpotLegTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 13, 4))198armorMpotLegTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 10, 3))199armorMpotLegTier4.set(Lines.HP, new Line(Lines.HP, 12, 4))200armorMpotLegTier4.set(Lines.MP, new Line(Lines.MP, 12, 4))201armorMpotLegTier4.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 6))202armorMpotLegTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))203armorMpotLegTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 12, 4))204armorMpotLegTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 12, 4))205armorMpotLegTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 12, 4))206armorMpotLegTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 9, 3))207armorMpotLegTier3.set(Lines.HP, new Line(Lines.HP, 12, 4))208armorMpotLegTier3.set(Lines.MP, new Line(Lines.MP, 12, 4))209armorMpotLegTier3.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 6))210armorMpotLegTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 8))211armorMpotUniTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 10, 5))212armorMpotUniTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 10, 5))213armorMpotUniTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 10, 5))214armorMpotUniTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 7, 4))215armorMpotUniTier4.set(Lines.HP, new Line(Lines.HP, 9, 6))216armorMpotUniTier4.set(Lines.MP, new Line(Lines.MP, 9, 6))217armorMpotUniTier4.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 8))218armorMpotUniTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 13))219armorMpotUniTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 9, 5))220armorMpotUniTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 9, 5))221armorMpotUniTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 9, 5))222armorMpotUniTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 6, 4))223armorMpotUniTier3.set(Lines.HP, new Line(Lines.HP, 9, 6))224armorMpotUniTier3.set(Lines.MP, new Line(Lines.MP, 9, 6))225armorMpotUniTier3.set(Lines.IGNOREDAMAGE, new Line(Lines.IGNOREDAMAGE, 0, 8))226armorMpotUniTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 13))227armorBpotLegTier4.set(Lines.PRIMARYSTAT, new Line(Lines.PRIMARYSTAT, 19, 3))228armorBpotLegTier4.set(Lines.SECONDARYSTAT, new Line(Lines.SECONDARYSTAT, 19, 3))229armorBpotLegTier4.set(Lines.TERTIARYSTAT, new Line(Lines.TERTIARYSTAT, 19, 3))230armorBpotLegTier4.set(Lines.ATTACK, new Line(Lines.ATTACK, 15, 2))231armorBpotLegTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 8, 2))232armorBpotLegTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 8, 2))233armorBpotLegTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 8, 2))234armorBpotLegTier4.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 1, 2))235armorBpotLegTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 6, 2))236armorBpotLegTier4.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 2, 2))237armorBpotLegTier4.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 2, 2))238armorBpotLegTier4.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 2, 2))239armorBpotLegTier4.set(Lines.HP, new Line(Lines.HP, 10, 3))240armorBpotLegTier4.set(Lines.MP, new Line(Lines.MP, 10, 3))241armorBpotLegTier4.set(Lines.MESOS, new Line(Lines.MESOS, 5, 3))242armorBpotLegTier4.set(Lines.DROP, new Line(Lines.DROP, 5, 3))243armorBpotLegTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 25))244armorBpotLegTier3.set(Lines.PRIMARYSTAT, new Line(Lines.PRIMARYSTAT, 18, 3))245armorBpotLegTier3.set(Lines.SECONDARYSTAT, new Line(Lines.SECONDARYSTAT, 18, 3))246armorBpotLegTier3.set(Lines.TERTIARYSTAT, new Line(Lines.TERTIARYSTAT, 18, 3))247armorBpotLegTier3.set(Lines.ATTACK, new Line(Lines.ATTACK, 14, 2))248armorBpotLegTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 7, 2))249armorBpotLegTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 7, 2))250armorBpotLegTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 7, 2))251armorBpotLegTier3.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 1, 2))252armorBpotLegTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 5, 2))253armorBpotLegTier3.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 2, 2))254armorBpotLegTier3.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 2, 2))255armorBpotLegTier3.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 2, 2))256armorBpotLegTier3.set(Lines.HP, new Line(Lines.HP, 10, 3))257armorBpotLegTier3.set(Lines.MP, new Line(Lines.MP, 10, 3))258armorBpotLegTier3.set(Lines.MESOS, new Line(Lines.MESOS, 5, 3))259armorBpotLegTier3.set(Lines.DROP, new Line(Lines.DROP, 5, 3))260armorBpotLegTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 25))261armorBpotUniTier4.set(Lines.PRIMARYSTAT, new Line(Lines.PRIMARYSTAT, 17, 3))262armorBpotUniTier4.set(Lines.SECONDARYSTAT, new Line(Lines.SECONDARYSTAT, 17, 3))263armorBpotUniTier4.set(Lines.TERTIARYSTAT, new Line(Lines.TERTIARYSTAT, 17, 3))264armorBpotUniTier4.set(Lines.ATTACK, new Line(Lines.ATTACK, 13, 2))265armorBpotUniTier4.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 6, 2))266armorBpotUniTier4.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 6, 2))267armorBpotUniTier4.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 6, 2))268armorBpotUniTier4.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 5, 2))269armorBpotUniTier4.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 2))270armorBpotUniTier4.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 2))271armorBpotUniTier4.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 2))272armorBpotUniTier4.set(Lines.HP, new Line(Lines.HP, 7, 3))273armorBpotUniTier4.set(Lines.MP, new Line(Lines.MP, 7, 3))274armorBpotUniTier4.set(Lines.FILLER, new Line(Lines.FILLER, 0, 25))275armorBpotUniTier3.set(Lines.PRIMARYSTAT, new Line(Lines.PRIMARYSTAT, 16, 3))276armorBpotUniTier3.set(Lines.SECONDARYSTAT, new Line(Lines.SECONDARYSTAT, 16, 3))277armorBpotUniTier3.set(Lines.TERTIARYSTAT, new Line(Lines.TERTIARYSTAT, 16, 3))278armorBpotUniTier3.set(Lines.ATTACK, new Line(Lines.ATTACK, 12, 2))279armorBpotUniTier3.set(Lines.PRIMARYSTATPERCENT, new Line(Lines.PRIMARYSTATPERCENT, 5, 2))280armorBpotUniTier3.set(Lines.SECONDARYSTATPERCENT, new Line(Lines.SECONDARYSTATPERCENT, 5, 2))281armorBpotUniTier3.set(Lines.TERTIARYSTATPERCENT, new Line(Lines.TERTIARYSTATPERCENT, 5, 2))282armorBpotUniTier3.set(Lines.ALLSTATPERCENT, new Line(Lines.ALLSTATPERCENT, 4, 2))283armorBpotUniTier3.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 2))284armorBpotUniTier3.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 2))285armorBpotUniTier3.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 2))286armorBpotUniTier3.set(Lines.HP, new Line(Lines.HP, 7, 3))287armorBpotUniTier3.set(Lines.MP, new Line(Lines.MP, 7, 3))288armorBpotUniTier3.set(Lines.FILLER, new Line(Lines.FILLER, 0, 25))289let hatMpotLegTier4 = copyMap(armorMpotLegTier4)290let hatMpotLegTier3 = copyMap(armorMpotLegTier3)291let hatMpotUniTier4 = copyMap(armorMpotUniTier4)292let hatMpotUniTier3 = copyMap(armorMpotUniTier3)293let hatBpotLegTier4 = copyMap(armorBpotLegTier4)294let hatBpotLegTier3 = copyMap(armorBpotLegTier3)295let hatBpotUniTier4 = copyMap(armorBpotUniTier4)296let hatBpotUniTier3 = copyMap(armorBpotUniTier3)297hatMpotLegTier4.set(Lines.NONPRIMECOOLDOWNREDUCTION, new Line(Lines.NONPRIMECOOLDOWNREDUCTION, 1, 3))298hatMpotLegTier4.set(Lines.PRIMECOOLDOWNREDUCTION, new Line(Lines.PRIMECOOLDOWNREDUCTION, 2, 2))299hatMpotLegTier4.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 5))300hatMpotLegTier4.get(Lines.FILLER).weight = 11301hatMpotLegTier3.set(Lines.NONPRIMECOOLDOWNREDUCTION, new Line(Lines.NONPRIMECOOLDOWNREDUCTION, 1, 3))302hatMpotLegTier3.set(Lines.PRIMECOOLDOWNREDUCTION, new Line(Lines.PRIMECOOLDOWNREDUCTION, 2, 2))303hatMpotLegTier3.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 5))304hatMpotLegTier3.get(Lines.FILLER).weight = 11305hatMpotUniTier4.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 6))306hatMpotUniTier4.get(Lines.FILLER).weight = 17307hatMpotUniTier3.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 6))308hatMpotUniTier3.get(Lines.FILLER).weight = 17309hatBpotLegTier4.set(Lines.PRIMECOOLDOWNREDUCTION, new Line(Lines.PRIMECOOLDOWNREDUCTION, 1, 3))310hatBpotLegTier4.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 1))311hatBpotLegTier3.set(Lines.PRIMECOOLDOWNREDUCTION, new Line(Lines.PRIMECOOLDOWNREDUCTION, 1, 3))312hatBpotLegTier3.set(Lines.ALLSKILLLEVELS, new Line(Lines.ALLSKILLLEVELS, 0, 1))313let topMpotLegTier4 = copyMap(armorMpotLegTier4)314let topMpotLegTier3 = copyMap(armorMpotLegTier3)315let topMpotUniTier4 = copyMap(armorMpotUniTier4)316let topMpotUniTier3 = copyMap(armorMpotUniTier3)317let topBpotLegTier4 = copyMap(armorBpotLegTier4)318let topBpotLegTier3 = copyMap(armorBpotLegTier3)319let topBpotUniTier4 = copyMap(armorBpotUniTier4)320let topBpotUniTier3 = copyMap(armorBpotUniTier3)321topMpotLegTier4.set(Lines.INVINCIBILITY, new Line(Lines.INVINCIBILITY, 0, 3))322topMpotLegTier4.set(Lines.PERCENTINVINCIBILITY, new Line(Lines.PERCENTINVINCIBILITY, 0, 3))323topMpotLegTier4.get(Lines.FILLER).weight = 10324topMpotLegTier3.set(Lines.INVINCIBILITY, new Line(Lines.INVINCIBILITY, 0, 3))325topMpotLegTier3.set(Lines.PERCENTINVINCIBILITY, new Line(Lines.PERCENTINVINCIBILITY, 0, 3))326topMpotLegTier3.get(Lines.FILLER).weight = 10327topMpotUniTier4.set(Lines.INVINCIBILITY, new Line(Lines.INVINCIBILITY, 0, 4))328topMpotUniTier4.set(Lines.PERCENTINVINCIBILITY, new Line(Lines.PERCENTINVINCIBILITY, 0, 4))329topMpotUniTier4.get(Lines.FILLER).weight = 19330topMpotUniTier3.set(Lines.INVINCIBILITY, new Line(Lines.INVINCIBILITY, 0, 4))331topMpotUniTier3.set(Lines.PERCENTINVINCIBILITY, new Line(Lines.PERCENTINVINCIBILITY, 0, 4))332topMpotUniTier3.get(Lines.FILLER).weight = 19333let pantsMpotLegTier4 = copyMap(armorMpotLegTier4)334let pantsMpotLegTier3 = copyMap(armorMpotLegTier3)335let pantsMpotUniTier4 = copyMap(armorMpotUniTier4)336let pantsMpotUniTier3 = copyMap(armorMpotUniTier3)337let pantsBpotLegTier4 = copyMap(armorBpotLegTier4)338let pantsBpotLegTier3 = copyMap(armorBpotLegTier3)339let pantsBpotUniTier4 = copyMap(armorBpotUniTier4)340let pantsBpotUniTier3 = copyMap(armorBpotUniTier3)341pantsMpotLegTier4.get(Lines.FILLER).weight = 10342pantsMpotLegTier3.get(Lines.FILLER).weight = 10343pantsMpotUniTier4.get(Lines.FILLER).weight = 17344pantsMpotUniTier3.get(Lines.FILLER).weight = 17345let shoesMpotLegTier4 = copyMap(armorMpotLegTier4)346let shoesMpotLegTier3 = copyMap(armorMpotLegTier3)347let shoesMpotUniTier4 = copyMap(armorMpotUniTier4)348let shoesMpotUniTier3 = copyMap(armorMpotUniTier3)349let shoesBpotLegTier4 = copyMap(armorBpotLegTier4)350let shoesBpotLegTier3 = copyMap(armorBpotLegTier3)351let shoesBpotUniTier4 = copyMap(armorBpotUniTier4)352let shoesBpotUniTier3 = copyMap(armorBpotUniTier3)353shoesMpotLegTier4.get(Lines.FILLER).weight = 11354shoesMpotLegTier3.get(Lines.FILLER).weight = 11355shoesMpotUniTier4.get(Lines.FILLER).weight = 17356shoesMpotUniTier3.get(Lines.FILLER).weight = 17357let glovesMpotLegTier4 = copyMap(armorMpotLegTier4)358let glovesMpotLegTier3 = copyMap(armorMpotLegTier3)359let glovesMpotUniTier4 = copyMap(armorMpotUniTier4)360let glovesMpotUniTier3 = copyMap(armorMpotUniTier3)361let glovesBpotLegTier4 = copyMap(armorBpotLegTier4)362let glovesBpotLegTier3 = copyMap(armorBpotLegTier3)363let glovesBpotUniTier4 = copyMap(armorBpotUniTier4)364let glovesBpotUniTier3 = copyMap(armorBpotUniTier3)365glovesMpotLegTier4.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 8, 4))366glovesMpotLegTier4.set(Lines.SPEEDINFUSION, new Line(Lines.SPEEDINFUSION, 1, 3))367glovesMpotLegTier3.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 8, 4))368glovesMpotLegTier3.set(Lines.SPEEDINFUSION, new Line(Lines.SPEEDINFUSION, 1, 3))369glovesMpotUniTier4.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 1))370glovesMpotUniTier4.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 1))371glovesMpotUniTier4.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 1))372glovesMpotUniTier4.set(Lines.SHARPEYES, new Line(Lines.SHARPEYES, 1, 4))373glovesMpotUniTier4.get(Lines.FILLER).weight = 14374glovesMpotUniTier3.set(Lines.PRIMARYSTATPER10, new Line(Lines.PRIMARYSTATPER10, 1, 1))375glovesMpotUniTier3.set(Lines.SECONDARYSTATPER10, new Line(Lines.SECONDARYSTATPER10, 1, 1))376glovesMpotUniTier3.set(Lines.TERTIARYSTATPER10, new Line(Lines.TERTIARYSTATPER10, 1, 1))377glovesMpotUniTier3.set(Lines.SHARPEYES, new Line(Lines.SHARPEYES, 1, 4))378glovesMpotUniTier3.get(Lines.FILLER).weight = 14379glovesBpotLegTier4.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 3, 2))380glovesBpotLegTier3.set(Lines.CRITDMG, new Line(Lines.CRITDMG, 3, 2))381let accessoryMpotLegTier4 = copyMap(armorMpotLegTier4)382let accessoryMpotLegTier3 = copyMap(armorMpotLegTier3)383let accessoryMpotUniTier4 = copyMap(armorMpotUniTier4)384let accessoryMpotUniTier3 = copyMap(armorMpotUniTier3)385let accessoryBpotLegTier4 = copyMap(armorBpotLegTier4)386let accessoryBpotLegTier3 = copyMap(armorBpotLegTier3)387let accessoryBpotUniTier4 = copyMap(armorBpotUniTier4)388let accessoryBpotUniTier3 = copyMap(armorBpotUniTier3)389accessoryMpotLegTier4.delete(Lines.IGNOREDAMAGE)390accessoryMpotLegTier4.set(Lines.MESOS, new Line(Lines.MESOS, 20, 3))391accessoryMpotLegTier4.set(Lines.DROP, new Line(Lines.DROP, 20, 3))392accessoryMpotLegTier4.get(Lines.FILLER).weight = 14393accessoryMpotLegTier3.delete(Lines.IGNOREDAMAGE)394accessoryMpotLegTier3.set(Lines.MESOS, new Line(Lines.MESOS, 20, 3))395accessoryMpotLegTier3.set(Lines.DROP, new Line(Lines.DROP, 20, 3))396accessoryMpotLegTier3.get(Lines.FILLER).weight = 14397accessoryMpotUniTier4.delete(Lines.IGNOREDAMAGE)398accessoryMpotUniTier3.delete(Lines.IGNOREDAMAGE)399accessoryBpotLegTier4.delete(Lines.CRITDMG)400accessoryBpotLegTier4.get(Lines.FILLER).weight = 28401accessoryBpotLegTier3.delete(Lines.CRITDMG)402accessoryBpotLegTier3.get(Lines.FILLER).weight = 28403let heartMpotLegTier4 = copyMap(armorMpotLegTier4)404let heartMpotLegTier3 = copyMap(armorMpotLegTier3)405let heartMpotUniTier4 = copyMap(armorMpotUniTier4)406let heartMpotUniTier3 = copyMap(armorMpotUniTier3)407let heartBpotLegTier4 = copyMap(armorBpotLegTier4)408let heartBpotLegTier3 = copyMap(armorBpotLegTier3)409let heartBpotUniTier4 = copyMap(armorBpotUniTier4)410let heartBpotUniTier3 = copyMap(armorBpotUniTier3)411heartMpotLegTier4.delete(Lines.IGNOREDAMAGE)412heartMpotLegTier3.delete(Lines.IGNOREDAMAGE)413heartMpotUniTier4.delete(Lines.IGNOREDAMAGE)414heartMpotUniTier3.delete(Lines.IGNOREDAMAGE)415heartBpotLegTier4.delete(Lines.CRITDMG)416heartBpotLegTier3.delete(Lines.CRITDMG)417const Emblem = {418 mpotLegTier4: emblemMpotLegTier4,419 mpotLegTier3: emblemMpotLegTier3,420 mpotUniTier4: emblemMpotUniTier4,421 mpotUniTier3: emblemMpotUniTier3,422 bpotLegTier4: emblemBpotLegTier4,423 bpotLegTier3: emblemBpotLegTier3,424 bpotUniTier4: emblemBpotUniTier4,...

Full Screen

Full Screen

checkKey.js

Source:checkKey.js Github

copy

Full Screen

1// @ts-check2/// <reference types="ses"/>3import {4 assertChecker,5 assertPassable,6 Far,7 getTag,8 isObject,9 makeTagged,10 passStyleOf,11} from '@endo/marshal';12import { checkElements, makeSetOfElements } from './copySet.js';13import { checkBagEntries, makeBagOfEntries } from './copyBag.js';14import {15 compareAntiRank,16 makeFullOrderComparatorKit,17 sortByRank,18} from '../patterns/rankOrder.js';19const { details: X, quote: q } = assert;20const { ownKeys } = Reflect;21// ////////////////// Primitive and Scalar keys ////////////////////////////////22/**23 * @param {Passable} val24 * @param {Checker=} check25 * @returns {boolean}26 */27const checkPrimitiveKey = (val, check = x => x) => {28 if (isObject(val)) {29 return check(false, X`A ${q(typeof val)} cannot be a primitive: ${val}`);30 }31 // TODO There is not yet a checkPassable, but perhaps there should be.32 // If that happens, we should call it here instead.33 assertPassable(val);34 return true;35};36/**37 * @param {Passable} val38 * @returns {boolean}39 */40export const isPrimitiveKey = val => checkPrimitiveKey(val);41harden(isPrimitiveKey);42/**43 * @param {Passable} val44 * @returns {void}45 */46export const assertPrimitiveKey = val => {47 checkPrimitiveKey(val, assertChecker);48};49harden(assertPrimitiveKey);50/**51 * @param {Passable} val52 * @param {Checker=} check53 * @returns {boolean}54 */55export const checkScalarKey = (val, check = x => x) => {56 if (isPrimitiveKey(val)) {57 return true;58 }59 const passStyle = passStyleOf(val);60 return check(61 passStyle === 'remotable',62 X`A ${q(passStyle)} cannot be a scalar key: ${val}`,63 );64};65/**66 * @param {Passable} val67 * @returns {boolean}68 */69export const isScalarKey = val => checkScalarKey(val);70harden(isScalarKey);71/**72 * @param {Passable} val73 * @returns {void}74 */75export const assertScalarKey = val => {76 checkScalarKey(val, assertChecker);77};78harden(assertScalarKey);79// ////////////////////////////// Keys /////////////////////////////////////////80/** @type {WeakSet<Key>} */81const keyMemo = new WeakSet();82/**83 * @param {Passable} val84 * @param {Checker=} check85 * @returns {boolean}86 */87export const checkKey = (val, check = x => x) => {88 if (isPrimitiveKey(val)) {89 return true;90 }91 if (!isObject(val)) {92 // TODO There is not yet a checkPassable, but perhaps there should be.93 // If that happens, we should call it here instead.94 assertPassable(val);95 return true;96 }97 if (keyMemo.has(val)) {98 return true;99 }100 // eslint-disable-next-line no-use-before-define101 const result = checkKeyInternal(val, check);102 if (result) {103 // Don't cache the undefined cases, so that if it is tried again104 // with `assertChecker` it'll throw a diagnostic again105 keyMemo.add(val);106 }107 // Note that we do not memoize a negative judgement, so that if it is tried108 // again with a checker, it will still produce a useful diagnostic.109 return result;110};111harden(checkKey);112/**113 * @param {Passable} val114 * @returns {boolean}115 */116export const isKey = val => checkKey(val);117harden(isKey);118/**119 * @param {Key} val120 */121export const assertKey = val => {122 checkKey(val, assertChecker);123};124harden(assertKey);125// //////////////////////////// CopySet ////////////////////////////////////////126// Moved to here so they can check that the copySet contains only keys127// without creating an import cycle.128/** @type WeakSet<CopySet<Key>> */129const copySetMemo = new WeakSet();130/**131 * @param {Passable} s132 * @param {Checker=} check133 * @returns {boolean}134 */135export const checkCopySet = (s, check = x => x) => {136 if (copySetMemo.has(s)) {137 return true;138 }139 const result =140 check(141 passStyleOf(s) === 'tagged' && getTag(s) === 'copySet',142 X`Not a copySet: ${s}`,143 ) &&144 checkElements(s.payload, check) &&145 checkKey(s.payload);146 if (result) {147 copySetMemo.add(s);148 }149 return result;150};151harden(checkCopySet);152/**153 * @callback IsCopySet154 * @param {Passable} s155 * @returns {s is CopySet<Key>}156 */157/** @type {IsCopySet} */158export const isCopySet = s => checkCopySet(s);159harden(isCopySet);160/**161 * @callback AssertCopySet162 * @param {Passable} s163 * @returns {asserts s is CopySet<Key>}164 */165/** @type {AssertCopySet} */166export const assertCopySet = s => {167 checkCopySet(s, assertChecker);168};169harden(assertCopySet);170/**171 * @template K172 * @param {CopySet<K>} s173 * @returns {K[]}174 */175export const getCopySetKeys = s => {176 assertCopySet(s);177 return s.payload;178};179harden(getCopySetKeys);180/**181 * @template K182 * @param {CopySet<K>} s183 * @param {(key: K, index: number) => boolean} fn184 * @returns {boolean}185 */186export const everyCopySetKey = (s, fn) =>187 getCopySetKeys(s).every((key, index) => fn(key, index));188harden(everyCopySetKey);189/**190 * @template K191 * @param {Iterable<K>} elementIter192 * @returns {CopySet<K>}193 */194export const makeCopySet = elementIter => {195 const result = makeSetOfElements(elementIter);196 assertCopySet(result);197 return result;198};199harden(makeCopySet);200// //////////////////////////// CopyBag ////////////////////////////////////////201// Moved to here so they can check that the copyBag contains only keys202// without creating an import cycle.203/** @type WeakSet<CopyBag<Key>> */204const copyBagMemo = new WeakSet();205/**206 * @param {Passable} b207 * @param {Checker=} check208 * @returns {boolean}209 */210export const checkCopyBag = (b, check = x => x) => {211 if (copyBagMemo.has(b)) {212 return true;213 }214 const result =215 check(216 passStyleOf(b) === 'tagged' && getTag(b) === 'copyBag',217 X`Not a copyBag: ${b}`,218 ) &&219 checkBagEntries(b.payload, check) &&220 checkKey(b.payload);221 if (result) {222 copyBagMemo.add(b);223 }224 return result;225};226harden(checkCopyBag);227/**228 * @callback IsCopyBag229 * @param {Passable} b230 * @returns {b is CopyBag<Key>}231 */232/** @type {IsCopyBag} */233export const isCopyBag = b => checkCopyBag(b);234harden(isCopyBag);235/**236 * @callback AssertCopyBag237 * @param {Passable} b238 * @returns {asserts b is CopyBag<Key>}239 */240/** @type {AssertCopyBag} */241export const assertCopyBag = b => {242 checkCopyBag(b, assertChecker);243};244harden(assertCopyBag);245/**246 * @template K247 * @param {CopyBag<K>} b248 * @returns {K[]}249 */250export const getCopyBagEntries = b => {251 assertCopyBag(b);252 return b.payload;253};254harden(getCopyBagEntries);255/**256 * @template K257 * @param {CopyBag<K>} b258 * @param {(entry: [K, bigint], index: number) => boolean} fn259 * @returns {boolean}260 */261export const everyCopyBagEntry = (b, fn) =>262 getCopyBagEntries(b).every((entry, index) => fn(entry, index));263harden(everyCopyBagEntry);264/**265 * @template K266 * @param {Iterable<[K,bigint]>} bagEntryIter267 * @returns {CopyBag<K>}268 */269export const makeCopyBag = bagEntryIter => {270 const result = makeBagOfEntries(bagEntryIter);271 assertCopyBag(result);272 return result;273};274harden(makeCopyBag);275/**276 * @template K277 * @param {Iterable<K>} elementIter278 * @returns {CopySet<K>}279 */280export const makeCopyBagFromElements = elementIter => {281 // This fullOrder contains history dependent state. It is specific282 // to this one call and does not survive it.283 const fullCompare = makeFullOrderComparatorKit().antiComparator;284 const sorted = sortByRank(elementIter, fullCompare);285 /** @type {[K,bigint][]} */286 const entries = [];287 for (let i = 0; i < sorted.length; ) {288 const k = sorted[i];289 let j = i + 1;290 while (j < sorted.length && fullCompare(k, sorted[j]) === 0) {291 j += 1;292 }293 entries.push([k, BigInt(j - i)]);294 i = j;295 }296 return makeCopyBag(entries);297};298harden(makeCopyBagFromElements);299// //////////////////////////// CopyMap ////////////////////////////////////////300// Moved to here so they can check that the copyMap's keys contains only keys301// without creating an import cycle.302/** @type WeakSet<CopyMap<any,any>> */303const copyMapMemo = new WeakSet();304/**305 * @param {Passable} m306 * @param {Checker=} check307 * @returns {boolean}308 */309export const checkCopyMap = (m, check = x => x) => {310 if (copyMapMemo.has(m)) {311 return true;312 }313 if (!(passStyleOf(m) === 'tagged' && getTag(m) === 'copyMap')) {314 return check(false, X`Not a copyMap: ${m}`);315 }316 const { payload } = m;317 if (passStyleOf(payload) !== 'copyRecord') {318 return check(false, X`A copyMap's payload must be a record: ${m}`);319 }320 const { keys, values, ...rest } = payload;321 const result =322 check(323 ownKeys(rest).length === 0,324 X`A copyMap's payload must only have .keys and .values: ${m}`,325 ) &&326 checkElements(keys, check) &&327 check(328 passStyleOf(values) === 'copyArray',329 X`A copyMap's .values must be a copyArray: ${m}`,330 ) &&331 check(332 keys.length === values.length,333 X`A copyMap must have the same number of keys and values: ${m}`,334 );335 if (result) {336 copyMapMemo.add(m);337 }338 return result;339};340harden(checkCopyMap);341/**342 * @callback IsCopyMap343 * @param {Passable} m344 * @returns {m is CopyMap<Key, Passable>}345 */346/** @type {IsCopyMap} */347export const isCopyMap = m => checkCopyMap(m);348harden(isCopyMap);349/**350 * @callback AssertCopyMap351 * @param {Passable} m352 * @returns {asserts m is CopyMap<Key, Passable>}353 */354/** @type {AssertCopyMap} */355export const assertCopyMap = m => {356 checkCopyMap(m, assertChecker);357};358harden(assertCopyMap);359/**360 * @template K,V361 * @param {CopyMap<K,V>} m362 * @returns {K[]}363 */364export const getCopyMapKeys = m => {365 assertCopyMap(m);366 return m.payload.keys;367};368harden(getCopyMapKeys);369/**370 * @template K,V371 * @param {CopyMap<K,V>} m372 * @returns {V[]}373 */374export const getCopyMapValues = m => {375 assertCopyMap(m);376 return m.payload.values;377};378harden(getCopyMapValues);379/**380 * @template K,V381 * @param {CopyMap<K,V>} m382 * @returns {Iterable<[K,V]>}383 */384export const getCopyMapEntries = m => {385 assertCopyMap(m);386 const {387 payload: { keys, values },388 } = m;389 const { length } = keys;390 return Far('CopyMap entries iterable', {391 [Symbol.iterator]: () => {392 let i = 0;393 return Far('CopyMap entries iterator', {394 next: () => {395 /** @type {IteratorResult<[K,V],void>} */396 let result;397 if (i < length) {398 result = harden({ done: false, value: [keys[i], values[i]] });399 i += 1;400 return result;401 } else {402 result = harden({ done: true, value: undefined });403 }404 return result;405 },406 });407 },408 });409};410harden(getCopyMapEntries);411/**412 * @template K,V413 * @param {CopyMap<K,V>} m414 * @param {(key: K, index: number) => boolean} fn415 * @returns {boolean}416 */417export const everyCopyMapKey = (m, fn) =>418 getCopyMapKeys(m).every((key, index) => fn(key, index));419harden(everyCopyMapKey);420/**421 * @template K,V422 * @param {CopyMap<K,V>} m423 * @param {(value: V, index: number) => boolean} fn424 * @returns {boolean}425 */426export const everyCopyMapValue = (m, fn) =>427 getCopyMapValues(m).every((value, index) => fn(value, index));428harden(everyCopyMapValue);429/**430 * @template K,V431 * @param {CopyMap<K,V>} m432 * @returns {CopySet<K>}433 */434export const copyMapKeySet = m =>435 // A copyMap's keys are already in the internal form used by copySets.436 makeTagged('copySet', m.payload.keys);437harden(copyMapKeySet);438/**439 * @template K,V440 * @param {Iterable<[K, V]>} entries441 * @returns {CopyMap<K,V>}442 */443export const makeCopyMap = entries => {444 // This is weird, but reverse rank sorting the entries is a good first step445 // for getting the rank sorted keys together with the values446 // organized by those keys. Also, among values associated with447 // keys in the same equivalence class, those are rank sorted.448 // TODO This449 // could solve the copyMap cover issue explained in patternMatchers.js.450 // But only if we include this criteria in our validation of copyMaps,451 // which we currently do not.452 const sortedEntries = sortByRank(entries, compareAntiRank);453 const keys = sortedEntries.map(([k, _v]) => k);454 const values = sortedEntries.map(([_k, v]) => v);455 const result = makeTagged('copyMap', { keys, values });456 assertCopyMap(result);457 return result;458};459harden(makeCopyMap);460// //////////////////////// Keys Recur /////////////////////////////////////////461/**462 * @param {Passable} val463 * @param {Checker=} check464 * @returns {boolean}465 */466const checkKeyInternal = (val, check = x => x) => {467 const checkIt = child => checkKey(child, check);468 const passStyle = passStyleOf(val);469 switch (passStyle) {470 case 'copyRecord': {471 // A copyRecord is a key iff all its children are keys472 return Object.values(val).every(checkIt);473 }474 case 'copyArray': {475 // A copyArray is a key iff all its children are keys476 return val.every(checkIt);477 }478 case 'tagged': {479 const tag = getTag(val);480 switch (tag) {481 case 'copySet': {482 return checkCopySet(val, check);483 }484 case 'copyBag': {485 return checkCopyBag(val, check);486 }487 case 'copyMap': {488 return (489 checkCopyMap(val, check) &&490 // For a copyMap to be a key, all its keys and values must491 // be keys. Keys already checked by `checkCopyMap` since492 // that's a copyMap requirement in general.493 everyCopyMapValue(val, checkIt)494 );495 }496 default: {497 return check(498 false,499 X`A passable tagged ${q(tag)} is not a key: ${val}`,500 );501 }502 }503 }504 case 'remotable': {505 // All remotables are keys.506 return true;507 }508 case 'error':509 case 'promise': {510 return check(false, X`A ${q(passStyle)} cannot be a key`);511 }512 default: {513 // Unexpected tags are just non-keys, but an unexpected passStyle514 // is always an error.515 assert.fail(X`unexpected passStyle ${q(passStyle)}: ${val}`);516 }517 }...

Full Screen

Full Screen

MRV.js

Source:MRV.js Github

copy

Full Screen

1import {data_teachers_map} from "../data/data_teacher.js";2import {data_auditory_map} from "../data/data_auditory.js";3import {data_map_disciplines, data_plurals, fillDisciplines, fillPluralsForDiscipline} from "./algorithm.js";4import {Lesson} from "../plurals/Lesson.js";5import {data_course_arr} from "../data/data_course.js";6'use strict'7/**8 * @param {Discipline} discipline9 * @param {} plural10 */11function isSuitableForSchedule(discipline, plural) {12 /**13 * @param {[]} teacherTools14 * @param {[]} auditoryTools15 * @returns {boolean}16 */17 function isAllToolsAvailable(teacherTools, auditoryTools) {18 for (let i = 0; i < teacherTools.length; i++)19 if (!auditoryTools.includes(teacherTools[i]))20 return false21 return true22 }23 function isSizeRequire(groupSize, auditorySize) {24 return auditorySize >= groupSize25 }26 function isCorrectAuditoryType(disciplineType, auditoryType) {27 return auditoryType === "l|p" ? true : auditoryType === disciplineType28 }29 function isCorrectDay(teacherAvailableDays, day) {30 return teacherAvailableDays[day].length > 031 }32 function isFreePair(teacherAvailablePair, day, auditoryPair) {33 return teacherAvailablePair[day].includes(auditoryPair)34 }35 let disciplineType = discipline.getDisciplineType36 let teacherName = discipline.getDisciplineTeacher37 let teacherRules = data_teachers_map[teacherName].getTeacherRules //new Rules38 let teacherTools = disciplineType === "l" ? teacherRules.getRuleTeacherToolsForLecture : teacherRules.getRuleTeacherToolsForPractice39 let teachersAvailableDays = teacherRules.getRuleCanWork40 // console.log(teachersAvailableDays)41 let auditoryName = plural[0]42 let auditory = data_auditory_map[auditoryName]43 let auditoryDay = plural[1]44 let auditoryPair = plural[2]45 let auditoryTools = auditory.getAuditoryTools46 let auditorySize = auditory.getAuditoryCapacity47 let groupSize = discipline.getDisciplineGroup.getStudentGroupSize48 let tools = isAllToolsAvailable(teacherTools, auditoryTools)49 let size = isSizeRequire(groupSize, auditorySize)50 let type = isCorrectAuditoryType(disciplineType, auditory.getAuditoryType)51 let day = isCorrectDay(teachersAvailableDays, auditoryDay)52 let pair = isFreePair(teachersAvailableDays, auditoryDay, auditoryPair)53 return (tools && size && type && day && pair)54}55function countConstraints(map_disciplines, data_plural) {56 function analyzeInMapDisciplines(value, key, map) {57 let discipline = key58 let constraintsList = [] // [] or value if value -> duplicate audit-day-pair59 function analyzePluralsElements(value, key, map) {60 if (value === true) {61 if (isSuitableForSchedule(discipline, key)) {62 constraintsList.push(key)63 }64 }65 }66 data_plural.forEach(analyzePluralsElements)67 map_disciplines.set(discipline, constraintsList)68 }69 map_disciplines.forEach(analyzeInMapDisciplines)70 return map_disciplines71}72function sortByConstraints(data_map_disciplines) {73 data_map_disciplines[Symbol.iterator] = function* () {74 yield* [...this.entries()].sort((a, b) => a[1].length - b[1].length);75 }76 return data_map_disciplines77}78function getElemByIndexInMap(map, index) {79 return Array.from(map)[index]80}81/**82 * @param {Discipline} d183 * @param {Discipline} d284 */85function compare2Disciplines(d1, d2) {86 return d1.getDisciplineGroup === d2.getDisciplineGroup87}88/**89 *90 * @param {[]} schedule91 * @param {Map} data_plurals92 * @param {Map} copyDisciplinesMap93 * @param {Map} originDisciplinesMap94 * @returns {*}95 */96let queueOfDeletedOperation = []97let countWhenScheduleAdd = 098function solveSchedule(schedule, data_plurals, copyMap, originDisciplinesMap) {99 if (originDisciplinesMap.size === schedule.length) return true // ??? maybe true or schedule100 if (copyMap.size === 0) return true // xz true or false101 // завжди беремо перший елемент із всіх дисциплінн тому що цей 1 елем має найбільше обмежень102 let item = getElemByIndexInMap(copyMap, 0)103 let dis = item[0]104 let variablesList = item[1]105 if (variablesList.length === 0) return false106 // for (let i = 0; i < variablesList.length; i++) {107 let variant = variablesList[0]108 data_plurals.set(variant, false)109 // console.log("countWhenScheduleAdd :: " + countWhenScheduleAdd++)110 schedule.push(new Lesson(dis, variant[0], variant[1], variant[2]))111 queueOfDeletedOperation.push(dis)112 copyMap.delete(dis)113 //видаляємо [аудит-день-пара] із можливого списку кожної дисципліни тому що вона вже зайнята114 copyMap = countConstraints(copyMap, data_plurals)115 copyMap = sortByConstraints(copyMap)116 if (originDisciplinesMap.length === schedule.length) {117 return true118 }119 if (getElemByIndexInMap(copyMap, 0) === undefined) {120 // console.log("cant solve do step back")121 return false122 } else {123 solveSchedule(schedule, data_plurals, copyMap, originDisciplinesMap)124 }125 // }126 return true127}128function solveSchedulePRO(schedule, data_plurals, copyMap, originDisciplinesMap) {129 if (copyMap.size === 0) return true130 if (schedule.length === originDisciplinesMap.size) return true131 let delQueue = []132 while (schedule.length !== originDisciplinesMap.size) {133 let item = getElemByIndexInMap(copyMap, 0)134 let dis = item[0]135 let disList = item[1]136 for (let i = 0; i < disList.length; i++) {137 let firstVar = disList[i]138 data_plurals.set(firstVar, false)139 let newLesson = new Lesson(dis, disList[i][0], disList[i][1], disList[i][2])140 delQueue.push(newLesson)141 schedule.push(newLesson)142 copyMap.delete(dis)143 copyMap = countConstraints(copyMap, data_plurals)144 copyMap = sortByConstraints(copyMap)145 if (copyMap.size === 0) return true146 if (getElemByIndexInMap(copyMap, 0)[1].length === 0) {147 schedule.pop()148 data_plurals[firstVar] = true149 copyMap.set(dis, disList)150 delQueue.pop()151 } else if (getElemByIndexInMap(copyMap, 0)[1].length === 0 && (i + 1) === disList.length) {152 schedule.pop()153 data_plurals[firstVar] = true154 copyMap.set(dis, disList.slice(1))155 delQueue.pop()156 break; // to finish cycle157 } else {158 break // to finish cycle | another way is do i to big for instance := i+= disList.length159 }160 }161 }162 return true163}164function main() {165 fillDisciplines()166 fillPluralsForDiscipline()167 countConstraints(data_map_disciplines, data_plurals)168 sortByConstraints(data_map_disciplines)169 let firstIndexFromMap = getElemByIndexInMap(data_map_disciplines, 0)[0]170 let plurals_with_most_constraints = getElemByIndexInMap(data_map_disciplines, 0)[1]171 let schedule = []172 let copyMap = new Map(data_map_disciplines)173 solveSchedulePRO(schedule, data_plurals, copyMap, data_map_disciplines)174 // console.log(solveSchedulePRO(schedule, data_plurals, copyMap, data_map_disciplines));175 // console.log(schedule);176 printSchedule(schedule)177}178function getDay(num) {179 switch (num) {180 case 0 :181 return "Monday"182 case 1 :183 return "Tuesday"184 case 2 :185 return "Wednesday"186 case 3 :187 return "Thursday"188 case 4 :189 return "Friday"190 case 5 :191 return "Saturday"192 }193}194function getPair(num) {195 switch (num) {196 case 1 :197 return "Para 1"198 case 2 :199 return "Para 2"200 case 3 :201 return "Para 3"202 case 4 :203 return "Para 4"204 case 5 :205 return "Para 5"206 case 6 :207 return "Para 6"208 case 7 :209 return "Para 7"210 }211}212function printSchedule(schedule){213 for (let course = 0; course < data_course_arr.length; course++) {214 console.log( "\n" + data_course_arr[course].getCourseName)215 for (let day = 0; day < 6; day++) {216 console.log(getDay(day))217 for (let pair = 0; pair < 7; pair++) {218 let auditory = "~~~"219 let discipline = "~~~"220 for (let lesson = 0; lesson < schedule.length ; lesson++){221 let l1 = schedule[lesson].getLessonDiscipline222 let l2 = schedule[lesson].getLessonDiscipline.getDisciplineGroup223 let l3 = schedule[lesson].getLessonDiscipline.getDisciplineGroup.getStudentGroupName224 if (schedule[lesson].getLessonDiscipline.getDisciplineGroup.getStudentGroupCourseName === data_course_arr[course].getCourseName) {225 if (schedule[lesson].getLessonDay === day){226 if (schedule[lesson].getLessonPair === pair){227 auditory = schedule[lesson].getLessonAuditory228 discipline = schedule[lesson].getLessonDiscipline.getDisciplineGroup229 console.log(getPair(pair) + " | Auditory :: " + auditory + "\t| Discipline :: " + discipline)230 }231 }232 }233 }234 }235 }236 }237}...

Full Screen

Full Screen

day24b.js

Source:day24b.js Github

copy

Full Screen

1const fs = require('fs')2// var contents = fs.readFileSync('./day24/testinput.txt', 'utf8');3var contents = fs.readFileSync('./day24/input.txt', 'utf8');4// example parse5const input = contents.split(/\n/)6// directions e, se, sw, w, nw, and ne7// create map of the movements8// when storing values in the map subtract opposites then store the final postions9let tileMap = new Map()10let directionSet = new Set(["e", "se", "sw", "w", "nw", "ne"])11const findTilePosition = (directions) => {12 // let tilePos = {"e":0, "se":0, "sw":0, "w":0, "nw":0, "ne":0}13 let tilePos = {"e":0, "s":0, "n":0, "w":0}14 while(directions.length !== 0) {15 let nextMove = directions.slice(0,2)16 if(directionSet.has(nextMove) && nextMove.length > 1) {17 tilePos[nextMove[0]]+=118 tilePos[nextMove[1]]+=119 // tilePos[nextMove]++20 directions = directions.slice(2)21 } else {22 nextMove = directions.slice(0,1)23 tilePos[nextMove]+=224 directions = directions.slice(1)25 }26 }27 // e and w are opposites28 if(tilePos['e'] > tilePos['w']) {29 tilePos['e'] = tilePos['e'] - tilePos['w']30 tilePos['w'] = 031 } else {32 tilePos['w'] = tilePos['w'] - tilePos['e']33 tilePos['e'] = 034 }35 if(tilePos['n'] > tilePos['s']) {36 tilePos['n'] = tilePos['n'] - tilePos['s']37 tilePos['s'] = 038 } else {39 tilePos['s'] = tilePos['s'] - tilePos['n']40 tilePos['n'] = 041 }42 43 return tilePos44}45const flipTiles = (line) => {46 const tile = JSON.stringify(findTilePosition(line))47 // store tile in the 48 if(tileMap.has(tile)) {49 tileMap.set(tile, false)50 } else {51 tileMap.set(tile, true)52 }53}54const setTiles = () => {55 input.forEach(line => {56 flipTiles(line)57 })58}59setTiles()60let copyMap = new Map()61const findBlackTiles = () => {62 let totalBlack = 063 tileMap.forEach((black, tile, map) => {64 if(black) {65 totalBlack++66 // copyMap.set(tile, true)67 // }68 // else {69 tile = JSON.parse(tile)70 let tilePosE = JSON.stringify(findTruePosition({"e":tile["e"]+2, "s":tile["s"], "n":tile["n"], "w":tile["w"]}))71 let tilePosSE = JSON.stringify(findTruePosition({"e":tile["e"]+1, "s":tile["s"]+1, "n":tile["n"], "w":tile["w"]}))72 let tilePosSW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"]+1, "n":tile["n"], "w":tile["w"]+1}))73 let tilePosW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"], "n":tile["n"], "w":tile["w"]+2}))74 let tilePosNW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"], "n":tile["n"]+1, "w":tile["w"]+1}))75 let tilePosNE = JSON.stringify(findTruePosition({"e":tile["e"]+1, "s":tile["s"], "n":tile["n"]+1, "w":tile["w"]}))76 77 // determine the neighbors positions add/sub 2 e w and 1 in n s 78 if(tileMap.get(tilePosE)) black++79 else {80 if (!tileMap.has(tilePosE)) tileMap.set(tilePosE, false)81 }82 if(tileMap.get(tilePosSE)) black++83 else {84 if (!tileMap.has(tilePosSE)) tileMap.set(tilePosSE, false)85 }86 if(tileMap.get(tilePosSW)) black++87 else {88 if (!tileMap.has(tilePosSW)) tileMap.set(tilePosSW, false)89 }90 if(tileMap.get(tilePosW)) black++91 else {92 if (!tileMap.has(tilePosW)) tileMap.set(tilePosW, false)93 }94 if(tileMap.get(tilePosNW)) black++95 else {96 if (!tileMap.has(tilePosNW)) tileMap.set(tilePosNW, false)97 }98 if(tileMap.get(tilePosNE)) black++99 else {100 if (!tileMap.has(tilePosNE)) tileMap.set(tilePosNE, false)101 }102 }103 })104 return totalBlack105}106const findTruePosition = (tilePos) => {107 if(tilePos['e'] > tilePos['w']) {108 tilePos['e'] = tilePos['e'] - tilePos['w']109 tilePos['w'] = 0110 } else {111 tilePos['w'] = tilePos['w'] - tilePos['e']112 tilePos['e'] = 0113 }114 if(tilePos['n'] > tilePos['s']) {115 tilePos['n'] = tilePos['n'] - tilePos['s']116 tilePos['s'] = 0117 } else {118 tilePos['s'] = tilePos['s'] - tilePos['n']119 tilePos['n'] = 0120 }121 122 return tilePos123}124// Any black tile with zero or more than 2 black tiles immediately adjacent to it is flipped to white.125// Any white tile with exactly 2 black tiles immediately adjacent to it is flipped to black.126// all tiles are initially white127const setColor = (tilePos, isBlack) => {128 let blackCount = 0129 let tile = JSON.parse(tilePos)130 let tilePosE = JSON.stringify(findTruePosition({"e":tile["e"]+2, "s":tile["s"], "n":tile["n"], "w":tile["w"]}))131 let tilePosSE = JSON.stringify(findTruePosition({"e":tile["e"]+1, "s":tile["s"]+1, "n":tile["n"], "w":tile["w"]}))132 let tilePosSW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"]+1, "n":tile["n"], "w":tile["w"]+1}))133 let tilePosW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"], "n":tile["n"], "w":tile["w"]+2}))134 let tilePosNW = JSON.stringify(findTruePosition({"e":tile["e"], "s":tile["s"], "n":tile["n"]+1, "w":tile["w"]+1}))135 let tilePosNE = JSON.stringify(findTruePosition({"e":tile["e"]+1, "s":tile["s"], "n":tile["n"]+1, "w":tile["w"]}))136 // determine the neighbors positions add/sub 2 e w and 1 in n s 137 if(tileMap.get(tilePosE)) blackCount++138 else {139 if (!copyMap.has(tilePosE)) copyMap.set(tilePosE, false)140 }141 if(tileMap.get(tilePosSE)) blackCount++142 else {143 if (!copyMap.has(tilePosSE)) copyMap.set(tilePosSE, false)144 }145 if(tileMap.get(tilePosSW)) blackCount++146 else {147 if (!copyMap.has(tilePosSW)) copyMap.set(tilePosSW, false)148 }149 if(tileMap.get(tilePosW)) blackCount++150 else {151 if (!copyMap.has(tilePosW)) copyMap.set(tilePosW, false)152 }153 if(tileMap.get(tilePosNW)) blackCount++154 else {155 if (!copyMap.has(tilePosNW)) copyMap.set(tilePosNW, false)156 }157 if(tileMap.get(tilePosNE)) blackCount++158 else {159 if (!copyMap.has(tilePosNE)) copyMap.set(tilePosNE, false)160 }161 // tileMap.get(tilePosE) ? blackCount++ : copyMap.set(tilePosE, false)162 // tileMap.get(tilePosSE) ? blackCount++ : copyMap.set(tilePosSE, false)163 // tileMap.get(tilePosSW) ? blackCount++ : copyMap.set(tilePosSW, false)164 // tileMap.get(tilePosW) ? blackCount++ : copyMap.set(tilePosW, false)165 // tileMap.get(tilePosNW) ? blackCount++ : copyMap.set(tilePosNW, false)166 // tileMap.get(tilePosNE) ? blackCount++ : copyMap.set(tilePosNE, false)167 // tileMap.get(tilePosE) ? blackCount++ : tileMap.set(tilePosE, false)168 // tileMap.get(tilePosSE) ? blackCount++ : tileMap.set(tilePosSE, false)169 // tileMap.get(tilePosSW) ? blackCount++ : tileMap.set(tilePosSW, false)170 // tileMap.get(tilePosW) ? blackCount++ : tileMap.set(tilePosW, false)171 // tileMap.get(tilePosNW) ? blackCount++ : tileMap.set(tilePosNW, false)172 // tileMap.get(tilePosNE) ? blackCount++ : tileMap.set(tilePosNE, false)173 // true is black174 let returnedColor = isBlack175 if(isBlack){176 if(blackCount === 0 || blackCount > 2) {177 returnedColor = false178 }179 }180 else if(blackCount==2) {181 returnedColor = true182 }183 return returnedColor184}185const groupFlip = () => {186 copyMap = new Map()187 let totalBlack = 0188 tileMap.forEach((black, tile, map) => {189 const color = setColor(tile, black)190 if(color) {191 totalBlack++192 }193 copyMap.set(tile, color)194 })195 // console.log(totalBlack)196 return copyMap197}198const flipNTimes = () => {199 for(let i = 1; i<=100; i++) {200 tileMap = groupFlip()201 }202 return findBlackTiles()203}204console.log("Total black first run", findBlackTiles())...

Full Screen

Full Screen

9. 深复制.js

Source:9. 深复制.js Github

copy

Full Screen

1/*2 * @Description:3 * @Author: lv.zhd4 * @Date: 2021-03-08 09:49:535 * @LastEditors: lv.zhd6 * @LastEditTime: 2021-03-09 15:18:487 * @FilePath: \草稿\9. 深复制.js8 */9function deepClone(target) {10 let result = Array.isArray(target) ? [] : {};11 for (key of Object.keys(target)) {12 if (typeof target[key] === "object") {13 result[key] = deepClone(target[key]);14 } else {15 result[key] = target[key];16 }17 }18 return result;19}20function deepClone2(target) {21 let uniqueList = [];22 debugger;23 function dp(target) {24 let result = Array.isArray(target) ? [] : {};25 let obj = find(uniqueList, target);26 if (obj) {27 return obj.result;28 }29 uniqueList.push({30 target: target,31 result: result,32 });33 for (key of Object.keys(target)) {34 if (typeof target[key] === "object") {35 result[key] = dp(target[key]);36 } else {37 result[key] = target[key];38 }39 }40 return result;41 }42 return dp(target);43}44function find(arr, item) {45 for (ele of arr) {46 if (ele.target === item) return ele;47 }48 return null;49}50let a = { b: 11 };51a.a = a;52bb = deepClone2(a);53let obj1 = { a: 1, b: 2 };54obj1.c = obj1;55obj1.d = { dd: 1 };56obj1.e = obj1.d;57let obj2 = deepClone2(obj1);58// let oldObj = {a:1,b:{c:2}}59// let newObj = deepClone(oldObj)60// console.log(oldObj === newObj)61let obj1 = { a: 1, b: 2 };62obj1.c = obj1;63let obj2 = deepClone(obj1);64function isObject(obj) {65 return obj !== null && typeof obj === "object";66}67function deepCloneMap(target) {68 let copyMap = new Map();69 function deepClone(target) {70 if (!isObject(target)) return target;71 if (copyMap.has(target)) return copyMap.get(target);72 let result = Array.isArray(target) ? [] : {};73 copyMap.set(target, result);74 for (key of Object.keys(target)) {75 result[key] = deepClone(target[key]);76 }77 return result;78 }79 return deepClone(target);80}81let a = { b: 11 };82a.a = a;83bb = deepCloneMap(a);84var graph = {85 A: ["B", "C"],86 B: ["A", "C", "D"],87 C: ["A", "D", "E"],88 D: ["B", "E", "F"],89 E: ["C", "D"],90 F: ["D"],91};92function BFS(graph, node) {93 let bfsResult = [];94 let visitedList = [];95 let remark = new Set();96 visitedList.push(node);97 remark.add(node);98 while (visitedList.length) {99 vet = visitedList.shift();100 bfsResult.push(vet);101 for (item of graph[vet]) {102 if (!remark.has(item)) {103 visitedList.push(item);104 remark.add(item);105 }106 }107 }108 return bfsResult;109}110let bfs = BFS(graph, "A");111console.log(bfs);112function DFS(graph, node) {113 let dfsResult = [];114 let visitedList = [];115 let remark = new Set();116 visitedList.push(node);117 remark.add(node);118 while (visitedList.length) {119 vet = visitedList.pop();120 dfsResult.push(vet);121 for (item of graph[vet]) {122 if (!remark.has(item)) {123 visitedList.push(item);124 remark.add(item);125 }126 }127 }128 return dfsResult;129}130let dfs = DFS(graph, "A");131console.log(dfs);132function isObject(obj) {133 return obj !== null && typeof obj === "object";134}135function deepCloneMapBFS(target) {136 if (!isObject(target)) return target;137 let copyMap = new Map();138 let queue = [target];139 while (queue.length) {140 let curData = queue.shift();141 let obj;142 if (copyMap.has(curData)) {143 obj = copyMap.get(curData);144 continue;145 } else {146 obj = Array.isArray(curData) ? [] : {};147 copyMap.set(curData, obj);148 }149 for (key of Object.keys(curData)) {150 let tmp = curData[key];151 if (!isObject(tmp)) {152 obj[key] = tmp;153 continue;154 }155 if (copyMap.has(tmp)) {156 obj[key] = copyMap.get(tmp);157 } else {158 obj[key] = Array.isArray(curData) ? [] : {};159 copyMap.set(tmp, obj[key]);160 queue.push(tmp);161 }162 }163 }164 return copyMap.get(target);165}166let a = { b: 11 };167a.a = a;...

Full Screen

Full Screen

solve_0438.js

Source:solve_0438.js Github

copy

Full Screen

1/**2 * @index 4383 * @title 找到字符串中所有字母异位词4 * @difficulty 中等5 * @tags hash-table,string,sliding-window6 * @draft false7 * @link https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/8 * @frontendId 4389*/10/**11 * @param {string} s12 * @param {string} p13 * @return {number[]}14 * @date 2021/11/2815 */16var findAnagrams = function(s, p) {17let anagramsArray = [] , amap = new Map()18 for(j = 0;j < p.length ;j++) {19 if (!amap.has(p[j])) {20 amap.set(p[j],1)21 } else {22 amap.set(p[j], amap.get(p[j]) + 1)23 }24 }25 // console.log("amap:", amap)26 27 const checkIsEqual = (string) => {28 let flag = true , copyMap = new Map(amap) 29 for(m = 0; m < string.length ;m++) {30 if(!copyMap.has(string[m])) {31 return false32 } else {33 if (copyMap.get(string[m] === 0)) {34 return false35 } else {36 copyMap.set(string[m] ,copyMap.get(string[m]) - 1)37 }38 }39 }40 for([keys,values] of copyMap) {41 if (values !== 0) {42 return false43 }44 }45 return flag46 }47 for(let i = 0 ; i < s.length - p.length + 1;i++) {48 const string1 = s.slice(i,i+p.length) 49 // console.log("string1:", string1,',string2:', string2)50 if (checkIsEqual(string1)) {51 anagramsArray.push(i)52 }53 }54 return anagramsArray...

Full Screen

Full Screen

cloneDescriptor.js

Source:cloneDescriptor.js Github

copy

Full Screen

1import 'core-js/stable'2import cloneDescriptorDetail from './cloneDescriptorDetail'3/**4 * Make a copy of an object descriptor so that the original will not be mutated.5 * @function6 * @memberOf module:objectDescriptors7 * @param {module:objectDescriptors~descriptor} originalMap8 * @returns {module:objectDescriptors~descriptor}9 */10const cloneDescriptor = originalMap => {11 const copyMap = {}12 copyMap.index = originalMap.index || 013 copyMap.details = originalMap.details.map(cloneDescriptorDetail)14 copyMap.length = originalMap.length15 copyMap.keys = originalMap.keys.map(key => key)16 copyMap.references = originalMap.references.map(reference => reference)17 copyMap.isArray = originalMap.isArray18 copyMap.complete = originalMap.complete19 return copyMap20}...

Full Screen

Full Screen

Jest Testing Tutorial

LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.

Chapters

  1. What is Jest Framework
  2. Advantages of Jest - Jest has 3,898,000 GitHub repositories, as mentioned on its official website. Learn what makes Jest special and why Jest has gained popularity among the testing and developer community.
  3. Jest Installation - All the prerequisites and set up steps needed to help you start Jest automation testing.
  4. Using Jest with NodeJS Project - Learn how to leverage Jest framework to automate testing using a NodeJS Project.
  5. Writing First Test for Jest Framework - Get started with code-based tutorial to help you write and execute your first Jest framework testing script.
  6. Jest Vocabulary - Learn the industry renowned and official jargons of the Jest framework by digging deep into the Jest vocabulary.
  7. Unit Testing with Jest - Step-by-step tutorial to help you execute unit testing with Jest framework.
  8. Jest Basics - Learn about the most pivotal and basic features which makes Jest special.
  9. Jest Parameterized Tests - Avoid code duplication and fasten automation testing with Jest using parameterized tests. Parameterization allows you to trigger the same test scenario over different test configurations by incorporating parameters.
  10. Jest Matchers - Enforce assertions better with the help of matchers. Matchers help you compare the actual output with the expected one. Here is an example to see if the object is acquired from the correct class or not. -

|<p>it('check_object_of_Car', () => {</p><p> expect(newCar()).toBeInstanceOf(Car);</p><p> });</p>| | :- |

  1. Jest Hooks: Setup and Teardown - Learn how to set up conditions which needs to be followed by the test execution and incorporate a tear down function to free resources after the execution is complete.
  2. Jest Code Coverage - Unsure there is no code left unchecked in your application. Jest gives a specific flag called --coverage to help you generate code coverage.
  3. HTML Report Generation - Learn how to create a comprehensive HTML report based on your Jest test execution.
  4. Testing React app using Jest Framework - Learn how to test your react web-application with Jest framework in this detailed Jest tutorial.
  5. Test using LambdaTest cloud Selenium Grid - Run your Jest testing script over LambdaTest cloud-based platform and leverage parallel testing to help trim down your test execution time.
  6. Snapshot Testing for React Front Ends - Capture screenshots of your react based web-application and compare them automatically for visual anomalies with the help of Jest tutorial.
  7. Bonus: Import ES modules with Jest - ES modules are also known as ECMAScript modules. Learn how to best use them by importing in your Jest testing scripts.
  8. Jest vs Mocha vs Jasmine - Learn the key differences between the most popular JavaScript-based testing frameworks i.e. Jest, Mocha, and Jasmine.
  9. Jest FAQs(Frequently Asked Questions) - Explore the most commonly asked questions around Jest framework, with their answers.

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