Skip to content

Commit

Permalink
reuse compact utility (#6220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb committed Aug 24, 2022
1 parent 64449a7 commit 7da232b
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions packages/kit/src/runtime/server/page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -401,18 +402,3 @@ function redirect_response(status, location) {
headers: { location }
});
}

/**
* @template T
* @param {Array<T | null>} array
* @returns {T[]}
*/
function compact(array) {
const compacted = [];
for (const item of array) {
if (item) {
compacted.push(item);
}
}
return compacted;
}

0 comments on commit 7da232b

Please sign in to comment.