aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/style/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/style/util.ts')
-rw-r--r--packages/instant/src/style/util.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/instant/src/style/util.ts b/packages/instant/src/style/util.ts
new file mode 100644
index 000000000..3e38c4a7d
--- /dev/null
+++ b/packages/instant/src/style/util.ts
@@ -0,0 +1,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 '';
+};