From 86afa2318d9aaa9bd4b880e96f2aaded0995ef5c Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 24 Aug 2022 21:43:27 +0700 Subject: [PATCH] reuse compact utility --- packages/kit/src/runtime/server/page/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/kit/src/runtime/server/page/index.js b/packages/kit/src/runtime/server/page/index.js index d0df231da30b..ebe1f005df3e 100644 --- a/packages/kit/src/runtime/server/page/index.js +++ b/packages/kit/src/runtime/server/page/index.js @@ -5,6 +5,7 @@ import { method_not_allowed, error_to_pojo, allowed_methods } from '../utils.js' import { create_fetch } from './fetch.js'; import { HttpError, Redirect } from '../../../index/private.js'; import { error, json } from '../../../index/index.js'; +import { compact } from '../../../utils/array.js'; import { normalize_error } from '../../../utils/error.js'; import { load_data, load_server_data } from './load_data.js'; @@ -401,18 +402,3 @@ function redirect_response(status, location) { headers: { location } }); } - -/** - * @template T - * @param {Array} array - * @returns {T[]} - */ -function compact(array) { - const compacted = []; - for (const item of array) { - if (item) { - compacted.push(item); - } - } - return compacted; -}