File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ import type { AnyStruct } from '../utils.js';
55
66export const SENSITIVE_REDACTED = '***' ;
77
8- // Unique brand set on every struct created by `sensitive()`. Because the
9- // `Struct` constructor copies Symbol-keyed properties from its `props` spread,
10- // any wrapper built with `new Struct({ ...sensitiveStruct, ... })` inherits
11- // the brand automatically — no manual tracking required.
12- const SENSITIVE_BRAND : unique symbol = Symbol ( 'sensitive' ) ;
8+ // Global-registry Symbol so the brand is shared across multiple instances of
9+ // this library loaded in the same runtime (e.g. npm dedup failure). Compare
10+ // with `ExactOptionalBrand`, which uses a plain string for the same reason.
11+ // Using Symbol.for() (not Symbol()) means isSensitiveStruct() works even when
12+ // `sensitive()` and `object()` come from different copies of this package.
13+ const SENSITIVE_BRAND = Symbol . for ( 'superstruct.sensitive' ) ;
1314
1415/**
1516 * Check whether a struct was created by `sensitive()`, or wraps one.
You can’t perform that action at this time.
0 commit comments