Skip to content

Commit b1b4526

Browse files
committed
Extract uniqueList function
1 parent d62369f commit b1b4526

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

source/list/unique-list.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export function uniqueList<const List extends readonly unknown[]>(values: List): Readonly<List> {
2+
return Array.from(new Set(values)) as unknown as List;
3+
}
4+

source/validation/formatting.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { type NonEmptyReadonlyArray, map, flatMap, initNonEmpty, lastNonEmpty } from 'effect/ReadonlyArray';
22
import type { ParseIssue, Type, Key, Index, Tuple, TypeLiteral, ParseError, Union } from '@effect/schema/ParseResult';
3+
import { uniqueList } from '../list/unique-list.js';
34
import { capitalize } from './capitalize.js';
45
import { formatAst, isBooleanLiteralUnion } from './formatting/ast.js';
56

6-
function uniqueList<const T extends readonly unknown[]>(values: T): Readonly<T> {
7-
return Array.from(new Set(values)) as unknown as T;
8-
}
9-
107
type Path = readonly PropertyKey[];
118

129
function hasTag<TaggedValue extends { _tag: string }, Tag extends string>(

0 commit comments

Comments
 (0)