packages: upgrade radash
This commit is contained in:
parent
92badbba4b
commit
601e03da90
@ -1,4 +1,4 @@
|
||||
import { alphabetical } from 'radash/dist/array';
|
||||
import { alphabetical } from 'radash';
|
||||
import type { CalculationOptions } from 'stores/calculation/options/types';
|
||||
|
||||
export const selectSeasonType = [
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { rest } from 'msw';
|
||||
import { random } from 'radash';
|
||||
const _ = require('radash');
|
||||
|
||||
const users = {
|
||||
akalinina: {
|
||||
@ -29,8 +29,8 @@ export const handlers = [
|
||||
rest.post('/api/core/fingap', (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.json({
|
||||
sum: random(100000, 200000),
|
||||
premium: random(1000, 10000),
|
||||
sum: _.random(100000, 200000),
|
||||
premium: _.random(1000, 10000),
|
||||
})
|
||||
);
|
||||
}),
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"next-plugin-graphql": "^0.0.2",
|
||||
"next-with-less": "^2.0.5",
|
||||
"normalize.css": "^8.0.1",
|
||||
"radash": "^7.1.0",
|
||||
"radash": "^8.0.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rebass": "^4.0.7",
|
||||
|
||||
@ -4,10 +4,11 @@ import type { ApolloClient } from '@apollo/client';
|
||||
import type { QueryClient } from '@tanstack/react-query';
|
||||
import { selectHighSeasonStart, selectSeasonType } from 'config/default-options';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
import { shift } from 'radash';
|
||||
import type { CalculationOptions } from 'stores/calculation/options/types';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { Row } from 'stores/tables/payments/types';
|
||||
import { difference, shift } from 'tools/array';
|
||||
import { difference } from 'tools/array';
|
||||
import * as seasonsConstants from './lib/seasons-constants';
|
||||
import * as seasonsTools from './lib/seasons-tools';
|
||||
import validatePaymentsTable from './validation';
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable max-len */
|
||||
/* eslint-disable no-case-declarations */
|
||||
import { counting, max, min, sort } from 'radash/dist/array';
|
||||
|
||||
import { counting, max, min, shift, sort } from 'radash';
|
||||
import type RootStore from 'stores/root';
|
||||
import { areEqual, isSorted, shift } from 'tools/array';
|
||||
import { areEqual, isSorted } from 'tools/array';
|
||||
import { SEASONS_PERIODS, SEASONS_PERIOD_NUMBER } from './lib/seasons-constants';
|
||||
|
||||
export default function validatePaymentsTable({ $calculation, $tables }: RootStore) {
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
import { shift } from 'tools/array';
|
||||
|
||||
describe('tools/array', () => {
|
||||
describe('[function] shift', () => {
|
||||
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
test('should shift array right 3 positions', () => {
|
||||
const result = shift(arr, 3);
|
||||
expect(result).toEqual([7, 8, 9, 1, 2, 3, 4, 5, 6]);
|
||||
});
|
||||
test('should shift array left 3 positions', () => {
|
||||
const result = shift(arr, -3);
|
||||
expect(result).toEqual([4, 5, 6, 7, 8, 9, 1, 2, 3]);
|
||||
});
|
||||
test('should shift array right 6 positions', () => {
|
||||
const result = shift(arr, 15);
|
||||
expect(result).toEqual([4, 5, 6, 7, 8, 9, 1, 2, 3]);
|
||||
});
|
||||
test('should shift array left 6 positions', () => {
|
||||
const result = shift(arr, -15);
|
||||
expect(result).toEqual([7, 8, 9, 1, 2, 3, 4, 5, 6]);
|
||||
});
|
||||
test('should keep array as is', () => {
|
||||
const result = shift(arr, 0);
|
||||
expect(result).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||
});
|
||||
test('should keep array as is', () => {
|
||||
const result = shift(arr, 9);
|
||||
expect(result).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||
});
|
||||
test('should return empty array', () => {
|
||||
const result = shift([], 0);
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
test('should return empty array', () => {
|
||||
const result = shift([], 0);
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -16,16 +16,6 @@ export function difference<T>(arr1: ReadonlyArray<T>, arr2: ReadonlyArray<T>) {
|
||||
return changes;
|
||||
}
|
||||
|
||||
export function shift<T>(arr: Array<T>, n: number) {
|
||||
if (arr.length === 0) return arr;
|
||||
|
||||
const shiftNumber = n % arr.length;
|
||||
|
||||
if (shiftNumber === 0) return arr;
|
||||
|
||||
return [...arr.slice(-shiftNumber, arr.length), ...arr.slice(0, -shiftNumber)];
|
||||
}
|
||||
|
||||
export function isSorted(arr: Array<number>) {
|
||||
return arr.every((value, index, array) => !index || array[index - 1] <= value);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import type { BaseOption } from 'Elements/types';
|
||||
import { isEmpty } from 'radash/dist/typed';
|
||||
import { isEmpty } from 'radash';
|
||||
|
||||
export function normalizeOptions(options: any[] | null | undefined) {
|
||||
return (isEmpty(options) ? [] : options) as BaseOption[];
|
||||
|
||||
@ -7858,10 +7858,10 @@ queue-microtask@^1.2.2:
|
||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
||||
|
||||
radash@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/radash/-/radash-7.1.0.tgz#b6da541c678368ab3a1f3702057342e944599e92"
|
||||
integrity sha512-NOWTaF5YMY3mCgrNq9Fw9fK8yvJv92uqRb2StcVq5W8kcJ6949EbV2vk6nLJKAocYs29rzJafZZP1lFkEkoVGw==
|
||||
radash@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/radash/-/radash-8.0.0.tgz#c3486c0062f2388e6502a85cd51b56264bde7d88"
|
||||
integrity sha512-OaK3HZDH1I2Yh0+v3nZRcy/OLNviADAk12QepxmLZH2dsQ4SZWEd+YwbZEG/veignExeAJBKfQDiNCZUiXR6iA==
|
||||
|
||||
rc-align@^4.0.0:
|
||||
version "4.0.11"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user