From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../tmp/src/foundation/util/array-util.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 node_modules/@jet-app/app-store/tmp/src/foundation/util/array-util.js (limited to 'node_modules/@jet-app/app-store/tmp/src/foundation/util/array-util.js') diff --git a/node_modules/@jet-app/app-store/tmp/src/foundation/util/array-util.js b/node_modules/@jet-app/app-store/tmp/src/foundation/util/array-util.js new file mode 100644 index 0000000..57c8e84 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/foundation/util/array-util.js @@ -0,0 +1,32 @@ +/** + * Creates an array containing multiple copies of the elements of another array. + * + * For example, if A = [Q, W, E, R, T, Y], then calling repeating(A, 3) would return + * [Q, W, E, R, T, Y, Q, W, E, R, T, Y, Q, W, E, R, T, Y] + * + * @param elements The elements that will be repeated + * @param times The number of times all of the elements should appear in the new array. + */ +export function arrayByRepeating(elements, times) { + if (times <= 0) { + return []; + } + let newArray = []; + for (let i = 0; i < times; i++) { + newArray = newArray.concat(elements); + } + return newArray; +} +export function partition(array, predicate) { + const part1 = []; + const part2 = []; + array.forEach((item) => (predicate(item) ? part1.push(item) : part2.push(item))); + return [part1, part2]; +} +export function isEmpty(elements) { + return elements.length === 0; +} +export function isNotEmpty(elements) { + return !isEmpty(elements); +} +//# sourceMappingURL=array-util.js.map \ No newline at end of file -- cgit v1.2.3