MCPcopy Create free account
hub / github.com/dataform-co/dataform / matchPatterns

Function matchPatterns

core/utils.ts:29–48  ·  view source on GitHub ↗
(patterns: string[], values: string[])

Source from the content-addressed store, hash-verified

27 typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
28
29export function matchPatterns(patterns: string[], values: string[]) {
30 const fullyQualifiedActions: string[] = [];
31 patterns.forEach(pattern => {
32 if (pattern.includes(".")) {
33 if (values.includes(pattern)) {
34 fullyQualifiedActions.push(pattern);
35 }
36 } else {
37 const matchingActions = values.filter(value => pattern === value.split(".").slice(-1)[0]);
38 if (matchingActions.length === 0) {
39 return;
40 }
41 if (matchingActions.length > 1) {
42 throw new Error(ambiguousActionNameMsg(pattern, matchingActions));
43 }
44 fullyQualifiedActions.push(matchingActions[0]);
45 }
46 });
47 return fullyQualifiedActions;
48}
49
50export function getCallerFile(rootDir: string) {
51 let lastfile: string;

Callers

nothing calls this directly

Calls 2

ambiguousActionNameMsgFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected