How to use next method in autotest

Best Python code snippet using autotest_python

routes.js

Source:routes.js Github

copy

Full Screen

1/**2 * Generated by "@vuepress/internal-routes"3 */4import { injectComponentOption, ensureAsyncComponentsLoaded } from '@app/util'5import rootMixins from '@internal/root-mixins'6import GlobalLayout from "/Users/xule/vuepress/node_modules/@vuepress/core/lib/client/components/GlobalLayout.vue"7injectComponentOption(GlobalLayout, 'mixins', rootMixins)8export const routes = [9 {10 name: "v-73453928",11 path: "/api/cli.html",12 component: GlobalLayout,13 beforeEnter: (to, from, next) => {14 ensureAsyncComponentsLoaded("Layout", "v-73453928").then(next)15 },16 },17 {18 name: "v-5d81d274",19 path: "/api/node.html",20 component: GlobalLayout,21 beforeEnter: (to, from, next) => {22 ensureAsyncComponentsLoaded("Layout", "v-5d81d274").then(next)23 },24 },25 {26 name: "v-3c48d225",27 path: "/faq/",28 component: GlobalLayout,29 beforeEnter: (to, from, next) => {30 ensureAsyncComponentsLoaded("Layout", "v-3c48d225").then(next)31 },32 },33 {34 path: "/faq/index.html",35 redirect: "/faq/"36 },37 {38 name: "v-21d2ac23",39 path: "/config/",40 component: GlobalLayout,41 beforeEnter: (to, from, next) => {42 ensureAsyncComponentsLoaded("Layout", "v-21d2ac23").then(next)43 },44 },45 {46 path: "/config/index.html",47 redirect: "/config/"48 },49 {50 name: "v-d5771bce",51 path: "/guide/",52 component: GlobalLayout,53 beforeEnter: (to, from, next) => {54 ensureAsyncComponentsLoaded("Layout", "v-d5771bce").then(next)55 },56 },57 {58 path: "/guide/index.html",59 redirect: "/guide/"60 },61 {62 name: "v-09c23cc8",63 path: "/guide/assets.html",64 component: GlobalLayout,65 beforeEnter: (to, from, next) => {66 ensureAsyncComponentsLoaded("Layout", "v-09c23cc8").then(next)67 },68 },69 {70 name: "v-8e1ab568",71 path: "/guide/basic-config.html",72 component: GlobalLayout,73 beforeEnter: (to, from, next) => {74 ensureAsyncComponentsLoaded("Layout", "v-8e1ab568").then(next)75 },76 },77 {78 name: "v-263a0700",79 path: "/guide/deploy.html",80 component: GlobalLayout,81 beforeEnter: (to, from, next) => {82 ensureAsyncComponentsLoaded("Layout", "v-263a0700").then(next)83 },84 },85 {86 name: "v-38f82170",87 path: "/guide/directory-structure.html",88 component: GlobalLayout,89 beforeEnter: (to, from, next) => {90 ensureAsyncComponentsLoaded("Layout", "v-38f82170").then(next)91 },92 },93 {94 name: "v-32d45ae8",95 path: "/guide/frontmatter.html",96 component: GlobalLayout,97 beforeEnter: (to, from, next) => {98 ensureAsyncComponentsLoaded("Layout", "v-32d45ae8").then(next)99 },100 },101 {102 name: "v-411d91a8",103 path: "/guide/getting-started.html",104 component: GlobalLayout,105 beforeEnter: (to, from, next) => {106 ensureAsyncComponentsLoaded("Layout", "v-411d91a8").then(next)107 },108 },109 {110 name: "v-1def10c8",111 path: "/guide/global-computed.html",112 component: GlobalLayout,113 beforeEnter: (to, from, next) => {114 ensureAsyncComponentsLoaded("Layout", "v-1def10c8").then(next)115 },116 },117 {118 name: "v-32196c68",119 path: "/guide/markdown-slot.html",120 component: GlobalLayout,121 beforeEnter: (to, from, next) => {122 ensureAsyncComponentsLoaded("Layout", "v-32196c68").then(next)123 },124 },125 {126 name: "v-8150c4dc",127 path: "/guide/i18n.html",128 component: GlobalLayout,129 beforeEnter: (to, from, next) => {130 ensureAsyncComponentsLoaded("Layout", "v-8150c4dc").then(next)131 },132 },133 {134 name: "v-af314a20",135 path: "/guide/markdown.html",136 component: GlobalLayout,137 beforeEnter: (to, from, next) => {138 ensureAsyncComponentsLoaded("Layout", "v-af314a20").then(next)139 },140 },141 {142 name: "v-4dc37c88",143 path: "/guide/using-vue.html",144 component: GlobalLayout,145 beforeEnter: (to, from, next) => {146 ensureAsyncComponentsLoaded("Layout", "v-4dc37c88").then(next)147 },148 },149 {150 name: "v-994d2284",151 path: "/guide/permalinks.html",152 component: GlobalLayout,153 beforeEnter: (to, from, next) => {154 ensureAsyncComponentsLoaded("Layout", "v-994d2284").then(next)155 },156 },157 {158 name: "v-410b8f01",159 path: "/",160 component: GlobalLayout,161 beforeEnter: (to, from, next) => {162 ensureAsyncComponentsLoaded("Layout", "v-410b8f01").then(next)163 },164 },165 {166 path: "/index.html",167 redirect: "/"168 },169 {170 name: "v-6b3ec228",171 path: "/miscellaneous/design-concepts.html",172 component: GlobalLayout,173 beforeEnter: (to, from, next) => {174 ensureAsyncComponentsLoaded("Layout", "v-6b3ec228").then(next)175 },176 },177 {178 name: "v-5ec9ab14",179 path: "/miscellaneous/glossary.html",180 component: GlobalLayout,181 beforeEnter: (to, from, next) => {182 ensureAsyncComponentsLoaded("Layout", "v-5ec9ab14").then(next)183 },184 },185 {186 name: "v-0f964348",187 path: "/miscellaneous/local-development.html",188 component: GlobalLayout,189 beforeEnter: (to, from, next) => {190 ensureAsyncComponentsLoaded("Layout", "v-0f964348").then(next)191 },192 },193 {194 name: "v-c6511c70",195 path: "/miscellaneous/migration-guide.html",196 component: GlobalLayout,197 beforeEnter: (to, from, next) => {198 ensureAsyncComponentsLoaded("Layout", "v-c6511c70").then(next)199 },200 },201 {202 name: "v-14317003",203 path: "/plugin/",204 component: GlobalLayout,205 beforeEnter: (to, from, next) => {206 ensureAsyncComponentsLoaded("Layout", "v-14317003").then(next)207 },208 },209 {210 path: "/plugin/index.html",211 redirect: "/plugin/"212 },213 {214 name: "v-175d40f4",215 path: "/plugin/context-api.html",216 component: GlobalLayout,217 beforeEnter: (to, from, next) => {218 ensureAsyncComponentsLoaded("Layout", "v-175d40f4").then(next)219 },220 },221 {222 name: "v-40b442b0",223 path: "/plugin/life-cycle.html",224 component: GlobalLayout,225 beforeEnter: (to, from, next) => {226 ensureAsyncComponentsLoaded("Layout", "v-40b442b0").then(next)227 },228 },229 {230 name: "v-2e976786",231 path: "/plugin/official/plugin-back-to-top.html",232 component: GlobalLayout,233 beforeEnter: (to, from, next) => {234 ensureAsyncComponentsLoaded("Layout", "v-2e976786").then(next)235 },236 },237 {238 name: "v-71567518",239 path: "/plugin/official/plugin-active-header-links.html",240 component: GlobalLayout,241 beforeEnter: (to, from, next) => {242 ensureAsyncComponentsLoaded("Layout", "v-71567518").then(next)243 },244 },245 {246 name: "v-25663e70",247 path: "/plugin/official/plugin-blog.html",248 component: GlobalLayout,249 beforeEnter: (to, from, next) => {250 ensureAsyncComponentsLoaded("Layout", "v-25663e70").then(next)251 },252 },253 {254 name: "v-2dfe26c8",255 path: "/plugin/official/plugin-google-analytics.html",256 component: GlobalLayout,257 beforeEnter: (to, from, next) => {258 ensureAsyncComponentsLoaded("Layout", "v-2dfe26c8").then(next)259 },260 },261 {262 name: "v-2924e9f0",263 path: "/plugin/official/plugin-last-updated.html",264 component: GlobalLayout,265 beforeEnter: (to, from, next) => {266 ensureAsyncComponentsLoaded("Layout", "v-2924e9f0").then(next)267 },268 },269 {270 name: "v-722ca282",271 path: "/plugin/official/plugin-medium-zoom.html",272 component: GlobalLayout,273 beforeEnter: (to, from, next) => {274 ensureAsyncComponentsLoaded("Layout", "v-722ca282").then(next)275 },276 },277 {278 name: "v-f8b47738",279 path: "/plugin/official/plugin-pwa.html",280 component: GlobalLayout,281 beforeEnter: (to, from, next) => {282 ensureAsyncComponentsLoaded("Layout", "v-f8b47738").then(next)283 },284 },285 {286 name: "v-aa74ab3c",287 path: "/plugin/official/plugin-nprogress.html",288 component: GlobalLayout,289 beforeEnter: (to, from, next) => {290 ensureAsyncComponentsLoaded("Layout", "v-aa74ab3c").then(next)291 },292 },293 {294 name: "v-c163e850",295 path: "/plugin/official/plugin-register-components.html",296 component: GlobalLayout,297 beforeEnter: (to, from, next) => {298 ensureAsyncComponentsLoaded("Layout", "v-c163e850").then(next)299 },300 },301 {302 name: "v-905043f0",303 path: "/plugin/official/plugin-search.html",304 component: GlobalLayout,305 beforeEnter: (to, from, next) => {306 ensureAsyncComponentsLoaded("Layout", "v-905043f0").then(next)307 },308 },309 {310 name: "v-64e466f0",311 path: "/plugin/option-api.html",312 component: GlobalLayout,313 beforeEnter: (to, from, next) => {314 ensureAsyncComponentsLoaded("Layout", "v-64e466f0").then(next)315 },316 },317 {318 name: "v-66baf8c8",319 path: "/plugin/using-a-plugin.html",320 component: GlobalLayout,321 beforeEnter: (to, from, next) => {322 ensureAsyncComponentsLoaded("Layout", "v-66baf8c8").then(next)323 },324 },325 {326 name: "v-359e33c8",327 path: "/plugin/writing-a-plugin.html",328 component: GlobalLayout,329 beforeEnter: (to, from, next) => {330 ensureAsyncComponentsLoaded("Layout", "v-359e33c8").then(next)331 },332 },333 {334 name: "v-7836a9bf",335 path: "/theme/",336 component: GlobalLayout,337 beforeEnter: (to, from, next) => {338 ensureAsyncComponentsLoaded("Layout", "v-7836a9bf").then(next)339 },340 },341 {342 path: "/theme/index.html",343 redirect: "/theme/"344 },345 {346 name: "v-2d4a2f28",347 path: "/theme/blog-theme.html",348 component: GlobalLayout,349 beforeEnter: (to, from, next) => {350 ensureAsyncComponentsLoaded("Layout", "v-2d4a2f28").then(next)351 },352 },353 {354 name: "v-245d0084",355 path: "/theme/default-theme-config.html",356 component: GlobalLayout,357 beforeEnter: (to, from, next) => {358 ensureAsyncComponentsLoaded("Layout", "v-245d0084").then(next)359 },360 },361 {362 name: "v-99b66e70",363 path: "/theme/inheritance.html",364 component: GlobalLayout,365 beforeEnter: (to, from, next) => {366 ensureAsyncComponentsLoaded("Layout", "v-99b66e70").then(next)367 },368 },369 {370 name: "v-8bc734b8",371 path: "/theme/option-api.html",372 component: GlobalLayout,373 beforeEnter: (to, from, next) => {374 ensureAsyncComponentsLoaded("Layout", "v-8bc734b8").then(next)375 },376 },377 {378 name: "v-7edc83f0",379 path: "/theme/using-a-theme.html",380 component: GlobalLayout,381 beforeEnter: (to, from, next) => {382 ensureAsyncComponentsLoaded("Layout", "v-7edc83f0").then(next)383 },384 },385 {386 name: "v-5a6f8a88",387 path: "/theme/writing-a-theme.html",388 component: GlobalLayout,389 beforeEnter: (to, from, next) => {390 ensureAsyncComponentsLoaded("Layout", "v-5a6f8a88").then(next)391 },392 },393 {394 name: "v-666b1d23",395 path: "/zh/",396 component: GlobalLayout,397 beforeEnter: (to, from, next) => {398 ensureAsyncComponentsLoaded("Layout", "v-666b1d23").then(next)399 },400 },401 {402 path: "/zh/index.html",403 redirect: "/zh/"404 },405 {406 name: "v-13647ba0",407 path: "/zh/api/cli.html",408 component: GlobalLayout,409 beforeEnter: (to, from, next) => {410 ensureAsyncComponentsLoaded("Layout", "v-13647ba0").then(next)411 },412 },413 {414 name: "v-a2111570",415 path: "/zh/api/node.html",416 component: GlobalLayout,417 beforeEnter: (to, from, next) => {418 ensureAsyncComponentsLoaded("Layout", "v-a2111570").then(next)419 },420 },421 {422 name: "v-1fc5904b",423 path: "/zh/config/",424 component: GlobalLayout,425 beforeEnter: (to, from, next) => {426 ensureAsyncComponentsLoaded("Layout", "v-1fc5904b").then(next)427 },428 },429 {430 path: "/zh/config/index.html",431 redirect: "/zh/config/"432 },433 {434 name: "v-0320befa",435 path: "/zh/guide/",436 component: GlobalLayout,437 beforeEnter: (to, from, next) => {438 ensureAsyncComponentsLoaded("Layout", "v-0320befa").then(next)439 },440 },441 {442 path: "/zh/guide/index.html",443 redirect: "/zh/guide/"444 },445 {446 name: "v-209103c3",447 path: "/zh/faq/",448 component: GlobalLayout,449 beforeEnter: (to, from, next) => {450 ensureAsyncComponentsLoaded("Layout", "v-209103c3").then(next)451 },452 },453 {454 path: "/zh/faq/index.html",455 redirect: "/zh/faq/"456 },457 {458 name: "v-5680bda8",459 path: "/zh/guide/assets.html",460 component: GlobalLayout,461 beforeEnter: (to, from, next) => {462 ensureAsyncComponentsLoaded("Layout", "v-5680bda8").then(next)463 },464 },465 {466 name: "v-d6f6e0b0",467 path: "/zh/guide/basic-config.html",468 component: GlobalLayout,469 beforeEnter: (to, from, next) => {470 ensureAsyncComponentsLoaded("Layout", "v-d6f6e0b0").then(next)471 },472 },473 {474 name: "v-63929028",475 path: "/zh/guide/deploy.html",476 component: GlobalLayout,477 beforeEnter: (to, from, next) => {478 ensureAsyncComponentsLoaded("Layout", "v-63929028").then(next)479 },480 },481 {482 name: "v-bb8d2e70",483 path: "/zh/guide/frontmatter.html",484 component: GlobalLayout,485 beforeEnter: (to, from, next) => {486 ensureAsyncComponentsLoaded("Layout", "v-bb8d2e70").then(next)487 },488 },489 {490 name: "v-59102394",491 path: "/zh/guide/directory-structure.html",492 component: GlobalLayout,493 beforeEnter: (to, from, next) => {494 ensureAsyncComponentsLoaded("Layout", "v-59102394").then(next)495 },496 },497 {498 name: "v-01e8eea8",499 path: "/zh/guide/getting-started.html",500 component: GlobalLayout,501 beforeEnter: (to, from, next) => {502 ensureAsyncComponentsLoaded("Layout", "v-01e8eea8").then(next)503 },504 },505 {506 name: "v-41132dee",507 path: "/zh/guide/global-computed.html",508 component: GlobalLayout,509 beforeEnter: (to, from, next) => {510 ensureAsyncComponentsLoaded("Layout", "v-41132dee").then(next)511 },512 },513 {514 name: "v-e247f1f0",515 path: "/zh/guide/i18n.html",516 component: GlobalLayout,517 beforeEnter: (to, from, next) => {518 ensureAsyncComponentsLoaded("Layout", "v-e247f1f0").then(next)519 },520 },521 {522 name: "v-0fbb8d38",523 path: "/zh/guide/markdown-slot.html",524 component: GlobalLayout,525 beforeEnter: (to, from, next) => {526 ensureAsyncComponentsLoaded("Layout", "v-0fbb8d38").then(next)527 },528 },529 {530 name: "v-51584b68",531 path: "/zh/guide/markdown.html",532 component: GlobalLayout,533 beforeEnter: (to, from, next) => {534 ensureAsyncComponentsLoaded("Layout", "v-51584b68").then(next)535 },536 },537 {538 name: "v-4a237dc8",539 path: "/zh/guide/permalinks.html",540 component: GlobalLayout,541 beforeEnter: (to, from, next) => {542 ensureAsyncComponentsLoaded("Layout", "v-4a237dc8").then(next)543 },544 },545 {546 name: "v-db7effbc",547 path: "/zh/guide/using-vue.html",548 component: GlobalLayout,549 beforeEnter: (to, from, next) => {550 ensureAsyncComponentsLoaded("Layout", "v-db7effbc").then(next)551 },552 },553 {554 name: "v-03ff2544",555 path: "/zh/miscellaneous/design-concepts.html",556 component: GlobalLayout,557 beforeEnter: (to, from, next) => {558 ensureAsyncComponentsLoaded("Layout", "v-03ff2544").then(next)559 },560 },561 {562 name: "v-629d8906",563 path: "/zh/miscellaneous/local-development.html",564 component: GlobalLayout,565 beforeEnter: (to, from, next) => {566 ensureAsyncComponentsLoaded("Layout", "v-629d8906").then(next)567 },568 },569 {570 name: "v-008ba970",571 path: "/zh/miscellaneous/glossary.html",572 component: GlobalLayout,573 beforeEnter: (to, from, next) => {574 ensureAsyncComponentsLoaded("Layout", "v-008ba970").then(next)575 },576 },577 {578 name: "v-1e0d7b04",579 path: "/zh/miscellaneous/migration-guide.html",580 component: GlobalLayout,581 beforeEnter: (to, from, next) => {582 ensureAsyncComponentsLoaded("Layout", "v-1e0d7b04").then(next)583 },584 },585 {586 name: "v-156e71ae",587 path: "/zh/plugin/",588 component: GlobalLayout,589 beforeEnter: (to, from, next) => {590 ensureAsyncComponentsLoaded("Layout", "v-156e71ae").then(next)591 },592 },593 {594 path: "/zh/plugin/index.html",595 redirect: "/zh/plugin/"596 },597 {598 name: "v-c16013b0",599 path: "/zh/plugin/context-api.html",600 component: GlobalLayout,601 beforeEnter: (to, from, next) => {602 ensureAsyncComponentsLoaded("Layout", "v-c16013b0").then(next)603 },604 },605 {606 name: "v-ccb33fd8",607 path: "/zh/plugin/life-cycle.html",608 component: GlobalLayout,609 beforeEnter: (to, from, next) => {610 ensureAsyncComponentsLoaded("Layout", "v-ccb33fd8").then(next)611 },612 },613 {614 name: "v-60720370",615 path: "/zh/plugin/official/plugin-back-to-top.html",616 component: GlobalLayout,617 beforeEnter: (to, from, next) => {618 ensureAsyncComponentsLoaded("Layout", "v-60720370").then(next)619 },620 },621 {622 name: "v-0f63a530",623 path: "/zh/plugin/official/plugin-active-header-links.html",624 component: GlobalLayout,625 beforeEnter: (to, from, next) => {626 ensureAsyncComponentsLoaded("Layout", "v-0f63a530").then(next)627 },628 },629 {630 name: "v-7a9f680e",631 path: "/zh/plugin/official/plugin-blog.html",632 component: GlobalLayout,633 beforeEnter: (to, from, next) => {634 ensureAsyncComponentsLoaded("Layout", "v-7a9f680e").then(next)635 },636 },637 {638 name: "v-fe11c624",639 path: "/zh/plugin/official/plugin-google-analytics.html",640 component: GlobalLayout,641 beforeEnter: (to, from, next) => {642 ensureAsyncComponentsLoaded("Layout", "v-fe11c624").then(next)643 },644 },645 {646 name: "v-9114df6c",647 path: "/zh/plugin/official/plugin-last-updated.html",648 component: GlobalLayout,649 beforeEnter: (to, from, next) => {650 ensureAsyncComponentsLoaded("Layout", "v-9114df6c").then(next)651 },652 },653 {654 name: "v-e5c827f0",655 path: "/zh/plugin/official/plugin-medium-zoom.html",656 component: GlobalLayout,657 beforeEnter: (to, from, next) => {658 ensureAsyncComponentsLoaded("Layout", "v-e5c827f0").then(next)659 },660 },661 {662 name: "v-240d2588",663 path: "/zh/plugin/official/plugin-nprogress.html",664 component: GlobalLayout,665 beforeEnter: (to, from, next) => {666 ensureAsyncComponentsLoaded("Layout", "v-240d2588").then(next)667 },668 },669 {670 name: "v-024ec828",671 path: "/zh/plugin/official/plugin-pwa.html",672 component: GlobalLayout,673 beforeEnter: (to, from, next) => {674 ensureAsyncComponentsLoaded("Layout", "v-024ec828").then(next)675 },676 },677 {678 name: "v-ba834d30",679 path: "/zh/plugin/official/plugin-register-components.html",680 component: GlobalLayout,681 beforeEnter: (to, from, next) => {682 ensureAsyncComponentsLoaded("Layout", "v-ba834d30").then(next)683 },684 },685 {686 name: "v-456df90c",687 path: "/zh/plugin/option-api.html",688 component: GlobalLayout,689 beforeEnter: (to, from, next) => {690 ensureAsyncComponentsLoaded("Layout", "v-456df90c").then(next)691 },692 },693 {694 name: "v-1fad9fc2",695 path: "/zh/plugin/official/plugin-search.html",696 component: GlobalLayout,697 beforeEnter: (to, from, next) => {698 ensureAsyncComponentsLoaded("Layout", "v-1fad9fc2").then(next)699 },700 },701 {702 name: "v-7f65df24",703 path: "/zh/plugin/using-a-plugin.html",704 component: GlobalLayout,705 beforeEnter: (to, from, next) => {706 ensureAsyncComponentsLoaded("Layout", "v-7f65df24").then(next)707 },708 },709 {710 name: "v-32270544",711 path: "/zh/plugin/writing-a-plugin.html",712 component: GlobalLayout,713 beforeEnter: (to, from, next) => {714 ensureAsyncComponentsLoaded("Layout", "v-32270544").then(next)715 },716 },717 {718 name: "v-df9adcba",719 path: "/zh/theme/",720 component: GlobalLayout,721 beforeEnter: (to, from, next) => {722 ensureAsyncComponentsLoaded("Layout", "v-df9adcba").then(next)723 },724 },725 {726 path: "/zh/theme/index.html",727 redirect: "/zh/theme/"728 },729 {730 name: "v-26f723e8",731 path: "/zh/theme/blog-theme.html",732 component: GlobalLayout,733 beforeEnter: (to, from, next) => {734 ensureAsyncComponentsLoaded("Layout", "v-26f723e8").then(next)735 },736 },737 {738 name: "v-7c12ebb0",739 path: "/zh/theme/default-theme-config.html",740 component: GlobalLayout,741 beforeEnter: (to, from, next) => {742 ensureAsyncComponentsLoaded("Layout", "v-7c12ebb0").then(next)743 },744 },745 {746 name: "v-51e8742e",747 path: "/zh/theme/inheritance.html",748 component: GlobalLayout,749 beforeEnter: (to, from, next) => {750 ensureAsyncComponentsLoaded("Layout", "v-51e8742e").then(next)751 },752 },753 {754 name: "v-e739d730",755 path: "/zh/theme/option-api.html",756 component: GlobalLayout,757 beforeEnter: (to, from, next) => {758 ensureAsyncComponentsLoaded("Layout", "v-e739d730").then(next)759 },760 },761 {762 name: "v-2594b9da",763 path: "/zh/theme/using-a-theme.html",764 component: GlobalLayout,765 beforeEnter: (to, from, next) => {766 ensureAsyncComponentsLoaded("Layout", "v-2594b9da").then(next)767 },768 },769 {770 name: "v-3e75e6ea",771 path: "/zh/theme/writing-a-theme.html",772 component: GlobalLayout,773 beforeEnter: (to, from, next) => {774 ensureAsyncComponentsLoaded("Layout", "v-3e75e6ea").then(next)775 },776 },777 {778 path: '*',779 component: GlobalLayout780 }...

Full Screen

Full Screen

bootstrap.js

Source:bootstrap.js Github

copy

Full Screen

...93 this.cont.nesting = 0;94 setTimeout(next, 0);95 }96 else {97 next();98 }99 }100}101Factor.prototype.push_data = function(v, next) {102 factor.cont.data_stack.push(v);103 factor.call_next(next);104}105Factor.prototype.use = function(v, next) {106 factor.cont.data_stack.push(v);107 factor.get_word("kernel", "use+").execute(next);108}109Factor.prototype.using = function(v, next) {110 factor.cont.data_stack.push(v);111 factor.get_word("kernel", "using").execute(next);112}113var fjsc_repl = false;114Factor.prototype.set_in = function(v, next) {115 factor.cont.data_stack.push(v);116 factor.get_word("kernel", "set-in").execute(next);117 if (fjsc_repl) {118 fjsc_repl.ps = '( ' + v + ' )';119 }120}121Factor.prototype.get_word = function(vocab,name) {122 return factor.vocabs[vocab][name];123}124Factor.prototype.find_word = function(name) {125 for(var v = 0; v<factor.using_vocabs.length; ++v) {126 var w = factor.vocabs[factor.using_vocabs[v]][name];127 if(w)128 return w;129 }130 return false;131}132Factor.prototype.add_word = function(vocab,name, source, func) {133 var v = factor.vocabs[vocab];134 if(!v) {135 v = { };136 factor.vocabs[vocab] = v;137 }138 v[name] = new Word(vocab,name,source,func);139}140Factor.prototype.remove_word = function(vocab,name) {141 var v = factor.vocabs[vocab];142 if(!v) {143 v = { };144 factor.vocabs[vocab] = v;145 }146 delete v[name];147}148 149Factor.prototype.define_word = function(name, source, func, next) {150 factor.vocabs[factor.in_vocab][name] = new Word(factor.in_vocab, name, source, function(next) {151 var old = factor.cont.next;152 factor.cont.next = function() {153 factor.cont.next = old;154 factor.call_next(next);155 }156 func();157 });158 factor.call_next(next);159}160Factor.prototype.make_quotation = function(source, func) {161 return new Word("quotations", "quotation", source, function(next) {162 var old = factor.cont.next;163 factor.cont.next = function() {164 factor.cont.next = old;165 factor.call_next(next);166 }167 func();168 });169}170Factor.prototype.server_eval = function(text, handler, next) {171 var self = this;172 $.post("compile", { code: text }, function(result) {173 factor.run_eval = function(func) {174 factor.cont.next = function() { handler(text,result); } 175 try {176 func(factor);177 } catch(ex) {178 alert("Error Parsing Javascript: " + ex); 179 handler(text, result);180 }181 if(next) 182 factor.call_next(next);183 }184 try {185 eval("factor.run_eval" + result);186 } catch(e) {187 factor.run_eval(function() { alert("Error Parsing Javascript: " + e); });188 }189 });190}191/* kernel-internals vocabulary */192factor.add_word("kernel-internals", ">n", "primitive", function(next) {193 var data_stack = factor.cont.data_stack;194 var name_stack = factor.cont.name_stack;195 name_stack.push(data_stack.pop());196 factor.call_next(next);197});198factor.add_word("kernel-internals", "n>", "primitive", function(next) {199 var data_stack = factor.cont.data_stack;200 var name_stack = factor.cont.name_stack;201 data_stack.push(name_stack.pop());202 factor.call_next(next);203});204/* Kernel Vocabulary */205factor.add_word("kernel","dup", "primitive", function(next) {206 var stack = factor.cont.data_stack;207 stack[stack.length] = stack[stack.length-1];208 factor.call_next(next);209});210factor.add_word("kernel", "drop", "primitive", function(next) {211 factor.cont.data_stack.pop();212 factor.call_next(next);213});214factor.add_word("kernel", "nip", "primitive", function(next) {215 var stack = factor.cont.data_stack;216 stack[stack.length-2] = stack[stack.length-1];217 stack.pop();218 factor.call_next(next);219});220factor.add_word("kernel", "over", "primitive", function(next) {221 var stack = factor.cont.data_stack;222 stack[stack.length] = stack[stack.length-2];223 factor.call_next(next);224});225factor.add_word("kernel", "pick", "primitive", function(next) {226 var stack = factor.cont.data_stack;227 stack[stack.length] = stack[stack.length-3];228 factor.call_next(next);229});230factor.add_word("kernel", "swap", "primitive", function(next) {231 var stack = factor.cont.data_stack;232 var temp = stack[stack.length-2];233 stack[stack.length-2] = stack[stack.length-1];234 stack[stack.length-1] = temp;235 factor.call_next(next);236});237factor.add_word("kernel", ">r", "primitive", function(next) {238 var data_stack = factor.cont.data_stack;239 var retain_stack = factor.cont.retain_stack;240 retain_stack.push(data_stack.pop());241 factor.call_next(next);242});243factor.add_word("kernel", "r>", "primitive", function(next) {244 var data_stack = factor.cont.data_stack;245 var retain_stack = factor.cont.retain_stack;246 data_stack.push(retain_stack.pop());247 factor.call_next(next);248});249factor.add_word("kernel", "call", "primitive", function(next) {250 var quot = factor.cont.data_stack.pop();251 quot.execute(next);252});253factor.add_word("kernel", "execute", "primitive", function(next) {254 var quot = factor.cont.data_stack.pop();255 quot.execute(next);256});257factor.add_word("kernel", "clear", "primitive", function(next) {258 factor.cont.data_stack = [];259 factor.cont.retain_stack = [];260 factor.call_next(next);261});262factor.add_word("kernel", "if", "primitive", function(next) { 263 var stack = factor.cont.data_stack;264 var else_quot = stack.pop();265 var then_quot = stack.pop();266 var condition = stack.pop();267 if(condition) {268 then_quot.execute(next);269 } else {270 else_quot.execute(next);271 }272});273factor.add_word("kernel", "f", "primitive", function(next) { 274 factor.cont.data_stack.push(false);275 factor.call_next(next);276});277factor.add_word("kernel", "t", "primitive", function(next) { 278 factor.cont.data_stack.push(true);279 factor.call_next(next);280});281factor.add_word("kernel", "=", "primitive", function(next) { 282 var stack = factor.cont.data_stack;283 stack.push(stack.pop()==stack.pop());284 factor.call_next(next);285});286factor.add_word("kernel", "bootstrap", "primitive", function(next) { 287 factor.cont.data_stack.push("/responder/fjsc-resources/bootstrap.factor");288 factor.get_word("parser", "run-file").execute(next);289});290factor.add_word("kernel", "callcc0", "primitive", function(next) { 291 var data_stack = factor.cont.data_stack;292 var quot = data_stack.pop();293 var new_cont = factor.cont.clone(); 294 var old_next = factor.cont.next;295 factor.cont.next = function() {296 factor.cont.next = old_next;297 factor.call_next(next);298 }299 new_cont.data_stack.push(factor.cont);300 factor.cont = new_cont;301 quot.execute(next); 302});303factor.add_word("kernel", "callcc1", "primitive", function(next) { 304 factor.get_word("kernel", "callcc0").execute(next);305});306factor.add_word("kernel", "continue", "primitive", function(next) { 307 var data_stack = factor.cont.data_stack;308 var cont = data_stack.pop(); 309 factor.cont = cont.clone();310 factor.call_next(cont.next);311});312factor.add_word("kernel", "continue-with", "primitive", function(next) { 313 var data_stack = factor.cont.data_stack;314 var cont = data_stack.pop(); 315 var data = data_stack.pop(); 316 factor.cont = cont.clone();317 factor.cont.data_stack.push(data);318 factor.call_next(cont.next);319});320factor.add_word("kernel", "set-in", "primitive", function(next) { 321 var stack = factor.cont.data_stack;322 var vocab = stack.pop();323 var v = factor.vocabs[vocab];324 if(!v) {325 v = { };326 factor.vocabs[vocab] = v;327 }328 factor.in_vocab = vocab;329 factor.call_next(next); 330});331factor.add_word("kernel", "current-vocab", "primitive", function(next) { 332 var stack = factor.cont.data_stack;333 stack.push(factor.in_vocab);334 factor.call_next(next); 335});336factor.add_word("kernel", "use+", "primitive", function(next) { 337 var stack = factor.cont.data_stack;338 var vocab = stack.pop();339 var v = factor.vocabs[vocab];340 if(!v) {341 v = { };342 factor.vocabs[vocab] = v;343 }344 factor.using_vocabs.push(vocab);345 factor.call_next(next); 346});347factor.add_word("kernel", "using", "primitive", function(next) { 348 var stack = factor.cont.data_stack;349 var vocabs = stack.pop();350 for(var i=0;i<vocabs.length;++i) { 351 var v = factor.vocabs[vocabs[i]];352 if(!v) {353 v = { };354 factor.vocabs[vocabs[i]] = v;355 }356 factor.using_vocabs.push(vocabs[i]);357 }358 factor.call_next(next); 359});360factor.add_word("kernel", "current-using", "primitive", function(next) { 361 var stack = factor.cont.data_stack;362 stack.push(factor.using_vocabs);363 factor.call_next(next); 364});365factor.add_word("kernel", "forget", "primitive", function(next) { 366 var stack = factor.cont.data_stack;367 var word = stack.pop();368 factor.remove_word(word.vocab, word.name);369 factor.call_next(next); 370});371factor.add_word("kernel", ">function", "primitive", function(next) { 372 var stack = factor.cont.data_stack;373 var word = stack.pop();374 stack.push(function() { word.func(function() { }) });375 factor.call_next(next); 376});377factor.add_word("kernel", "curry", "primitive", function(next) { 378 var stack = factor.cont.data_stack;379 var quot = stack.pop();380 var value = stack.pop();381 382 stack.push(factor.make_quotation("quotation", function(next) {383 factor.cont.data_stack.push(value); 384 quot.execute(factor.cont.next);385 }));386 factor.call_next(next);387});388/* Math vocabulary */389factor.add_word("math", "*", "primitive", function(next) {390 var stack = factor.cont.data_stack;391 stack.push(stack.pop() * stack.pop());392 factor.call_next(next);393});394factor.add_word("math", "+", "primitive", function(next) {395 var stack = factor.cont.data_stack;396 stack.push(stack.pop() + stack.pop());397 factor.call_next(next);398});399factor.add_word("math", "-", "primitive", function(next) {400 var stack = factor.cont.data_stack;401 var v1 = stack.pop();402 var v2 = stack.pop();403 stack.push(v2 - v1);404 factor.call_next(next);405});406factor.add_word("math", "/", "primitive", function(next) {407 var stack = factor.cont.data_stack;408 var v1 = stack.pop();409 var v2 = stack.pop();410 stack.push(v2 / v1);411 factor.call_next(next);412});413factor.add_word("parser", "run-file", "primitive", function(next) { 414 var stack = factor.cont.data_stack;415 var url = stack.pop();416 $.get(url, function(result) {417 factor.server_eval(result, function() { }, next);418 });419});420factor.add_word("alien", "alien-invoke", "primitive", function(next) { 421 var stack = factor.cont.data_stack;422 var arg_types = stack.pop();423 var method_name = stack.pop();424 var library_name = stack.pop();425 var return_values = stack.pop();426 var obj = stack.pop();427 var args = [ ];428 for(var i = 0; i < arg_types.length; ++i) {429 args[i] = stack.pop();430 }431 var func = obj[method_name];432 if(method_name=="alert") {433 func = function(a) { alert(a); }434 }435 var v = func.apply(obj, args.reverse());436 if(return_values.length > 0)437 stack.push(v);438 factor.call_next(next);439});440factor.add_word("alien", "alien-property", "primitive", function(next) { 441 var stack = factor.cont.data_stack;442 var obj = stack.pop();443 var property_name = stack.pop();444 var v = obj[property_name];445 stack.push(v);446 factor.call_next(next);447});448factor.add_word("alien", "set-alien-property", "primitive", function(next) { 449 var stack = factor.cont.data_stack;450 var obj = stack.pop();451 var property_name = stack.pop();452 var data = stack.pop();453 obj[property_name] = v;454 factor.call_next(next);455});456factor.add_word("alien", "uneval", "primitive", function(next) {457 var stack = factor.cont.data_stack;458 stack.push(uneval(stack.pop()));459 factor.call_next(next);460});461factor.add_word("words", "vocabs", "primitive", function(next) { 462 var stack = factor.cont.data_stack;463 var result = [];464 for(v in factor.vocabs) {465 result.push(v);466 }467 stack.push(result);468 factor.call_next(next);469});470factor.add_word("words", "words", "primitive", function(next) { 471 var stack = factor.cont.data_stack;472 var vocab = factor.vocabs[stack.pop()];473 var result = [];474 for(w in vocab) {475 result.push(vocab[w]);476 }477 stack.push(result);478 factor.call_next(next);479});480factor.add_word("words", "all-words", "primitive", function(next) { 481 var stack = factor.cont.data_stack;482 var result = [];483 for(v in factor.vocabs) {484 for(w in factor.vocabs[v]) {485 result.push(factor.vocabs[v][w]);486 }487 }488 stack.push(result);489 factor.call_next(next);490});491/* Sequences vocabulary */492factor.add_word("sequences", "nth", "primitive", function(next) { 493 var stack = factor.cont.data_stack;494 var seq = stack.pop();495 var index = stack.pop();496 stack.push(seq[index]);497 factor.call_next(next);498});499factor.add_word("sequences", "first", "primitive", function(next) { 500 var stack = factor.cont.data_stack;501 var seq = stack.pop();502 stack.push(seq[0]);503 factor.call_next(next);504});505factor.add_word("sequences", "second", "primitive", function(next) { 506 var stack = factor.cont.data_stack;507 var seq = stack.pop();508 stack.push(seq[1]);509 factor.call_next(next);510});511factor.add_word("sequences", "third", "primitive", function(next) { 512 var stack = factor.cont.data_stack;513 var seq = stack.pop();514 stack.push(seq[2]);515 factor.call_next(next);516});517factor.add_word("sequences", "fourth", "primitive", function(next) { 518 var stack = factor.cont.data_stack;519 var seq = stack.pop();520 stack.push(seq[0]);521 factor.call_next(next);522});523factor.add_word("sequences", "first2", "primitive", function(next) { 524 var stack = factor.cont.data_stack;525 var seq = stack.pop();526 stack.push(seq[0],seq[1]);527 factor.call_next(next);528});529factor.add_word("sequences", "first3", "primitive", function(next) { 530 var stack = factor.cont.data_stack;531 var seq = stack.pop();532 stack.push(seq[0],seq[1],seq[2]);533 factor.call_next(next);534});535factor.add_word("sequences", "first4", "primitive", function(next) { 536 var stack = factor.cont.data_stack;537 var seq = stack.pop();538 stack.push(seq[0],seq[1],seq[2],seq[3]);539 factor.call_next(next);540});541factor.add_word("sequences", "each", "primitive", function(next) { 542 var stack = factor.cont.data_stack;543 var quot = stack.pop();544 var seq = stack.pop();545 for(var i=0;i<seq.length;++i) { 546 stack.push(seq[i]);547 quot.execute();548 }549 factor.call_next(next);550});551factor.add_word("sequences", "map", "primitive", function(next) { 552 var stack = factor.cont.data_stack;553 var quot = stack.pop();554 var seq = stack.pop();555 var result = [ ];556 for(var i=0;i<seq.length;++i) { 557 stack.push(seq[i]);558 quot.execute();559 result[i]=stack.pop();560 }561 stack.push(result);562 factor.call_next(next);563});564factor.add_word("sequences", "reduce", "primitive", function(next) { 565 var stack = factor.cont.data_stack;566 var quot = stack.pop();567 var prev = stack.pop();568 var seq = stack.pop();569 for(var i=0;i<seq.length;++i) { 570 stack.push(prev);571 stack.push(seq[i]);572 quot.execute();573 prev=stack.pop();Al574 }575 stack.push(prev);576 factor.call_next(next);577});578/* hashtables vocabulary */579factor.add_word("hashtables", "alist>hash", "primitive", function(next) { 580 var stack = factor.cont.data_stack;581 var alist = stack.pop();582 stack.push(new Hashtable().fromAlist(alist));583 factor.call_next(next);584});585factor.add_word("hashtables", "hash>alist", "primitive", function(next) { 586 var stack = factor.cont.data_stack;587 var hashtable = stack.pop();588 stack.push(hashtable.toAlist());589 factor.call_next(next);590});591factor.add_word("hashtables", "hash", "primitive", function(next) { 592 var stack = factor.cont.data_stack;593 var hashtable = stack.pop();594 var key = stack.pop();595 stack.push(hashtable.get(key));596 factor.call_next(next);597});598factor.add_word("hashtables", "set-hash", "primitive", function(next) { 599 var stack = factor.cont.data_stack;600 var hashtable = stack.pop();601 var key = stack.pop();602 var value = stack.pop();603 hashtable.set(key, value);604 factor.call_next(next);605});606factor.add_word("sequences", "hash-each", "primitive", function(next) { 607 var stack = factor.cont.data_stack;608 var quot = stack.pop();609 var hashtable = stack.pop().table;610 for(k in hashtable) { 611 var v = hashtable[k]; 612 stack.push(k, v);613 quot.execute();614 }615 factor.call_next(next);616});617factor.add_word("sequences", "hash-map", "primitive", function(next) { 618 var stack = factor.cont.data_stack;619 var quot = stack.pop();620 var hashtable = stack.pop().table;621 var result = [ ];622 for(k in hashtable) { 623 var v = hashtable[k];624 stack.push(k,v);625 quot.execute();626 result.push(stack.pop());627 }628 stack.push(result);629 factor.call_next(next);630});631/* browser-dom vocab */632factor.add_word("browser-dom", "window", "primitive", function(next) { 633 factor.cont.data_stack.push(window);634 factor.call_next(next);635});636factor.add_word("browser-dom", "document", "primitive", function(next) { 637 factor.cont.data_stack.push(document);638 factor.call_next(next);639});640factor.add_word("browser-dom", "load-script", "primitive", function(next) { 641 var stack = factor.cont.data_stack;642 $("head/script#jsonrequest").remove();643 var script = document.createElement("script");644 script.id = "jsonrequest"; 645 script.type = "text/javascript";646 script.src = stack.pop();647 $("head").append(script);648 factor.call_next(next); 649});650var handle_json = false;651factor.add_word("browser-dom", "json-request", "primitive", function(next) { 652 var stack = factor.cont.data_stack;653 handle_json = function(data) { 654 factor.cont.data_stack.push(data);655 factor.call_next(next);656 }657 factor.get_word("browser-dom", "load-script").execute();...

Full Screen

Full Screen

tags.js

Source:tags.js Github

copy

Full Screen

...35 async.parallel([36 async.apply(db.setAdd, 'topic:' + tid + ':tags', tags),37 async.apply(db.sortedSetsAdd, keys, timestamp, tid),38 ], function (err) {39 next(err);40 });41 },42 function (next) {43 async.each(tags, updateTagCount, next);44 },45 ], callback);46 };47 function filterCategoryTags(tags, tid, callback) {48 async.waterfall([49 function (next) {50 Topics.getTopicField(tid, 'cid', next);51 },52 function (cid, next) {53 db.getSortedSetRange('cid:' + cid + ':tag:whitelist', 0, -1, next);54 },55 function (tagWhitelist, next) {56 if (!tagWhitelist.length) {57 return next(null, tags);58 }59 tags = tags.filter(function (tag) {60 return tagWhitelist.indexOf(tag) !== -1;61 });62 next(null, tags);63 },64 ], callback);65 }66 Topics.createEmptyTag = function (tag, callback) {67 if (!tag) {68 return callback(new Error('[[error:invalid-tag]]'));69 }70 tag = utils.cleanUpTag(tag, meta.config.maximumTagLength);71 if (tag.length < (meta.config.minimumTagLength || 3)) {72 return callback(new Error('[[error:tag-too-short]]'));73 }74 async.waterfall([75 function (next) {76 db.isSortedSetMember('tags:topic:count', tag, next);77 },78 function (isMember, next) {79 if (isMember) {80 return next();81 }82 db.sortedSetAdd('tags:topic:count', 0, tag, next);83 },84 ], callback);85 };86 Topics.updateTags = function (data, callback) {87 async.eachSeries(data, function (tagData, next) {88 db.setObject('tag:' + tagData.value, {89 color: tagData.color,90 bgColor: tagData.bgColor,91 }, next);92 }, callback);93 };94 Topics.renameTags = function (data, callback) {95 async.eachSeries(data, function (tagData, next) {96 renameTag(tagData.value, tagData.newName, next);97 }, callback);98 };99 function renameTag(tag, newTagName, callback) {100 if (!newTagName || tag === newTagName) {101 return setImmediate(callback);102 }103 async.waterfall([104 function (next) {105 Topics.createEmptyTag(newTagName, next);106 },107 function (next) {108 batch.processSortedSet('tag:' + tag + ':topics', function (tids, next) {109 async.waterfall([110 function (next) {111 db.sortedSetScores('tag:' + tag + ':topics', tids, next);112 },113 function (scores, next) {114 db.sortedSetAdd('tag:' + newTagName + ':topics', scores, tids, next);115 },116 function (next) {117 var keys = tids.map(function (tid) {118 return 'topic:' + tid + ':tags';119 });120 async.series([121 async.apply(db.sortedSetRemove, 'tag:' + tag + ':topics', tids),122 async.apply(db.setsRemove, keys, tag),123 async.apply(db.setsAdd, keys, newTagName),124 ], next);125 },126 ], next);127 }, next);128 },129 function (next) {130 Topics.deleteTag(tag, next);131 },132 function (next) {133 updateTagCount(newTagName, next);134 },135 ], callback);136 }137 function updateTagCount(tag, callback) {138 callback = callback || function () {};139 async.waterfall([140 function (next) {141 Topics.getTagTopicCount(tag, next);142 },143 function (count, next) {144 count = count || 0;145 db.sortedSetAdd('tags:topic:count', count, tag, next);146 },147 ], callback);148 }149 Topics.getTagTids = function (tag, start, stop, callback) {150 db.getSortedSetRevRange('tag:' + tag + ':topics', start, stop, callback);151 };152 Topics.getTagTopicCount = function (tag, callback) {153 db.sortedSetCard('tag:' + tag + ':topics', callback);154 };155 Topics.deleteTags = function (tags, callback) {156 if (!Array.isArray(tags) || !tags.length) {157 return callback();158 }159 async.series([160 function (next) {161 removeTagsFromTopics(tags, next);162 },163 function (next) {164 var keys = tags.map(function (tag) {165 return 'tag:' + tag + ':topics';166 });167 db.deleteAll(keys, next);168 },169 function (next) {170 db.sortedSetRemove('tags:topic:count', tags, next);171 },172 function (next) {173 db.deleteAll(tags.map(function (tag) {174 return 'tag:' + tag;175 }), next);176 },177 ], function (err) {178 callback(err);179 });180 };181 function removeTagsFromTopics(tags, callback) {182 async.eachLimit(tags, 50, function (tag, next) {183 db.getSortedSetRange('tag:' + tag + ':topics', 0, -1, function (err, tids) {184 if (err || !tids.length) {185 return next(err);186 }187 var keys = tids.map(function (tid) {188 return 'topic:' + tid + ':tags';189 });190 db.setsRemove(keys, tag, next);191 });192 }, callback);193 }194 Topics.deleteTag = function (tag, callback) {195 Topics.deleteTags([tag], callback);196 };197 Topics.getTags = function (start, stop, callback) {198 async.waterfall([199 function (next) {200 db.getSortedSetRevRangeWithScores('tags:topic:count', start, stop, next);201 },202 function (tags, next) {203 Topics.getTagData(tags, next);204 },205 ], callback);206 };207 Topics.getTagData = function (tags, callback) {208 var keys = tags.map(function (tag) {209 return 'tag:' + tag.value;210 });211 async.waterfall([212 function (next) {213 db.getObjects(keys, next);214 },215 function (tagData, next) {216 tags.forEach(function (tag, index) {217 tag.valueEscaped = validator.escape(String(tag.value));218 tag.color = tagData[index] ? tagData[index].color : '';219 tag.bgColor = tagData[index] ? tagData[index].bgColor : '';220 });221 next(null, tags);222 },223 ], callback);224 };225 Topics.getTopicTags = function (tid, callback) {226 db.getSetMembers('topic:' + tid + ':tags', callback);227 };228 Topics.getTopicsTags = function (tids, callback) {229 var keys = tids.map(function (tid) {230 return 'topic:' + tid + ':tags';231 });232 db.getSetsMembers(keys, callback);233 };234 Topics.getTopicTagsObjects = function (tid, callback) {235 Topics.getTopicsTagsObjects([tid], function (err, data) {236 callback(err, Array.isArray(data) && data.length ? data[0] : []);237 });238 };239 Topics.getTopicsTagsObjects = function (tids, callback) {240 var sets = tids.map(function (tid) {241 return 'topic:' + tid + ':tags';242 });243 var uniqueTopicTags;244 var topicTags;245 async.waterfall([246 function (next) {247 db.getSetsMembers(sets, next);248 },249 function (_topicTags, next) {250 topicTags = _topicTags;251 uniqueTopicTags = _.uniq(_.flatten(topicTags));252 var tags = uniqueTopicTags.map(function (tag) {253 return { value: tag };254 });255 async.parallel({256 tagData: function (next) {257 Topics.getTagData(tags, next);258 },259 counts: function (next) {260 db.sortedSetScores('tags:topic:count', uniqueTopicTags, next);261 },262 }, next);263 },264 function (results, next) {265 results.tagData.forEach(function (tag, index) {266 tag.score = results.counts[index] ? results.counts[index] : 0;267 });268 var tagData = _.zipObject(uniqueTopicTags, results.tagData);269 topicTags.forEach(function (tags, index) {270 if (Array.isArray(tags)) {271 topicTags[index] = tags.map(function (tag) { return tagData[tag]; });272 topicTags[index].sort(function (tag1, tag2) {273 return tag2.score - tag1.score;274 });275 }276 });277 next(null, topicTags);278 },279 ], callback);280 };281 Topics.updateTopicTags = function (tid, tags, callback) {282 callback = callback || function () {};283 async.waterfall([284 function (next) {285 Topics.deleteTopicTags(tid, next);286 },287 function (next) {288 Topics.getTopicField(tid, 'timestamp', next);289 },290 function (timestamp, next) {291 Topics.createTags(tags, tid, timestamp, next);292 },293 ], callback);294 };295 Topics.deleteTopicTags = function (tid, callback) {296 async.waterfall([297 function (next) {298 Topics.getTopicTags(tid, next);299 },300 function (tags, next) {301 async.series([302 function (next) {303 db.delete('topic:' + tid + ':tags', next);304 },305 function (next) {306 var sets = tags.map(function (tag) {307 return 'tag:' + tag + ':topics';308 });309 db.sortedSetsRemove(sets, tid, next);310 },311 function (next) {312 async.each(tags, function (tag, next) {313 updateTagCount(tag, next);314 }, next);315 },316 ], next);317 },318 ], function (err) {319 callback(err);320 });321 };322 Topics.searchTags = function (data, callback) {323 if (!data || !data.query) {324 return callback(null, []);325 }326 async.waterfall([327 function (next) {328 if (plugins.hasListeners('filter:topics.searchTags')) {329 plugins.fireHook('filter:topics.searchTags', { data: data }, next);330 } else {331 findMatches(data.query, 0, next);332 }333 },334 function (result, next) {335 plugins.fireHook('filter:tags.search', { data: data, matches: result.matches }, next);336 },337 function (result, next) {338 next(null, result.matches);339 },340 ], callback);341 };342 Topics.autocompleteTags = function (data, callback) {343 if (!data || !data.query) {344 return callback(null, []);345 }346 async.waterfall([347 function (next) {348 if (plugins.hasListeners('filter:topics.autocompleteTags')) {349 plugins.fireHook('filter:topics.autocompleteTags', { data: data }, next);350 } else {351 findMatches(data.query, data.cid, next);352 }353 },354 function (result, next) {355 next(null, result.matches);356 },357 ], callback);358 };359 function findMatches(query, cid, callback) {360 async.waterfall([361 function (next) {362 if (parseInt(cid, 10)) {363 db.getSortedSetRange('cid:' + cid + ':tag:whitelist', 0, -1, next);364 } else {365 setImmediate(next, null, []);366 }367 },368 function (tagWhitelist, next) {369 if (tagWhitelist.length) {370 setImmediate(next, null, tagWhitelist);371 } else {372 db.getSortedSetRevRange('tags:topic:count', 0, -1, next);373 }374 },375 function (tags, next) {376 query = query.toLowerCase();377 var matches = [];378 for (var i = 0; i < tags.length; i += 1) {379 if (tags[i].toLowerCase().startsWith(query)) {380 matches.push(tags[i]);381 if (matches.length > 19) {382 break;383 }384 }385 }386 matches = matches.sort(function (a, b) {387 return a > b;388 });389 next(null, { matches: matches });390 },391 ], callback);392 }393 Topics.searchAndLoadTags = function (data, callback) {394 var searchResult = {395 tags: [],396 matchCount: 0,397 pageCount: 1,398 };399 if (!data || !data.query || !data.query.length) {400 return callback(null, searchResult);401 }402 async.waterfall([403 function (next) {404 Topics.searchTags(data, next);405 },406 function (tags, next) {407 async.parallel({408 counts: function (next) {409 db.sortedSetScores('tags:topic:count', tags, next);410 },411 tagData: function (next) {412 tags = tags.map(function (tag) {413 return { value: tag };414 });415 Topics.getTagData(tags, next);416 },417 }, next);418 },419 function (results, next) {420 results.tagData.forEach(function (tag, index) {421 tag.score = results.counts[index];422 });423 results.tagData.sort(function (a, b) {424 return b.score - a.score;425 });426 searchResult.tags = results.tagData;427 searchResult.matchCount = results.tagData.length;428 searchResult.pageCount = 1;429 next(null, searchResult);430 },431 ], callback);432 };433 Topics.getRelatedTopics = function (topicData, uid, callback) {434 if (plugins.hasListeners('filter:topic.getRelatedTopics')) {435 return plugins.fireHook('filter:topic.getRelatedTopics', { topic: topicData, uid: uid }, callback);436 }437 var maximumTopics = parseInt(meta.config.maximumRelatedTopics, 10) || 0;438 if (maximumTopics === 0 || !topicData.tags || !topicData.tags.length) {439 return callback(null, []);440 }441 maximumTopics = maximumTopics || 5;442 async.waterfall([443 function (next) {444 async.map(topicData.tags, function (tag, next) {445 Topics.getTagTids(tag.value, 0, 5, next);446 }, next);447 },448 function (tids, next) {449 tids = _.shuffle(_.uniq(_.flatten(tids))).slice(0, maximumTopics);450 Topics.getTopics(tids, uid, next);451 },452 function (topics, next) {453 topics = topics.filter(function (topic) {454 return topic && !topic.deleted && parseInt(topic.uid, 10) !== parseInt(uid, 10);455 });456 next(null, topics);457 },458 ], callback);459 };...

Full Screen

Full Screen

General.js

Source:General.js Github

copy

Full Screen

1'use strict';2var General = require('./GeneralService');3module.exports.addmultisigaddress = function addmultisigaddress (req, res, next) {4 General.addmultisigaddress(req.swagger.params, res, next);5};6module.exports.dumpprivkey = function dumpprivkey (req, res, next) {7 General.dumpprivkey(req.swagger.params, res, next);8};9module.exports.dumpwallet = function dumpwallet (req, res, next) {10 General.dumpwallet(req.swagger.params, res, next);11};12module.exports.encryptwallet = function encryptwallet (req, res, next) {13 General.encryptwallet(req.swagger.params, res, next);14};15module.exports.generate = function generate (req, res, next) {16 General.generate(req.swagger.params, res, next);17};18module.exports.generatepublickey = function generatepublickey (req, res, next) {19 General.generatepublickey(req.swagger.params, res, next);20};21module.exports.getaccount = function getaccount (req, res, next) {22 General.getaccount(req.swagger.params, res, next);23};24module.exports.getaccountaddress = function getaccountaddress (req, res, next) {25 General.getaccountaddress(req.swagger.params, res, next);26};27module.exports.getaddressesbyaccount = function getaddressesbyaccount (req, res, next) {28 General.getaddressesbyaccount(req.swagger.params, res, next);29};30module.exports.getbalance = function getbalance (req, res, next) {31 General.getbalance(req.swagger.params, res, next);32};33module.exports.getblock = function getblock (req, res, next) {34 General.getblock(req.swagger.params, res, next);35};36module.exports.getblockchaininfo = function getblockchaininfo (req, res, next) {37 General.getblockchaininfo(req.swagger.params, res, next);38};39module.exports.getblockcount = function getblockcount (req, res, next) {40 General.getblockcount(req.swagger.params, res, next);41};42module.exports.getinfo = function getinfo (req, res, next) {43 General.getinfo(req.swagger.params, res, next);44};45module.exports.getmempoolinfo = function getmempoolinfo (req, res, next) {46 General.getmempoolinfo(req.swagger.params, res, next);47}48module.exports.getdifficulty = function getdifficulty (req, res, next) {49 General.getdifficulty(req.swagger.params, res, next);50}51module.exports.getmininginfo = function getmininginfo (req, res, next) {52 General.getmininginfo(req.swagger.params, res, next);53};54module.exports.getnetworkinfo = function getnetworkinfo (req, res, next) {55 General.getnetworkinfo(req.swagger.params, res, next);56};57module.exports.getnewaddress = function getnewaddress (req, res, next) {58 General.getnewaddress(req.swagger.params, res, next);59};60module.exports.getpeerinfo = function getpeerinfo (req, res, next) {61 General.getpeerinfo(req.swagger.params, res, next);62};63module.exports.getreceivedbyaccount = function getreceivedbyaccount (req, res, next) {64 General.getreceivedbyaccount(req.swagger.params, res, next);65};66module.exports.getreceivedbyaddress = function getreceivedbyaddress (req, res, next) {67 General.getreceivedbyaddress(req.swagger.params, res, next);68};69module.exports.gettransaction = function gettransaction (req, res, next) {70 General.gettransaction(req.swagger.params, res, next);71};72module.exports.getunconfirmedbalance = function getunconfirmedbalance (req, res, next) {73 General.getunconfirmedbalance(req.swagger.params, res, next);74};75module.exports.getwalletinfo = function getwalletinfo (req, res, next) {76 General.getwalletinfo(req.swagger.params, res, next);77};78module.exports.importaddress = function importaddress (req, res, next) {79 General.importaddress(req.swagger.params, res, next);80};81module.exports.importprivkey = function importprivkey (req, res, next) {82 General.importprivkey(req.swagger.params, res, next);83};84module.exports.importpubkey = function importpubkey (req, res, next) {85 General.importpubkey(req.swagger.params, res, next);86};87module.exports.importwallet = function importwallet (req, res, next) {88 General.importwallet(req.swagger.params, res, next);89};90module.exports.listaccounts = function listaccounts (req, res, next) {91 General.listaccounts(req.swagger.params, res, next);92};93module.exports.listaddressgroupings = function listaddressgroupings (req, res, next) {94 General.listaddressgroupings(req.swagger.params, res, next);95};96module.exports.listreceivedbyaccount = function listreceivedbyaccount (req, res, next) {97 General.listreceivedbyaccount(req.swagger.params, res, next);98};99module.exports.listreceivedbyaddress = function listreceivedbyaddress (req, res, next) {100 General.listreceivedbyaddress(req.swagger.params, res, next);101};102module.exports.listsinceblock = function listsinceblock (req, res, next) {103 General.listsinceblock(req.swagger.params, res, next);104};105module.exports.listtransactions = function listtransactions (req, res, next) {106 General.listtransactions(req.swagger.params, res, next);107};108module.exports.listunspent = function listunspent (req, res, next) {109 General.listunspent(req.swagger.params, res, next);110};111module.exports.move = function move (req, res, next) {112 General.move(req.swagger.params, res, next);113};114module.exports.sendfrom = function sendfrom (req, res, next) {115 General.sendfrom(req.swagger.params, res, next);116};117module.exports.sendmany = function sendmany (req, res, next) {118 General.sendmany(req.swagger.params, res, next);119};120module.exports.sendtoaddress = function sendtoaddress (req, res, next) {121 General.sendtoaddress(req.swagger.params, res, next);122};123module.exports.signmessage = function signmessage (req, res, next) {124 General.signmessage(req.swagger.params, res, next);125};126module.exports.syscoindecoderawtransaction = function syscoindecoderawtransaction (req, res, next) {127 General.syscoindecoderawtransaction(req.swagger.params, res, next);128};129module.exports.validateaddress = function validateaddress (req, res, next) {130 General.validateaddress(req.swagger.params, res, next);131};132module.exports.verifymessage = function verifymessage (req, res, next) {133 General.verifymessage(req.swagger.params, res, next);134};135module.exports.walletlock = function walletlock (req, res, next) {136 General.walletlock(req.swagger.params, res, next);137};138module.exports.walletpassphrase = function walletpassphrase (req, res, next) {139 General.walletpassphrase(req.swagger.params, res, next);140};141module.exports.walletpassphrasechange = function walletpassphrasechange (req, res, next) {142 General.walletpassphrasechange(req.swagger.params, res, next);143};144module.exports.syscoinlistreceivedbyaddress = function syscoinlistreceivedbyaddress (req, res, next) {145 General.syscoinlistreceivedbyaddress(req.swagger.params, res, next);146};147module.exports.getaddressbalance = function getaddressbalance (req, res, next) {148 console.log(req.swagger.params);149 General.getaddressbalance(req.swagger.params, res, next);150};151module.exports.getaddressdeltas = function getaddressdeltas (req, res, next) {152 General.getaddressdeltas(req.swagger.params, res, next);153};154module.exports.getaddressmempool = function getaddressmempool (req, res, next) {155 General.getaddressmempool(req.swagger.params, res, next);156};157module.exports.syscoinsendrawtransaction = function getaddressmempool (req, res, next) {158 General.syscoinsendrawtransaction(req.swagger.params, res, next);159};160module.exports.getgenerate = function getgenerate (req, res, next) {161 General.getgenerate(req.swagger.params, res, next);162};163module.exports.setgenerate = function setgenerate (req, res, next) {164 General.setgenerate(req.swagger.params, res, next);165};166module.exports.setnetworkactive = function setnetworkactive (req, res, next) {167 General.setnetworkactive(req.swagger.params, res, next);168};169module.exports.mnsync = function mnsync (req, res, next) {170 General.mnsync(req.swagger.params, res, next);171};172module.exports.dumphdinfo = function dumphdinfo (req, res, next) {173 General.dumphdinfo(req.swagger.params, res, next);174};175module.exports.debug = function debug (req, res, next) {176 General.debug(req.swagger.params, res, next);177};178module.exports.instantsendtoaddress = function debug (req, res, next) {179 General.instantsendtoaddress(req.swagger.params, res, next);180};181module.exports.getaddresstxids = function getaddresstxids (req, res, next) {182 General.getaddresstxids(req.swagger.params, res, next);183};184module.exports.getblockhashes = function getblockhashes (req, res, next) {185 General.getblockhashes(req.swagger.params, res, next);186};187module.exports.getblockhash = function getblockhash (req, res, next) {188 General.getblockhash(req.swagger.params, res, next);189}190module.exports.getblockheaders = function getblockheaders (req, res, next) {191 General.getblockheaders(req.swagger.params, res, next);192};193module.exports.getchaintips = function getchaintips (req, res, next) {194 General.getchaintips(req.swagger.params, res, next);195};196module.exports.getspentinfo = function getspentinfo (req, res, next) {197 General.getspentinfo(req.swagger.params, res, next);198};199module.exports.getgovernanceinfo = function getgovernanceinfo (req, res, next) {200 General.getgovernanceinfo(req.swagger.params, res, next);201};202module.exports.getpoolinfo = function getpoolinfo (req, res, next) {203 General.getpoolinfo(req.swagger.params, res, next);204};205module.exports.getsuperblockbudget = function getsuperblockbudget (req, res, next) {206 General.getsuperblockbudget(req.swagger.params, res, next);207};208module.exports.gobject = function gobject (req, res, next) {209 General.gobject(req.swagger.params, res, next);210};211module.exports.masternode = function masternode (req, res, next) {212 General.masternode(req.swagger.params, res, next);213};214module.exports.masternodebroadcast = function masternodebroadcast (req, res, next) {215 General.masternodebroadcast(req.swagger.params, res, next);216};217module.exports.masternodelist = function masternodelist (req, res, next) {218 General.masternodelist(req.swagger.params, res, next);219};220module.exports.fundrawtransaction = function masternodelist (req, res, next) {221 General.fundrawtransaction(req.swagger.params, res, next);222};223module.exports.getblocktemplate = function masternodelist (req, res, next) {224 General.getblocktemplate(req.swagger.params, res, next);225};226module.exports.signrawtransaction = function masternodelist (req, res, next) {227 General.signrawtransaction(req.swagger.params, res, next);228};229module.exports.lockunspent = function masternodelist (req, res, next) {230 General.lockunspent(req.swagger.params, res, next);231};232module.exports.getaddressutxos = function getaddressutxos (req, res, next) {233 General.getaddressutxos(req.swagger.params, res, next);234};235module.exports.setaccount = function setaccount (req, res, next) {236 General.setaccount(req.swagger.params, res, next);237};238module.exports.resendwallettransactions = function resendwallettransactions (req, res, next) {239 General.resendwallettransactions(req.swagger.params, res, next);...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

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

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