ant-design/components/theme/util/calc/index.ts
MadCcc bacaad0262
feat: calc support no unit (#45775)
* chore: calc support no unit

* test: add test case

* test: add test case
2023-11-10 14:54:16 +08:00

12 lines
360 B
TypeScript

import NumCalculator from './NumCalculator';
import CSSCalculator from './CSSCalculator';
import type AbstractCalculator from './calculator';
const genCalc = (type: 'css' | 'js') => {
const Calculator = type === 'css' ? CSSCalculator : NumCalculator;
return (num: number | string | AbstractCalculator) => new Calculator(num);
};
export default genCalc;