MCPcopy
hub / github.com/single-spa/single-spa / validateRegisterWithArguments

Function validateRegisterWithArguments

src/applications/apps.js:266–307  ·  view source on GitHub ↗
(
  name,
  appOrLoadApp,
  activeWhen,
  customProps
)

Source from the content-addressed store, hash-verified

264}
265
266function validateRegisterWithArguments(
267 name,
268 appOrLoadApp,
269 activeWhen,
270 customProps
271) {
272 if (typeof name !== "string" || name.length === 0)
273 throw Error(
274 formatErrorMessage(
275 20,
276 __DEV__ &&
277 `The 1st argument to registerApplication must be a non-empty string 'appName'`
278 )
279 );
280
281 if (!appOrLoadApp)
282 throw Error(
283 formatErrorMessage(
284 23,
285 __DEV__ &&
286 "The 2nd argument to registerApplication must be an application or loading application function"
287 )
288 );
289
290 if (typeof activeWhen !== "function")
291 throw Error(
292 formatErrorMessage(
293 24,
294 __DEV__ &&
295 "The 3rd argument to registerApplication must be an activeWhen function"
296 )
297 );
298
299 if (!validCustomProps(customProps))
300 throw Error(
301 formatErrorMessage(
302 22,
303 __DEV__ &&
304 "The optional 4th argument is a customProps and must be an object"
305 )
306 );
307}
308
309export function validateRegisterWithConfig(config) {
310 if (Array.isArray(config) || config === null)

Callers 1

sanitizeArgumentsFunction · 0.85

Calls 2

formatErrorMessageFunction · 0.90
validCustomPropsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…