MCPcopy Index your code
hub / github.com/vercel/hyper / getProps

Function getProps

lib/utils/plugins.ts:401–431  ·  view source on GitHub ↗
(name: keyof typeof propsDecorators, props: any, ...fnArgs: any[])

Source from the content-addressed store, hash-verified

399}
400
401function getProps(name: keyof typeof propsDecorators, props: any, ...fnArgs: any[]) {
402 const decorators = propsDecorators[name];
403 let props_: typeof props;
404
405 decorators.forEach((fn) => {
406 let ret_;
407
408 if (!props_) {
409 props_ = Object.assign({}, props);
410 }
411
412 try {
413 // eslint-disable-next-line @typescript-eslint/no-unsafe-call
414 ret_ = fn(...fnArgs, props_);
415 } catch (err) {
416 notify('Plugin error', `${fn._pluginName}: Error occurred in \`${name}\`. Check Developer Tools for details.`, {
417 error: err
418 });
419 return;
420 }
421
422 if (!ret_ || typeof ret_ !== 'object') {
423 notify('Plugin error', `${fn._pluginName}: Invalid return value of \`${name}\` (object expected).`);
424 return;
425 }
426
427 props_ = ret_;
428 });
429
430 return props_ || props;
431}
432
433export function getTermGroupProps<T extends Assignable<TermGroupOwnProps, T>>(
434 uid: string,

Callers 4

getTermGroupPropsFunction · 0.85
getTermPropsFunction · 0.85
getTabsPropsFunction · 0.85
getTabPropsFunction · 0.85

Calls 3

fnFunction · 0.85
notifyFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected