Skip to content

Commit 3c7c2f8

Browse files
committed
fix: update fn to break early
1 parent cf3b853 commit 3c7c2f8

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

src/chart_types/xy_chart/domains/x_domain.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,23 @@ export function mergeXDomain(
123123
};
124124
}
125125

126-
function getMinInterval(computedMinInterval: number, size: number, customMinInterval?: number) {
127-
if (customMinInterval != null) {
128-
// Allow greater custom min if xValues has 1 member.
129-
if (size > 1 && customMinInterval > computedMinInterval) {
130-
Logger.warn(
131-
'custom xDomain is invalid, custom minInterval is greater than computed minInterval. Using computed minInterval.',
132-
);
133-
return computedMinInterval;
134-
}
135-
if (customMinInterval < 0) {
136-
Logger.warn('custom xDomain is invalid, custom minInterval is less than 0. Using computed minInterval.');
137-
return computedMinInterval;
138-
}
126+
function getMinInterval(computedMinInterval: number, size: number, customMinInterval?: number): number {
127+
if (customMinInterval == null) {
128+
return computedMinInterval;
129+
}
130+
// Allow greater custom min if xValues has 1 member.
131+
if (size > 1 && customMinInterval > computedMinInterval) {
132+
Logger.warn(
133+
'custom xDomain is invalid, custom minInterval is greater than computed minInterval. Using computed minInterval.',
134+
);
135+
return computedMinInterval;
136+
}
137+
if (customMinInterval < 0) {
138+
Logger.warn('custom xDomain is invalid, custom minInterval is less than 0. Using computed minInterval.');
139+
return computedMinInterval;
139140
}
140141

141-
return customMinInterval || computedMinInterval;
142+
return customMinInterval;
142143
}
143144

144145
/**

0 commit comments

Comments
 (0)