clientnode 4.0.1441 → 4.0.1443

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.
Files changed (142) hide show
  1. package/dist/Lock.d.ts +39 -0
  2. package/dist/Lock.js +69 -83
  3. package/dist/Logger.d.ts +102 -0
  4. package/dist/Logger.js +756 -163
  5. package/dist/Semaphore.d.ts +29 -0
  6. package/dist/Semaphore.js +56 -46
  7. package/dist/array.d.ts +150 -0
  8. package/dist/array.js +661 -337
  9. package/dist/bundle/Lock.js +86 -0
  10. package/dist/bundle/Logger.js +778 -0
  11. package/dist/bundle/Semaphore.js +75 -0
  12. package/dist/bundle/array.js +776 -0
  13. package/dist/bundle/cli.js +59 -0
  14. package/dist/bundle/constants.js +214 -0
  15. package/dist/bundle/context.js +280 -0
  16. package/dist/bundle/cookie.js +301 -0
  17. package/dist/bundle/data-transfer.js +825 -0
  18. package/dist/bundle/datetime.js +1148 -0
  19. package/dist/bundle/domNode.js +549 -0
  20. package/dist/bundle/expression/evaluators.js +1228 -0
  21. package/dist/bundle/expression/helper.js +117 -0
  22. package/dist/bundle/expression/index.js +1357 -0
  23. package/dist/bundle/expression/indicator-functions.js +332 -0
  24. package/dist/bundle/expression/type.js +16 -0
  25. package/dist/bundle/filesystem.js +436 -0
  26. package/dist/bundle/function.js +117 -0
  27. package/dist/bundle/index.js +3249 -0
  28. package/dist/bundle/indicators.js +565 -0
  29. package/dist/bundle/module.js +213 -0
  30. package/dist/bundle/number.js +527 -0
  31. package/dist/bundle/object.js +1104 -0
  32. package/dist/bundle/process.js +291 -0
  33. package/dist/bundle/property-types.js +36 -0
  34. package/dist/bundle/scope.js +2121 -0
  35. package/dist/bundle/string.js +1213 -0
  36. package/dist/bundle/test-helper.js +802 -0
  37. package/dist/bundle/type.js +16 -0
  38. package/dist/bundle/utility.js +420 -0
  39. package/dist/cli.d.ts +31 -0
  40. package/dist/cli.js +45 -37
  41. package/dist/compatible/Lock.js +86 -0
  42. package/dist/compatible/Logger.js +778 -0
  43. package/dist/compatible/Semaphore.js +75 -0
  44. package/dist/compatible/array.js +776 -0
  45. package/dist/compatible/cli.js +59 -0
  46. package/dist/compatible/constants.js +214 -0
  47. package/dist/compatible/context.js +280 -0
  48. package/dist/compatible/cookie.js +301 -0
  49. package/dist/compatible/data-transfer.js +825 -0
  50. package/dist/compatible/datetime.js +1148 -0
  51. package/dist/compatible/domNode.js +549 -0
  52. package/dist/compatible/expression/evaluators.js +1228 -0
  53. package/dist/compatible/expression/helper.js +117 -0
  54. package/dist/compatible/expression/index.js +1357 -0
  55. package/dist/compatible/expression/indicator-functions.js +332 -0
  56. package/dist/compatible/expression/type.js +16 -0
  57. package/dist/compatible/filesystem.js +436 -0
  58. package/dist/compatible/function.js +117 -0
  59. package/dist/compatible/index.js +3249 -0
  60. package/dist/compatible/indicators.js +565 -0
  61. package/dist/compatible/module.js +213 -0
  62. package/dist/compatible/number.js +527 -0
  63. package/dist/compatible/object.js +1104 -0
  64. package/dist/compatible/process.js +291 -0
  65. package/dist/compatible/property-types.js +36 -0
  66. package/dist/compatible/scope.js +2121 -0
  67. package/dist/compatible/string.js +1213 -0
  68. package/dist/compatible/test-helper.js +802 -0
  69. package/dist/compatible/type.js +16 -0
  70. package/dist/compatible/utility.js +420 -0
  71. package/dist/constants.d.ts +99 -0
  72. package/dist/constants.js +198 -110
  73. package/dist/context.d.ts +8 -0
  74. package/dist/context.js +265 -25
  75. package/dist/cookie.d.ts +31 -0
  76. package/dist/cookie.js +265 -48
  77. package/dist/data-transfer.d.ts +45 -0
  78. package/dist/data-transfer.js +775 -166
  79. package/dist/datetime.d.ts +37 -0
  80. package/dist/datetime.js +1107 -241
  81. package/dist/domNode.d.ts +82 -0
  82. package/dist/domNode.js +495 -277
  83. package/dist/expression/evaluators.d.ts +55 -0
  84. package/dist/expression/evaluators.js +1189 -234
  85. package/dist/expression/helper.d.ts +4 -0
  86. package/dist/expression/helper.js +102 -82
  87. package/dist/expression/index.d.ts +7 -0
  88. package/dist/expression/index.js +1341 -10
  89. package/dist/expression/indicator-functions.d.ts +14 -0
  90. package/dist/expression/indicator-functions.js +316 -21
  91. package/dist/expression/type.d.ts +70 -0
  92. package/dist/expression/type.js +1 -5
  93. package/dist/filesystem.d.ts +143 -0
  94. package/dist/filesystem.js +349 -323
  95. package/dist/function.d.ts +20 -0
  96. package/dist/function.js +93 -51
  97. package/dist/index.d.ts +23 -0
  98. package/dist/index.js +3232 -26
  99. package/dist/indicators.d.ts +68 -0
  100. package/dist/indicators.js +512 -68
  101. package/dist/module.d.ts +8 -0
  102. package/dist/module.js +197 -99
  103. package/dist/number.d.ts +35 -0
  104. package/dist/number.js +491 -25
  105. package/dist/object.d.ts +231 -0
  106. package/dist/object.js +917 -775
  107. package/dist/process.d.ts +22 -0
  108. package/dist/process.js +261 -38
  109. package/dist/property-types.d.ts +460 -0
  110. package/dist/property-types.js +17 -96
  111. package/dist/scope.d.ts +44 -0
  112. package/dist/scope.js +2092 -56
  113. package/dist/string.d.ts +312 -0
  114. package/dist/string.js +991 -603
  115. package/dist/test/Lock.d.ts +1 -0
  116. package/dist/test/Logger.d.ts +1 -0
  117. package/dist/test/Semaphore.d.ts +1 -0
  118. package/dist/test/array.d.ts +1 -0
  119. package/dist/test/cookie.d.ts +1 -0
  120. package/dist/test/data-transfer.d.ts +1 -0
  121. package/dist/test/datetime.d.ts +1 -0
  122. package/dist/test/domNode.d.ts +1 -0
  123. package/dist/test/expression/evaluators.d.ts +1 -0
  124. package/dist/test/expression/helper.d.ts +1 -0
  125. package/dist/test/expression/indicator-functions.d.ts +1 -0
  126. package/dist/test/filesystem.d.ts +1 -0
  127. package/dist/test/function.d.ts +1 -0
  128. package/dist/test/indicators.d.ts +1 -0
  129. package/dist/test/number.d.ts +1 -0
  130. package/dist/test/object.d.ts +1 -0
  131. package/dist/test/process.d.ts +1 -0
  132. package/dist/test/property-types.d.ts +1 -0
  133. package/dist/test/scope.d.ts +1 -0
  134. package/dist/test/string.d.ts +1 -0
  135. package/dist/test/utility.d.ts +1 -0
  136. package/dist/test-helper.d.ts +143 -0
  137. package/dist/test-helper.js +633 -171
  138. package/dist/type.d.ts +230 -0
  139. package/dist/type.js +4 -9
  140. package/dist/utility.d.ts +44 -0
  141. package/dist/utility.js +372 -91
  142. package/package.json +3 -3
@@ -0,0 +1,29 @@
1
+ import type { AnyFunction } from './type';
2
+ /**
3
+ * Represents the semaphore state.
4
+ * @property queue - List of waiting resource requests.
5
+ * @property numberOfFreeResources - Number free allowed concurrent resource
6
+ * uses.
7
+ * @property numberOfResources - Number of allowed concurrent resource uses.
8
+ */
9
+ export declare class Semaphore {
10
+ queue: Array<AnyFunction>;
11
+ numberOfResources: number;
12
+ numberOfFreeResources: number;
13
+ /**
14
+ * Initializes number of resources.
15
+ * @param numberOfResources - Number of resources to manage.
16
+ */
17
+ constructor(numberOfResources?: number);
18
+ /**
19
+ * Acquires a new resource and runs given callback if available.
20
+ * @returns A promise which will be resolved if requested resource is
21
+ * available.
22
+ */
23
+ acquire(): Promise<number>;
24
+ /**
25
+ * Releases a resource and runs a waiting resolver if there exists some.
26
+ */
27
+ release(): void;
28
+ }
29
+ export default Semaphore;
package/dist/Semaphore.js CHANGED
@@ -1,9 +1,47 @@
1
+ if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;/******/ // The require scope
2
+ /******/ var __webpack_require__ = {};
3
+ /******/
4
+ /************************************************************************/
5
+ /******/ /* webpack/runtime/define property getters */
6
+ /******/ !function() {
7
+ /******/ // define getter/value functions for harmony exports
8
+ /******/ __webpack_require__.d = function(exports, definition) {
9
+ /******/ if(Array.isArray(definition)) {
10
+ /******/ var i = 0;
11
+ /******/ while(i < definition.length) {
12
+ /******/ var key = definition[i++];
13
+ /******/ var binding = definition[i++];
14
+ /******/ if(!__webpack_require__.o(exports, key)) {
15
+ /******/ if(binding === 0) {
16
+ /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
17
+ /******/ } else {
18
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
19
+ /******/ }
20
+ /******/ } else if(binding === 0) { i++; }
21
+ /******/ }
22
+ /******/ } else {
23
+ /******/ for(var key in definition) {
24
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
+ /******/ }
27
+ /******/ }
28
+ /******/ }
29
+ /******/ };
30
+ /******/ }();
31
+ /******/
32
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
33
+ /******/ !function() {
34
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
35
+ /******/ }();
36
+ /******/
37
+ /************************************************************************/
38
+ var __webpack_exports__ = {};
39
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
40
+ /* harmony export */ j: function() { return /* binding */ Semaphore; }
41
+ /* harmony export */ });
1
42
  // #!/usr/bin/env babel-node
2
43
  // -*- coding: utf-8 -*-
3
- /** @module Semaphore */
4
- 'use strict';
5
-
6
- /* !
44
+ /** @module Semaphore *//* !
7
45
  region header
8
46
  [Project page](https://torben.website/clientnode)
9
47
 
@@ -16,50 +54,22 @@
16
54
  naming 3.0 unported license.
17
55
  See https://creativecommons.org/licenses/by/3.0/deed.de
18
56
  endregion
19
- */
20
- import "core-js/modules/es.array.push.js";
21
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
23
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
24
- /**
57
+ */function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
25
58
  * Represents the semaphore state.
26
59
  * @property queue - List of waiting resource requests.
27
60
  * @property numberOfFreeResources - Number free allowed concurrent resource
28
61
  * uses.
29
62
  * @property numberOfResources - Number of allowed concurrent resource uses.
30
- */
31
- export class Semaphore {
32
- /**
33
- * Initializes number of resources.
34
- * @param numberOfResources - Number of resources to manage.
35
- */
36
- constructor(numberOfResources = 2) {
37
- _defineProperty(this, "queue", []);
38
- _defineProperty(this, "numberOfResources", void 0);
39
- _defineProperty(this, "numberOfFreeResources", void 0);
40
- this.numberOfResources = numberOfResources;
41
- this.numberOfFreeResources = numberOfResources;
42
- }
43
- /**
44
- * Acquires a new resource and runs given callback if available.
45
- * @returns A promise which will be resolved if requested resource is
46
- * available.
47
- */
48
- acquire() {
49
- return new Promise(resolve => {
50
- if (this.numberOfFreeResources <= 0) this.queue.push(resolve);else {
51
- this.numberOfFreeResources -= 1;
52
- resolve(this.numberOfFreeResources);
53
- }
54
- });
55
- }
56
- /**
57
- * Releases a resource and runs a waiting resolver if there exists some.
58
- */
59
- release() {
60
- const callback = this.queue.shift();
61
- if (callback === undefined) this.numberOfFreeResources += 1;else callback(this.numberOfFreeResources);
62
- }
63
- }
64
- export default Semaphore;
65
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL1NlbWFwaG9yZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyAjIS91c3IvYmluL2VudiBiYWJlbC1ub2RlXG4vLyAtKi0gY29kaW5nOiB1dGYtOCAtKi1cbi8qKiBAbW9kdWxlIFNlbWFwaG9yZSAqL1xuJ3VzZSBzdHJpY3QnXG4vKiAhXG4gICAgcmVnaW9uIGhlYWRlclxuICAgIFtQcm9qZWN0IHBhZ2VdKGh0dHBzOi8vdG9yYmVuLndlYnNpdGUvY2xpZW50bm9kZSlcblxuICAgIENvcHlyaWdodCBUb3JiZW4gU2lja2VydCAoaW5mb1tcIn5hdH5cIl10b3JiZW4ud2Vic2l0ZSkgMTYuMTIuMjAxMlxuXG4gICAgTGljZW5zZVxuICAgIC0tLS0tLS1cblxuICAgIFRoaXMgbGlicmFyeSB3cml0dGVuIGJ5IFRvcmJlbiBTaWNrZXJ0IHN0YW5kcyB1bmRlciBhIGNyZWF0aXZlIGNvbW1vbnNcbiAgICBuYW1pbmcgMy4wIHVucG9ydGVkIGxpY2Vuc2UuXG4gICAgU2VlIGh0dHBzOi8vY3JlYXRpdmVjb21tb25zLm9yZy9saWNlbnNlcy9ieS8zLjAvZGVlZC5kZVxuICAgIGVuZHJlZ2lvblxuKi9cbmltcG9ydCB0eXBlIHtBbnlGdW5jdGlvbn0gZnJvbSAnLi90eXBlJ1xuXG4vKipcbiAqIFJlcHJlc2VudHMgdGhlIHNlbWFwaG9yZSBzdGF0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mVMaXN0IjpbXX0=
63
+ */var Semaphore=/*#__PURE__*/function(){/**
64
+ * Initializes number of resources.
65
+ * @param numberOfResources - Number of resources to manage.
66
+ */function Semaphore(numberOfResources){if(numberOfResources===void 0){numberOfResources=2}_classCallCheck(this,Semaphore);_defineProperty(this,"queue",[]);_defineProperty(this,"numberOfResources",void 0);_defineProperty(this,"numberOfFreeResources",void 0);this.numberOfResources=numberOfResources;this.numberOfFreeResources=numberOfResources}/**
67
+ * Acquires a new resource and runs given callback if available.
68
+ * @returns A promise which will be resolved if requested resource is
69
+ * available.
70
+ */return _createClass(Semaphore,[{key:"acquire",value:function acquire(){var _this=this;return new Promise(function(resolve){if(_this.numberOfFreeResources<=0)_this.queue.push(resolve);else{_this.numberOfFreeResources-=1;resolve(_this.numberOfFreeResources)}})}/**
71
+ * Releases a resource and runs a waiting resolver if there exists some.
72
+ */},{key:"release",value:function release(){var callback=this.queue.shift();if(callback===undefined)this.numberOfFreeResources+=1;else callback(this.numberOfFreeResources)}}])}();/* harmony default export */ __webpack_exports__.A = (Semaphore);
73
+ var __webpack_exports__Semaphore = __webpack_exports__.j;
74
+ var __webpack_exports__default = __webpack_exports__.A;
75
+ export { __webpack_exports__Semaphore as Semaphore, __webpack_exports__default as default };
@@ -0,0 +1,150 @@
1
+ import type { Mapping, Page, PaginateOptions } from './type';
2
+ /**
3
+ * Summarizes given property of given item list.
4
+ * @param data - Array of objects with given property name.
5
+ * @param propertyName - Property name to summarize.
6
+ * @param defaultValue - Value to return if property values doesn't match.
7
+ * @returns Aggregated value.
8
+ */
9
+ export declare const aggregatePropertyIfEqual: <T = unknown>(data: Array<Mapping<unknown>>, propertyName: string, defaultValue?: T) => T;
10
+ /**
11
+ * Deletes every item witch has only empty attributes for given property names.
12
+ * If given property names are empty each attribute will be considered. The
13
+ * empty string, "null" and "undefined" will be interpreted as empty.
14
+ * @param data - Data to filter.
15
+ * @param propertyNames - Properties to consider.
16
+ * @returns Given data without empty items.
17
+ */
18
+ export declare const deleteEmptyItems: <T extends Mapping<unknown> = Mapping<unknown>>(data: Array<T>, propertyNames?: Array<string | symbol>) => Array<T>;
19
+ /**
20
+ * Extracts all properties from all items which occur in given property names.
21
+ * @param data - Data where each item should be sliced.
22
+ * @param propertyNames - Property names to extract.
23
+ * @returns Data with sliced items.
24
+ */
25
+ export declare const extract: <T = Mapping<unknown>>(data: unknown, propertyNames: Array<string>) => Array<T>;
26
+ /**
27
+ * Extracts all values which matches given regular expression.
28
+ * @param data - Data to filter.
29
+ * @param regularExpression - Pattern to match for.
30
+ * @returns Filtered data.
31
+ */
32
+ export declare const extractIfMatches: (data: unknown, regularExpression: string | RegExp) => Array<string>;
33
+ /**
34
+ * Filters given data if given property is set or not.
35
+ * @param data - Data to filter.
36
+ * @param propertyName - Property name to check for existence.
37
+ * @returns Given data without the items which doesn't have specified property.
38
+ */
39
+ export declare const extractIfPropertyExists: <T extends Mapping<unknown> = Mapping<unknown>>(data: unknown, propertyName: string) => Array<T>;
40
+ /**
41
+ * Extract given data where specified property value matches given patterns.
42
+ * @param data - Data to filter.
43
+ * @param propertyPattern - Mapping of property names to pattern.
44
+ * @returns Filtered data.
45
+ */
46
+ export declare const extractIfPropertyMatches: <T = unknown>(data: unknown, propertyPattern: Mapping<RegExp | string>) => Array<T>;
47
+ /**
48
+ * Determines all objects which exists in "first" and in "second".
49
+ * Object key which will be compared are given by "keys". If an empty array is
50
+ * given each key will be compared. If an object is given corresponding initial
51
+ * data key will be mapped to referenced new data key.
52
+ * @param first - Referenced data to check for.
53
+ * @param second - Data to check for existence.
54
+ * @param keys - Keys to define equality.
55
+ * @param strict - The strict parameter indicates whether "null" and
56
+ * "undefined" should be interpreted as equal (takes only effect if given keys
57
+ * aren't empty).
58
+ * @returns Data which does exit in given initial data.
59
+ */
60
+ export declare const intersect: <T = unknown>(first: unknown, second: unknown, keys?: Array<string> | Mapping<number | string>, strict?: boolean) => Array<T>;
61
+ /**
62
+ * Converts given object into an array.
63
+ * @param object - Target to convert.
64
+ * @returns Generated array.
65
+ */
66
+ export declare const makeArray: <T = unknown>(object: unknown) => Array<T>;
67
+ /**
68
+ * Creates a list of items within given range.
69
+ * @param range - Array of lower and upper bounds. If only one value is given
70
+ * lower bound will be assumed to be zero. Both integers have to be positive
71
+ * and will be contained in the resulting array. If more than two numbers are
72
+ * provided given range will be returned.
73
+ * @param step - Space between two consecutive values.
74
+ * @param ignoreLastStep - Removes last step.
75
+ * @returns Produced array of integers.
76
+ */
77
+ export declare const makeRange: (range: number | Array<number> | [number] | [number, number], step?: number, ignoreLastStep?: boolean) => Array<number>;
78
+ /**
79
+ * Merge the contents of two arrays together into the first array.
80
+ * @param target - Target array.
81
+ * @param source - Source array.
82
+ * @returns Target array with merged given source one.
83
+ */
84
+ export declare const merge: <T = unknown>(target: Array<T>, source: Array<T>) => Array<T>;
85
+ /**
86
+ * Generates a list if pagination symbols to render a pagination from.
87
+ * @param options - Configure bounds and current page of pagination to
88
+ * determine.
89
+ * @param options.boundaryCount - Indicates where to start pagination within
90
+ * given total range.
91
+ * @param options.disabled - Indicates whether to disable all items.
92
+ * @param options.hideNextButton - Indicates whether to show a jump to next
93
+ * item.
94
+ * @param options.hidePrevButton - Indicates whether to show a jump to previous
95
+ * item.
96
+ * @param options.page - Indicates current visible page.
97
+ * @param options.pageSize - Number of items per page.
98
+ * @param options.showFirstButton - Indicates whether to show a jump to first
99
+ * item.
100
+ * @param options.showLastButton - Indicates whether to show a jump to last
101
+ * item.
102
+ * @param options.siblingCount - Number of sibling page symbols next to current
103
+ * page symbol.
104
+ * @param options.total - Number of all items to paginate.
105
+ * @returns A list of pagination symbols.
106
+ */
107
+ export declare const paginate: (options?: Partial<PaginateOptions>) => Array<Page>;
108
+ /**
109
+ * Generates all permutations of given iterable.
110
+ * @param data - Array like object.
111
+ * @returns Array of permuted arrays.
112
+ */
113
+ export declare const permute: <T = unknown>(data: Array<T>) => Array<Array<T>>;
114
+ /**
115
+ * Generates all lengths permutations of given iterable.
116
+ * @param data - Array like object.
117
+ * @param minimalSubsetLength - Defines how long the minimal subset length
118
+ * should be.
119
+ * @returns Array of permuted arrays.
120
+ */
121
+ export declare const permuteLength: <T = unknown>(data: Array<T>, minimalSubsetLength?: number) => Array<Array<T>>;
122
+ /**
123
+ * Sums up given property of given item list.
124
+ * @param data - The objects with specified property to sum up.
125
+ * @param propertyName - Property name to sum up its value.
126
+ * @returns The aggregated value.
127
+ */
128
+ export declare const sumUpProperty: (data: unknown, propertyName: string) => number;
129
+ /**
130
+ * Removes given target on given list.
131
+ * @param list - Array to splice.
132
+ * @param target - Target to remove from given list.
133
+ * @param strict - Indicates whether to fire an exception if given target
134
+ * doesn't exist given list.
135
+ * @returns Item with the appended target.
136
+ */
137
+ export declare const removeArrayItem: <T = unknown>(list: Array<T>, target: T, strict?: boolean) => Array<T>;
138
+ /**
139
+ * Sorts given object of dependencies in a topological order.
140
+ * @param items - Items to sort.
141
+ * @returns Sorted array of given items respecting their dependencies.
142
+ */
143
+ export declare const sortTopological: (items: Mapping<Array<string> | string>) => Array<string>;
144
+ /**
145
+ * Makes all values in given iterable unique by removing duplicates (The first
146
+ * occurrences will be left).
147
+ * @param data - Array like object.
148
+ * @returns Sliced version of given object.
149
+ */
150
+ export declare const unique: <T = unknown>(data: Array<T>) => Array<T>;