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

Function transformCLI

dlp/inspectPhoneNumber.js:108–132  ·  view source on GitHub ↗
(infoTypes, customInfoTypes)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected