mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
eslint: Fix unicorn/no-zero-fractions.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/no-zero-fractions.md Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
0d4af4f8e7
commit
78ccb15d9e
@@ -4,11 +4,11 @@ zrequire("colorspace");
|
|||||||
|
|
||||||
run_test("sRGB_to_linear", () => {
|
run_test("sRGB_to_linear", () => {
|
||||||
let srgb_color = 0.0042;
|
let srgb_color = 0.0042;
|
||||||
let expected_value = 0.0042 / 255.0 / 12.92;
|
let expected_value = 0.0042 / 255 / 12.92;
|
||||||
let actual_value = colorspace.sRGB_to_linear(srgb_color);
|
let actual_value = colorspace.sRGB_to_linear(srgb_color);
|
||||||
assert.equal(actual_value, expected_value);
|
assert.equal(actual_value, expected_value);
|
||||||
|
|
||||||
srgb_color = 255.0;
|
srgb_color = 255;
|
||||||
expected_value = 1;
|
expected_value = 1;
|
||||||
actual_value = colorspace.sRGB_to_linear(srgb_color);
|
actual_value = colorspace.sRGB_to_linear(srgb_color);
|
||||||
assert.equal(actual_value, expected_value);
|
assert.equal(actual_value, expected_value);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
// https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation
|
// https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation
|
||||||
exports.sRGB_to_linear = function (v) {
|
exports.sRGB_to_linear = function (v) {
|
||||||
v = v / 255.0;
|
v = v / 255;
|
||||||
if (v <= 0.04045) {
|
if (v <= 0.04045) {
|
||||||
return v / 12.92;
|
return v / 12.92;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user