mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 09:39:10 +08:00
bacaad0262
* chore: calc support no unit * test: add test case * test: add test case
12 lines
360 B
TypeScript
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;
|