diff --git a/lib/formatPercentageProps.js b/lib/formatPercentageProps.js deleted file mode 100644 index ddc74156..00000000 --- a/lib/formatPercentageProps.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Format potential percentage props - * - * convert somet props like those - * width="50%" - * height="500" - * - * to - * { - * width: { - * percentage: true, - * value: 0.5 - * }, - * height: { - * percentage: false, - * value: 500 - * } - * } - * - * - */ -import _ from 'lodash'; -import percentToFloat from './percentToFloat'; - -function percentageTransform(value) { - if (typeof value === 'number') { - return { - percentage: false, - value - }; - } - - let float = percentToFloat(value); - - return { - percentage: float !== +value, - value: float - }; -} - -export default function (props, list) { - return _.reduce(list, (prev, name) => { - if (!_.isNil(props[name])) { - prev[name] = percentageTransform(props[name]); - } - - return prev; - }, {}); -} diff --git a/lib/percentFactory.js b/lib/percentFactory.js deleted file mode 100644 index bf404c7e..00000000 --- a/lib/percentFactory.js +++ /dev/null @@ -1,13 +0,0 @@ -import percentToFloat from './percentToFloat'; -let percentReg = /%/; - -export default function (...args) { - let hasPercent = percentReg.test(args.join('')); - if (hasPercent) { - return args.map(arg => { - return function (base) { - return percentReg.test(arg) ? percentToFloat(arg) * base : +arg; - }; - }); - } -}