MCPcopy
hub / github.com/meteor/meteor / check

Function check

packages/check/match.js:20–44  ·  view source on GitHub ↗
(value, pattern)

Source from the content-addressed store, hash-verified

18 * @param {MatchPattern} pattern The pattern to match `value` against
19 */
20export function check(value, pattern) {
21 // Record that check got called, if somebody cared.
22 //
23 // We use getOrNullIfOutsideFiber so that it's OK to call check()
24 // from non-Fiber server contexts; the downside is that if you forget to
25 // bindEnvironment on some random callback in your method/publisher,
26 // it might not find the argumentChecker and you'll get an error about
27 // not checking an argument that it looks like you're checking (instead
28 // of just getting a "Node code must run in a Fiber" error).
29 const argChecker = currentArgumentChecker.getOrNullIfOutsideFiber();
30 if (argChecker) {
31 argChecker.checking(value);
32 }
33
34 const result = testSubtree(value, pattern);
35 if (result) {
36 const err = new Match.Error(result.message);
37 if (result.path) {
38 err.message += ` in field ${result.path}`;
39 err.path = result.path;
40 }
41
42 throw err;
43 }
44};
45
46/**
47 * @namespace Match

Callers 15

'links.insert'Function · 0.90
matchesFunction · 0.70
failsFunction · 0.70
match_test.jsFile · 0.70
matchFunction · 0.70
oauth_client.jsFile · 0.50
livedata_tests.jsFile · 0.50
datatypes.jsFile · 0.50
solver.jsFile · 0.50
catalog-cache.jsFile · 0.50

Calls 2

testSubtreeFunction · 0.85
checkingMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…