MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / transformCLI

Function transformCLI

dlp/inspectFile.js:119–143  ·  view source on GitHub ↗
(infoTypes, customInfoTypes)

Source from the content-addressed store, hash-verified

117});
118
119function transformCLI(infoTypes, customInfoTypes) {
120 infoTypes = infoTypes
121 ? infoTypes.split(',').map(type => {
122 return {name: type};
123 })
124 : undefined;
125
126 if (customInfoTypes) {
127 customInfoTypes = customInfoTypes.includes(',')
128 ? customInfoTypes.split(',').map((dict, idx) => {
129 return {
130 infoType: {name: 'CUSTOM_DICT_'.concat(idx.toString())},
131 dictionary: {wordList: {words: dict.split(',')}},
132 };
133 })
134 : customInfoTypes.split(',').map((rgx, idx) => {
135 return {
136 infoType: {name: 'CUSTOM_REGEX_'.concat(idx.toString())},
137 regex: {pattern: rgx},
138 };
139 });
140 }
141
142 return [infoTypes, customInfoTypes];
143}

Callers 1

mainFunction · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected