Skip to content

Instantly share code, notes, and snippets.

@itsdouges
Created September 4, 2017 05:52
Show Gist options
  • Save itsdouges/ba109f72db2c27c73f792bde2db51fa4 to your computer and use it in GitHub Desktop.
Save itsdouges/ba109f72db2c27c73f792bde2db51fa4 to your computer and use it in GitHub Desktop.
Prefixes inline styles with vendor browser prefixes
// @flow
import upperFirst from 'lodash/upperFirst';
const vendors = ['Webkit', 'Moz', 'ms', 'O'];
// eslint-disable-next-line import/prefer-default-export
export function prefix (key: string, value: string): { [key: string]: string } {
const obj = {
[key]: value,
};
vendors.forEach((vendor) => (obj[`${vendor}${upperFirst(key)}`] = value));
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment