'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = createPrefixer; var _prefixProperty = require('./utils/prefixProperty'); var _prefixProperty2 = _interopRequireDefault(_prefixProperty); var _prefixValue = require('./utils/prefixValue'); var _prefixValue2 = _interopRequireDefault(_prefixValue); var _addNewValuesOnly = require('./utils/addNewValuesOnly'); var _addNewValuesOnly2 = _interopRequireDefault(_addNewValuesOnly); var _isObject = require('./utils/isObject'); var _isObject2 = _interopRequireDefault(_isObject); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createPrefixer(_ref) { var prefixMap = _ref.prefixMap, plugins = _ref.plugins; return function prefix(style) { for (var property in style) { var value = style[property]; // handle nested objects if ((0, _isObject2.default)(value)) { style[property] = prefix(value); // handle array values } else if (Array.isArray(value)) { var combinedValue = []; for (var i = 0, len = value.length; i < len; ++i) { var processedValue = (0, _prefixValue2.default)(plugins, property, value[i], style, prefixMap); (0, _addNewValuesOnly2.default)(combinedValue, processedValue || value[i]); } // only modify the value if it was touched // by any plugin to prevent unnecessary mutations if (combinedValue.length > 0) { style[property] = combinedValue; } } else { var _processedValue = (0, _prefixValue2.default)(plugins, property, value, style, prefixMap); // only modify the value if it was touched // by any plugin to prevent unnecessary mutations if (_processedValue) { style[property] = _processedValue; } style = (0, _prefixProperty2.default)(prefixMap, property, style); } } return style; }; }