Skip to content

Commit 86afa23

Browse files
committed
reuse compact utility
1 parent 349dc2d commit 86afa23

File tree

1 file changed

+1
-15
lines changed
  • packages/kit/src/runtime/server/page

1 file changed

+1
-15
lines changed

packages/kit/src/runtime/server/page/index.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { method_not_allowed, error_to_pojo, allowed_methods } from '../utils.js'
55
import { create_fetch } from './fetch.js';
66
import { HttpError, Redirect } from '../../../index/private.js';
77
import { error, json } from '../../../index/index.js';
8+
import { compact } from '../../../utils/array.js';
89
import { normalize_error } from '../../../utils/error.js';
910
import { load_data, load_server_data } from './load_data.js';
1011

@@ -401,18 +402,3 @@ function redirect_response(status, location) {
401402
headers: { location }
402403
});
403404
}
404-
405-
/**
406-
* @template T
407-
* @param {Array<T | null>} array
408-
* @returns {T[]}
409-
*/
410-
function compact(array) {
411-
const compacted = [];
412-
for (const item of array) {
413-
if (item) {
414-
compacted.push(item);
415-
}
416-
}
417-
return compacted;
418-
}

0 commit comments

Comments
 (0)