aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/style/util.ts
blob: 3e38c4a7de534ddc01f63d2d475517cbbee8b38c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import { ObjectMap } from '@0x/types';
import * as _ from 'lodash';

export const cssRuleIfExists = (props: ObjectMap<any>, rule: string): string => {
    const camelCaseRule = _.camelCase(rule);
    const ruleValueIfExists = props[camelCaseRule];
    if (!_.isUndefined(ruleValueIfExists)) {
        return `${rule}: ${ruleValueIfExists};`;
    }
    return '';
};