replace let with const

This commit is contained in:
vchikalkin 2021-04-06 10:20:40 +03:00 committed by Chika
parent 671d9fff61
commit e36a5e3b52
11 changed files with 23 additions and 23 deletions

View File

@ -49,7 +49,7 @@ export const useValidation = ({
calculationStore.setValidation(elementName, undefined);
} else {
if (validator) {
let validationResult = validator(value);
const validationResult = validator(value);
calculationStore.setValidation(elementName, validationResult);
}
}
@ -109,7 +109,7 @@ export const useTableValidation = ({
]);
} else {
if (validator) {
let validationResult = validator(value);
const validationResult = validator(value);
calculationStore.setTableRows(
tableName,
rowIndex,

View File

@ -7,7 +7,7 @@ import { toJS } from 'mobx';
import { omit } from 'lodash';
export default () => {
let invalidElements: string[] = [];
const invalidElements: string[] = [];
const { validations: storeValidations } = CalculationStore;
const validations = toJS(storeValidations);
Object.keys(validations).forEach(elementName => {
@ -16,7 +16,7 @@ export default () => {
}
});
let invalidTables: string[] = [];
const invalidTables: string[] = [];
const { tables: storeTables } = CalculationStore;
const tables = omit(toJS(storeTables), tablesExclusion);
Object.keys(tables).forEach(tableName => {

View File

@ -16,7 +16,7 @@ export default ({
const { values, options, tables } = calculationStore;
//@ts-ignore
let preparedPaymentsRows: PaymentRow[] = Array.from(
const preparedPaymentsRows: PaymentRow[] = Array.from(
{ length: values.leasingPeriod },
() => ({
numberPayment: 0,
@ -75,7 +75,7 @@ export default ({
}
}
let preparedValues: PreparedValues = {
const preparedValues: PreparedValues = {
brandId: NIL,
configurationId: NIL,
firstPaymentAbs: 0,
@ -133,19 +133,19 @@ export default ({
preparedValues.transportTaxGrYear = 0;
preparedValues.transportTaxGr = 0;
let insuranceKaskoRow = tables.tableInsurance.rows.find(
const insuranceKaskoRow = tables.tableInsurance.rows.find(
x => x.policyType?.value === 'КАСКО',
);
let insuranceNSRow = tables.tableInsurance.rows.find(
const insuranceNSRow = tables.tableInsurance.rows.find(
x => x.policyType?.value === 'НС',
);
let insuranceDGORow = tables.tableInsurance.rows.find(
const insuranceDGORow = tables.tableInsurance.rows.find(
x => x.policyType?.value === 'ДГО',
);
let insuranceOSAGORow = tables.tableInsurance.rows.find(
const insuranceOSAGORow = tables.tableInsurance.rows.find(
x => x.policyType?.value === 'ОСАГО',
);

View File

@ -11,7 +11,7 @@ export default {
) => {
if (preparedData.preparedValues.nmper) {
const { sumWithVatColumn, vatColumn, sumRepaymentColumn } = res.columns;
let results: TableProps<ITableCell>[] = [];
const results: TableProps<ITableCell>[] = [];
for (let i = 0; i < preparedData.preparedValues.nmper; i++) {
results.push({

View File

@ -212,7 +212,7 @@ const validatePaymentsTable = () => {
const startPositions =
seasonTypeOptions && seasonTypeOptions.startPositions;
let stepsValues = [];
const stepsValues = [];
for (let i = 0; i < startPositions.length; i++) {
const targetIndex = startPositions[i];
//@ts-ignore

View File

@ -241,7 +241,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
x => x.evo_baseproductid === newValues.product,
);
let addProducts = Object.assign(
const addProducts = Object.assign(
{},
...Object.keys(map_add_product_types_to_values).map(elementName => {
const target_add_product_type = quote?.evo_addproduct_types?.find(

View File

@ -250,7 +250,7 @@ export default [
?.find(x => x.evo_ref_transactioncurrency === supplierCurrencyId);
const evo_currencychangeValue =
(evo_currencychange && evo_currencychange.evo_currencychange) || 0;
let price = convertPrice(
const price = convertPrice(
supplierCurrency?.isocurrencycode,
leaseObjectPrice,
evo_currencychangeValue,
@ -287,7 +287,7 @@ export default [
?.find(x => x.evo_ref_transactioncurrency === supplierCurrencyId);
const evo_currencychangeValue =
(evo_currencychange && evo_currencychange.evo_currencychange) || 0;
let price = convertPrice(
const price = convertPrice(
supplierCurrency?.isocurrencycode,
leaseObjectPrice,
evo_currencychangeValue,

View File

@ -42,13 +42,13 @@ const reactionEffects: IReactionEffect[] = [
?.find(x => x.evo_ref_transactioncurrency === supplierCurrencyId);
const evo_currencychangeValue =
(evo_currencychange && evo_currencychange.evo_currencychange) || 0;
let price = convertPrice(
const price = convertPrice(
supplierCurrency?.isocurrencycode,
leaseObjectPrice,
evo_currencychangeValue,
);
let maxPriceChange =
const maxPriceChange =
price - supplierDiscountRub < 800000
? price - supplierDiscountRub + 50000
: (price - supplierDiscountRub) * 1.05;
@ -118,7 +118,7 @@ const reactionEffects: IReactionEffect[] = [
?.find(x => x.evo_ref_transactioncurrency === supplierCurrencyId);
const evo_currencychangeValue =
(evo_currencychange && evo_currencychange.evo_currencychange) || 0;
let price = convertPrice(
const price = convertPrice(
supplierCurrency?.isocurrencycode,
leaseObjectPrice,
evo_currencychangeValue,

View File

@ -582,7 +582,7 @@ export default [
},
}),
);
for (let i in middleRows) {
for (const i in middleRows) {
const currRow = middleRows[parseInt(i)];
const prevRow = middleRows[parseInt(i) - 1];
currRow.paymentRelation.value = parseFloat(

View File

@ -30,7 +30,7 @@ export default class {
if (!res.data || res.errors) {
reject(res.error || res.errors);
}
let resEntities: TEntities<TCRMEntity | TCRMEntity[]> = cloneDeep(
const resEntities: TEntities<TCRMEntity | TCRMEntity[]> = cloneDeep(
res.data,
);
@ -42,8 +42,8 @@ export default class {
//@ts-ignore
if (toOptions.includes(targetName)) {
if (Array.isArray(targetEnt)) {
let optionatedEntities: (TCRMEntity & IBaseOption)[] = [];
for (let entity of targetEnt) {
const optionatedEntities: (TCRMEntity & IBaseOption)[] = [];
for (const entity of targetEnt) {
const entityOption = convertEntityToOption(
entity,
entity.__typename,

View File

@ -2,7 +2,7 @@ export function stringifyObject(obj_from_json: any): string {
if (typeof obj_from_json !== 'object' || Array.isArray(obj_from_json)) {
return JSON.stringify(obj_from_json);
}
let props = Object.keys(obj_from_json)
const props = Object.keys(obj_from_json)
.map(key => `${key}:${stringifyObject(obj_from_json[key])}`)
.join(',');
return `${props}`;