MCPcopy Create free account
hub / github.com/apitable/apitable / testPath

Function testPath

packages/core/src/event_manager/helper.ts:74–96  ·  view source on GitHub ↗
(pathList: (string | number)[], testPathList: string[], flag = true)

Source from the content-addressed store, hash-verified

72 * }
73 */
74export const testPath = (pathList: (string | number)[], testPathList: string[], flag = true) => {
75 const NOT_PASS_RES = {
76 pass: false,
77 };
78 if (!flag || pathList.length !== testPathList.length) {
79 return NOT_PASS_RES;
80 }
81 const res: {
82 [key: string]: any
83 } = { pass: true };
84
85 for (let i = 0; i < testPathList.length; i++) {
86 if (testPathList[i]!.startsWith(':')) {
87 const pathKey = testPathList[i]!.slice(1);
88 res[pathKey] = pathList[i];
89 continue;
90 }
91 if (pathList[i] !== testPathList[i]) {
92 return NOT_PASS_RES;
93 }
94 }
95 return res;
96};
97
98export const shallowEqual = (objA: any, objB: any) => {
99 if (objA === objB) {

Callers 9

handleSubscriptionsMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90
testMethod · 0.90

Calls

no outgoing calls

Tested by 8

testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72