Best JavaScript code snippet using ng-mocks
outerData.js
Source:outerData.js
1export const orgData = [2 {3 "id": "",4 "orgCode": "130602401888303",5 "fdesc": "ä¿å®å¸ç¬¬äºå»é¢",6 "hopGrade.id": "3",7 "hopType.id": "1",8 "clsCode": "",9 "exSchema.id": "",10 "exSchema1.id": "",11 "addr": "",12 "email": "",13 "tel": "",14 "rcArea.id": "130602",15 "province.id": "130602",16 "icd10.id": "",17 "dataCtg.id": "",18 "batStatMode": "",19 "hopPcFiles": "",20 "repLogs": "",21 "hopUsers": "",22 "chkScores": ""23 },24 {25 "id": "",26 "orgCode": "130606401888397",27 "fdesc": "ä¿å®å¸ä¼ æç
å»é¢",28 "hopGrade.id": "3",29 "hopType.id": "1",30 "clsCode": "",31 "exSchema.id": "",32 "exSchema1.id": "",33 "addr": "",34 "email": "",35 "tel": "",36 "rcArea.id": "130606",37 "province.id": "130606",38 "icd10.id": "",39 "dataCtg.id": "",40 "batStatMode": "",41 "hopPcFiles": "",42 "repLogs": "",43 "hopUsers": "",44 "chkScores": ""45 },46 {47 "id": "",48 "orgCode": "13060640206340X",49 "fdesc": "ä¿å®å¸ç¬¬ä¸ä¸å¿å»é¢",50 "hopGrade.id": "3",51 "hopType.id": "1",52 "clsCode": "",53 "exSchema.id": "",54 "exSchema1.id": "",55 "addr": "",56 "email": "",57 "tel": "",58 "rcArea.id": "130606",59 "province.id": "130606",60 "icd10.id": "",61 "dataCtg.id": "",62 "batStatMode": "",63 "hopPcFiles": "",64 "repLogs": "",65 "hopUsers": "",66 "chkScores": ""67 },68 {69 "id": "",70 "orgCode": "130606401888290",71 "fdesc": "ä¿å®å¸ç¬¬ä¸å»é¢",72 "hopGrade.id": "3",73 "hopType.id": "1",74 "clsCode": "",75 "exSchema.id": "",76 "exSchema1.id": "",77 "addr": "",78 "email": "",79 "tel": "",80 "rcArea.id": "130606",81 "province.id": "130606",82 "icd10.id": "",83 "dataCtg.id": "",84 "batStatMode": "",85 "hopPcFiles": "",86 "repLogs": "",87 "hopUsers": "",88 "chkScores": ""89 },90 {91 "id": "",92 "orgCode": "130606401888469",93 "fdesc": "ä¿å®å¸ä¸å»é¢",94 "hopGrade.id": "3",95 "hopType.id": "1",96 "clsCode": "",97 "exSchema.id": "",98 "exSchema1.id": "",99 "addr": "",100 "email": "",101 "tel": "",102 "rcArea.id": "130606",103 "province.id": "130606",104 "icd10.id": "",105 "dataCtg.id": "",106 "batStatMode": "",107 "hopPcFiles": "",108 "repLogs": "",109 "hopUsers": "",110 "chkScores": ""111 },112 {113 "id": "",114 "orgCode": "130606402063450",115 "fdesc": "ä¿å®å¸ç¬¬ä¸ä¸å»é¢",116 "hopGrade.id": "3",117 "hopType.id": "1",118 "clsCode": "",119 "exSchema.id": "",120 "exSchema1.id": "",121 "addr": "",122 "email": "",123 "tel": "",124 "rcArea.id": "130606",125 "province.id": "130606",126 "icd10.id": "",127 "dataCtg.id": "",128 "batStatMode": "",129 "hopPcFiles": "",130 "repLogs": "",131 "hopUsers": "",132 "chkScores": ""133 },134 {135 "id": "",136 "orgCode": "130606401893161",137 "fdesc": "ä¿å®å¸å¦å¹¼ä¿å¥é¢",138 "hopGrade.id": "3",139 "hopType.id": "1",140 "clsCode": "",141 "exSchema.id": "",142 "exSchema1.id": "",143 "addr": "",144 "email": "",145 "tel": "",146 "rcArea.id": "130606",147 "province.id": "130606",148 "icd10.id": "",149 "dataCtg.id": "",150 "batStatMode": "",151 "hopPcFiles": "",152 "repLogs": "",153 "hopUsers": "",154 "chkScores": ""155 },156 {157 "id": "",158 "orgCode": "130627403711392",159 "fdesc": "åå¿äººæ°å»é¢",160 "hopGrade.id": "3",161 "hopType.id": "1",162 "clsCode": "",163 "exSchema.id": "",164 "exSchema1.id": "",165 "addr": "",166 "email": "",167 "tel": "",168 "rcArea.id": "130627",169 "province.id": "130627",170 "icd10.id": "",171 "dataCtg.id": "",172 "batStatMode": "",173 "hopPcFiles": "",174 "repLogs": "",175 "hopUsers": "",176 "chkScores": ""177 },178 {179 "id": "",180 "orgCode": "130681404893941",181 "fdesc": "ä¿å®å¸ç¬¬äºä¸å¿å»é¢",182 "hopGrade.id": "3",183 "hopType.id": "1",184 "clsCode": "",185 "exSchema.id": "",186 "exSchema1.id": "",187 "addr": "",188 "email": "",189 "tel": "",190 "rcArea.id": "130681",191 "province.id": "130681",192 "icd10.id": "",193 "dataCtg.id": "",194 "batStatMode": "",195 "hopPcFiles": "",196 "repLogs": "",197 "hopUsers": "",198 "chkScores": ""199 },200 {201 "id": "",202 "orgCode": "130681403641347",203 "fdesc": "涿å·å¸å»é¢",204 "hopGrade.id": "3",205 "hopType.id": "1",206 "clsCode": "",207 "exSchema.id": "",208 "exSchema1.id": "",209 "addr": "",210 "email": "",211 "tel": "",212 "rcArea.id": "130681",213 "province.id": "130681",214 "icd10.id": "",215 "dataCtg.id": "",216 "batStatMode": "",217 "hopPcFiles": "",218 "repLogs": "",219 "hopUsers": "",220 "chkScores": ""221 },222 {223 "id": "",224 "orgCode": "13090240198379x",225 "fdesc": "沧å·å¸äººæ°å»é¢",226 "hopGrade.id": "3",227 "hopType.id": "1",228 "clsCode": "",229 "exSchema.id": "",230 "exSchema1.id": "",231 "addr": "",232 "email": "",233 "tel": "",234 "rcArea.id": "130902",235 "province.id": "130902",236 "icd10.id": "",237 "dataCtg.id": "",238 "batStatMode": "",239 "hopPcFiles": "",240 "repLogs": "",241 "hopUsers": "",242 "chkScores": ""243 },244 {245 "id": "",246 "orgCode": "130903401983829",247 "fdesc": "æ²³åç沧å·ä¸è¥¿å»ç»åå»é¢",248 "hopGrade.id": "3",249 "hopType.id": "1",250 "clsCode": "",251 "exSchema.id": "",252 "exSchema1.id": "",253 "addr": "",254 "email": "",255 "tel": "",256 "rcArea.id": "130903",257 "province.id": "130903",258 "icd10.id": "",259 "dataCtg.id": "",260 "batStatMode": "",261 "hopPcFiles": "",262 "repLogs": "",263 "hopUsers": "",264 "chkScores": ""265 },266 {267 "id": "",268 "orgCode": "130903401983888",269 "fdesc": "沧å·å¸ä¸å¿å»é¢",270 "hopGrade.id": "3",271 "hopType.id": "1",272 "clsCode": "",273 "exSchema.id": "",274 "exSchema1.id": "",275 "addr": "",276 "email": "",277 "tel": "",278 "rcArea.id": "130903",279 "province.id": "130903",280 "icd10.id": "",281 "dataCtg.id": "",282 "batStatMode": "",283 "hopPcFiles": "",284 "repLogs": "",285 "hopUsers": "",286 "chkScores": ""287 },288 {289 "id": "",290 "orgCode": "130927404505726",291 "fdesc": "åç®å¿äººæ°å»é¢",292 "hopGrade.id": "3",293 "hopType.id": "1",294 "clsCode": "",295 "exSchema.id": "",296 "exSchema1.id": "",297 "addr": "",298 "email": "",299 "tel": "",300 "rcArea.id": "130927",301 "province.id": "130927",302 "icd10.id": "",303 "dataCtg.id": "",304 "batStatMode": "",305 "hopPcFiles": "",306 "repLogs": "",307 "hopUsers": "",308 "chkScores": ""309 },310 {311 "id": "",312 "orgCode": "130802401942760",313 "fdesc": "æ¿å¾·å¸ä¸å¿å»é¢",314 "hopGrade.id": "3",315 "hopType.id": "1",316 "clsCode": "",317 "exSchema.id": "",318 "exSchema1.id": "",319 "addr": "",320 "email": "",321 "tel": "",322 "rcArea.id": "130802",323 "province.id": "130802",324 "icd10.id": "",325 "dataCtg.id": "",326 "batStatMode": "",327 "hopPcFiles": "",328 "repLogs": "",329 "hopUsers": "",330 "chkScores": ""331 },332 {333 "id": "",334 "orgCode": "130824402118597",335 "fdesc": "滦平å¿ä¸å»é¢",336 "hopGrade.id": "3",337 "hopType.id": "1",338 "clsCode": "",339 "exSchema.id": "",340 "exSchema1.id": "",341 "addr": "",342 "email": "",343 "tel": "",344 "rcArea.id": "130824",345 "province.id": "130824",346 "icd10.id": "",347 "dataCtg.id": "",348 "batStatMode": "",349 "hopPcFiles": "",350 "repLogs": "",351 "hopUsers": "",352 "chkScores": ""353 },354 {355 "id": "",356 "orgCode": "130826402114529",357 "fdesc": "丰å®å¿å¿å»é¢",358 "hopGrade.id": "3",359 "hopType.id": "1",360 "clsCode": "",361 "exSchema.id": "",362 "exSchema1.id": "",363 "addr": "",364 "email": "",365 "tel": "",366 "rcArea.id": "130826",367 "province.id": "130826",368 "icd10.id": "",369 "dataCtg.id": "",370 "batStatMode": "",371 "hopPcFiles": "",372 "repLogs": "",373 "hopUsers": "",374 "chkScores": ""375 },376 {377 "id": "",378 "orgCode": "130682402073659",379 "fdesc": "å®å·å¸äººæ°å»é¢",380 "hopGrade.id": "3",381 "hopType.id": "1",382 "clsCode": "",383 "exSchema.id": "",384 "exSchema1.id": "",385 "addr": "",386 "email": "",387 "tel": "",388 "rcArea.id": "130682",389 "province.id": "130682",390 "icd10.id": "",391 "dataCtg.id": "",392 "batStatMode": "",393 "hopPcFiles": "",394 "repLogs": "",395 "hopUsers": "",396 "chkScores": ""397 },398 {399 "id": "",400 "orgCode": "13040240259039X",401 "fdesc": "é¯é¸å¸ä¸å¿å»é¢",402 "hopGrade.id": "3",403 "hopType.id": "1",404 "clsCode": "",405 "exSchema.id": "",406 "exSchema1.id": "",407 "addr": "",408 "email": "",409 "tel": "",410 "rcArea.id": "130402",411 "province.id": "130402",412 "icd10.id": "",413 "dataCtg.id": "",414 "batStatMode": "",415 "hopPcFiles": "",416 "repLogs": "",417 "hopUsers": "",418 "chkScores": ""419 },420 {421 "id": "",422 "orgCode": "130402402590357",423 "fdesc": "é¯é¸å¸å¦å¹¼ä¿å¥é¢",424 "hopGrade.id": "3",425 "hopType.id": "1",426 "clsCode": "",427 "exSchema.id": "",428 "exSchema1.id": "",429 "addr": "",430 "email": "",431 "tel": "",432 "rcArea.id": "130402",433 "province.id": "130402",434 "icd10.id": "",435 "dataCtg.id": "",436 "batStatMode": "",437 "hopPcFiles": "",438 "repLogs": "",439 "hopUsers": "",440 "chkScores": ""441 },442 {443 "id": "",444 "orgCode": "130402402590349",445 "fdesc": "é¯é¸å¸ä¸å»é¢",446 "hopGrade.id": "3",447 "hopType.id": "1",448 "clsCode": "",449 "exSchema.id": "",450 "exSchema1.id": "",451 "addr": "",452 "email": "",453 "tel": "",454 "rcArea.id": "130402",455 "province.id": "130402",456 "icd10.id": "",457 "dataCtg.id": "",458 "batStatMode": "",459 "hopPcFiles": "",460 "repLogs": "",461 "hopUsers": "",462 "chkScores": ""463 },464 {465 "id": "",466 "orgCode": "130403402590373",467 "fdesc": "é¯é¸å¸ç¬¬ä¸å»é¢",468 "hopGrade.id": "3",469 "hopType.id": "1",470 "clsCode": "",471 "exSchema.id": "",472 "exSchema1.id": "",473 "addr": "",474 "email": "",475 "tel": "",476 "rcArea.id": "130403",477 "province.id": "130403",478 "icd10.id": "",479 "dataCtg.id": "",480 "batStatMode": "",481 "hopPcFiles": "",482 "repLogs": "",483 "hopUsers": "",484 "chkScores": ""485 },486 {487 "id": "",488 "orgCode": "130434402946798",489 "fdesc": "éå¿ä¸å»é¢",490 "hopGrade.id": "3",491 "hopType.id": "1",492 "clsCode": "",493 "exSchema.id": "",494 "exSchema1.id": "",495 "addr": "",496 "email": "",497 "tel": "",498 "rcArea.id": "130434",499 "province.id": "130434",500 "icd10.id": "",501 "dataCtg.id": "",502 "batStatMode": "",503 "hopPcFiles": "",504 "repLogs": "",505 "hopUsers": "",506 "chkScores": ""507 },508 {509 "id": "",510 "orgCode": "130481401838736",511 "fdesc": "æ¦å®å¸ç¬¬ä¸äººæ°å»é¢",512 "hopGrade.id": "3",513 "hopType.id": "1",514 "clsCode": "",515 "exSchema.id": "",516 "exSchema1.id": "",517 "addr": "",518 "email": "",519 "tel": "",520 "rcArea.id": "130481",521 "province.id": "130481",522 "icd10.id": "",523 "dataCtg.id": "",524 "batStatMode": "",525 "hopPcFiles": "",526 "repLogs": "",527 "hopUsers": "",528 "chkScores": ""529 },530 {531 "id": "",532 "orgCode": "131102404796498",533 "fdesc": "è¡¡æ°´å¸äººæ°å»é¢",534 "hopGrade.id": "3",535 "hopType.id": "1",536 "clsCode": "",537 "exSchema.id": "",538 "exSchema1.id": "",539 "addr": "",540 "email": "",541 "tel": "",542 "rcArea.id": "131102",543 "province.id": "131102",544 "icd10.id": "",545 "dataCtg.id": "",546 "batStatMode": "",547 "hopPcFiles": "",548 "repLogs": "",549 "hopUsers": "",550 "chkScores": ""551 },552 {553 "id": "",554 "orgCode": "131102737390189",555 "fdesc": "è¡¡æ°´å¸ç¬¬å人æ°å»é¢",556 "hopGrade.id": "3",557 "hopType.id": "1",558 "clsCode": "",559 "exSchema.id": "",560 "exSchema1.id": "",561 "addr": "",562 "email": "",563 "tel": "",564 "rcArea.id": "131102",565 "province.id": "131102",566 "icd10.id": "",567 "dataCtg.id": "",568 "batStatMode": "",569 "hopPcFiles": "",570 "repLogs": "",571 "hopUsers": "",572 "chkScores": ""573 },574 {575 "id": "",576 "orgCode": "131102404631677",577 "fdesc": "è¡¡æ°´å¸ç¬¬äºäººæ°å»é¢",578 "hopGrade.id": "3",579 "hopType.id": "1",580 "clsCode": "",581 "exSchema.id": "",582 "exSchema1.id": "",583 "addr": "",584 "email": "",585 "tel": "",586 "rcArea.id": "131102",587 "province.id": "131102",588 "icd10.id": "",589 "dataCtg.id": "",590 "batStatMode": "",591 "hopPcFiles": "",592 "repLogs": "",593 "hopUsers": "",594 "chkScores": ""595 },596 {597 "id": "",598 "orgCode": "131126404751628",599 "fdesc": "æ
åå¿å»é¢",600 "hopGrade.id": "3",601 "hopType.id": "1",602 "clsCode": "",603 "exSchema.id": "",604 "exSchema1.id": "",605 "addr": "",606 "email": "",607 "tel": "",608 "rcArea.id": "131126",609 "province.id": "131126",610 "icd10.id": "",611 "dataCtg.id": "",612 "batStatMode": "",613 "hopPcFiles": "",614 "repLogs": "",615 "hopUsers": "",616 "chkScores": ""617 },618 {619 "id": "",620 "orgCode": "131003401997032",621 "fdesc": "å»åå¸ä¸å»å»é¢",622 "hopGrade.id": "3",623 "hopType.id": "1",624 "clsCode": "",625 "exSchema.id": "",626 "exSchema1.id": "",627 "addr": "",628 "email": "",629 "tel": "",630 "rcArea.id": "131003",631 "province.id": "131003",632 "icd10.id": "",633 "dataCtg.id": "",634 "batStatMode": "",635 "hopPcFiles": "",636 "repLogs": "",637 "hopUsers": "",638 "chkScores": ""639 },640 {641 "id": "",642 "orgCode": "131001401996881",643 "fdesc": "å»åå¸äººæ°å»é¢",644 "hopGrade.id": "3",645 "hopType.id": "1",646 "clsCode": "",647 "exSchema.id": "",648 "exSchema1.id": "",649 "addr": "",650 "email": "",651 "tel": "",652 "rcArea.id": "131001",653 "province.id": "131001",654 "icd10.id": "",655 "dataCtg.id": "",656 "batStatMode": "",657 "hopPcFiles": "",658 "repLogs": "",659 "hopUsers": "",660 "chkScores": ""661 },662 {663 "id": "",664 "orgCode": "131081401993947",665 "fdesc": "å»åå¸ç¬¬å人æ°å»é¢",666 "hopGrade.id": "3",667 "hopType.id": "1",668 "clsCode": "",669 "exSchema.id": "",670 "exSchema1.id": "",671 "addr": "",672 "email": "",673 "tel": "",674 "rcArea.id": "131081",675 "province.id": "131081",676 "icd10.id": "",677 "dataCtg.id": "",678 "batStatMode": "",679 "hopPcFiles": "",680 "repLogs": "",681 "hopUsers": "",682 "chkScores": ""683 },684 {685 "id": "",686 "orgCode": "130105401703874",687 "fdesc": "æ²³åç人æ°å»é¢",688 "hopGrade.id": "3",689 "hopType.id": "1",690 "clsCode": "",691 "exSchema.id": "",692 "exSchema1.id": "",693 "addr": "",694 "email": "",695 "tel": "",696 "rcArea.id": "130105",697 "province.id": "130105",698 "icd10.id": "",699 "dataCtg.id": "",700 "batStatMode": "",701 "hopPcFiles": "",702 "repLogs": "",703 "hopUsers": "",704 "chkScores": ""705 },706 {707 "id": "",708 "orgCode": "130105401700390",709 "fdesc": "æ²³åå»ç§å¤§å¦ç¬¬äºå»é¢",710 "hopGrade.id": "3",711 "hopType.id": "1",712 "clsCode": "",713 "exSchema.id": "",714 "exSchema1.id": "",715 "addr": "",716 "email": "",717 "tel": "",718 "rcArea.id": "130105",719 "province.id": "130105",720 "icd10.id": "",721 "dataCtg.id": "",722 "batStatMode": "",723 "hopPcFiles": "",724 "repLogs": "",725 "hopUsers": "",726 "chkScores": ""727 },728 {729 "id": "",730 "orgCode": "130104401700374",731 "fdesc": "æ²³åå»ç§å¤§å¦ç¬¬ä¸å»é¢",732 "hopGrade.id": "3",733 "hopType.id": "1",734 "clsCode": "",735 "exSchema.id": "",736 "exSchema1.id": "",737 "addr": "",738 "email": "",739 "tel": "",740 "rcArea.id": "130104",741 "province.id": "130104",742 "icd10.id": "",743 "dataCtg.id": "",744 "batStatMode": "",745 "hopPcFiles": "",746 "repLogs": "",747 "hopUsers": "",748 "chkScores": ""749 },750 {751 "id": "",752 "orgCode": "130102401700382",753 "fdesc": "æ²³åå»ç§å¤§å¦ç¬¬åå»é¢",754 "hopGrade.id": "3",755 "hopType.id": "1",756 "clsCode": "",757 "exSchema.id": "",758 "exSchema1.id": "",759 "addr": "",760 "email": "",761 "tel": "",762 "rcArea.id": "130102",763 "province.id": "130102",764 "icd10.id": "",765 "dataCtg.id": "",766 "batStatMode": "",767 "hopPcFiles": "",768 "repLogs": "",769 "hopUsers": "",770 "chkScores": ""771 },772 {773 "id": "",774 "orgCode": "130604401703938",775 "fdesc": "æ²³å大å¦éå±å»é¢",776 "hopGrade.id": "3",777 "hopType.id": "1",778 "clsCode": "",779 "exSchema.id": "",780 "exSchema1.id": "",781 "addr": "",782 "email": "",783 "tel": "",784 "rcArea.id": "130604",785 "province.id": "130604",786 "icd10.id": "",787 "dataCtg.id": "",788 "batStatMode": "",789 "hopPcFiles": "",790 "repLogs": "",791 "hopUsers": "",792 "chkScores": ""793 },794 {795 "id": "",796 "orgCode": "130802401942840",797 "fdesc": "æ¿å¾·å»å¦é¢éå±å»é¢",798 "hopGrade.id": "3",799 "hopType.id": "1",800 "clsCode": "",801 "exSchema.id": "",802 "exSchema1.id": "",803 "addr": "",804 "email": "",805 "tel": "",806 "rcArea.id": "130802",807 "province.id": "130802",808 "icd10.id": "",809 "dataCtg.id": "",810 "batStatMode": "",811 "hopPcFiles": "",812 "repLogs": "",813 "hopUsers": "",814 "chkScores": ""815 },816 {817 "id": "",818 "orgCode": "130703401901305",819 "fdesc": "æ²³ååæ¹å¦é¢éå±ç¬¬ä¸å»é¢",820 "hopGrade.id": "3",821 "hopType.id": "1",822 "clsCode": "",823 "exSchema.id": "",824 "exSchema1.id": "",825 "addr": "",826 "email": "",827 "tel": "",828 "rcArea.id": "130703",829 "province.id": "130703",830 "icd10.id": "",831 "dataCtg.id": "",832 "batStatMode": "",833 "hopPcFiles": "",834 "repLogs": "",835 "hopUsers": "",836 "chkScores": ""837 },838 {839 "id": "",840 "orgCode": "130705401925370",841 "fdesc": "æ²³ååæ¹å¦é¢éå±ç¬¬äºå»é¢",842 "hopGrade.id": "3",843 "hopType.id": "1",844 "clsCode": "",845 "exSchema.id": "",846 "exSchema1.id": "",847 "addr": "",848 "email": "",849 "tel": "",850 "rcArea.id": "130705",851 "province.id": "130705",852 "icd10.id": "",853 "dataCtg.id": "",854 "batStatMode": "",855 "hopPcFiles": "",856 "repLogs": "",857 "hopUsers": "",858 "chkScores": ""859 },860 {861 "id": "",862 "orgCode": "130108401704076",863 "fdesc": "æ²³åçå¿ç«¥å»é¢",864 "hopGrade.id": "3",865 "hopType.id": "1",866 "clsCode": "",867 "exSchema.id": "",868 "exSchema1.id": "",869 "addr": "",870 "email": "",871 "tel": "",872 "rcArea.id": "130108",873 "province.id": "130108",874 "icd10.id": "",875 "dataCtg.id": "",876 "batStatMode": "",877 "hopPcFiles": "",878 "repLogs": "",879 "hopUsers": "",880 "chkScores": ""881 },882 {883 "id": "",884 "orgCode": "130102401703903",885 "fdesc": "æ²³åçè¸ç§å»é¢",886 "hopGrade.id": "3",887 "hopType.id": "1",888 "clsCode": "",889 "exSchema.id": "",890 "exSchema1.id": "",891 "addr": "",892 "email": "",893 "tel": "",894 "rcArea.id": "130102",895 "province.id": "130102",896 "icd10.id": "",897 "dataCtg.id": "",898 "batStatMode": "",899 "hopPcFiles": "",900 "repLogs": "",901 "hopUsers": "",902 "chkScores": ""903 },904 {905 "id": "",906 "orgCode": "130102401704017",907 "fdesc": "æ²³åçä¸å»é¢",908 "hopGrade.id": "3",909 "hopType.id": "1",910 "clsCode": "",911 "exSchema.id": "",912 "exSchema1.id": "",913 "addr": "",914 "email": "",915 "tel": "",916 "rcArea.id": "130102",917 "province.id": "130102",918 "icd10.id": "",919 "dataCtg.id": "",920 "batStatMode": "",921 "hopPcFiles": "",922 "repLogs": "",923 "hopUsers": "",924 "chkScores": ""925 },926 {927 "id": "",928 "orgCode": "130102787000396",929 "fdesc": "æ²³åå»ç§å¤§å¦å£è
å»é¢",930 "hopGrade.id": "3",931 "hopType.id": "1",932 "clsCode": "",933 "exSchema.id": "",934 "exSchema1.id": "",935 "addr": "",936 "email": "",937 "tel": "",938 "rcArea.id": "130102",939 "province.id": "130102",940 "icd10.id": "",941 "dataCtg.id": "",942 "batStatMode": "",943 "hopPcFiles": "",944 "repLogs": "",945 "hopUsers": "",946 "chkScores": ""947 },948 {949 "id": "",950 "orgCode": "130108401748183",951 "fdesc": "æ²³åå»ç§å¤§å¦ç¬¬ä¸å»é¢",952 "hopGrade.id": "3",953 "hopType.id": "1",954 "clsCode": "",955 "exSchema.id": "",956 "exSchema1.id": "",957 "addr": "",958 "email": "",959 "tel": "",960 "rcArea.id": "130108",961 "province.id": "130108",962 "icd10.id": "",963 "dataCtg.id": "",964 "batStatMode": "",965 "hopPcFiles": "",966 "repLogs": "",967 "hopUsers": "",968 "chkScores": ""969 },970 {971 "id": "",972 "orgCode": "130203402250440",973 "fdesc": "æ²³åèå大å¦éå±å»é¢",974 "hopGrade.id": "3",975 "hopType.id": "1",976 "clsCode": "",977 "exSchema.id": "",978 "exSchema1.id": "",979 "addr": "",980 "email": "",981 "tel": "",982 "rcArea.id": "130203",983 "province.id": "130203",984 "icd10.id": "",985 "dataCtg.id": "",986 "batStatMode": "",987 "hopPcFiles": "",988 "repLogs": "",989 "hopUsers": "",990 "chkScores": ""991 },992 {993 "id": "",994 "orgCode": "130403795483471",995 "fdesc": "æ²³åå·¥ç¨å¤§å¦éå±å»é¢",996 "hopGrade.id": "3",997 "hopType.id": "1",998 "clsCode": "",999 "exSchema.id": "",1000 "exSchema1.id": "",1001 "addr": "",1002 "email": "",1003 "tel": "",1004 "rcArea.id": "130403",1005 "province.id": "130403",1006 "icd10.id": "",1007 "dataCtg.id": "",1008 "batStatMode": "",1009 "hopPcFiles": "",1010 "repLogs": "",1011 "hopUsers": "",1012 "chkScores": ""1013 },1014 {1015 "id": "",1016 "orgCode": "130102401751630",1017 "fdesc": "ç³å®¶åºå¸ç¬¬ä¸å»é¢",1018 "hopGrade.id": "3",1019 "hopType.id": "1",1020 "clsCode": "",1021 "exSchema.id": "",1022 "exSchema1.id": "",1023 "addr": "",1024 "email": "",1025 "tel": "",1026 "rcArea.id": "130102",1027 "province.id": "130102",1028 "icd10.id": "",1029 "dataCtg.id": "",1030 "batStatMode": "",1031 "hopPcFiles": "",1032 "repLogs": "",1033 "hopUsers": "",1034 "chkScores": ""1035 },1036 {1037 "id": "",1038 "orgCode": "130102401750347",1039 "fdesc": "ç³å®¶åºå¸ç¬¬ä¸å»é¢",1040 "hopGrade.id": "3",1041 "hopType.id": "1",1042 "clsCode": "",1043 "exSchema.id": "",1044 "exSchema1.id": "",1045 "addr": "",1046 "email": "",1047 "tel": "",1048 "rcArea.id": "130102",1049 "province.id": "130102",1050 "icd10.id": "",1051 "dataCtg.id": "",1052 "batStatMode": "",1053 "hopPcFiles": "",1054 "repLogs": "",1055 "hopUsers": "",1056 "chkScores": ""1057 },1058 {1059 "id": "",1060 "orgCode": "130102401750363",1061 "fdesc": "ç³å®¶åºå¸ç¬¬åå»é¢",1062 "hopGrade.id": "3",1063 "hopType.id": "1",1064 "clsCode": "",1065 "exSchema.id": "",1066 "exSchema1.id": "",1067 "addr": "",1068 "email": "",1069 "tel": "",1070 "rcArea.id": "130102",1071 "province.id": "130102",1072 "icd10.id": "",1073 "dataCtg.id": "",1074 "batStatMode": "",1075 "hopPcFiles": "",1076 "repLogs": "",1077 "hopUsers": "",1078 "chkScores": ""1079 },1080 {1081 "id": "",1082 "orgCode": "130104401750435",1083 "fdesc": "ç³å®¶åºå¸ä¸å»é¢",1084 "hopGrade.id": "3",1085 "hopType.id": "1",1086 "clsCode": "",1087 "exSchema.id": "",1088 "exSchema1.id": "",1089 "addr": "",1090 "email": "",1091 "tel": "",1092 "rcArea.id": "130104",1093 "province.id": "130104",1094 "icd10.id": "",1095 "dataCtg.id": "",1096 "batStatMode": "",1097 "hopPcFiles": "",1098 "repLogs": "",1099 "hopUsers": "",1100 "chkScores": ""1101 },1102 {1103 "id": "",1104 "orgCode": "130108401750398",1105 "fdesc": "ç³å®¶åºå¸ç¬¬äºå»é¢",1106 "hopGrade.id": "3",1107 "hopType.id": "1",1108 "clsCode": "",1109 "exSchema.id": "",1110 "exSchema1.id": "",1111 "addr": "",1112 "email": "",1113 "tel": "",1114 "rcArea.id": "130108",1115 "province.id": "130108",1116 "icd10.id": "",1117 "dataCtg.id": "",1118 "batStatMode": "",1119 "hopPcFiles": "",1120 "repLogs": "",1121 "hopUsers": "",1122 "chkScores": ""1123 },1124 {1125 "id": "",1126 "orgCode": "130202402248463",1127 "fdesc": "åå±±å¸äººæ°å»é¢",1128 "hopGrade.id": "3",1129 "hopType.id": "1",1130 "clsCode": "",1131 "exSchema.id": "",1132 "exSchema1.id": "",1133 "addr": "",1134 "email": "",1135 "tel": "",1136 "rcArea.id": "130202",1137 "province.id": "130202",1138 "icd10.id": "",1139 "dataCtg.id": "",1140 "batStatMode": "",1141 "hopPcFiles": "",1142 "repLogs": "",1143 "hopUsers": "",1144 "chkScores": ""1145 },1146 {1147 "id": "",1148 "orgCode": "130202402248391",1149 "fdesc": "åå±±å¸ååå»é¢",1150 "hopGrade.id": "3",1151 "hopType.id": "1",1152 "clsCode": "",1153 "exSchema.id": "",1154 "exSchema1.id": "",1155 "addr": "",1156 "email": "",1157 "tel": "",1158 "rcArea.id": "130202",1159 "province.id": "130202",1160 "icd10.id": "",1161 "dataCtg.id": "",1162 "batStatMode": "",1163 "hopPcFiles": "",1164 "repLogs": "",1165 "hopUsers": "",1166 "chkScores": ""1167 },1168 {1169 "id": "",1170 "orgCode": "13020240224848X",1171 "fdesc": "åå±±å¸å¦å¹¼ä¿å¥é¢",1172 "hopGrade.id": "3",1173 "hopType.id": "1",1174 "clsCode": "",1175 "exSchema.id": "",1176 "exSchema1.id": "",1177 "addr": "",1178 "email": "",1179 "tel": "",1180 "rcArea.id": "130202",1181 "province.id": "130202",1182 "icd10.id": "",1183 "dataCtg.id": "",1184 "batStatMode": "",1185 "hopPcFiles": "",1186 "repLogs": "",1187 "hopUsers": "",1188 "chkScores": ""1189 },1190 {1191 "id": "",1192 "orgCode": "130203402250395",1193 "fdesc": "åå±±å¸ç¬¬äºå»é¢",1194 "hopGrade.id": "3",1195 "hopType.id": "1",1196 "clsCode": "",1197 "exSchema.id": "",1198 "exSchema1.id": "",1199 "addr": "",1200 "email": "",1201 "tel": "",1202 "rcArea.id": "130203",1203 "province.id": "130203",1204 "icd10.id": "",1205 "dataCtg.id": "",1206 "batStatMode": "",1207 "hopPcFiles": "",1208 "repLogs": "",1209 "hopUsers": "",1210 "chkScores": ""1211 },1212 {1213 "id": "",1214 "orgCode": "130281403220403",1215 "fdesc": "éµåå¸äººæ°å»é¢",1216 "hopGrade.id": "3",1217 "hopType.id": "1",1218 "clsCode": "",1219 "exSchema.id": "",1220 "exSchema1.id": "",1221 "addr": "",1222 "email": "",1223 "tel": "",1224 "rcArea.id": "130281",1225 "province.id": "130281",1226 "icd10.id": "",1227 "dataCtg.id": "",1228 "batStatMode": "",1229 "hopPcFiles": "",1230 "repLogs": "",1231 "hopUsers": "",1232 "chkScores": ""1233 },1234 {1235 "id": "",1236 "orgCode": "130283402350396",1237 "fdesc": "è¿å®å¸ä¸å»å»é¢",1238 "hopGrade.id": "3",1239 "hopType.id": "1",1240 "clsCode": "",1241 "exSchema.id": "",1242 "exSchema1.id": "",1243 "addr": "",1244 "email": "",1245 "tel": "",1246 "rcArea.id": "130283",1247 "province.id": "130283",1248 "icd10.id": "",1249 "dataCtg.id": "",1250 "batStatMode": "",1251 "hopPcFiles": "",1252 "repLogs": "",1253 "hopUsers": "",1254 "chkScores": ""1255 },1256 {1257 "id": "",1258 "orgCode": "130203402248471",1259 "fdesc": "åå±±å¸å·¥äººå»é¢",1260 "hopGrade.id": "3",1261 "hopType.id": "1",1262 "clsCode": "",1263 "exSchema.id": "",1264 "exSchema1.id": "",1265 "addr": "",1266 "email": "",1267 "tel": "",1268 "rcArea.id": "130203",1269 "province.id": "130203",1270 "icd10.id": "",1271 "dataCtg.id": "",1272 "batStatMode": "",1273 "hopPcFiles": "",1274 "repLogs": "",1275 "hopUsers": "",1276 "chkScores": ""1277 },1278 {1279 "id": "",1280 "orgCode": "130203402248420",1281 "fdesc": "åå±±å¸ä¸å»å»é¢",1282 "hopGrade.id": "3",1283 "hopType.id": "1",1284 "clsCode": "",1285 "exSchema.id": "",1286 "exSchema1.id": "",1287 "addr": "",1288 "email": "",1289 "tel": "",1290 "rcArea.id": "130203",1291 "province.id": "130203",1292 "icd10.id": "",1293 "dataCtg.id": "",1294 "batStatMode": "",1295 "hopPcFiles": "",1296 "repLogs": "",1297 "hopUsers": "",1298 "chkScores": ""1299 },1300 {1301 "id": "",1302 "orgCode": "130208402310175",1303 "fdesc": "åå±±å¸ä¸°æ¶¦åºäººæ°å»é¢",1304 "hopGrade.id": "3",1305 "hopType.id": "1",1306 "clsCode": "",1307 "exSchema.id": "",1308 "exSchema1.id": "",1309 "addr": "",1310 "email": "",1311 "tel": "",1312 "rcArea.id": "130208",1313 "province.id": "130208",1314 "icd10.id": "",1315 "dataCtg.id": "",1316 "batStatMode": "",1317 "hopPcFiles": "",1318 "repLogs": "",1319 "hopUsers": "",1320 "chkScores": ""1321 },1322 {1323 "id": "",1324 "orgCode": "130181402045973",1325 "fdesc": "è¾éå¸ç¬¬ä¸å»é¢",1326 "hopGrade.id": "3",1327 "hopType.id": "1",1328 "clsCode": "",1329 "exSchema.id": "",1330 "exSchema1.id": "",1331 "addr": "",1332 "email": "",1333 "tel": "",1334 "rcArea.id": "130181",1335 "province.id": "130181",1336 "icd10.id": "",1337 "dataCtg.id": "",1338 "batStatMode": "",1339 "hopPcFiles": "",1340 "repLogs": "",1341 "hopUsers": "",1342 "chkScores": ""1343 },1344 {1345 "id": "",1346 "orgCode": "130502403390971",1347 "fdesc": "é¢å°å¸ä¸å»å»é¢",1348 "hopGrade.id": "3",1349 "hopType.id": "1",1350 "clsCode": "",1351 "exSchema.id": "",1352 "exSchema1.id": "",1353 "addr": "",1354 "email": "",1355 "tel": "",1356 "rcArea.id": "130502",1357 "province.id": "130502",1358 "icd10.id": "",1359 "dataCtg.id": "",1360 "batStatMode": "",1361 "hopPcFiles": "",1362 "repLogs": "",1363 "hopUsers": "",1364 "chkScores": ""1365 },1366 {1367 "id": "",1368 "orgCode": "130503692074667",1369 "fdesc": "é¢å°å»å¦é«çä¸ç§å¦æ ¡ç¬¬äºéå±å»é¢",1370 "hopGrade.id": "3",1371 "hopType.id": "1",1372 "clsCode": "",1373 "exSchema.id": "",1374 "exSchema1.id": "",1375 "addr": "",1376 "email": "",1377 "tel": "",1378 "rcArea.id": "130503",1379 "province.id": "130503",1380 "icd10.id": "",1381 "dataCtg.id": "",1382 "batStatMode": "",1383 "hopPcFiles": "",1384 "repLogs": "",1385 "hopUsers": "",1386 "chkScores": ""1387 },1388 {1389 "id": "",1390 "orgCode": "130503401880686",1391 "fdesc": "åä¸è½æºé¢å°ç¿ä¸æé责任å
¬å¸éå¢æ»å»é¢",1392 "hopGrade.id": "3",1393 "hopType.id": "1",1394 "clsCode": "",1395 "exSchema.id": "",1396 "exSchema1.id": "",1397 "addr": "",1398 "email": "",1399 "tel": "",1400 "rcArea.id": "130503",1401 "province.id": "130503",1402 "icd10.id": "",1403 "dataCtg.id": "",1404 "batStatMode": "",1405 "hopPcFiles": "",1406 "repLogs": "",1407 "hopUsers": "",1408 "chkScores": ""1409 },1410 {1411 "id": "",1412 "orgCode": "130529403298489",1413 "fdesc": "巨鹿å¿å»é¢",1414 "hopGrade.id": "3",1415 "hopType.id": "1",1416 "clsCode": "",1417 "exSchema.id": "",1418 "exSchema1.id": "",1419 "addr": "",1420 "email": "",1421 "tel": "",1422 "rcArea.id": "130529",1423 "province.id": "130529",1424 "icd10.id": "",1425 "dataCtg.id": "",1426 "batStatMode": "",1427 "hopPcFiles": "",1428 "repLogs": "",1429 "hopUsers": "",1430 "chkScores": ""1431 },1432 {1433 "id": "",1434 "orgCode": "130502403390912",1435 "fdesc": "é¢å°å¸äººæ°å»é¢",1436 "hopGrade.id": "3",1437 "hopType.id": "1",1438 "clsCode": "",1439 "exSchema.id": "",1440 "exSchema1.id": "",1441 "addr": "",1442 "email": "",1443 "tel": "",1444 "rcArea.id": "130502",1445 "province.id": "130502",1446 "icd10.id": "",1447 "dataCtg.id": "",1448 "batStatMode": "",1449 "hopPcFiles": "",1450 "repLogs": "",1451 "hopUsers": "",1452 "chkScores": ""1453 },1454 {1455 "id": "",1456 "orgCode": "130502403390234",1457 "fdesc": "æ²³åçç¼ç§å»é¢",1458 "hopGrade.id": "3",1459 "hopType.id": "1",1460 "clsCode": "",1461 "exSchema.id": "",1462 "exSchema1.id": "",1463 "addr": "",1464 "email": "",1465 "tel": "",1466 "rcArea.id": "130502",1467 "province.id": "130502",1468 "icd10.id": "",1469 "dataCtg.id": "",1470 "batStatMode": "",1471 "hopPcFiles": "",1472 "repLogs": "",1473 "hopUsers": "",1474 "chkScores": ""1475 },1476 {1477 "id": "",1478 "orgCode": "130503403390963",1479 "fdesc": "é¢å°å¸ç¬¬ä¸å»é¢",1480 "hopGrade.id": "3",1481 "hopType.id": "1",1482 "clsCode": "",1483 "exSchema.id": "",1484 "exSchema1.id": "",1485 "addr": "",1486 "email": "",1487 "tel": "",1488 "rcArea.id": "130503",1489 "province.id": "130503",1490 "icd10.id": "",1491 "dataCtg.id": "",1492 "batStatMode": "",1493 "hopPcFiles": "",1494 "repLogs": "",1495 "hopUsers": "",1496 "chkScores": ""1497 },1498 {1499 "id": "",1500 "orgCode": "130703401913601",1501 "fdesc": "å¼ å®¶å£å¦é¢éå±äººæ°å»é¢ï¼å¼ 家å£å¸ç¬¬ä¸å»é¢ï¼",1502 "hopGrade.id": "3",1503 "hopType.id": "1",1504 "clsCode": "",1505 "exSchema.id": "",1506 "exSchema1.id": "",1507 "addr": "",1508 "email": "",1509 "tel": "",1510 "rcArea.id": "130703",1511 "province.id": "130703",1512 "icd10.id": "",1513 "dataCtg.id": "",1514 "batStatMode": "",1515 "hopPcFiles": "",1516 "repLogs": "",1517 "hopUsers": "",1518 "chkScores": ""1519 },1520 {1521 "id": "",1522 "orgCode": "130729402101517",1523 "fdesc": "å¼ å®¶å£å¸ä¸å
¨åºä¸å»é¢",1524 "hopGrade.id": "3",1525 "hopType.id": "1",1526 "clsCode": "",1527 "exSchema.id": "",1528 "exSchema1.id": "",1529 "addr": "",1530 "email": "",1531 "tel": "",1532 "rcArea.id": "130729",1533 "province.id": "130729",1534 "icd10.id": "",1535 "dataCtg.id": "",1536 "batStatMode": "",1537 "hopPcFiles": "",1538 "repLogs": "",1539 "hopUsers": "",1540 "chkScores": ""1541 },1542 {1543 "id": "",1544 "orgCode": "130733402110026",1545 "fdesc": "å´ç¤¼åºäººæ°å»é¢",1546 "hopGrade.id": "3",1547 "hopType.id": "1",1548 "clsCode": "",1549 "exSchema.id": "",1550 "exSchema1.id": "",1551 "addr": "",1552 "email": "",1553 "tel": "",1554 "rcArea.id": "130733",1555 "province.id": "130733",1556 "icd10.id": "",1557 "dataCtg.id": "",1558 "batStatMode": "",1559 "hopPcFiles": "",1560 "repLogs": "",1561 "hopUsers": "",1562 "chkScores": ""1563 },1564 {1565 "id": "",1566 "orgCode": "130203730249684",1567 "fdesc": "å¼æ»¦æ»å»é¢",1568 "hopGrade.id": "3",1569 "hopType.id": "1",1570 "clsCode": "",1571 "exSchema.id": "",1572 "exSchema1.id": "",1573 "addr": "",1574 "email": "",1575 "tel": "",1576 "rcArea.id": "130203",1577 "province.id": "130203",1578 "icd10.id": "",1579 "dataCtg.id": "",1580 "batStatMode": "",1581 "hopPcFiles": "",1582 "repLogs": "",1583 "hopUsers": "",1584 "chkScores": ""1585 },1586 {1587 "id": "",1588 "orgCode": "130302401816123",1589 "fdesc": "秦çå²å¸å¦å¹¼ä¿å¥é¢",1590 "hopGrade.id": "3",1591 "hopType.id": "1",1592 "clsCode": "",1593 "exSchema.id": "",1594 "exSchema1.id": "",1595 "addr": "",1596 "email": "",1597 "tel": "",1598 "rcArea.id": "130302",1599 "province.id": "130302",1600 "icd10.id": "",1601 "dataCtg.id": "",1602 "batStatMode": "",1603 "hopPcFiles": "",1604 "repLogs": "",1605 "hopUsers": "",1606 "chkScores": ""1607 },1608 {1609 "id": "",1610 "orgCode": "130322401830208",1611 "fdesc": "秦çå²å¸ç¬¬äºå»é¢",1612 "hopGrade.id": "3",1613 "hopType.id": "1",1614 "clsCode": "",1615 "exSchema.id": "",1616 "exSchema1.id": "",1617 "addr": "",1618 "email": "",1619 "tel": "",1620 "rcArea.id": "130322",1621 "province.id": "130322",1622 "icd10.id": "",1623 "dataCtg.id": "",1624 "batStatMode": "",1625 "hopPcFiles": "",1626 "repLogs": "",1627 "hopUsers": "",1628 "chkScores": ""1629 },1630 {1631 "id": "",1632 "orgCode": "130302401816107",1633 "fdesc": "秦çå²å¸ä¸å»å»é¢",1634 "hopGrade.id": "3",1635 "hopType.id": "1",1636 "clsCode": "",1637 "exSchema.id": "",1638 "exSchema1.id": "",1639 "addr": "",1640 "email": "",1641 "tel": "",1642 "rcArea.id": "130302",1643 "province.id": "130302",1644 "icd10.id": "",1645 "dataCtg.id": "",1646 "batStatMode": "",1647 "hopPcFiles": "",1648 "repLogs": "",1649 "hopUsers": "",1650 "chkScores": ""1651 },1652 {1653 "id": "",1654 "orgCode": "130302401816078",1655 "fdesc": "秦çå²å¸ç¬¬ä¸å»é¢",1656 "hopGrade.id": "3",1657 "hopType.id": "1",1658 "clsCode": "",1659 "exSchema.id": "",1660 "exSchema1.id": "",1661 "addr": "",1662 "email": "",1663 "tel": "",1664 "rcArea.id": "130302",1665 "province.id": "130302",1666 "icd10.id": "",1667 "dataCtg.id": "",1668 "batStatMode": "",1669 "hopPcFiles": "",1670 "repLogs": "",1671 "hopUsers": "",1672 "chkScores": ""1673 },1674 {1675 "id": "",1676 "orgCode": "ä¸å½ç³æ²¹ä¸å¿å»é¢",1677 "fdesc": "3",1678 "hopGrade.id": "1",1679 "hopType.id": "",1680 "clsCode": "",1681 "exSchema.id": "",1682 "exSchema1.id": "",1683 "addr": "",1684 "email": "",1685 "tel": "131003",1686 "rcArea.id": "131003",1687 "province.id": "",1688 "icd10.id": "",1689 "dataCtg.id": "",1690 "batStatMode": "",1691 "hopPcFiles": "",1692 "repLogs": "",1693 "hopUsers": ""1694 },1695 {1696 "id": "",1697 "orgCode": "131003718312556",1698 "fdesc": "ä¸å½ç³æ²¹ä¸å¿å»é¢",1699 "hopGrade.id": "3",1700 "hopType.id": "1",1701 "clsCode": "",1702 "exSchema.id": "",1703 "exSchema1.id": "",1704 "addr": "",1705 "email": "",1706 "tel": "",1707 "rcArea.id": "131003",1708 "province.id": "131003",1709 "icd10.id": "",1710 "dataCtg.id": "",1711 "batStatMode": "",1712 "hopPcFiles": "",1713 "repLogs": "",1714 "hopUsers": "",1715 "chkScores": ""1716 }...
library.js
Source:library.js
1/**2 * library generation3 */4var fs = require('fs'),5 path = require('path'),6 wrench = require('wrench'),7 crypto = require('crypto'),8 _ = require('underscore'),9 log = require('../log'),10 util = require('../util'),11 jsgen = require('./jsgen'),12 typelib = require('./type'),13 HEADER = util.HEADER;14exports.generateLibrary = generateLibrary;15exports.getArchitectures = getArchitectures;16exports.prepareArchitecture = prepareArchitecture;17exports.generateBuiltinClasses = generateBuiltinClasses;18exports.writeSourceFile = writeSourceFile;19exports.loadSourceCache = loadSourceCache;20exports.saveSourceCache = saveSourceCache;21exports.generateCodeDependencies = generateCodeDependencies;22exports.generateCode = generateCode;23// for testing24exports.compileType = compileType;25function getArchitectures(options, callback) {26 loadLibrary(options).getArchitectures(options, callback);27}28function prepareArchitecture (options, arch, details, settings, callback) {29 loadLibrary(options).prepareArchitecture(options, arch, details, settings, callback);30}31function loadLibrary(options) {32 // we are going to load the platform library from the platform dir33 var platform_lib = path.join(options.platform_dir, 'lib', 'library.js');34 if (!fs.existsSync(platform_lib)) {35 throw new Error("Couldn't find platform library at "+platform_lib);36 }37 var library = require(platform_lib);38 return library;39}40/**41 * load in the source cache file42 */43function loadSourceCache (options) {44 var hash = util.sha1(JSON.stringify(options));45 options.srcCacheFn = path.join(options.srcdir,'srccache.json')46 options.compilerSrcCache = {};47 if (!fs.existsSync(options.srcdir)) {48 wrench.mkdirSyncRecursive(options.srcdir);49 }50 else {51 fs.existsSync(options.srcCacheFn) && (options.compilerSrcCache = JSON.parse(fs.readFileSync(options.srcCacheFn,'utf8')));52 log.trace('generating source cache hashes (options,file)=>',hash,options.compilerSrcCache.hash)53 if (options.compilerSrcCache && options.compilerSrcCache.hash!=hash) {54 log.info('reset compiler cache because options have changed. forcing a rebuild');55 options.compilerSrcCache = {};56 }57 options.compilerSrcCache.hash = hash;58 }59}60/**61 * save our source cache file62 */63function saveSourceCache (options) {64 log.trace('saving',options.compilerSrcCache)65 fs.writeFileSync(options.srcCacheFn, JSON.stringify(options.compilerSrcCache,null,3),'utf8');66}67/**68 * called to generate a pre-compiled native metabase library69 */70function generateLibrary(options, callback) {71 log.info('Generating library');72 var library = loadLibrary(options);73 // set the global platform in the typelib74 typelib.platform = options.platform_dir;75 // put the files as a child directory of the destination dir76 options.srcdir = path.join(options.dest,'src');77 var outdir = options.outdir = path.join(options.dest,'build');78 if (!fs.existsSync(options.srcdir)) {79 wrench.mkdirSyncRecursive(options.srcdir);80 }81 if (!fs.existsSync(options.outdir)) {82 wrench.mkdirSyncRecursive(options.outdir);83 }84 // by default, this is the hyperloop library85 options.libname = options.libname || library.getDefaultLibraryName();86 var header_name = 'hyperloop' + library.getFileExtension(true)87 header = path.join(options.dest, header_name),88 header_dir = options.dest;89 // if we already have a header, make sure we regenerate since we have dynamic headers/source90 if (fs.existsSync(header)){91 fs.unlinkSync(header);92 if (fs.existsSync(options.srcdir)) {93 wrench.rmdirSyncRecursive(options.srcdir);94 }95 }96 97 function proceed () {98 99 // delete any files that already exist100 util.filelisting(options.dest,/\.(a|so|dylib|dll|lib)$/).forEach(fs.unlinkSync);101 102 // start the generation and compilation103 library.prepareLibrary(options,function(err, archs, details, settings) {104 if (err) return callback(err);105 var i = 0,106 arch_results = {};107 (function nextArch() {108 var arch = archs[i++];109 if (arch) {110 // put the files as a child directory of the destination dir111 options.srcdir = path.join(options.dest,'src',arch);112 options.outdir = path.join(outdir,arch);113 loadSourceCache(options);114 // generate for each architecture115 library.prepareArchitecture(options, arch, details, settings, function(err, metabase) {116 if (err) return callback(err);117 // file which we are going to compile118 options.srcfiles = [];119 // set the metabase120 typelib.metabase = metabase;121 // reset to remove any cached types since we're changing metabase122 typelib.reset();123 generateBuiltinClasses(options, arch, metabase, library);124 // save our source cache125 saveSourceCache(options);126 library.compileLibrary(options, arch, metabase, function(err, libfile){127 if (err) return callback(err);128 arch_results[arch] = libfile;129 nextArch();130 });131 });132 }133 else {134 library.generateLibrary(options, arch_results, settings, callback);135 // write out the symbol map for the library136 var symmap = jsgen.getSymbolMap();137 fs.writeFileSync(path.join(options.dest,'library_symbols.json'),JSON.stringify(symmap,null,'\t'),'utf8');138 }139 })();140 });141 }142 // allow the library to validate options143 library.validateOptions ? library.validateOptions(options, proceed) : proceed();144}145/**146 * called to copy any built-in classes to the src directory147 */148function generateBuiltinClasses(options, arch, metabase, library, header_only) {149 var basedir = path.join(__dirname,'..','..','templates'), // common code templates150 // platform specific code templates151 platform_basedir = path.join(options.platform_dir,'templates'),152 header_name = 'hyperloop' + library.getFileExtension(true),153 files = fs.readdirSync(basedir).filter(function(f){return f.indexOf(header_name)==-1}).map(function(f) { return path.join(basedir, f) }),154 platform_files = fs.existsSync(platform_basedir) ? fs.readdirSync(platform_basedir).map(function(f){ return path.join(platform_basedir,f) }) : [],155 header = path.join(basedir, header_name),156 hyperloopHeader = path.join(options.headerdir, header_name),157 impls = [],158 headerCreated = fs.existsSync(hyperloopHeader);159 !headerCreated && util.copyFileSync(path.join(basedir, header_name), hyperloopHeader);160 files = files.concat(platform_files);161 // we are going to group _ headers in sorted order before non _ files162 var agroup = files.filter(function(f) { return path.basename(f).charAt(0)==='_'; }),163 bgroup = files.filter(function(f) { return path.basename(f).charAt(0)!=='_'; });164 // prefer underscores first before real headers. this allows us to order things 165 // that need to be loaded before others166 function sorter(a,b) {167 var a1 = path.basename(a).charAt(0),168 b1 = path.basename(b).charAt(1);169 if (a1==b1) return 0;170 if (a1=='_') return -1;171 return 1;172 }173 // only sort the _ files, not the others so we can preserve order between common and platform174 var sorted = agroup.sort(sorter).concat(bgroup).filter(function(fn){175 return !util.isDirectory(fn) && !/^\.(DS_Store|git|svn|cvs)/.test(path.basename(fn));176 });177 sorted.forEach(function(fn){178 var ext = path.extname(fn),179 basename = path.basename(fn),180 base = basename.replace(ext,''),181 header = ext=='.h',182 prepend = basename.charAt(0)==='_',183 destfn = path.join(header ? options.headerdir : options.srcdir, base + library.getFileExtension(header)),184 is_platform = fn.indexOf(platform_basedir)==0,185 exists = fs.existsSync(destfn),186 hlfn = hyperloopHeader;187 // copy the files into the source directory, correctly setting the file extensions188 // for the platform. this allows us to use a generic file extension and have it 189 // correctly set when the files are copied (for example changing .cpp -> .m on ios)190 if (header && !headerCreated) {191 // we always merge all headers to the main hyperloop.h so we only need192 // to distribute one file193 prepend ? util.prependFileSync(fn,hlfn) : util.appendFileSync(fn, hlfn);194 }195 else if (!header_only && !header) {196 if (is_platform && exists) {197 util.appendFileSync(fn, destfn);198 }199 else {200 var content = fs.readFileSync(fn,'utf8').toString();201 options.obfuscate && (impls.push(content));202 writeSourceFile(options, library, destfn, content, true);203 }204 }205 });206 // we are going to obfuscate our exported APIs such that the final compiled207 // code will have randomized function names. from a dev standpoint, the 208 // developer still uses the export API name but the compiler will turn that 209 // name into the obfuscated name during compilation210 if (options.obfuscate && !headerCreated) {211 var exportRegEx = /EXPORTAPI\s+(.*)?\s+(\w+)\s*\(/,212 exportFPRegEx = /typedef\s+(\w+)\s+\(\*(.*)?\)\s*\(/,213 staticRegEx = /static\s+(.*)?\s+(\w+)\s*\(/,214 renameWords = ['Appcelerator','Hyperloop','Titanium'],215 renameListRegEx = new RegExp('('+renameWords.join('|')+')','i'),216 exportedAPIS = {'HyperloopAppRequire':1},217 content = fs.readFileSync(hyperloopHeader,'utf8').toString();218 function extractSymbols(fcontents) {219 fcontents.split('\n').forEach(function(line){220 // log.debug('testing',line)221 line = line.trim();222 var fn;223 if (line && exportRegEx.test(line)) {224 var m = exportRegEx.exec(line);225 fn = m[2];226 }227 else if (line && staticRegEx.test(line)) {228 var m = staticRegEx.exec(line);229 fn = renameListRegEx.test(m[2]) && m[2];230 }231 else if (line && exportFPRegEx.test(line)) {232 var m = exportFPRegEx.exec(line);233 fn = m[2];234 }235 if (fn && !(fn in exportedAPIS)) {236 exportedAPIS[fn]=1;237 }238 });239 }240 // extract symbols from hyperloop.h241 extractSymbols(content);242 // extract additional symbols from each implementation243 impls.forEach(function(icontent){244 extractSymbols(icontent);245 });246 var defines = '// rename our common symbols for obfuscation. these are generated library build\n' +247 Object.keys(exportedAPIS)248 .concat(renameWords)249 .map(function(k){250 return '#define '+k+' '+jsgen.obfuscate(k,'HL_');251 })252 .join('\n') + '\n';253 // insert after the first comment block254 var idx = content.indexOf('*/');255 if (idx > 0) {256 content = content.substring(0,idx+2) + '\n\n' + defines + content.substring(idx+2);257 }258 else {259 content = defines + content;260 }261 fs.writeFileSync(hyperloopHeader,content,'utf8');262 }263}264/**265 * generate code for all functions266 */267function generateFunctions(options, state, metabase, library, functions) {268 var code = [HEADER],269 fncode = [];270 // generate header details271 code.push(util.multilineComment('Hyperloop functions library'));272 code.push('');273 code.push('#include <hyperloop.h>');274 code.push('');275 library.prepareFunctions && library.prepareFunctions(options,state,metabase,library,code,functions);276 functions.forEach(function (fn) {277 // resolve the return type278 typelib.resolveType(fn.returnType);279 library.prepareFunction && library.prepareFunction(options,metabase,state,fn.name,code);280 // generate the function281 compileFunction(options, metabase, state, library, fn.name, fn, fncode);282 });283 // let the library do it's own includes284 library.prepareIncludes && library.prepareIncludes(options,metabase,state,code);285 code.push('#ifdef __cplusplus');286 code.push('extern "C" {');287 code.push('#endif');288 if (fncode.length) {289 // this must be called before processing290 library.prepareHeader(options, metabase, state, '', code);291 // append function body code292 code = code.concat(fncode);293 // this must be called after processing294 library.prepareFooter(options, metabase, state, '', code);295 code.push('#ifdef __cplusplus');296 code.push('}');297 code.push('#endif');298 // determine the filename299 var outfn = path.join(options.srcdir, library.getFunctionsFilename(options, metabase, state));300 // write source file if required301 writeSourceFile(options,library,outfn,code);302 }303}304function addExtern(externs, ext) {305 ext = /^EXPORTAPI/.test(ext) ? ext : ('EXPORTAPI '+ext);306 ~~externs.indexOf(ext) && externs.push(ext);307}308/**309 * generate code for all types310 */311function generateTypes(options, state, metabase, library) {312 var types = typelib.types, // get all the dependent types313 code = [HEADER],314 typecode = [],315 state = {};316 // generate header details317 code.push(util.multilineComment('Hyperloop types library'));318 code.push('');319 code.push('#include <hyperloop.h>');320 // let the library do it's own includes321 library.prepareIncludes && library.prepareIncludes(options,metabase,state,code);322 if (library.shouldCompileTypes && !library.shouldCompileTypes()) {323 return;324 }325 library.prepareTypes && library.prepareTypes(options,state,metabase,library,code);326 types.forEach(function (typename) {327 var typeobj = typelib.resolveType(typename);328 if (typeobj.isNativeConstant()) {329 // resolve constant type330 typeobj = typelib.resolveType(typeobj.toName());331 var externs = [], export_externs = [];332 compileConstant(options, metabase, state, library, typename, typeobj, typecode, externs);333 externs.forEach(function(e) {334 addExtern(export_externs, e);335 });336 export_externs.forEach(function(e) {337 code.push(e+';');338 });339 code.push('');340 } else if (typeobj.isNativeNull() || typeobj.isNativeVoid() || typeobj.isNativePrimitive()341 || typeobj.isNativeString() || typeobj._void || typeobj.isNativeBoolean() || typeobj.isNativePointer()) {342 return;343 } else {344 var type = library.prepareType(options, metabase, state, typename);345 if (typeobj.isNativeFunctionPointer() || type) {346 // generate the type347 compileType(options, metabase, state, library, typename, type, typecode);348 }349 }350 });351 code.push('#ifdef __cplusplus');352 code.push('extern "C" {');353 code.push('#endif');354 if (typecode.length) {355 // this must be called before processing356 library.prepareHeader(options, metabase, state, '', code);357 // append function body code358 code = code.concat(typecode);359 // this must be called after processing360 library.prepareFooter(options, metabase, state, '', code);361 code.push('#ifdef __cplusplus');362 code.push('}');363 code.push('#endif');364 // determine the filename365 var outfn = path.join(options.srcdir, library.getTypesFilename(options, metabase, state));366 // write source file if required367 writeSourceFile(options,library,outfn,code);368 }369}370/**371 * generate code for constants372 */373function compileConstant(options, metabase, state, library, typename, typeobj, code, externs) {374 var preamble = [], 375 cleanup = [];376 var body = typeobj.toJSBody(typename,preamble,cleanup,externs);377 code.push(util.multilineComment('constant: '+typename));378 code.push('EXPORTAPI JSValueRef '+typename+'_Get(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');379 code.push('{');380 preamble.forEach(function(l) {381 code.push(l);382 });383 code.push('\tauto result = '+body+';');384 cleanup.forEach(function(l) {385 code.push(l);386 });387 code.push('\treturn result;');388 code.push('}'); 389 code.push('');390}391/**392 * generate a function body code393 */394function compileFunction(options, metabase, state, library, fnname, fn, code) {395 var gen = library.generateFunction(options, metabase, state, '\t', fnname, fn);396 code.push(util.multilineComment('function: '+fnname));397 code.push('EXPORTAPI JSValueRef '+fnname+'_function(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');398 code.push('{');399 code.push(gen);400 code.push('}'); 401 code.push('');402 fn.arguments.forEach(function(arg,index){403 var type = arg.type||arg.subtype||arg.name;404 if (!type) {405 throw new Error("couldn't determine argument["+index+"] type for function: "+fnname,arg);406 }407 typelib.resolveType(type);408 });409}410/**411 * generate a type body code412 */413function compileType(options, metabase, state, library, typename, type, code) {414 var typeobj = typelib.resolveType(typename),415 name = typeobj.getAsKey();416 // to keep track of one's generated since we format types (such as enum Foo -> Foo) and417 // we need to make that we don't generate two for both (enum and non enum prefixes)418 if (!state.types) {419 state.types = {};420 }421 if (name in state.types) {422 log.debug("ignoring already generated type",name);423 return;424 }425 if (typeobj.isNativeObject()) {426 // objects already have their own conversion functions427 return;428 }429 if (typeobj.isNativeFunctionPointer()) {430 code.push(util.multilineComment('callback for '+typename));431 var gen = typeobj.toNativeFunctionCallback(name);432 code.push(gen);433 code.push('');434 }435 state.types[name]=1;436 var cast = typeobj.toCast(),437 isObject = typeobj.isNativeFunctionPointer() ||438 typeobj.isNativePointer() || typeobj.isNativeStruct() || 439 typeobj.isNativeBlock() || typeobj.isNativeUnion(),440 preamble = [], 441 cleanup = [],442 declare = [],443 body = [];444 isObject && body.push(typeobj.toDeclaration());445 body.push(util.multilineComment('type: '+typename+' to JSValueRef'));446 body.push('EXPORTAPI JSValueRef '+typeobj.toJSValueName()+'(JSContextRef ctx, '+cast+' value, JSValueRef *exception)');447 body.push('{');448 //TODO: review this -- maybe move this back into type.js?449 if (!isObject) {450 gen = typeobj.toJSBody('value',preamble,cleanup,declare);451 preamble.length && preamble.forEach(function(c){body.push('\t'+c)});452 body.push('\tauto result$ = '+gen+';');453 cleanup.length && cleanup.forEach(function(c){body.push('\t'+c)});454 body.push('\treturn result$;');455 declare.length && declare.forEach(function(c){code.push(c)});456 }457 else {458 body.push('\treturn JSObjectMake(ctx,Register'+typeobj.toName()+'(),new Hyperloop::NativeObject<'+cast+'>(value));');459 }460 body.push('}'); 461 body.push('');462 body.push(util.multilineComment('type: '+typename+' from JSValueRef'));463 body.push('EXPORTAPI '+cast+' '+typeobj.toNativeName()+'(JSContextRef ctx, JSValueRef value, JSValueRef *exception)');464 body.push('{');465 if (!isObject) {466 preamble.length && (preamble=[]);467 cleanup.length && (cleanup=[]);468 declare.length && (declare=[]);469 gen = typeobj.toNativeBody('value',preamble,cleanup,declare);470 preamble.length && preamble.forEach(function(c){body.push('\t'+c)});471 body.push('\tauto result$ = static_cast<'+cast+'>('+gen+');');472 cleanup.length && cleanup.forEach(function(c){body.push('\t'+c)});473 body.push('\treturn result$;');474 declare.length && declare.forEach(function(c){code.push(c)});475 }476 else {477 body.push('\tauto p = JSObjectGetPrivate(JSValueToObject(ctx,value,exception));');478 body.push('\tauto po = reinterpret_cast<Native'+typeobj.toName()+'>(p);');479 body.push('\treturn po->getObject();');480 }481 body.push('}'); 482 body.push('');483 code.push(body.join('\n'));484}485/**486 * generate a method body code487 */488function compileMethod(options, metabase, state, library, classname, methodname, methods, code, superCall) {489 var methods = Array.isArray(methods) ? methods : [methods],490 typeobj = typelib.resolveType(classname),491 cast = typeobj.toCast(),492 mangledClassname = jsgen.sanitizeClassName(classname),493 indent = '\t';494 methods.forEach(function(method) {495 var instance = library.isMethodInstance(options, metabase, state, method),496 isConstructor = superCall ? false : library.isMethodConstructor ? library.isMethodConstructor(options,metabase,state,method) : false,497 ig = library.prepareMethod(options,metabase,state,classname,methodname,methods,code),498 varname = instance ? mangledClassname.toLowerCase() : mangledClassname,499 signature = library.getMethodSignature(options, metabase, state, classname, methodname, method),500 gen = library.generateMethod(options, metabase, state, indent, varname, classname, method, methodname, superCall, isConstructor),501 fn = jsgen.generateMethodName(classname, methodname)+(methods.length > 1 ? signature : ''),502 ig = typelib.resolveType(method.returnType);503 code.push(util.multilineComment('method: '+(method.selector||method.signature||method.name)));504 code.push('EXPORTAPI JSValueRef '+fn+'(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');505 code.push('{');506 if (instance && !isConstructor) {507 code.push(indent+'auto '+varname+' = ToNativeObject(JSValueToObject(ctx,arguments[0],exception));');508 code.push(indent+'if ('+varname+' == nullptr)');509 code.push(indent+'{');510 code.push(indent+'\t*exception = HyperloopMakeException(ctx,"couldn\'t convert object to '+classname+'");');511 code.push(indent+'\treturn JSValueMakeUndefined(ctx);');512 code.push(indent+'}');513 }514 code.push(gen);515 code.push('}');516 code.push('');517 method.args.forEach(function(arg){518 typelib.resolveType(arg.type);519 });520 });521}522/**523 * generate a property body code524 */525function compileProperty(options, metabase, state, library, classname, propertyname, property, code, isGetter) {526 var typeobj = typelib.resolveType(classname),527 cast = typeobj.toCast(),528 varname = jsgen.sanitizeClassName(classname).toLowerCase(),529 instance = library.isPropertyInstance(options, metabase, state, property),530 indent = '\t',531 ig = library.prepareProperty(options,metabase,state,classname,propertyname,property,code,isGetter);532 if (isGetter) {533 var fn = jsgen.generateGetterName(classname, propertyname);534 code.push(util.multilineComment('property getter: '+propertyname));535 code.push('EXPORTAPI JSValueRef '+fn+'(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');536 code.push('{');537 code.push('\tJSValueRef result = nullptr;');538 if (instance) {539 code.push(indent+'auto '+varname+' = ToNativeObject(JSValueToObject(ctx,arguments[0],exception));');540 code.push(indent+'if ('+varname+' == nullptr)');541 code.push(indent+'{');542 code.push(indent+'\t*exception = HyperloopMakeException(ctx,"couldn\'t convert object to '+classname+'");');543 code.push(indent+'\treturn JSValueMakeUndefined(ctx);');544 code.push(indent+'}');545 }546 var gen = library.generateGetterProperty(options, metabase, state, library, classname, propertyname, property, varname, cast, indent);547 code.push(gen);548 code.push('\treturn result;');549 code.push('}'); 550 code.push('');551 }552 else {553 var fn = jsgen.generateSetterName(classname, propertyname);554 code.push(util.multilineComment('property setter: '+propertyname));555 code.push('EXPORTAPI JSValueRef '+fn+'(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');556 code.push('{');557 code.push('\tJSValueRef result = nullptr;');558 if (instance) {559 code.push(indent+'auto '+varname+' = ToNativeObject(JSValueToObject(ctx,arguments[0],exception));');560 code.push(indent+'if ('+varname+' == nullptr)');561 code.push(indent+'{');562 code.push(indent+'\t*exception = HyperloopMakeException(ctx,"couldn\'t convert object to '+classname+'");');563 code.push(indent+'\treturn JSValueMakeUndefined(ctx);');564 code.push(indent+'}');565 code.push(indent+'auto value = arguments[1];');566 } else {567 code.push(indent+'auto value = arguments[0];');568 }569 var gen = library.generateSetterProperty(options, metabase, state, library, classname, propertyname, property, varname, cast, indent);570 code.push(gen);571 code.push('\treturn result;');572 code.push('}'); 573 code.push('');574 }575}576/**577 * class to hold each compile unit578 */579function SourceEntry(options, library, outfn, code) {580 this.srcfile = outfn;581 this.objfile = path.join(options.outdir,path.basename(outfn)).replace(path.extname(outfn),library.getObjectFileExtension(false));582 this.compile = /\.(cpp|m|mm|c)$/.test(path.extname(outfn)); // only compile C/C++ files583 this.hash = crypto.createHash('md5').update(code).digest('hex');584 options.srcfiles.push(this);585 // if not on disk, remove it586 if (!fs.existsSync(this.objfile) && (outfn in options.compilerSrcCache)) {587 delete options.compilerSrcCache[outfn];588 }589}590/**591 * check the compiler source cache and return true if the same as the code592 * we have generated593 */594function writeSourceFile(options, library, outfn, code, write) {595 var srccode = Array.isArray(code) ? code.join('\n') : code,596 entry = new SourceEntry(options, library, outfn, srccode);597 // --skip-codegen option skips overwriting existing file598 if (!write && fs.existsSync(outfn) && options['skip-codegen']) {599 var hashB = crypto.createHash('md5').update(fs.readFileSync(outfn,'utf8').toString()).digest('hex');600 if (entry.hash==hashB) {601 entry.compile = false;602 } else {603 options.compilerSrcCache[outfn] = hashB;604 }605 return;606 }607 // write our output608 write && !fs.existsSync(outfn) && (write=true) && fs.writeFileSync(outfn, srccode, 'utf8');609 // don't re-write same files unless force compile610 if (fs.existsSync(outfn) && !options.force) {611 if (outfn in options.compilerSrcCache) {612 var hashB = crypto.createHash('md5').update(fs.readFileSync(outfn,'utf8').toString()).digest('hex');613 if (entry.hash==hashB) {614 log.debug('cached function source file from',outfn.cyan);615 entry.compile = false;616 }617 }618 }619 // remember the cache620 options.compilerSrcCache[outfn] = entry.hash;621 // only write if we are compiling622 if (entry.compile && !write) {623 // write out the content624 fs.writeFileSync(outfn, srccode, 'utf8');625 log.debug('wrote source file to',outfn.cyan);626 }627}628/**629 * generate dependent types found during processing630 */631function generateCodeDependentTypes(options,state,symboltable) {632 typelib.classes.forEach(function(_k){633 var k = typelib.resolveType(_k).toSafeClassName();634 if (!(k in symboltable.classmap)) {635 // we have detected a class dependency that we need to record636 symboltable.classmap[k] = {637 static_methods: {},638 instance_methods: {},639 getters: {},640 setters: {},641 constructors: {}642 };643 }644 });645}646/**647 * generate source code648 */649function generateCodeDependencies(options,state,symboltable,relativeFilename,arch,symbols,nodefail) {650 var classmap = symboltable.classmap || {},651 functions = symboltable.functions || {},652 variablemap = symboltable.variablemap && symboltable.variablemap[relativeFilename];653 if (!symboltable.classmap) {654 symboltable.classmap = classmap;655 symboltable.functions = functions;656 }657 if (!variablemap) {658 symboltable.variablemap = {};659 symboltable.variablemap[relativeFilename] = variablemap = {};660 }661 // custom class symbol should be added to symbol table even if it is never used662 state.custom_classes && Object.keys(state.custom_classes).forEach(function(c) {663 symboltable.classmap[c] = symboltable.classmap[c] || {664 static_methods: {},665 instance_methods: {},666 getters: {},667 setters: {},668 constructors: {}669 };670 });671 var metabase = state.metabase;672 function resolveTypes(returnType,args) {673 // resolve each arg674 args && args.length && args.forEach(function(arg){675 if (typeof(arg.type)!=='string') {676 arg.type = arg.type.value;677 }678 arg.type && typelib.resolveType(arg.type);679 });680 if (typeof(returnType)!=='string' && returnType.value) {681 returnType = returnType.value;682 } else if (returnType instanceof typelib.Class) {683 returnType = returnType.toName();684 }685 // resolve and return the result type686 return typelib.resolveType(returnType);687 }688 Object.keys(symbols).forEach(function(name){689 var symbol = symbols[name];690 switch (symbol.type) {691 case 'constructor': 692 case 'statement':693 case 'method': {694 var entry = classmap[symbol.class];695 if (!entry) {696 entry = {697 static_methods: {},698 instance_methods: {},699 getters: {},700 setters: {},701 constructors: {}702 };703 classmap[symbol.class] = entry;704 }705 if (name in variablemap) {706 variablemap[name].push(symbol.symbolname);707 }708 else {709 variablemap[name] = [symbol.symbolname];710 }711 switch (symbol.metatype) {712 case 'instance': {713 entry.instance_methods[symbol.symbolname] = symbol;714 var type = resolveTypes(symbol.returnType,symbol.method.args);715 if (type && type.isNativeObject()) {716 var typename = type.toName();717 classmap[typename] = classmap[typename] || {718 static_methods: {},719 instance_methods: {},720 getters: {},721 setters: {},722 constructors: {}723 };724 }725 break;726 }727 case 'static': {728 entry.static_methods[symbol.symbolname] = symbol;729 var type = resolveTypes(symbol.returnType,symbol.method.args);730 if (type && type.isNativeObject()) {731 var typename = type.toName();732 classmap[typename] = classmap[typename] || {733 static_methods: {},734 instance_methods: {},735 getters: {},736 setters: {},737 constructors: {}738 };739 }740 break;741 }742 case 'setter': {743 entry.setters[symbol.symbolname] = symbol;744 var type = resolveTypes(symbol.property.type);745 break;746 }747 case 'getter': {748 entry.getters[symbol.symbolname] = symbol;749 var type = resolveTypes(symbol.property.type);750 if (type && type.isNativeObject()) {751 var typename = type.toName();752 classmap[typename] = classmap[typename] || {753 static_methods: {},754 instance_methods: {},755 getters: {},756 setters: {},757 constructors: {}758 };759 }760 break;761 }762 case 'constructor': {763 // this is constructor764 var type = resolveTypes(symbol.class, symbol.method && symbol.method.args);765 entry.constructors[symbol.symbolname] = symbol;766 break;767 }768 default: {769 throw new Error("unknown metatype:"+symbol.type);770 }771 }772 break;773 }774 case 'function': {775 functions[name] = symbol;776 break;777 }778 default: {779 throw new Error("symbol of type: "+symbol.type+" not yet supported");780 }781 }782 });783}784/**785 * generate all dependent source code786 */787function generateCode(options,state,symboltable,arch,nodefail) {788 var library = loadLibrary(options),789 metabase = state.metabase;790 // generate any detected dependent types found during code processing791 generateCodeDependentTypes(options,state,symboltable);792 // set some required properties793 options.srcdir = path.join(options.dest,'src',arch);794 var outdir = options.outdir = path.join(options.dest,'build',arch);795 if (!fs.existsSync(options.srcdir)) {796 wrench.mkdirSyncRecursive(options.srcdir);797 }798 if (!fs.existsSync(options.outdir)) {799 wrench.mkdirSyncRecursive(options.outdir);800 }801 // load up our source code cache802 loadSourceCache(options);803 // file which we are going to compile804 options.srcfiles = [];805 if (symboltable.functions) {806 var functions = [];807 //TODO FIXME808 state.externs = [];809 Object.keys(symboltable.functions).forEach(function(e){ 810 var fn = symboltable.functions[e].function,811 found = functions.filter(function(f){return f.name === fn.name});812 if (!found.length) {813 functions.push(fn);814 }815 });816 generateFunctions(options, state, metabase, library, functions);817 }818 library.prepareClasses && library.prepareClasses(options, state, metabase, library, symboltable);819 if (symboltable.classmap) {820 var classes = {};821 Object.keys(symboltable.classmap).forEach(function(name){822 var symbol = symboltable.classmap[name],823 clscode = classes[name] || [],824 classname = name,825 typeobj = typelib.resolveType(classname),826 cast = typeobj.toCast(),827 basecast = typeobj.toBaseCast(),828 mangledClassname = jsgen.sanitizeClassName(classname),829 isClassLike = typeobj.isNativeObject() || typeobj.isNativeStruct() ||830 typeobj.isNativePointer() || typeobj.isNativeBlock() ||831 typeobj.isNativeFunctionPointer() || typeobj.isNativeUnion();832 if (typeobj.isJSUndefined() || typeobj.isJSNull()) {833 // skip non types834 return;835 }836 if (!clscode.length && isClassLike) {837 log.info('Generating class:',name.yellow.bold);838 839 classes[name] = clscode;840 841 var skip = library.prepareClass(options,metabase,state,name,clscode);842 if (skip) {843 return;844 }845 846 clscode.push('EXPORTAPI '+cast+' JSValueTo_'+mangledClassname+'(JSContextRef,JSValueRef,JSValueRef*);');847 clscode.push('');848 clscode.push('typedef Hyperloop::NativeObject<'+basecast+'> * Native'+mangledClassname+';');849 clscode.push('');850 clscode.push('static JSClassRef RegisterClass();');851 clscode.push('');852 clscode.push(util.multilineComment('internal method to return NativeObject'));853 clscode.push('static Native'+mangledClassname+' ToNative(JSObjectRef object)');854 clscode.push('{');855 clscode.push('\tauto p = JSObjectGetPrivate(object);')856 clscode.push('\treturn reinterpret_cast<Native'+mangledClassname+'>(p);')857 clscode.push('}');858 clscode.push('');859 clscode.push(util.multilineComment('internal method to return object'));860 clscode.push('static '+cast+' ToNativeObject(JSObjectRef object)');861 clscode.push('{');862 clscode.push('\tauto o = ToNative(object);');863 clscode.push('\tif (o == nullptr)');864 clscode.push('\t{');865 clscode.push('\t\treturn '+typeobj.toValueAtConversionFail()+';');866 clscode.push('\t}');867 clscode.push('\treturn '+typeobj.toNativeObject()+';');868 clscode.push('}');869 clscode.push('');870 clscode.push(util.multilineComment('called when object is created'));871 clscode.push('static void Initializer(JSContextRef context, JSObjectRef object)');872 clscode.push('{');873 clscode.push('\tToNative(object)->retain();');874 clscode.push('}');875 clscode.push('');876 clscode.push(util.multilineComment('called when object is destroyed'));877 clscode.push('static void Finalizer(JSObjectRef object)');878 clscode.push('{');879 clscode.push('\tToNative(object)->release();');880 clscode.push('}');881 clscode.push('');882 clscode.push(util.multilineComment('called when object is used in instanceof'));883 clscode.push('static bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception)');884 clscode.push('{');885 clscode.push('\treturn ToNative(constructor)->hasInstance(ctx,possibleInstance,exception);');886 clscode.push('}');887 clscode.push('');888 clscode.push(util.multilineComment('called when toString is invoked'));889 clscode.push('static JSValueRef ToString(JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');890 clscode.push('{');891 clscode.push('\tauto o = ToNative(object);');892 clscode.push('\tauto str = o->toString(ctx,exception);');893 clscode.push('\tif (!str.empty())');894 clscode.push('\t{');895 clscode.push('\t\tauto strRef = JSStringCreateWithUTF8CString(str.c_str());');896 clscode.push('\t\tauto result = JSValueMakeString(ctx, strRef);');897 clscode.push('\t\tJSStringRelease(strRef);');898 clscode.push('\t\treturn result;');899 clscode.push('\t}');900 clscode.push('\telse');901 clscode.push('\t{');902 clscode.push('\t\treturn JSValueMakeNull(ctx);');903 clscode.push('\t}');904 clscode.push('}');905 clscode.push('');906 clscode.push(util.multilineComment('called when toString is invoked (from JS)'));907 clscode.push('EXPORTAPI JSValueRef '+mangledClassname+'_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');908 clscode.push('{');909 clscode.push('\treturn ToString(ctx,0,JSValueToObject(ctx,arguments[0],exception),0,0,exception);');910 clscode.push('}');911 clscode.push('');912 clscode.push(util.multilineComment('called when conversion of one JS type to another'));913 clscode.push('static JSValueRef ConvertTo(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception)');914 clscode.push('{');915 clscode.push('\tJSValueRef result = nullptr;');916 clscode.push('\tif (type == kJSTypeString)');917 clscode.push('\t{');918 clscode.push('\t\tresult = ToString(ctx,nullptr,object,0,nullptr,exception);');919 clscode.push('\t}');920 clscode.push('\tauto po = ToNative(object);');921 clscode.push('\tif (type == kJSTypeNumber)');922 clscode.push('\t{');923 clscode.push('\t\tresult = JSValueMakeNumber(ctx,po->toNumber(ctx,exception));');924 clscode.push('\t}');925 clscode.push('\tif (type == kJSTypeBoolean)');926 clscode.push('\t{');927 clscode.push('\t\tresult = JSValueMakeBoolean(ctx,po->toBoolean(ctx,exception));');928 clscode.push('\t}');929 clscode.push('\t// should check exception and clear it out here,');930 clscode.push('\t// otherwise implicit conversion with \"+\" operator fails');931 clscode.push('\tif (!JSValueIsNull(ctx, *exception))');932 clscode.push('\t{');933 clscode.push('\t\t*exception = nullptr;');934 clscode.push('\t\treturn nullptr;');935 clscode.push('\t}');936 clscode.push('\treturn result;');937 clscode.push('}');938 clscode.push('');939 clscode.push(util.multilineComment('called to convert an '+cast+' to a JSValueRef'));940 clscode.push('EXPORTAPI JSValueRef '+mangledClassname+'_ToJSValue(JSContextRef ctx, '+cast+' instance, JSValueRef *exception)');941 clscode.push('{');942 typeobj.toNullCheck('instance','\t',clscode);943 clscode.push('\tauto po = new Hyperloop::NativeObject'+typeobj.getNewNativeObjectCast('instance')+';');944 clscode.push('\treturn JSObjectMake(ctx, RegisterClass(), po);');945 clscode.push('}');946 clscode.push('');947 clscode.push(util.multilineComment('called to update an '+cast+' pointer on JSValueRef'));948 clscode.push('EXPORTAPI JSValueRef Update_'+mangledClassname+'_ToJSValue(JSContextRef ctx, '+cast+' instance, JSValueRef valueObj, JSValueRef *exception)');949 clscode.push('{');950 clscode.push('\tauto object = JSValueToObject(ctx, valueObj, exception);');951 clscode.push('\tif (object==nullptr)');952 clscode.push('\t{');953 clscode.push('\t\t*exception = HyperloopMakeException(ctx,"couldn\'t update object to '+classname+'");');954 clscode.push('\t\treturn valueObj;');955 clscode.push('\t}');956 clscode.push('\tToNative(object)->release();');957 clscode.push('\tauto po = new Hyperloop::NativeObject'+typeobj.getNewNativeObjectCast('instance')+';');958 clscode.push('\tpo->retain();');959 clscode.push('\tJSObjectSetPrivate(object, po);');960 clscode.push('\treturn valueObj;');961 clscode.push('}');962 clscode.push('');963 if (typeobj.hasConstructor() && state.constructors && state.constructors[classname]) {964 Object.keys(state.constructors[classname]).forEach(function(key) {965 var m = state.constructors[classname][key];966 if (m.method && m.method.action) {967 return;968 } else {969 clscode.push(util.multilineComment('called when this class is called as function'));970 clscode.push('EXPORTAPI JSValueRef '+m.symbolname+'(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)');971 clscode.push('{');972 clscode.push(library.generateNewInstance(state,metabase,'\t',classname,cast,'instance',m));973 clscode.push('\treturn instance ? '+mangledClassname+'_ToJSValue(ctx,instance,exception) : JSValueMakeUndefined(ctx);');974 clscode.push('}');975 clscode.push('');976 }977 });978 }979 if (state.supermethods && state.supermethods[classname]) {980 Object.keys(state.supermethods[classname]).forEach(function(key) {981 var m = state.supermethods[classname][key];982 compileMethod(options,metabase,state,library,name,'super_'+m.name,m.method,clscode,true);983 }); 984 }985 986 clscode.push('');987 //TODO: make ToString read/write988 clscode.push('static JSStaticFunction StaticFunctions[] = {');989 clscode.push('\t{ "toString", ToString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },');990 clscode.push('\t{ 0, 0, 0 }');991 clscode.push('};');992 clscode.push('');993 clscode.push(util.multilineComment('called to register this class into the JS engine'));994 clscode.push('static JSClassRef RegisterClass()');995 clscode.push('{');996 clscode.push('\tstatic JSClassRef jsClass;');997 clscode.push('\tif (!jsClass)');998 clscode.push('\t{');999 clscode.push('\t\tJSClassDefinition def = kJSClassDefinitionEmpty;');1000 clscode.push('\t\tdef.initialize = Initializer;');1001 clscode.push('\t\tdef.finalize = Finalizer;');1002 clscode.push('\t\tdef.hasInstance = HasInstance;');1003 clscode.push('\t\tdef.className = "'+classname+'";');1004 clscode.push('\t\tdef.staticFunctions = StaticFunctions;');1005 clscode.push('\t\tdef.convertToType = ConvertTo;');1006 clscode.push('\t\tjsClass = JSClassCreate(&def);');1007 clscode.push('\t}');1008 clscode.push('\treturn jsClass;');1009 clscode.push('}');1010 clscode.push('');1011 // conversion wrappers1012 clscode.push(util.multilineComment('convert a JSValueRef to '+classname));1013 clscode.push('EXPORTAPI '+cast+' JSValueTo_'+mangledClassname+'(JSContextRef ctx, JSValueRef value, JSValueRef *exception)');1014 clscode.push('{');1015 clscode.push('\tif (JSValueIsNull(ctx,value) || JSValueIsUndefined(ctx,value))');1016 clscode.push('\t{');1017 clscode.push('\t\t// this is a valid conversion. just return null since that was likely the intent');1018 clscode.push('\t\treturn '+typeobj.toValueAtConversionFail()+';');1019 clscode.push('\t}');1020 clscode.push('\tauto object = JSValueToObject(ctx,value,exception);');1021 clscode.push('\tif (object==nullptr)');1022 clscode.push('\t{');1023 clscode.push('\t\t*exception = HyperloopMakeException(ctx,"couldn\'t convert object to '+classname+'");');1024 clscode.push('\t\treturn '+typeobj.toValueAtConversionFail()+';');1025 clscode.push('\t}');1026 clscode.push('\treturn ToNativeObject(object);');1027 clscode.push('}');1028 clscode.push('');1029 }1030 Object.keys(symbol.static_methods).forEach(function(methodname) {1031 var entry = symbol.static_methods[methodname];1032 log.info("Generating static method:",entry.name.yellow.bold);1033 compileMethod(options,metabase,state,library,name,entry.name,entry.method,clscode);1034 });1035 Object.keys(symbol.instance_methods).forEach(function(methodname) {1036 var entry = symbol.instance_methods[methodname];1037 // TODO: review this, we need to skip generation of built-in methods. 1038 // right now, toString is the only one1039 if (!jsgen.isBuiltinFunction(entry.name)) {1040 log.info("Generating instance method:",entry.name.yellow.bold);1041 compileMethod(options,metabase,state,library,name,entry.name,entry.method,clscode);1042 }1043 });1044 1045 Object.keys(symbol.getters).forEach(function(propname) {1046 var entry = symbol.getters[propname];1047 log.info("Generating getter:",entry.name.yellow.bold);1048 compileProperty(options,metabase,state,library,name,entry.name,entry.property,clscode,true);1049 });1050 1051 Object.keys(symbol.setters).forEach(function(propname) {1052 var entry = symbol.setters[propname];1053 log.info("Generating setter:",entry.name.yellow.bold);1054 compileProperty(options,metabase,state,library,name,entry.name,entry.property,clscode,false);1055 });1056 1057 Object.keys(symbol.constructors).forEach(function(ctorname) {1058 var entry = symbol.constructors[ctorname];1059 //NOTE: constructors are always generated in the implementation right now1060 //log.error('not yet generating constructor',entry);1061 });1062 var code = [];1063 // generate header details1064 code.push(HEADER);1065 code.push(util.multilineComment('Hyperloop class library for '+name));1066 code.push('');1067 code.push('#include <hyperloop.h>');1068 library.prepareIncludes && library.prepareIncludes(options,metabase,state,code);1069 library.prepareHeader(options,metabase,state,classname,code);1070 code.push('');1071 clscode.unshift(code.join('\n'));1072 1073 library.prepareFooter(options,metabase,state,classname,clscode);1074 // determine the filename1075 var outfn = path.join(options.srcdir, library.getClassFilename(options, metabase, state, mangledClassname));1076 // write source file if required1077 writeSourceFile(options,library,outfn,clscode);1078 });1079 generateTypes(options, state, metabase, library);1080 }...
Using AI Code Generation
1import { clsCode } from 'ng-mocks';2import { TestComponent } from './test.component';3describe('TestComponent', () => {4 it('should create an instance', () => {5 expect(clsCode(TestComponent)).toBeTruthy();6 });7});8import { Component } from '@angular/core';9@Component({10})11export class TestComponent {12}13import { async, ComponentFixture, TestBed } from '@angular/core/testing';14import { TestComponent } from './test.component';15describe('TestComponent', () => {16 let component: TestComponent;17 let fixture: ComponentFixture<TestComponent>;18 beforeEach(async(() => {19 TestBed.configureTestingModule({20 }).compileComponents();21 }));22 beforeEach(() => {23 fixture = TestBed.createComponent(TestComponent);24 component = fixture.componentInstance;25 fixture.detectChanges();26 });27 it('should create', () => {28 expect(component).toBeTruthy();29 });30});31describe('TestComponent', () => {32 it('should create an instance', () => {33 expect(clsCode(TestComponent)).toBeTruthy();34 });35});36describe('TestComponent', () => {37 let component: TestComponent;38 let fixture: ComponentFixture<TestComponent>;39 beforeEach(async(() => {40 TestBed.configureTestingModule({41 }).compileComponents();42 }));43 beforeEach(() => {44 fixture = TestBed.createComponent(TestComponent);45 component = fixture.componentInstance;46 fixture.detectChanges();47 });48 it('should create', () => {49 expect(component).toBeTruthy();50 });51});
Using AI Code Generation
1import { clsCode } from 'ng-mocks-universal';2describe('clsCode', () => {3 it('should be defined', () => {4 expect(clsCode).toBeDefined();5 });6});7import 'zone.js/dist/zone-testing';8import { getTestBed } from '@angular/core/testing';9import {10} from '@angular/platform-browser-dynamic/testing';11getTestBed().initTestEnvironment(12 platformBrowserDynamicTesting(),13);
Using AI Code Generation
1var clsCode = ngMocks.clsCode;2var TestComponent = /** @class */ (function () {3 function TestComponent() {4 this.test = 'test';5 }6 TestComponent = __decorate([7 core.Component({8 })9 ], TestComponent);10 return TestComponent;11}());12var TestModule = /** @class */ (function () {13 function TestModule() {14 }15 TestModule = __decorate([16 core.NgModule({17 })18 ], TestModule);19 return TestModule;20}());21describe('TestComponent', function () {22 beforeEach(function () {23 ngMocks.stub(clsCode(TestComponent, 'test'), 'test');24 });25 it('should work', function () {26 var fixture = testing.TestBed.createComponent(TestComponent);27 fixture.detectChanges();28 expect(fixture.nativeElement.innerHTML).toEqual('test');29 });30});31var clsCode = ngMocks.clsCode;32var TestComponent = /** @class */ (function () {33 function TestComponent() {34 this.test = 'test';35 }36 TestComponent = __decorate([37 core.Component({38 })39 ], TestComponent);40 return TestComponent;41}());42var TestModule = /** @class */ (function () {43 function TestModule() {44 }45 TestModule = __decorate([46 core.NgModule({47 })48 ], TestModule);49 return TestModule;50}());51describe('TestComponent', function () {52 beforeEach(function () {53 ngMocks.stub(clsCode(TestComponent, 'test'), 'test');54 });55 it('should work', function () {56 var fixture = testing.TestBed.createComponent(TestComponent);57 fixture.detectChanges();58 expect(fixture.nativeElement.innerHTML).toEqual('test');59 });60});61var clsCode = ngMocks.clsCode;62var TestComponent = /** @class */ (function () {63 function TestComponent() {64 this.test = 'test';65 }66 TestComponent = __decorate([67 core.Component({
Using AI Code Generation
1import { clsCode } from 'ng-mocks';2import { MyComponent } from './my.component';3describe('MyComponent', () => {4 it('should render a component', () => {5 const fixture = clsCode(MyComponent, {6 });7 expect(fixture).toBeDefined();8 });9});10import { Component, Input } from '@angular/core';11@Component({12 <span>{{ myProperty }}</span>13})14export class MyComponent {15 @Input() myProperty: string;16}17import { clsCode } from 'ng-mocks';18import { MyComponent } from './my.component';19describe('MyComponent', () => {20 it('should render a component', () => {21 const fixture = clsCode(MyComponent, {22 });23 expect(fixture).toBeDefined();24 });25});26 <span>{{ myProperty }}</span>27import { Component, Input } from '@angular/core';28@Component({29 <span>{{ myProperty }}</span>30})31export class MyComponent {32 @Input() myProperty: string;33}34import { clsCode } from 'ng-mocks';35import { MyComponent } from './my.component';36describe('MyComponent', () => {37 it('should render a component', () => {38 const fixture = clsCode(MyComponent, {39 });40 expect(fixture).toBeDefined();41 });42});43 <span>{{ myProperty }}</span>
Using AI Code Generation
1import {clsCode} from 'ng-mocks';2describe('clsCode', () => {3 it('should return the class code', () => {4 expect(clsCode('test')).toEqual('test');5 });6});7import 'ng-mocks';8describe('ngMocks', () => {9 it('should return the class code', () => {10 expect(ngMocks.clsCode('test')).toEqual('test');11 });12});
Using AI Code Generation
1import { clsCode } from 'ng-mocks';2const component = clsCode( AppComponent );3import { clsCode } from 'ng-mocks';4const component = clsCode( AppComponent );5import { clsCode } from 'ng-mocks';6const component = clsCode( AppComponent );7import { clsCode } from 'ng-mocks';8const component = clsCode( AppComponent );9import { clsCode } from 'ng-mocks';10const component = clsCode( AppComponent );11import { clsCode } from 'ng-mocks';12const component = clsCode( AppComponent );13import { clsCode } from 'ng-mocks';14const component = clsCode( AppComponent );15import { clsCode } from 'ng-mocks';16const component = clsCode( AppComponent );17import { clsCode } from 'ng-mocks';18const component = clsCode( AppComponent );19import { clsCode } from 'ng-mocks';20const component = clsCode( AppComponent );21import { clsCode } from 'ng-mocks';22const component = clsCode( AppComponent );
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!