perf(bundlesize): remove lodash padStart/padEnd (#39040)

This commit is contained in:
afc163 2022-11-28 00:20:50 +08:00 committed by GitHub
parent 38e413e600
commit aae35a4d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 6 deletions

View File

@ -1,5 +1,4 @@
import classNames from 'classnames';
import padStart from 'lodash/padStart';
import { PickerPanel as RCPickerPanel } from 'rc-picker';
import type { GenerateConfig } from 'rc-picker/lib/generate';
import type { Locale } from 'rc-picker/lib/interface';
@ -198,7 +197,7 @@ function generateCalendar<DateType>(generateConfig: GenerateConfig<DateType>) {
})}
>
<div className={`${calendarPrefixCls}-date-value`}>
{padStart(String(generateConfig.getDate(date)), 2, '0')}
{String(generateConfig.getDate(date)).padStart(2, '0')}
</div>
<div className={`${calendarPrefixCls}-date-content`}>
{dateCellRender && dateCellRender(date)}

View File

@ -1,4 +1,3 @@
import padEnd from 'lodash/padEnd';
import * as React from 'react';
import type { FormatConfig, valueType } from './utils';
@ -30,7 +29,7 @@ const StatisticNumber: React.FC<NumberProps> = (props) => {
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
if (typeof precision === 'number') {
decimal = padEnd(decimal, precision, '0').slice(0, precision > 0 ? precision : 0);
decimal = decimal.padEnd(precision, '0').slice(0, precision > 0 ? precision : 0);
}
if (decimal) {

View File

@ -1,4 +1,3 @@
import padStart from 'lodash/padStart';
import type * as React from 'react';
export type valueType = number | string;
@ -46,7 +45,7 @@ export function formatTimeStr(duration: number, format: string) {
leftDuration -= value * unit;
return current.replace(new RegExp(`${name}+`, 'g'), (match: string) => {
const len = match.length;
return padStart(value.toString(), len, '0');
return value.toString().padStart(len, '0');
});
}
return current;