0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/tools
Vse Mozhet Byt 6946812191 tools: modernize and optimize doc/addon-verify.js
Modernize:
* Replace `var` with `const` / `let`.
* Replace common functions with arrow functions.
* Use destructuring.
* Use `String.prototype.padStart()`, `String.prototype.endsWith()`.

Optimize:
* Reduce function calls.
* Reduce intermediate variables.
* Cache retrieved object properties.
* Move RegExp declaration out of a cycle.
* Simplify RegExps.
* Replace RegExp with string when string suffices.
* Remove conditions that cannot be false.
* Replace for..in with `Object.keys().forEach()`.

Also, eliminate needlessly complicated function chains:
* `ondone` callback only checks errors;
* if there is an error, it is called once and throws, then script exits;
* if there are no errors, it is noop;
* so there is no need to wrap it into `once()` function
* and there is no need to call it without errors;
* we can eliminate it and replace with `throw` where an error occurs;
* we can also replace `onprogress` callback with `console.log` in place;
* at last, we can eliminate `waiting` counter and `once()` utility.

The new script produces results identical to the old ones.

PR-URL: https://github.com/nodejs/node/pull/20188
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-04-24 10:30:21 +03:00
..
bootstrap win, tools: add nasm to boxstarter script 2018-04-14 13:34:43 -07:00
configure.d
doc tools: modernize and optimize doc/addon-verify.js 2018-04-24 10:30:21 +03:00
eslint-rules lint: change require-buffer rule message 2018-04-02 23:11:54 -05:00
gyp Revert "tools: teach gyp to write an 'all deps' rule" 2018-01-25 08:18:42 +11:00
icu tools: fix broken link in icu notes 2018-04-14 12:25:59 -07:00
macos-installer
msvs build, tools, win: add nasm detection for OpenSSL 2018-04-10 06:45:45 +09:00
node_modules tools: update ESLint to 4.19.1 2018-03-24 04:11:48 -07:00
pkgsrc
remark-cli
remark-preset-lint-node doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
rpm
.eslintrc.yaml
certdata.txt tools: update certdata.txt 2018-03-26 18:20:07 -04:00
check_macros.py lib: add internal check macros 2018-03-05 08:35:44 -06:00
check-imports.py
compress_json.py
cpplint.py
create_android_makefiles
create_expfile.sh
dcheck_macros.py lib: add internal check macros 2018-03-05 08:35:44 -06:00
genv8constants.py
getmoduleversion.py
getnodeversion.py
gyp_node.py
install.py tools: install all header files OpenSSL-1.1.0 2018-04-10 06:45:45 +09:00
js2c.py tools,bootstrap: preprocess gypi files to json 2018-03-09 12:38:31 -06:00
license2rtf.js
license-builder.sh tools: add babel-eslint 2018-01-11 09:50:47 +01:00
lint-js.js
lsan_suppressions.txt
macosx-firewall.sh
make-v8.sh tools: fix make test-v8 2018-04-11 13:23:27 -04:00
Makefile
mk-ca-bundle.pl
mkssldef.py build: add OpenSSL-1.1.0 support 2018-04-10 06:45:45 +09:00
nodcheck_macros.py lib: add internal check macros 2018-03-05 08:35:44 -06:00
osx-codesign.sh
osx-pkg-postinstall.sh
osx-productsign.sh
release.sh
run-valgrind.py
sign.bat
specialize_node_d.py
test-npm-package.js tools: fix test-npm-package 2018-03-12 19:49:27 -04:00
test-v8.bat
test.py test: fix test when NODE_OPTIONS env var is set to --trace-warnings 2018-04-23 15:49:23 +02:00
update-authors.sh
update-babel-eslint.sh tools: add babel-eslint 2018-01-11 09:50:47 +01:00
update-eslint.sh
utils.py