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

Function transformCLI

dlp/inspectWithHotwordRules.js:150–174  ·  view source on GitHub ↗
(infoTypes, customInfoTypes)

Source from the content-addressed store, hash-verified

148});
149
150function transformCLI(infoTypes, customInfoTypes) {
151 infoTypes = infoTypes
152 ? infoTypes.split(',').map(type => {
153 return {name: type};
154 })
155 : undefined;
156
157 if (customInfoTypes) {
158 customInfoTypes = customInfoTypes.includes(',')
159 ? customInfoTypes.split(',').map((dict, idx) => {
160 return {
161 infoType: {name: 'CUSTOM_DICT_'.concat(idx.toString())},
162 dictionary: {wordList: {words: dict.split(',')}},
163 };
164 })
165 : customInfoTypes.split(',').map((rgx, idx) => {
166 return {
167 infoType: {name: 'CUSTOM_REGEX_'.concat(idx.toString())},
168 regex: {pattern: rgx},
169 };
170 });
171 }
172
173 return [infoTypes, customInfoTypes];
174}

Callers 1

mainFunction · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected