%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/node_modules/styled-components/src/utils/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/node_modules/styled-components/src/utils/hyphenateStyleName.ts |
const isUpper = (c: string) => c >= 'A' && c <= 'Z'; /** * Hyphenates a camelcased CSS property name, for example: * * > hyphenateStyleName('backgroundColor') * < "background-color" * > hyphenateStyleName('MozTransition') * < "-moz-transition" * > hyphenateStyleName('msTransition') * < "-ms-transition" * * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix * is converted to `-ms-`. */ export default function hyphenateStyleName(string: string): string { let output = ''; for (let i = 0; i < string.length; i++) { const c = string[i]; // Check for CSS variable prefix if (i === 1 && c === '-' && string[0] === '-') { return string; } if (isUpper(c)) { output += '-' + c.toLowerCase(); } else { output += c; } } return output.startsWith('ms-') ? '-' + output : output; }