Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Jul 31, 2024
1 parent 2d76e0b commit 094a813
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export type NonArgAggregateOp = Exclude<AggregateOp, 'argmin' | 'argmax'>;
export type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef;

export function isArgminDef(a: Aggregate | string): a is ArgminDef {
return !!a && hasKey(a, 'argmin');
return hasKey(a, 'argmin');
}

export function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef {
return !!a && hasKey(a, 'argmax');
return hasKey(a, 'argmax');
}

export function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp {
Expand Down
2 changes: 1 addition & 1 deletion src/compile/scale/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function parseUnitScaleCore(model: UnitModel): ScaleComponentIndex {
continue;
}

let specifiedScale = (fieldOrDatumDef as any)?.scale;
let specifiedScale = fieldOrDatumDef && (fieldOrDatumDef as any).scale;
if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {
specifiedScale ??= {};
const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel);
Expand Down
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,10 @@ export function stripAndRedirectConfig(config: Config<SignalRef>) {
redirectTitleConfig(config);

// Remove empty config objects.
for (const prop of keys(config)) {
for (const prop in config) {
// @ts-ignore
if (isObject(config[prop]) && isEmpty(config[prop])) {
// @ts-ignore
delete config[prop];
}
}
Expand Down

0 comments on commit 094a813

Please sign in to comment.