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

Function transformCLI

dlp/inspectString.js:107–131  ·  view source on GitHub ↗
(infoTypes, customInfoTypes)

Source from the content-addressed store, hash-verified

105});
106
107function transformCLI(infoTypes, customInfoTypes) {
108 infoTypes = infoTypes
109 ? infoTypes.split(',').map(type => {
110 return {name: type};
111 })
112 : undefined;
113
114 if (customInfoTypes) {
115 customInfoTypes = customInfoTypes.includes(',')
116 ? customInfoTypes.split(',').map((dict, idx) => {
117 return {
118 infoType: {name: 'CUSTOM_DICT_'.concat(idx.toString())},
119 dictionary: {wordList: {words: dict.split(',')}},
120 };
121 })
122 : customInfoTypes.split(',').map((rgx, idx) => {
123 return {
124 infoType: {name: 'CUSTOM_REGEX_'.concat(idx.toString())},
125 regex: {pattern: rgx},
126 };
127 });
128 }
129
130 return [infoTypes, customInfoTypes];
131}

Callers 1

mainFunction · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected