Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function prefixValue(value: string, propertyPrefixMap: Object): string {
if (isPrefixedValue(value)) {
return value
}
// only split multi values, not cubic beziers
const multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g)
for (let i = 0, len = multipleValues.length; i < len; ++i) {
const singleValue = multipleValues[i]
const values = [singleValue]
for (const property in propertyPrefixMap) {
const dashCaseProperty = hyphenateProperty(property)
if (
singleValue.indexOf(dashCaseProperty) > -1 &&
dashCaseProperty !== 'order'
) {
const prefixes = propertyPrefixMap[property]
for (let j = 0, pLen = prefixes.length; j < pLen; ++j) {
// join all prefixes and create a new value
values.unshift(
singleValue.replace(
dashCaseProperty,
prefixMapping[prefixes[j]] + dashCaseProperty
)
)
}
}
requiresPrefixDashCased = Object.keys(requiresPrefix).map(prop =>
hyphenateProperty(prop)
)