The Purpose of `Schema.identifier()`
Another question: what exactly is the point of
For example, I have this:
Schema.identifier()Schema.identifier()? Is it to be able to trace an individual value through a bunch of transformations?For example, I have this:
export const CardSchema = pipe(
// Validate the input
S.tuple(
pipe(
// Validate the input
S.string,
S.nonEmpty({ message: () => 'Should be non-empty"' }),
S.identifier('first'),
),
pipe(
// Validate the input
S.string,
S.nonEmpty({ message: () => 'Should be non-empty"' }),
S.identifier('second'),
),
),
// Transform to an object
S.transform(
S.struct({
first: pipe(S.string, S.identifier('first')),
second: pipe(S.string, S.identifier('second')),
}),
([first, second]) => ({ first, second }),
({ first, second }) => TU.tuple(first, second),
),
);export const CardSchema = pipe(
// Validate the input
S.tuple(
pipe(
// Validate the input
S.string,
S.nonEmpty({ message: () => 'Should be non-empty"' }),
S.identifier('first'),
),
pipe(
// Validate the input
S.string,
S.nonEmpty({ message: () => 'Should be non-empty"' }),
S.identifier('second'),
),
),
// Transform to an object
S.transform(
S.struct({
first: pipe(S.string, S.identifier('first')),
second: pipe(S.string, S.identifier('second')),
}),
([first, second]) => ({ first, second }),
({ first, second }) => TU.tuple(first, second),
),
);