Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/crazy-regions-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@imgproxy/imgproxy-js-core": patch
---

Fix typo in error messages: "then" -> "than"
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getMinNumText(
): string {
return `${getParamName(paramName)} value can't be less${
isEqual ? " or equal" : ""
} then ${value}${addInfo ? `. ${addInfo}` : ""}`;
} than ${value}${addInfo ? `. ${addInfo}` : ""}`;
}

export function guardIsNotNum(
Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/adjust.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("adjust", () => {

it("should throw an error if brightness less than -255", () => {
expect(() => build({ adjust: { brightness: -300 } })).toThrow(
"adjust.brightness value can't be less then -255"
"adjust.brightness value can't be less than -255"
);
});

Expand Down
8 changes: 4 additions & 4 deletions tests/optionsBasic/autoquality.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("autoquality", () => {

it("should throw an error if autoquality.target is less than 0", () => {
expect(() => build({ autoquality: { target: -1 } })).toThrow(
"autoquality.target value can't be less then 0"
"autoquality.target value can't be less than 0"
);
});

Expand All @@ -50,7 +50,7 @@ describe("autoquality", () => {

it("should throw an error if autoquality.min_quality is less than 0", () => {
expect(() => build({ autoquality: { min_quality: -1 } })).toThrow(
"autoquality.min_quality value can't be less then 0"
"autoquality.min_quality value can't be less than 0"
);
});

Expand All @@ -69,7 +69,7 @@ describe("autoquality", () => {

it("should throw an error if autoquality.max_quality is less than 0", () => {
expect(() => build({ autoquality: { max_quality: -1 } })).toThrow(
"autoquality.max_quality value can't be less then 0"
"autoquality.max_quality value can't be less than 0"
);
});

Expand All @@ -89,7 +89,7 @@ describe("autoquality", () => {
it("should throw an error if autoquality.allowed_error is less than 0", () => {
expect(() =>
build({ autoquality: { method: "ml", allowed_error: -1 } })
).toThrow("autoquality.allowed_error value can't be less then 0");
).toThrow("autoquality.allowed_error value can't be less than 0");
});

it("should throw an error if autoquality.allowed_error is more than 1", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/backgroundAlpha.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("backgroundAlpha", () => {

it("should throw an error if background alpha less than 0", () => {
expect(() => build({ background_alpha: -0.5 })).toThrow(
"background_alpha option value can't be less then 0"
"background_alpha option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/blur.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("blur", () => {

it("should throw an error if blur is less than 0", () => {
expect(() => build({ bl: -1 })).toThrow(
"blur option value can't be less then 0"
"blur option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/brightness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("brightness", () => {

it("should throw an error if brightness is less than -255", () => {
expect(() => build({ brightness: -275 })).toThrow(
"brightness option value can't be less then -255"
"brightness option value can't be less than -255"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/contrast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("contrast", () => {

it("should throw an error if contrast is less than 0", () => {
expect(() => build({ contrast: -1 })).toThrow(
"contrast option value can't be less then 0"
"contrast option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/cropAspectRatio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("cropAspectRatio", () => {
expect(() =>
build({ crop_aspect_ratio: { aspect_ratio: -1 } })
).toThrowError(
"crop_aspect_ratio.aspect_ratio value can't be less then 0"
"crop_aspect_ratio.aspect_ratio value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/dpr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("dpr", () => {

it("should throw an error if dpr is less than 0", () => {
expect(() => build({ dpr: -1 })).toThrow(
"dpr option value can't be less then 0"
"dpr option value can't be less than 0"
);
});

Expand Down
6 changes: 3 additions & 3 deletions tests/optionsBasic/gradient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("gradient", () => {

it("should throw an error if opacity is less than 0", () => {
expect(() => build({ gradient: { opacity: -0.5 } })).toThrow(
"gradient.opacity value can't be less then 0"
"gradient.opacity value can't be less than 0"
);
});

Expand Down Expand Up @@ -104,7 +104,7 @@ describe("gradient", () => {

it("should throw an error if start is less than 0", () => {
expect(() => build({ gradient: { opacity: 0.5, start: -0.5 } })).toThrow(
"gradient.start value can't be less then 0"
"gradient.start value can't be less than 0"
);
});

Expand All @@ -123,7 +123,7 @@ describe("gradient", () => {

it("should throw an error if stop is less than 0", () => {
expect(() => build({ gradient: { opacity: 0.5, stop: -0.5 } })).toThrow(
"gradient.stop value can't be less then 0"
"gradient.stop value can't be less than 0"
);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/gravity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe("gravity", () => {
y: 0.5,
},
})
).toThrow(`gravity.x value can't be less then 0`);
).toThrow(`gravity.x value can't be less than 0`);
});

it("should throw an error if x is greater than 1", () => {
Expand All @@ -201,7 +201,7 @@ describe("gravity", () => {
y: -0.5,
},
})
).toThrow(`gravity.y value can't be less then 0`);
).toThrow(`gravity.y value can't be less than 0`);
});

it("should throw an error if y is greater than 1", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/height.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("height", () => {

it("should throw an error if height is less than 0", () => {
expect(() => build({ height: -1 })).toThrow(
"height option value can't be less then 0"
"height option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/jpegOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe("jpegOptions", () => {
expect(() =>
// @ts-expect-error: Let's ignore an error (check for users with vanilla js).
build({ jpeg_options: { quant_table: -1 } })
).toThrow("jpeg_options.quant_table value can't be less then 0");
).toThrow("jpeg_options.quant_table value can't be less than 0");
});

it("should throw an error if quant_table is more than 8", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/maxAnimationFrameResolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("maxAnimationFrameResolution", () => {

it("should throw an error if max_animation_frame_resolution is less than 0", () => {
expect(() => build({ max_animation_frame_resolution: -1 })).toThrow(
"max_animation_frame_resolution option value can't be less then 0"
"max_animation_frame_resolution option value can't be less than 0"
);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/maxAnimationFrames.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ describe("maxAnimationFrames", () => {

it("should throw an error if max_animation_frames is less than 0", () => {
expect(() => build({ max_animation_frames: -1 })).toThrow(
"max_animation_frames option value can't be less or equal then 0"
"max_animation_frames option value can't be less or equal than 0"
);
});

it("should throw an error if max_animation_frames is 0", () => {
expect(() => build({ max_animation_frames: 0 })).toThrow(
"max_animation_frames option value can't be less or equal then 0"
"max_animation_frames option value can't be less or equal than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/maxBytes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("maxBytes", () => {

it("should throw an error if max_bytes is less than 0", () => {
expect(() => build({ max_bytes: -1 })).toThrow(
"max_bytes option value can't be less then 0"
"max_bytes option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/maxResultDimension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("maxResultDimension", () => {

it("should throw an error if max_result_dimension is less than 0", () => {
expect(() => build({ max_result_dimension: -1 })).toThrow(
"max_result_dimension option value can't be less then 0"
"max_result_dimension option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/minHeight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("min_height", () => {

it("should throw an error if min_height is less than 0", () => {
expect(() => build({ min_height: -10 })).toThrow(
"min_height option value can't be less then 0"
"min_height option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/minWidth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("min_width", () => {

it("should throw an error if min_width is less than 0", () => {
expect(() => build({ min_width: -1 })).toThrow(
"min_width option value can't be less then 0"
"min_width option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/padding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("padding", () => {

it("should throw an error if pd is less than 0", () => {
expect(() => build({ pd: -1 })).toThrow(
"padding option value can't be less then 0"
"padding option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("pages", () => {

it("should throw an error if pages is less than 1", () => {
expect(() => build({ pages: 0 })).toThrow(
"pages option value can't be less then 1"
"pages option value can't be less than 1"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/pixelate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("pixelate", () => {

it("should throw an error if pixelate is less than 0", () => {
expect(() => build({ pixelate: -1 })).toThrow(
"pixelate option value can't be less then 0"
"pixelate option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/pngOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("pngOptions", () => {

it("should throw an error if png_options.quantization_colors is less than 2", () => {
expect(() => build({ png_options: { quantization_colors: 1 } })).toThrow(
"png_options.quantization_colors value can't be less then 2"
"png_options.quantization_colors value can't be less than 2"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/quality.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("quality", () => {

it("should throw an error if quality is less than 0", () => {
expect(() => build({ quality: -1 })).toThrow(
"quality option value can't be less then 0"
"quality option value can't be less than 0"
);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/resize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ describe("resize", () => {

it("should return an error if width is less than 0", () => {
expect(() => build({ resize: { width: -15 } })).toThrow(
"resize.width value can't be less then 0"
"resize.width value can't be less than 0"
);
});

it("should return an error if height is less than 0", () => {
expect(() => build({ resize: { height: -25 } })).toThrow(
"resize.height value can't be less then 0"
"resize.height value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/saturation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("saturation", () => {

it("should throw an error if saturation is less than 0", () => {
expect(() => build({ saturation: -1 })).toThrow(
"saturation option value can't be less then 0"
"saturation option value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/sharpen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("sharpen", () => {

it("should throw an error if sharpen is less than 0", () => {
expect(() => build({ sharpen: -1 })).toThrow(
"sharpen option value can't be less then 0"
"sharpen option value can't be less than 0"
);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/size.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ describe("size", () => {

it("should return an error if width is less than 0", () => {
expect(() => build({ size: { width: -15 } })).toThrow(
"size.width value can't be less then 0"
"size.width value can't be less than 0"
);
});

it("should return an error if height is less than 0", () => {
expect(() => build({ size: { height: -25 } })).toThrow(
"size.height value can't be less then 0"
"size.height value can't be less than 0"
);
});

Expand Down
8 changes: 4 additions & 4 deletions tests/optionsBasic/unsharpMasking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("unsharpMasking", () => {

it("should throw an error if unsharp_masking.weight is not correct", () => {
expect(() => build({ unsharp_masking: { weight: -1 } })).toThrow(
"unsharp_masking.weight value can't be less or equal then 0"
"unsharp_masking.weight value can't be less or equal than 0"
);
});

Expand All @@ -43,10 +43,10 @@ describe("unsharpMasking", () => {

it("should throw an error if unsharp_masking.divider is not correct", () => {
expect(() => build({ unsharp_masking: { divider: -1 } })).toThrow(
"unsharp_masking.divider value can't be less or equal then 0"
"unsharp_masking.divider value can't be less or equal than 0"
);
expect(() => build({ unsharp_masking: { divider: 0 } })).toThrow(
"unsharp_masking.divider value can't be less or equal then 0"
"unsharp_masking.divider value can't be less or equal than 0"
);
});

Expand All @@ -59,7 +59,7 @@ describe("unsharpMasking", () => {

it("should throw an error if unsharp_masking.weight is not greater than zero", () => {
expect(() => build({ unsharp_masking: { weight: 0 } })).toThrow(
"unsharp_masking.weight value can't be less or equal then 0"
"unsharp_masking.weight value can't be less or equal than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/watermark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("watermark", () => {

it("should return throw an error if opacity is less than 0", () => {
expect(() => build({ watermark: { opacity: -1 } })).toThrow(
"watermark.opacity value can't be less then 0"
"watermark.opacity value can't be less than 0"
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/optionsBasic/watermarkShadow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("watermarkShadow", () => {

it("should throw an error if watermark_shadow option is less than 0", () => {
expect(() => build({ watermark_shadow: -1 })).toThrow(
"watermark_shadow option value can't be less then 0"
"watermark_shadow option value can't be less than 0"
);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/optionsBasic/watermarkSize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("watermarkSize", () => {

it("should throw an error if watermark_size.width is less than 0", () => {
expect(() => build({ watermark_size: { width: -1 } })).toThrow(
"watermark_size.width value can't be less then 0"
"watermark_size.width value can't be less than 0"
);
});

Expand All @@ -43,7 +43,7 @@ describe("watermarkSize", () => {

it("should throw an error if wms.height is less than 0", () => {
expect(() => build({ wms: { height: -1 } })).toThrow(
"watermark_size.height value can't be less then 0"
"watermark_size.height value can't be less than 0"
);
});

Expand Down
Loading