Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/opentdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ class Collection {
maxKeyIterations: opts.maxKeyIterations,
platformUrl: opts.platformUrl,
});
this.client.dataAttributes = opts.attributes || [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using the nullish coalescing operator (??) instead of the logical OR (||) for providing default values. ?? only provides the default for null or undefined, avoiding potential issues with other falsy values (like '' or 0). While both work here due to the type of opts.attributes, using ?? is a good practice for robustness and clarity.

Suggested change
this.client.dataAttributes = opts.attributes || [];
this.client.dataAttributes = opts.attributes ?? [];

}

/** Encrypts a source into a NanoTDF stream. */
Expand Down
Loading