Katochimoto/xblocks

View on GitHub
src/utils/exportPropTypes.js

Summary

Maintainability
A
0 mins
Test Coverage
import { utils } from 'xblocks-core';

/**
 * @param {string} tagName
 * @returns {Object}
 */
export default function (tagName) {
    const props = utils.propTypes(tagName);
    const propTypes = {};
    const prefix = tagName + '-';

    for (const p in props) {
        if (props.hasOwnProperty(p) && p[ 0 ] !== '_') {
            propTypes[ prefix + p ] = props[ p ];
        }
    }

    return { propTypes };
}