@hapl/api-queries 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import qs from 'qs';
3
3
  import { nanoid } from 'nanoid/non-secure';
4
- import isNil from 'lodash-es/isNil';
5
- import isString from 'lodash-es/isString';
6
- import chunk from 'lodash-es/chunk';
7
4
 
8
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
9
6
  try {
@@ -4077,6 +4074,92 @@ function findExpertGradesByExpertIdRequest(_ref) {
4077
4074
  });
4078
4075
  }
4079
4076
 
4077
+ /* Код взят c https://github.com/toss/es-toolkit */
4078
+
4079
+ /**
4080
+ * Splits an array into smaller arrays of a specified length.
4081
+ *
4082
+ * This function takes an input array and divides it into multiple smaller arrays,
4083
+ * each of a specified length. If the input array cannot be evenly divided,
4084
+ * the final sub-array will contain the remaining elements.
4085
+ *
4086
+ * @template T The type of elements in the array.
4087
+ * @param {T[]} arr - The array to be chunked into smaller arrays.
4088
+ * @param {number} size - The size of each smaller array. Must be a positive integer.
4089
+ * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.
4090
+ * @throws {Error} Throws an error if `size` is not a positive integer.
4091
+ *
4092
+ * @example
4093
+ * // Splits an array of numbers into sub-arrays of length 2
4094
+ * chunk([1, 2, 3, 4, 5], 2);
4095
+ * // Returns: [[1, 2], [3, 4], [5]]
4096
+ *
4097
+ * @example
4098
+ * // Splits an array of strings into sub-arrays of length 3
4099
+ * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);
4100
+ * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
4101
+ */
4102
+ function chunk(arr, size) {
4103
+ if (!Number.isInteger(size) || size <= 0) {
4104
+ throw new Error('Size must be an integer greater than zero.');
4105
+ }
4106
+
4107
+ var chunkLength = Math.ceil(arr.length / size);
4108
+ var result = Array(chunkLength);
4109
+
4110
+ for (var index = 0; index < chunkLength; index++) {
4111
+ var start = index * size;
4112
+ var end = start + size;
4113
+ result[index] = arr.slice(start, end);
4114
+ }
4115
+
4116
+ return result;
4117
+ }
4118
+ /**
4119
+ * Checks if a given value is null or undefined.
4120
+ *
4121
+ * This function tests whether the provided value is either `null` or `undefined`.
4122
+ * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
4123
+ *
4124
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
4125
+ *
4126
+ * @param {unknown} x - The value to test for null or undefined.
4127
+ * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.
4128
+ *
4129
+ * @example
4130
+ * const value1 = null;
4131
+ * const value2 = undefined;
4132
+ * const value3 = 42;
4133
+ * const result1 = isNil(value1); // true
4134
+ * const result2 = isNil(value2); // true
4135
+ * const result3 = isNil(value3); // false
4136
+ */
4137
+
4138
+ function isNil(x) {
4139
+ return x == null;
4140
+ }
4141
+ /**
4142
+ * Checks if a given value is string.
4143
+ *
4144
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`.
4145
+ *
4146
+ * @param {unknown} value The value to check if it is string.
4147
+ * @returns {value is string} Returns `true` if `value` is a string, else `false`.
4148
+ *
4149
+ * @example
4150
+ * const value1 = 'abc';
4151
+ * const value2 = 123;
4152
+ * const value3 = true;
4153
+ *
4154
+ * console.log(isString(value1)); // true
4155
+ * console.log(isString(value2)); // false
4156
+ * console.log(isString(value3)); // false
4157
+ */
4158
+
4159
+ function isString(value) {
4160
+ return typeof value === 'string';
4161
+ }
4162
+
4080
4163
  function uploadFileRequest(_ref) {
4081
4164
  var _ref$baseURL = _ref.baseURL,
4082
4165
  baseURL = _ref$baseURL === void 0 ? DEFAULT_BASE_URL : _ref$baseURL,