@naturalcycles/js-lib 14.57.0 → 14.58.0

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.
@@ -16,6 +16,8 @@ export declare function _chunk<T>(array: readonly T[], size?: number): T[][];
16
16
  /**
17
17
  * Polyfill to Array.flat() with depth=1.
18
18
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
19
+ *
20
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
19
21
  */
20
22
  export declare function _flatten<T>(arrays: T[][]): T[];
21
23
  /**
@@ -25,6 +27,8 @@ export declare function _flatten<T>(arrays: T[][]): T[];
25
27
  * @return Returns the new flattened array.
26
28
  *
27
29
  * Based on: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
30
+ *
31
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
28
32
  */
29
33
  export declare function _flattenDeep<T>(arr: RecursiveArray<T>): T[];
30
34
  /**
@@ -22,6 +22,8 @@ exports._chunk = _chunk;
22
22
  /**
23
23
  * Polyfill to Array.flat() with depth=1.
24
24
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
25
+ *
26
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
25
27
  */
26
28
  function _flatten(arrays) {
27
29
  // to flat single level array
@@ -35,6 +37,8 @@ exports._flatten = _flatten;
35
37
  * @return Returns the new flattened array.
36
38
  *
37
39
  * Based on: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
40
+ *
41
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
38
42
  */
39
43
  function _flattenDeep(arr) {
40
44
  return Array.isArray(arr)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _by, _chunk, _countBy, _difference, _dropRightWhile, _dropWhile, _findLast, _flatten, _flattenDeep, _groupBy, _intersection, _last, _mapToObject, _shuffle, _sortBy, _sum, _sumBy, _takeRightWhile, _takeWhile, _uniq, _uniqBy } from './array/array.util';
2
- import { _defineLazyProperty, _lazyValue } from './lazy';
2
+ import { _defineLazyProperty, _defineLazyProps, _lazyValue } from './lazy';
3
3
  import { _parseQueryString } from './string/url.util';
4
4
  import { _range } from './array/range';
5
5
  import { PromiseDecoratorCfg, PromiseDecoratorResp, _createPromiseDecorator } from './decorators/createPromiseDecorator';
@@ -55,4 +55,4 @@ import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdat
55
55
  import { _gb, _hb, _kb, _mb } from './unit/size.util';
56
56
  import { is } from './vendor/is';
57
57
  export type { MemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateTime, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, PromiseValue, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestamp, BaseDBEntity, SavedDBEntity, Saved, Unsaved, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, };
58
- export { is, _Memo, _memoFn, _LogMethod, _getArgsSignature, _createPromiseDecorator, AppError, HttpError, AssertionError, _isErrorObject, _isHttpErrorObject, _isHttpErrorResponse, _assert, _assertEquals, _assertDeepEquals, _assertIsError, _assertIsString, _assertIsNumber, _assertTypeOf, _randomInt, _randomArrayItem, _createDeterministicRandom, _inRange, _stringMapValues, _stringMapEntries, _objectKeys, _capitalize, _upperFirst, _lowerFirst, _split, _removeWhitespace, _substringBefore, _substringBeforeLast, _substringAfter, _substringAfterLast, _substringBetweenLast, _replaceAll, _nl2br, _truncate, _truncateMiddle, _pick, _omit, _filterFalsyValues, _filterUndefinedValues, _filterNullishValues, _filterEmptyArrays, _filterEmptyValues, _filterObject, _undefinedIfEmpty, _isObject, _isPrimitive, _mapKeys, _mapValues, _mapObject, _objectNullValuesToUndefined, _deepEquals, _deepCopy, _isEmptyObject, _isEmpty, _merge, _deepTrim, _sortObjectDeep, _sortObject, _get, _set, _has, _unset, _mask, _invert, _invertMap, _by, _groupBy, _sortBy, _sortNumbers, _toFixed, _toPrecision, _round, _findLast, _takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile, _countBy, _intersection, _difference, _shuffle, _mapToObject, _findKeyByValue, _anyToError, _anyToErrorObject, _errorToErrorObject, _errorObjectToAppError, _range, _uniq, _uniqBy, _flatten, _flattenDeep, _chunk, SimpleMovingAverage, _average, _averageWeighted, _percentile, _median, _debounce, _throttle, _Debounce, _Throttle, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, pBatch, ErrorMode, pFilter, pProps, pDelay, pDefer, pHang, pState, AggregatedError, pRetry, pTimeout, pTuple, _Retry, _Timeout, _tryCatch, _TryCatch, _try, pTry, _jsonParseIfPossible, _stringifyAny, _ms, _since, _hb, _gb, _mb, _kb, _snakeCase, _camelCase, _kebabCase, _sum, _sumBy, _clamp, _last, mergeJsonSchemaObjects, jsonSchema, JsonSchemaAnyBuilder, JSON_SCHEMA_ORDER, generateJsonSchemaFromData, _parseQueryString, _defineLazyProperty, _lazyValue, };
58
+ export { is, _Memo, _memoFn, _LogMethod, _getArgsSignature, _createPromiseDecorator, AppError, HttpError, AssertionError, _isErrorObject, _isHttpErrorObject, _isHttpErrorResponse, _assert, _assertEquals, _assertDeepEquals, _assertIsError, _assertIsString, _assertIsNumber, _assertTypeOf, _randomInt, _randomArrayItem, _createDeterministicRandom, _inRange, _stringMapValues, _stringMapEntries, _objectKeys, _capitalize, _upperFirst, _lowerFirst, _split, _removeWhitespace, _substringBefore, _substringBeforeLast, _substringAfter, _substringAfterLast, _substringBetweenLast, _replaceAll, _nl2br, _truncate, _truncateMiddle, _pick, _omit, _filterFalsyValues, _filterUndefinedValues, _filterNullishValues, _filterEmptyArrays, _filterEmptyValues, _filterObject, _undefinedIfEmpty, _isObject, _isPrimitive, _mapKeys, _mapValues, _mapObject, _objectNullValuesToUndefined, _deepEquals, _deepCopy, _isEmptyObject, _isEmpty, _merge, _deepTrim, _sortObjectDeep, _sortObject, _get, _set, _has, _unset, _mask, _invert, _invertMap, _by, _groupBy, _sortBy, _sortNumbers, _toFixed, _toPrecision, _round, _findLast, _takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile, _countBy, _intersection, _difference, _shuffle, _mapToObject, _findKeyByValue, _anyToError, _anyToErrorObject, _errorToErrorObject, _errorObjectToAppError, _range, _uniq, _uniqBy, _flatten, _flattenDeep, _chunk, SimpleMovingAverage, _average, _averageWeighted, _percentile, _median, _debounce, _throttle, _Debounce, _Throttle, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, pBatch, ErrorMode, pFilter, pProps, pDelay, pDefer, pHang, pState, AggregatedError, pRetry, pTimeout, pTuple, _Retry, _Timeout, _tryCatch, _TryCatch, _try, pTry, _jsonParseIfPossible, _stringifyAny, _ms, _since, _hb, _gb, _mb, _kb, _snakeCase, _camelCase, _kebabCase, _sum, _sumBy, _clamp, _last, mergeJsonSchemaObjects, jsonSchema, JsonSchemaAnyBuilder, JSON_SCHEMA_ORDER, generateJsonSchemaFromData, _parseQueryString, _defineLazyProperty, _defineLazyProps, _lazyValue, };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._isObject = exports._undefinedIfEmpty = exports._filterObject = exports._filterEmptyValues = exports._filterEmptyArrays = exports._filterNullishValues = exports._filterUndefinedValues = exports._filterFalsyValues = exports._omit = exports._pick = exports._truncateMiddle = exports._truncate = exports._nl2br = exports._replaceAll = exports._substringBetweenLast = exports._substringAfterLast = exports._substringAfter = exports._substringBeforeLast = exports._substringBefore = exports._removeWhitespace = exports._split = exports._lowerFirst = exports._upperFirst = exports._capitalize = exports._objectKeys = exports._stringMapEntries = exports._stringMapValues = exports._inRange = exports._createDeterministicRandom = exports._randomArrayItem = exports._randomInt = exports._assertTypeOf = exports._assertIsNumber = exports._assertIsString = exports._assertIsError = exports._assertDeepEquals = exports._assertEquals = exports._assert = exports._isHttpErrorResponse = exports._isHttpErrorObject = exports._isErrorObject = exports.AssertionError = exports.HttpError = exports.AppError = exports._createPromiseDecorator = exports._getArgsSignature = exports._LogMethod = exports._memoFn = exports._Memo = exports.is = void 0;
4
4
  exports._average = exports.SimpleMovingAverage = exports._chunk = exports._flattenDeep = exports._flatten = exports._uniqBy = exports._uniq = exports._range = exports._errorObjectToAppError = exports._errorToErrorObject = exports._anyToErrorObject = exports._anyToError = exports._findKeyByValue = exports._mapToObject = exports._shuffle = exports._difference = exports._intersection = exports._countBy = exports._dropRightWhile = exports._dropWhile = exports._takeRightWhile = exports._takeWhile = exports._findLast = exports._round = exports._toPrecision = exports._toFixed = exports._sortNumbers = exports._sortBy = exports._groupBy = exports._by = exports._invertMap = exports._invert = exports._mask = exports._unset = exports._has = exports._set = exports._get = exports._sortObject = exports._sortObjectDeep = exports._deepTrim = exports._merge = exports._isEmpty = exports._isEmptyObject = exports._deepCopy = exports._deepEquals = exports._objectNullValuesToUndefined = exports._mapObject = exports._mapValues = exports._mapKeys = exports._isPrimitive = void 0;
5
5
  exports.JSON_SCHEMA_ORDER = exports.JsonSchemaAnyBuilder = exports.jsonSchema = exports.mergeJsonSchemaObjects = exports._last = exports._clamp = exports._sumBy = exports._sum = exports._kebabCase = exports._camelCase = exports._snakeCase = exports._kb = exports._mb = exports._gb = exports._hb = exports._since = exports._ms = exports._stringifyAny = exports._jsonParseIfPossible = exports.pTry = exports._try = exports._TryCatch = exports._tryCatch = exports._Timeout = exports._Retry = exports.pTuple = exports.pTimeout = exports.pRetry = exports.AggregatedError = exports.pState = exports.pHang = exports.pDefer = exports.pDelay = exports.pProps = exports.pFilter = exports.ErrorMode = exports.pBatch = exports._noop = exports._passNothingPredicate = exports._passthroughPredicate = exports._passUndefinedMapper = exports._passthroughMapper = exports.pMap = exports._Throttle = exports._Debounce = exports._throttle = exports._debounce = exports._median = exports._percentile = exports._averageWeighted = void 0;
6
- exports._lazyValue = exports._defineLazyProperty = exports._parseQueryString = exports.generateJsonSchemaFromData = void 0;
6
+ exports._lazyValue = exports._defineLazyProps = exports._defineLazyProperty = exports._parseQueryString = exports.generateJsonSchemaFromData = void 0;
7
7
  const array_util_1 = require("./array/array.util");
8
8
  Object.defineProperty(exports, "_by", { enumerable: true, get: function () { return array_util_1._by; } });
9
9
  Object.defineProperty(exports, "_chunk", { enumerable: true, get: function () { return array_util_1._chunk; } });
@@ -28,6 +28,7 @@ Object.defineProperty(exports, "_uniq", { enumerable: true, get: function () { r
28
28
  Object.defineProperty(exports, "_uniqBy", { enumerable: true, get: function () { return array_util_1._uniqBy; } });
29
29
  const lazy_1 = require("./lazy");
30
30
  Object.defineProperty(exports, "_defineLazyProperty", { enumerable: true, get: function () { return lazy_1._defineLazyProperty; } });
31
+ Object.defineProperty(exports, "_defineLazyProps", { enumerable: true, get: function () { return lazy_1._defineLazyProps; } });
31
32
  Object.defineProperty(exports, "_lazyValue", { enumerable: true, get: function () { return lazy_1._lazyValue; } });
32
33
  const url_util_1 = require("./string/url.util");
33
34
  Object.defineProperty(exports, "_parseQueryString", { enumerable: true, get: function () { return url_util_1._parseQueryString; } });
package/dist/lazy.d.ts CHANGED
@@ -24,3 +24,7 @@ export declare function _lazyValue<T extends AnyFunction>(fn: T): T;
24
24
  * Based on: https://github.com/sindresorhus/define-lazy-prop
25
25
  */
26
26
  export declare function _defineLazyProperty<OBJ extends AnyObject>(obj: OBJ, propertyName: keyof OBJ, fn: AnyFunction): OBJ;
27
+ /**
28
+ * Like _defineLazyProperty, but allows to define multiple props at once.
29
+ */
30
+ export declare function _defineLazyProps<OBJ extends AnyObject>(obj: OBJ, props: Partial<Record<keyof OBJ, AnyFunction>>): OBJ;
package/dist/lazy.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._defineLazyProperty = exports._lazyValue = void 0;
3
+ exports._defineLazyProps = exports._defineLazyProperty = exports._lazyValue = void 0;
4
4
  /**
5
5
  * const value = lazyValue(() => expensiveComputation())
6
6
  *
@@ -53,3 +53,11 @@ function _defineLazyProperty(obj, propertyName, fn) {
53
53
  return obj;
54
54
  }
55
55
  exports._defineLazyProperty = _defineLazyProperty;
56
+ /**
57
+ * Like _defineLazyProperty, but allows to define multiple props at once.
58
+ */
59
+ function _defineLazyProps(obj, props) {
60
+ Object.entries(props).forEach(([k, fn]) => _defineLazyProperty(obj, k, fn));
61
+ return obj;
62
+ }
63
+ exports._defineLazyProps = _defineLazyProps;
@@ -18,6 +18,8 @@ export function _chunk(array, size = 1) {
18
18
  /**
19
19
  * Polyfill to Array.flat() with depth=1.
20
20
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
21
+ *
22
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
21
23
  */
22
24
  export function _flatten(arrays) {
23
25
  // to flat single level array
@@ -30,6 +32,8 @@ export function _flatten(arrays) {
30
32
  * @return Returns the new flattened array.
31
33
  *
32
34
  * Based on: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
35
+ *
36
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
33
37
  */
34
38
  export function _flattenDeep(arr) {
35
39
  return Array.isArray(arr)
package/dist-esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _by, _chunk, _countBy, _difference, _dropRightWhile, _dropWhile, _findLast, _flatten, _flattenDeep, _groupBy, _intersection, _last, _mapToObject, _shuffle, _sortBy, _sum, _sumBy, _takeRightWhile, _takeWhile, _uniq, _uniqBy, } from './array/array.util';
2
- import { _defineLazyProperty, _lazyValue } from './lazy';
2
+ import { _defineLazyProperty, _defineLazyProps, _lazyValue } from './lazy';
3
3
  import { _parseQueryString } from './string/url.util';
4
4
  import { _range } from './array/range';
5
5
  import { _createPromiseDecorator, } from './decorators/createPromiseDecorator';
@@ -50,4 +50,4 @@ import { _ms, _since } from './time/time.util';
50
50
  import { _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues, } from './types';
51
51
  import { _gb, _hb, _kb, _mb } from './unit/size.util';
52
52
  import { is } from './vendor/is';
53
- export { is, _Memo, _memoFn, _LogMethod, _getArgsSignature, _createPromiseDecorator, AppError, HttpError, AssertionError, _isErrorObject, _isHttpErrorObject, _isHttpErrorResponse, _assert, _assertEquals, _assertDeepEquals, _assertIsError, _assertIsString, _assertIsNumber, _assertTypeOf, _randomInt, _randomArrayItem, _createDeterministicRandom, _inRange, _stringMapValues, _stringMapEntries, _objectKeys, _capitalize, _upperFirst, _lowerFirst, _split, _removeWhitespace, _substringBefore, _substringBeforeLast, _substringAfter, _substringAfterLast, _substringBetweenLast, _replaceAll, _nl2br, _truncate, _truncateMiddle, _pick, _omit, _filterFalsyValues, _filterUndefinedValues, _filterNullishValues, _filterEmptyArrays, _filterEmptyValues, _filterObject, _undefinedIfEmpty, _isObject, _isPrimitive, _mapKeys, _mapValues, _mapObject, _objectNullValuesToUndefined, _deepEquals, _deepCopy, _isEmptyObject, _isEmpty, _merge, _deepTrim, _sortObjectDeep, _sortObject, _get, _set, _has, _unset, _mask, _invert, _invertMap, _by, _groupBy, _sortBy, _sortNumbers, _toFixed, _toPrecision, _round, _findLast, _takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile, _countBy, _intersection, _difference, _shuffle, _mapToObject, _findKeyByValue, _anyToError, _anyToErrorObject, _errorToErrorObject, _errorObjectToAppError, _range, _uniq, _uniqBy, _flatten, _flattenDeep, _chunk, SimpleMovingAverage, _average, _averageWeighted, _percentile, _median, _debounce, _throttle, _Debounce, _Throttle, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, pBatch, ErrorMode, pFilter, pProps, pDelay, pDefer, pHang, pState, AggregatedError, pRetry, pTimeout, pTuple, _Retry, _Timeout, _tryCatch, _TryCatch, _try, pTry, _jsonParseIfPossible, _stringifyAny, _ms, _since, _hb, _gb, _mb, _kb, _snakeCase, _camelCase, _kebabCase, _sum, _sumBy, _clamp, _last, mergeJsonSchemaObjects, jsonSchema, JsonSchemaAnyBuilder, JSON_SCHEMA_ORDER, generateJsonSchemaFromData, _parseQueryString, _defineLazyProperty, _lazyValue, };
53
+ export { is, _Memo, _memoFn, _LogMethod, _getArgsSignature, _createPromiseDecorator, AppError, HttpError, AssertionError, _isErrorObject, _isHttpErrorObject, _isHttpErrorResponse, _assert, _assertEquals, _assertDeepEquals, _assertIsError, _assertIsString, _assertIsNumber, _assertTypeOf, _randomInt, _randomArrayItem, _createDeterministicRandom, _inRange, _stringMapValues, _stringMapEntries, _objectKeys, _capitalize, _upperFirst, _lowerFirst, _split, _removeWhitespace, _substringBefore, _substringBeforeLast, _substringAfter, _substringAfterLast, _substringBetweenLast, _replaceAll, _nl2br, _truncate, _truncateMiddle, _pick, _omit, _filterFalsyValues, _filterUndefinedValues, _filterNullishValues, _filterEmptyArrays, _filterEmptyValues, _filterObject, _undefinedIfEmpty, _isObject, _isPrimitive, _mapKeys, _mapValues, _mapObject, _objectNullValuesToUndefined, _deepEquals, _deepCopy, _isEmptyObject, _isEmpty, _merge, _deepTrim, _sortObjectDeep, _sortObject, _get, _set, _has, _unset, _mask, _invert, _invertMap, _by, _groupBy, _sortBy, _sortNumbers, _toFixed, _toPrecision, _round, _findLast, _takeWhile, _takeRightWhile, _dropWhile, _dropRightWhile, _countBy, _intersection, _difference, _shuffle, _mapToObject, _findKeyByValue, _anyToError, _anyToErrorObject, _errorToErrorObject, _errorObjectToAppError, _range, _uniq, _uniqBy, _flatten, _flattenDeep, _chunk, SimpleMovingAverage, _average, _averageWeighted, _percentile, _median, _debounce, _throttle, _Debounce, _Throttle, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, pBatch, ErrorMode, pFilter, pProps, pDelay, pDefer, pHang, pState, AggregatedError, pRetry, pTimeout, pTuple, _Retry, _Timeout, _tryCatch, _TryCatch, _try, pTry, _jsonParseIfPossible, _stringifyAny, _ms, _since, _hb, _gb, _mb, _kb, _snakeCase, _camelCase, _kebabCase, _sum, _sumBy, _clamp, _last, mergeJsonSchemaObjects, jsonSchema, JsonSchemaAnyBuilder, JSON_SCHEMA_ORDER, generateJsonSchemaFromData, _parseQueryString, _defineLazyProperty, _defineLazyProps, _lazyValue, };
package/dist-esm/lazy.js CHANGED
@@ -48,3 +48,10 @@ export function _defineLazyProperty(obj, propertyName, fn) {
48
48
  });
49
49
  return obj;
50
50
  }
51
+ /**
52
+ * Like _defineLazyProperty, but allows to define multiple props at once.
53
+ */
54
+ export function _defineLazyProps(obj, props) {
55
+ Object.entries(props).forEach(([k, fn]) => _defineLazyProperty(obj, k, fn));
56
+ return obj;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.57.0",
3
+ "version": "14.58.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -22,6 +22,8 @@ export function _chunk<T>(array: readonly T[], size = 1): T[][] {
22
22
  /**
23
23
  * Polyfill to Array.flat() with depth=1.
24
24
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat
25
+ *
26
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
25
27
  */
26
28
  export function _flatten<T>(arrays: T[][]): T[] {
27
29
  // to flat single level array
@@ -35,6 +37,8 @@ export function _flatten<T>(arrays: T[][]): T[] {
35
37
  * @return Returns the new flattened array.
36
38
  *
37
39
  * Based on: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_flattendeep
40
+ *
41
+ * @deprecated prefer native Array.flat(), it's supported since iOS 12
38
42
  */
39
43
  export function _flattenDeep<T>(arr: RecursiveArray<T>): T[] {
40
44
  return Array.isArray(arr)
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  _uniq,
22
22
  _uniqBy,
23
23
  } from './array/array.util'
24
- import { _defineLazyProperty, _lazyValue } from './lazy'
24
+ import { _defineLazyProperty, _defineLazyProps, _lazyValue } from './lazy'
25
25
  import { _parseQueryString } from './string/url.util'
26
26
  import { _range } from './array/range'
27
27
  import {
@@ -451,5 +451,6 @@ export {
451
451
  generateJsonSchemaFromData,
452
452
  _parseQueryString,
453
453
  _defineLazyProperty,
454
+ _defineLazyProps,
454
455
  _lazyValue,
455
456
  }
package/src/lazy.ts CHANGED
@@ -60,3 +60,14 @@ export function _defineLazyProperty<OBJ extends AnyObject>(
60
60
 
61
61
  return obj
62
62
  }
63
+
64
+ /**
65
+ * Like _defineLazyProperty, but allows to define multiple props at once.
66
+ */
67
+ export function _defineLazyProps<OBJ extends AnyObject>(
68
+ obj: OBJ,
69
+ props: Partial<Record<keyof OBJ, AnyFunction>>,
70
+ ): OBJ {
71
+ Object.entries(props).forEach(([k, fn]) => _defineLazyProperty(obj, k, fn!))
72
+ return obj
73
+ }