mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
12 lines
351 B
TypeScript
12 lines
351 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 | AbstractCalculator) => new Calculator(num);
|
||
|
};
|
||
|
|
||
|
export default genCalc;
|