fbredius/storybook

View on GitHub
lib/store/src/csf/getValuesFromArgTypes.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { ArgTypes } from '@storybook/csf';

export const getValuesFromArgTypes = (argTypes: ArgTypes = {}) =>
  Object.entries(argTypes).reduce((acc, [arg, { defaultValue }]) => {
    if (typeof defaultValue !== 'undefined') {
      acc[arg] = defaultValue;
    }
    return acc;
  }, {} as ArgTypes);