0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/lib/internal/options.js
Joyee Cheung f895b5a58e src: cache the result of GetOptions() in JS land
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>
2018-11-07 20:40:38 -08:00

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
};