UNPKG

1.21 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/strategies/RandomProxyStrategy.js"],"names":["RandomProxyStrategy","strategy","list","getList","fatalCount","getFatalCount","count","length","Err","ProxyStrategy"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;IAEaA,mB;;;;;;;;;;;;;;;UACXC,Q,GAAW,Q;;;;;;WACX,oBAAW;AACT,UAAMC,IAAI,GAAG,KAAKC,OAAL,EAAb;AACA,UAAMC,UAAU,GAAG,KAAKC,aAAL,EAAnB;AACA,UAAMC,KAAK,GAAGJ,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEK,MAApB;AACA,UAAI,CAACD,KAAL,EAAY,MAAM,IAAIE,eAAJ,CAAQ,0BAAR,EAAoC;AAAEF,QAAAA,KAAK,EAALA,KAAF;AAASF,QAAAA,UAAU,EAAVA;AAAT,OAApC,CAAN;AACZ,aAAO,wBAAOF,IAAP,CAAP;AACD;;;EARsCO,6B;;;eAW1BT,mB","sourcesContent":["import Err from '@lskjs/err';\nimport get from 'lodash/get';\nimport sample from 'lodash/sample';\n\nimport { ProxyStrategy } from './ProxyStrategy';\n\nexport class RandomProxyStrategy extends ProxyStrategy {\n strategy = 'random';\n getProxy() {\n const list = this.getList();\n const fatalCount = this.getFatalCount();\n const count = list?.length;\n if (!count) throw new Err('PROXY_MANAGER_LIST_EMPTY', { count, fatalCount });\n return sample(list);\n }\n}\n\nexport default RandomProxyStrategy;\n"],"file":"RandomProxyStrategy.js"}
\No newline at end of file