mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 07:27:22 +01:00
f895b5a58e
Instead of calling into C++ each time we need to check the value of a command line option, cache the option map in a new `internal/options` module for faster access to the values in JS land. PR-URL: https://github.com/nodejs/node/pull/24091 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Refael Ackermann <refack@gmail.com>
19 lines
312 B
JavaScript
19 lines
312 B
JavaScript
'use strict';
|
|
|
|
const { getOptions } = internalBinding('options');
|
|
const { options, aliases } = getOptions();
|
|
|
|
function getOptionValue(option) {
|
|
const result = options.get(option);
|
|
if (!result) {
|
|
return undefined;
|
|
}
|
|
return result.value;
|
|
}
|
|
|
|
module.exports = {
|
|
options,
|
|
aliases,
|
|
getOptionValue
|
|
};
|