MCPcopy Index your code
hub / github.com/nodejs/node / serializeOptionBaseObject

Function serializeOptionBaseObject

test/fixtures/snapshot/typescript.js:41226–41267  ·  view source on GitHub ↗
(options, _a, pathOptions)

Source from the content-addressed store, hash-verified

41224 return serializeOptionBaseObject(options, getWatchOptionsNameMap());
41225 }
41226 function serializeOptionBaseObject(options, _a, pathOptions) {
41227 var optionsNameMap = _a.optionsNameMap;
41228 var result = new ts.Map();
41229 var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
41230 var _loop_5 = function (name) {
41231 if (ts.hasProperty(options, name)) {
41232 // tsconfig only options cannot be specified via command line,
41233 // so we can assume that only types that can appear here string | number | boolean
41234 if (optionsNameMap.has(name) && (optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options || optionsNameMap.get(name).category === ts.Diagnostics.Output_Formatting)) {
41235 return "continue";
41236 }
41237 var value = options[name];
41238 var optionDefinition = optionsNameMap.get(name.toLowerCase());
41239 if (optionDefinition) {
41240 var customTypeMap_1 = getCustomTypeMapOfCommandLineOption(optionDefinition);
41241 if (!customTypeMap_1) {
41242 // There is no map associated with this compiler option then use the value as-is
41243 // This is the case if the value is expect to be string, number, boolean or list of string
41244 if (pathOptions && optionDefinition.isFilePath) {
41245 result.set(name, ts.getRelativePathFromFile(pathOptions.configFilePath, ts.getNormalizedAbsolutePath(value, ts.getDirectoryPath(pathOptions.configFilePath)), getCanonicalFileName));
41246 }
41247 else {
41248 result.set(name, value);
41249 }
41250 }
41251 else {
41252 if (optionDefinition.type === "list") {
41253 result.set(name, value.map(function (element) { return getNameOfCompilerOptionValue(element, customTypeMap_1); })); // TODO: GH#18217
41254 }
41255 else {
41256 // There is a typeMap associated with this command-line option so use it to map value back to its name
41257 result.set(name, getNameOfCompilerOptionValue(value, customTypeMap_1));
41258 }
41259 }
41260 }
41261 }
41262 };
41263 for (var name in options) {
41264 _loop_5(name);
41265 }
41266 return result;
41267 }
41268 /**
41269 * Generate a list of the compiler options whose value is not the default.
41270 * @param options compilerOptions to be evaluated.

Callers 2

serializeCompilerOptionsFunction · 0.85
serializeWatchOptionsFunction · 0.85

Calls 1

_loop_5Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…