From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../app-store/tmp/src/common/util/page-common.js | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 node_modules/@jet-app/app-store/tmp/src/common/util/page-common.js (limited to 'node_modules/@jet-app/app-store/tmp/src/common/util/page-common.js') diff --git a/node_modules/@jet-app/app-store/tmp/src/common/util/page-common.js b/node_modules/@jet-app/app-store/tmp/src/common/util/page-common.js new file mode 100644 index 0000000..706fa9e --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/common/util/page-common.js @@ -0,0 +1,25 @@ +/** + * Created by ls on 6/19/2019. + */ +/** + * On different platforms, different shelves are expected to be in certain multiples to not appear like there is a "gap" + * This function is used to truncate an array of models to fit given expected multiple. + * Note that ideally we want to request the exact number of items needed, but this accounts for cases where some data fails to build into full UI elements. + * @param items Array of items to truncate + * @param mod Modulo to apply. + */ +export function truncateItems(items, mod) { + if (!items) { + return null; + } + const length = items.length; + const remainder = length % mod; + // If we have less than mod items, we should return them all instead of 0 (because i - (i % mod)=0 when i < mod) + if (length >= mod) { + return items.slice(0, length - remainder); + } + else { + return items; + } +} +//# sourceMappingURL=page-common.js.map \ No newline at end of file -- cgit v1.2.3