Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Parsing for qualifiers with colon characters #1277

Merged
merged 13 commits into from
May 24, 2023
Prev Previous commit
Next Next commit
fix: Clean up for lint errors
  • Loading branch information
KDB223 committed May 15, 2023
commit e982463866cee03f9da5ef64926cc5f5317f8290
6 changes: 3 additions & 3 deletions src/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@
*/
static parseColumnName(columnName: string): ParsedColumn {
const colonIdx = columnName.indexOf(':');
if (colonIdx == -1) {

if (colonIdx === -1) {
// columnName does not contain ':'
return {
family: columnName,
qualifier: null,
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend setting qualifier to undefined so that this code works the same way as before when the string doesn't contain a colon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that too, however the ParsedColumn interface does not declare undefined as an acceptable type for qualifier at https://github.com/googleapis/nodejs-bigtable/blob/main/src/mutation.ts#L35.

Adding undefined here would solve this:

export interface ParsedColumn {
  family: string | null;
  qualifier: string | null | undefined;
}
};
}

Check failure on line 392 in src/mutation.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `·`

Check failure on line 392 in src/mutation.ts

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
return {
family: columnName.slice(0, colonIdx),
qualifier: columnName.slice(colonIdx + 1),
Expand Down
Loading