1. Commander.js ```javascript import {Command} from ‘commander’;

const program = new Command()

program .version(‘0.0.1’) .name(‘fy’) .usage(‘‘) .argument(‘English’) .action(function (english){ console.log(english) })

program.parse(process.argv)

  1. 2. HTTPS 模块
  2. ```javascript
  3. import * as https from 'https'
  4. const options = {
  5. // hostname: 'fanyi-api.baidu.com',
  6. hostname: 'api.fanyi.baidu.com',
  7. port: 443,
  8. path: '/api/trans/vip/translate?' + query,
  9. method: 'GET'
  10. };
  11. const request = https.request(options, (response) => {
  12. const chunks:Buffer[] = [];
  13. response.on('data', (chunk) => {
  14. chunks.push(chunk);
  15. });
  16. response.on('end', () => {
  17. const string = Buffer.concat(chunks).toString();
  18. type BaiduResult = {
  19. error_msg?: string;
  20. error_code?: string;
  21. from: string;
  22. to: string;
  23. trans_result: { src: string; dst: string }[]
  24. }
  25. const obj: BaiduResult = JSON.parse(string);
  26. if (obj.error_code) {
  27. console.error(errorMap[obj.error_code] || obj.error_msg);
  28. process.exit(2);
  29. } else {
  30. obj.trans_result.map((obj)=>{console.log(obj.dst);})
  31. process.exit(0);
  32. }
  33. });
  34. });
  35. request.on('error', (e) => {
  36. console.error(e);
  37. });
  38. request.end();
  39. };
  1. querystring 查询字符串
    1. querystring.stringify(obj[, sep[, eq[, options]]])
    2. ->
    3. querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
    4. // 返回 'foo=bar&baz=qux&baz=quux&corge='
    ```

Language files blank comment code

Perl 628 33435 28224 2106458 C++ 2373 202313 171993 1644594 JavaScript 16157 198335 219483 1337991 Assembly 408 65948 9513 716931 C 1970 97894 86608 614690 C/C++ Header 3197 112342 233488 521333 Python 685 17294 24420 187441 Markdown 484 49946 3 179208 JSON 557 14 0 74211 HTML 397 4154 1278 57598 Bourne Shell 111 8578 8264 43129 m4 35 2447 1429 21485 TypeScript 96 1165 2008 9174 YAML 71 735 151 6105 IDL 12 757 0 4023 Starlark 2 102 113 3239 make 27 554 411 2641 CSS 9 388 9 2165 CMake 14 361 347 1574 diff 11 114 543 1526 Bazel 5 106 56 1359 DOS Batch 33 172 56 1329 XHTML 4 101 36 829 D 3 100 292 698 reStructuredText 33 2011 2996 664 Windows Module Definition 8 84 7 548 XML 12 8 21 418 WiX source 1 55 7 378 PowerShell 15 15 75 330 CSV 5 0 0 314 Lisp 4 46 77 293 Bourne Again Shell 9 64 38 259 R 4 49 49 245 Scheme 1 13 51 222 Windows Resource File 4 49 94 209 SVG 4 1 9 193 C# 1 55 9 186 vim script 3 28 30 147 WebAssembly 15 19 8 135 PHP 1 13 19 124 WiX string localization 4 45 12 103 MSBuild script 1 0 16 93 Visual Studio Solution 1 1 1 44 awk 1 1 8 18 CoffeeScript 1 7 8 14 INI 1 5 1 13 Ruby 1 4 5 13 JSX 1 1 0 11 Dockerfile 1 3 0 10

sed 1 0 0 6

SUM: 27422 799932 792266 7544721

```