Skip to content

Commit 2d44a06

Browse files
committed
prefer positive over negative predicate names
1 parent 360568f commit 2d44a06

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/kit/src/core/sync/create_manifest_data/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path';
33
import mime from 'mime';
44
import { runtime_directory } from '../../utils.js';
55
import { posixify } from '../../../utils/filesystem.js';
6-
import { parse_route_id, is_no_group } from '../../../utils/routing.js';
6+
import { parse_route_id, affects_path } from '../../../utils/routing.js';
77

88
/**
99
* @param {{
@@ -247,7 +247,7 @@ function create_routes_and_nodes(cwd, config, fallback) {
247247

248248
nodes.push(route.leaf);
249249

250-
const normalized = route.id.split('/').filter(is_no_group).join('/');
250+
const normalized = route.id.split('/').filter(affects_path).join('/');
251251

252252
if (conflicts.has(normalized)) {
253253
throw new Error(`${conflicts.get(normalized)} and ${route.id} occupy the same route`);

packages/kit/src/utils/routing.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function parse_route_id(id) {
2626
: new RegExp(
2727
`^${id
2828
.split(/(?:\/|$)/)
29-
.filter(is_no_group)
29+
.filter(affects_path)
3030
.map((segment, i, segments) => {
3131
const decoded_segment = decodeURIComponent(segment);
3232
// special case — /[...rest]/ could contain zero segments
@@ -89,9 +89,10 @@ export function parse_route_id(id) {
8989
}
9090

9191
/**
92+
* Returns `false` for `(group)` segments
9293
* @param {string} segment
9394
*/
94-
export function is_no_group(segment) {
95+
export function affects_path(segment) {
9596
return !/^\([^)]+\)$/.test(segment);
9697
}
9798

0 commit comments

Comments
 (0)