MCPcopy Index your code
hub / github.com/plotly/dash / validateArg

Function validateArg

dash/dash-renderer/src/actions/dependencies.js:286–355  ·  view source on GitHub ↗
({id, property}, head, cls, i, dispatchError)

Source from the content-addressed store, hash-verified

284}
285
286function validateArg({id, property}, head, cls, i, dispatchError) {
287 if (typeof property !== 'string' || !property) {
288 dispatchError('Callback property error', [
289 head,
290 `${cls}[${i}].property = ${JSON.stringify(property)}`,
291 'but we expected `property` to be a non-empty string.'
292 ]);
293 }
294
295 if (typeof id === 'object') {
296 if (isEmpty(id)) {
297 dispatchError('Callback item missing ID', [
298 head,
299 `${cls}[${i}].id = {}`,
300 'Every item linked to a callback needs an ID'
301 ]);
302 }
303
304 forEachObjIndexed((v, k) => {
305 if (!k) {
306 dispatchError('Callback wildcard ID error', [
307 head,
308 `${cls}[${i}].id has key "${k}"`,
309 'Keys must be non-empty strings.'
310 ]);
311 }
312
313 if (typeof v === 'object' && v.wild) {
314 if (allowedWildcards[cls][v.wild] !== v) {
315 dispatchError('Callback wildcard ID error', [
316 head,
317 `${cls}[${i}].id["${k}"] = ${v.wild}`,
318 `Allowed wildcards for ${cls}s are:`,
319 keys(allowedWildcards[cls]).join(', ')
320 ]);
321 }
322 } else if (!includes(typeof v, wildcardValTypes)) {
323 dispatchError('Callback wildcard ID error', [
324 head,
325 `${cls}[${i}].id["${k}"] = ${JSON.stringify(v)}`,
326 'Wildcard callback ID values must be either wildcards',
327 'or constants of one of these types:',
328 wildcardValTypes.join(', ')
329 ]);
330 }
331 }, id);
332 } else if (typeof id === 'string') {
333 if (!id) {
334 dispatchError('Callback item missing ID', [
335 head,
336 `${cls}[${i}].id = "${id}"`,
337 'Every item linked to a callback needs an ID'
338 ]);
339 }
340 const invalidChars = idInvalidChars.filter(c => includes(c, id));
341 if (invalidChars.length) {
342 dispatchError('Callback invalid ID string', [
343 head,

Callers 1

validateDependenciesFunction · 0.85

Calls 3

isEmptyFunction · 0.85
filterMethod · 0.80
dispatchErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…