From 15bac52a7cd355931d30e685ae1ed234f855846f Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:37:42 +0100 Subject: [PATCH 01/17] feat(console): add six-argument variants --- src/Core__Console.res | 4 ++++ src/Core__Console.resi | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index 8fefe380..baa5b9e5 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -3,24 +3,28 @@ @val external log3: ('a, 'b, 'c) => unit = "console.log" @val external log4: ('a, 'b, 'c, 'd) => unit = "console.log" @val external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" +@val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" @val external info: 'a => unit = "console.info" @val external info2: ('a, 'b) => unit = "console.info" @val external info3: ('a, 'b, 'c) => unit = "console.info" @val external info4: ('a, 'b, 'c, 'd) => unit = "console.info" @val external info5: ('a, 'b, 'c, 'd, 'e) => unit = "console.info" +@val external info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.info" @val external warn: 'a => unit = "console.warn" @val external warn2: ('a, 'b) => unit = "console.warn" @val external warn3: ('a, 'b, 'c) => unit = "console.warn" @val external warn4: ('a, 'b, 'c, 'd) => unit = "console.warn" @val external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" +@val external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" @val external error: 'a => unit = "console.error" @val external error2: ('a, 'b) => unit = "console.error" @val external error3: ('a, 'b, 'c) => unit = "console.error" @val external error4: ('a, 'b, 'c, 'd) => unit = "console.error" @val external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" +@val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" @val external trace: unit => unit = "console.trace" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 7aa5f7b5..5de84fbc 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -69,6 +69,20 @@ Console.log5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) */ @val external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" + +/** +`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments. + +## Examples + +```rescript +Console.log6("Hello", "World", "JS", '!', '!', '?') +Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" + /** `info(value)` print an informational message to console. See [`Console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info) @@ -136,6 +150,19 @@ Console.info5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) @val external info5: ('a, 'b, 'c, 'd, 'e) => unit = "console.info" +/** +`info6(v1, v2, v3, v4, v5, v6)`. Like `info`, but with six arguments. + +## Examples + +```rescript +Console.info6("Hello", "World", "from", "JS", "!!!", '!') +Console.info6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.info" + /** `warn(value)` print a warning message to console. See [`Console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) @@ -203,6 +230,19 @@ Console.warn5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) @val external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" +/** +`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments. + +## Examples + +```rescript +Console.warn6("Hello", "World", "from", "JS", "!!!", '!') +Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" + /** `error(value)` prints an error message to console. See [`Console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) @@ -270,6 +310,19 @@ Console.error5(1, #second, #third, ("fourth"), 'c') @val external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" +/** +`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments. + +## Examples + +```rescript +Console.error6("Hello", "World", "from", "JS", "!!!", '!') +Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" + /** `trace()` print a stack trace to console. See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) From c0fa1912f445d4724d8648822c62b31b4e8d182b Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:38:10 +0100 Subject: [PATCH 02/17] feat(console): add variadic variants --- src/Core__Console.res | 4 +++ src/Core__Console.resi | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index baa5b9e5..28743564 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -4,6 +4,7 @@ @val external log4: ('a, 'b, 'c, 'd) => unit = "console.log" @val external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" @val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" +@val @variadic external logMany: array<_> => unit = "console.log" @val external info: 'a => unit = "console.info" @val external info2: ('a, 'b) => unit = "console.info" @@ -11,6 +12,7 @@ @val external info4: ('a, 'b, 'c, 'd) => unit = "console.info" @val external info5: ('a, 'b, 'c, 'd, 'e) => unit = "console.info" @val external info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.info" +@val @variadic external infoMany: array<_> => unit = "console.info" @val external warn: 'a => unit = "console.warn" @val external warn2: ('a, 'b) => unit = "console.warn" @@ -18,6 +20,7 @@ @val external warn4: ('a, 'b, 'c, 'd) => unit = "console.warn" @val external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" @val external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" +@val @variadic external warnMany: array<_> => unit = "console.warn" @val external error: 'a => unit = "console.error" @val external error2: ('a, 'b) => unit = "console.error" @@ -25,6 +28,7 @@ @val external error4: ('a, 'b, 'c, 'd) => unit = "console.error" @val external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" @val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" +@val @variadic external errorMany: array<_> => unit = "console.error" @val external trace: unit => unit = "console.trace" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 5de84fbc..81f9e9e2 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -83,6 +83,20 @@ Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) @val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" +/** +`logMany(arr)`. Like `log`, but variadic. + +## Examples + +```rescript +Console.logMany(["Hello", "World"]) +Console.logMany([1, 2, 3]) +``` +*/ +@val +@variadic +external logMany: array<_> => unit = "console.log" + /** `info(value)` print an informational message to console. See [`Console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info) @@ -163,6 +177,20 @@ Console.info6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) @val external info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.info" +/** +`infoMany(arr)`. Like `info`, but variadic. + +## Examples + +```rescript +Console.infoMany(["Hello", "World"]) +Console.infoMany([1, 2, 3]) +``` +*/ +@val +@variadic +external infoMany: array<_> => unit = "console.info" + /** `warn(value)` print a warning message to console. See [`Console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) @@ -243,6 +271,20 @@ Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) @val external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" +/** +`warnMany(arr)`. Like `warn`, but variadic. + +## Examples + +```rescript +Console.warnMany(["Hello", "World"]) +Console.warnMany([1, 2, 3]) +``` +*/ +@val +@variadic +external warnMany: array<_> => unit = "console.warn" + /** `error(value)` prints an error message to console. See [`Console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) @@ -323,6 +365,20 @@ Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) @val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" +/** +`errorMany(arr)`. Like `error`, but variadic. + +## Examples + +```rescript +Console.errorMany(["Hello", "World"]) +Console.errorMany([1, 2, 3]) +``` +*/ +@val +@variadic +external errorMany: array<_> => unit = "console.error" + /** `trace()` print a stack trace to console. See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) From ccd4bd1470120943106f93c2c206f1c43619aa2e Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:54:12 +0100 Subject: [PATCH 03/17] docs(console): fix typo in example, log2 -> log3 --- src/Core__Console.resi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 81f9e9e2..b4cc30de 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -39,7 +39,7 @@ external log2: ('a, 'b) => unit = "console.log" ```rescript Console.log3("Hello", "World", "ReScript") -Console.log2("One", 2, #3) +Console.log3("One", 2, #3) ``` */ @val From 62fa2f708ca2b23903919bca754f01a66c78b81b Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:54:56 +0100 Subject: [PATCH 04/17] style(math): formatting --- src/Core__Math.resi | 134 ++++++++++++++++++++++++++++++-------------- 1 file changed, 91 insertions(+), 43 deletions(-) diff --git a/src/Core__Math.resi b/src/Core__Math.resi index 5394a636..00cd21b6 100644 --- a/src/Core__Math.resi +++ b/src/Core__Math.resi @@ -182,7 +182,8 @@ module Int: { Math.Int.imul(-5, 12) // 60 ``` */ - @val external imul: (int, int) => int = "Math.imul" + @val + external imul: (int, int) => int = "Math.imul" /** `min(a, b)` returns the minimum of its two integer arguments. @@ -195,7 +196,8 @@ module Int: { Math.Int.min(-1, -2) // -2 ``` */ - @val external min: (int, int) => int = "Math.min" + @val + external min: (int, int) => int = "Math.min" /** `minMany(arr)` returns the minimum of the integers in the given array `arr`. @@ -210,7 +212,9 @@ module Int: { Math.Int.minMany([])->Float.isFinite // false ``` */ - @variadic @val external minMany: array => int = "Math.min" + @variadic + @val + external minMany: array => int = "Math.min" /** `max(a, b)` returns the maximum of its two integer arguments. @@ -223,7 +227,8 @@ module Int: { Math.Int.max(-1, -2) // -1 ``` */ - @val external max: (int, int) => int = "Math.max" + @val + external max: (int, int) => int = "Math.max" /** `maxMany(arr)` returns the maximum of the integers in the given array `arr`. @@ -238,7 +243,9 @@ module Int: { Math.Int.maxMany([])->Float.isFinite // false ``` */ - @variadic @val external maxMany: array => int = "Math.max" + @variadic + @val + external maxMany: array => int = "Math.max" /** `pow(a, ~exp)` raises the given base `a` to the given exponent `exp`. @@ -251,7 +258,8 @@ module Int: { Math.Int.pow(3, ~exp=4) // 81 ``` */ - @val external pow: (int, ~exp: int) => int = "Math.pow" + @val + external pow: (int, ~exp: int) => int = "Math.pow" /** `sign(v)` returns the sign of its integer argument: `-1` if negative, `0` if @@ -266,7 +274,8 @@ module Int: { Math.Int.sign(0) // 0 ``` */ - @val external sign: int => int = "Math.sign" + @val + external sign: int => int = "Math.sign" } /** @@ -280,7 +289,8 @@ Math.abs(-2.0) // 2.0 Math.abs(3.0) // 3.0 ``` */ -@val external abs: float => float = "Math.abs" +@val +external abs: float => float = "Math.abs" /** `acos(v)` returns arccosine (in radians) of argument `v`, returns `NaN` if the @@ -294,7 +304,8 @@ Math.acos(-1) // 3.141592653589793 Math.acos(-3)->Float.isNaN // true ``` */ -@val external acos: float => float = "Math.acos" +@val +external acos: float => float = "Math.acos" /** `acosh(v)` returns the inverse hyperbolic arccosine (in radians) of argument `v`, @@ -308,7 +319,8 @@ Math.acosh(1) // 0.0 Math.acosh(0.5)->Float.isNaN // true ``` */ -@val external acosh: float => float = "Math.acosh" +@val +external acosh: float => float = "Math.acosh" /** `asin(v)` returns the inverse sine (in radians) of argument `v`, returns `NaN` @@ -322,7 +334,8 @@ Math.asin(-1.0) // -1.5707963267948966 Math.asin(-2.0)->Float.isNaN // true ``` */ -@val external asin: float => float = "Math.asin" +@val +external asin: float => float = "Math.asin" /** `asinh(v)` returns the inverse hyperbolic sine of argument `v`. @@ -335,7 +348,8 @@ Math.asinh(-1) // -0.881373587019543 Math.asinh(-0) // -0.0 ``` */ -@val external asinh: float => float = "Math.asinh" +@val +external asinh: float => float = "Math.asinh" /** `atan(v)` returns the inverse tangent (in radians) of argument `v`. @@ -349,7 +363,8 @@ Math.atan(0.0) // 0.0 Math.atan(1) // 0.7853981633974483 ``` */ -@val external atan: float => float = "Math.atan" +@val +external atan: float => float = "Math.atan" /** `atanh(v)` returns the invert hyperbolic tangent of argument `v`. Returns `NaN` @@ -367,7 +382,8 @@ Math.atanh(0.0) // 0.0 Math.atanh(0.5) // 0.5493061443340548 ``` */ -@val external atanh: float => float = "Math.atanh" +@val +external atanh: float => float = "Math.atanh" /** `atan2(~x, ~y)` returns the angle (in radians) of the quotient `y /. x`. It is @@ -383,7 +399,8 @@ Math.atan2(~x=90.0, ~y=15.0) // 1.4056476493802699 Math.atan2(~x=15.0, ~y=90.0) // 0.16514867741462683 ``` */ -@val external atan2: (~x: float, ~y: float) => float = "Math.atan2" +@val +external atan2: (~x: float, ~y: float) => float = "Math.atan2" /** `cbrt(v)` returns the cube root of argument `v`. @@ -397,7 +414,8 @@ Math.cbrt(-0.0) // -0.0 Math.cbrt(0.0) // 0.0 ``` */ -@val external cbrt: float => float = "Math.cbrt" +@val +external cbrt: float => float = "Math.cbrt" /** `ceil(v)` returns the smallest integral value greater than or equal to the @@ -414,7 +432,8 @@ Math.ceil(-3.1) == -3.0 Math.ceil(2_150_000_000.3) == 2_150_000_001.0 ``` */ -@val external ceil: float => float = "Math.ceil" +@val +external ceil: float => float = "Math.ceil" /** `cos(v)` returns the cosine of argument `v`, which must be specified in radians. @@ -428,7 +447,8 @@ Math.cos(0.0) // 1.0 Math.cos(1.0) // 0.5403023058681398 ``` */ -@val external cos: float => float = "Math.cos" +@val +external cos: float => float = "Math.cos" /** `cosh(v)` returns the hyperbolic cosine of argument `v`, which must be specified @@ -443,7 +463,8 @@ Math.cosh(-0.0) // 1.0 Math.cosh(0.0) // 1.0 ``` */ -@val external cosh: float => float = "Math.cosh" +@val +external cosh: float => float = "Math.cosh" /** `exp(v)` returns natural exponentional, returns *e* (the base of natural logarithms) @@ -457,7 +478,8 @@ Math.exp(-1.0) // 0.36787944117144233 Math.exp(0.0) // 1.0 ``` */ -@val external exp: float => float = "Math.exp" +@val +external exp: float => float = "Math.exp" /** `expm1(v)` returns *e* (the base of natural logarithms) to the power of the given @@ -471,7 +493,8 @@ Math.expm1(-1.0) // -0.6321205588285577 Math.expm1(-0.0) // -0 ``` */ -@val external expm1: float => float = "Math.expm1" +@val +external expm1: float => float = "Math.expm1" /** `floor(v)` returns the largest integral value less than or equal to the argument @@ -486,7 +509,8 @@ Math.floor(-45.05) // -46.0 Math.floor(-0.0) // -0.0 ``` */ -@val external floor: float => float = "Math.floor" +@val +external floor: float => float = "Math.floor" /** `fround(v)` returns the nearest single precision float. @@ -499,7 +523,8 @@ Math.fround(5.5) == 5.5 Math.fround(5.05) == 5.050000190734863 ``` */ -@val external fround: float => float = "Math.fround" +@val +external fround: float => float = "Math.fround" /** `hypot(a, b)` returns the square root of the sum of squares of its two arguments @@ -513,7 +538,8 @@ Math.hypot(3.0, 4.0) // 5.0 Math.hypot(3.0, 5.0) // 5.8309518948453 ``` */ -@val external hypot: (float, float) => float = "Math.hypot" +@val +external hypot: (float, float) => float = "Math.hypot" /** `hypotMany(arr)` returns the square root of the sum of squares of the numbers in @@ -528,7 +554,9 @@ Math.hypot([3.0, 4.0, 5.0]) // 7.0710678118654755 Math.hypot([]) // 0.0 ``` */ -@variadic @val external hypotMany: array => float = "Math.hypot" +@variadic +@val +external hypotMany: array => float = "Math.hypot" /** `log(v)` returns the natural logarithm of argument `v`, this is the number *x* @@ -545,7 +573,8 @@ Math.log(0.0)->Float.isFinite // false Math.log(1.0) // 0 ``` */ -@val external log: float => float = "Math.log" +@val +external log: float => float = "Math.log" /** `log1p(v)` returns the natural logarithm of one plus the argument `v`. @@ -560,7 +589,8 @@ Math.log1p(-1.0)->Float.isFinite // false Math.log1p(-0.0) // -0 ``` */ -@val external log1p: float => float = "Math.log1p" +@val +external log1p: float => float = "Math.log1p" /** `log10(v)` returns the base 10 logarithm of argument `v`. Returns `NaN` for @@ -576,7 +606,8 @@ Math.log10(0.0)->Float.isFinite // false Math.log10(1.0) // 0 ``` */ -@val external log10: float => float = "Math.log10" +@val +external log10: float => float = "Math.log10" /** `log2(v)` returns the base 2 logarithm of argument `v`. Returns `NaN` for @@ -592,7 +623,8 @@ Math.log2(0.0)->Float.isFinite // false Math.log2(1.0) // 0.0 ``` */ -@val external log2: float => float = "Math.log2" +@val +external log2: float => float = "Math.log2" /** `min(a, b)` returns the minimum of its two float arguments. @@ -605,7 +637,8 @@ Math.min(1.0, 2.0) // 1.0 Math.min(-1.0, -2.0) // -2.0 ``` */ -@val external min: (float, float) => float = "Math.min" +@val +external min: (float, float) => float = "Math.min" /** `minMany(arr)` returns the minimum of the float in the given array `arr`. @@ -620,7 +653,9 @@ Math.minMany([-1.0, -2.0]) // -2.0 Math.minMany([])->Float.isFinite // false ``` */ -@variadic @val external minMany: array => float = "Math.min" +@variadic +@val +external minMany: array => float = "Math.min" /** `max(a, b)` returns the maximum of its two float arguments. @@ -633,7 +668,8 @@ Math.max(1.0, 2.0) // 2.0 Math.max(-1.0, -2.0) // -1.0 ``` */ -@val external max: (float, float) => float = "Math.max" +@val +external max: (float, float) => float = "Math.max" /** `maxMany(arr)` returns the maximum of the float in the given array `arr`. @@ -648,7 +684,9 @@ Math.maxMany([-1.0, -2.0]) // -1.0 Math.maxMany([])->Float.isFinite // false ``` */ -@variadic @val external maxMany: array => float = "Math.max" +@variadic +@val +external maxMany: array => float = "Math.max" /** `pow(a, ~exp)` raises the given base `a` to the given exponent `exp`. @@ -661,7 +699,8 @@ Math.pow(2.0, ~exp=4.0) // 16.0 Math.pow(3.0, ~exp=4.0) // 81.0 ``` */ -@val external pow: (float, ~exp: float) => float = "Math.pow" +@val +external pow: (float, ~exp: float) => float = "Math.pow" /** `random()` returns a random number in the half-closed interval [0,1]. @@ -673,7 +712,8 @@ See [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe Math.random() ``` */ -@val external random: unit => float = "Math.random" +@val +external random: unit => float = "Math.random" /** `round(v)` returns then value of `v` rounded to nearest integral value @@ -691,7 +731,8 @@ Math.round(0.0) // 0.0 Math.round(-0.0) // -0.0 ``` */ -@val external round: float => float = "Math.round" +@val +external round: float => float = "Math.round" /** `sign(v)` returns the sign of its foat argument: `-1` if negative, `0` if @@ -706,7 +747,8 @@ Math.sign(-3.0) // 1.0 Math.sign(0.0) // 0.0 ``` */ -@val external sign: float => float = "Math.sign" +@val +external sign: float => float = "Math.sign" /** `sin(v)` returns the sine of argument `v`, which must be specified in radians. @@ -720,7 +762,8 @@ Math.sin(0.0) // 0.0 Math.sin(1.0) // 0.8414709848078965 ``` */ -@val external sin: float => float = "Math.sin" +@val +external sin: float => float = "Math.sin" /** `sinh(v)` returns then hyperbolic sine of argument `v`, which must be specified @@ -735,7 +778,8 @@ Math.sinh(0.0) // 0.0 Math.sinh(1.0) // 1.1752011936438014 ``` */ -@val external sinh: float => float = "Math.sinh" +@val +external sinh: float => float = "Math.sinh" /** `sqrt(v)` returns the square root of `v`. If `v` is negative returns `NaN`. @@ -751,7 +795,8 @@ Math.sqrt(1.0) // 1.0 Math.sqrt(9.0) // 3.0 ``` */ -@val external sqrt: float => float = "Math.sqrt" +@val +external sqrt: float => float = "Math.sqrt" /** `tan(v)` returns the tangent of argument `v`, which must be specified in @@ -766,7 +811,8 @@ Math.tan(0.0) // 0.0 Math.tan(1.0) // 1.5574077246549023 ``` */ -@val external tan: float => float = "Math.tan" +@val +external tan: float => float = "Math.tan" /** `tanh(v)` returns the hyperbolic tangent of argument `v`, which must be @@ -781,7 +827,8 @@ Math.tanh(0.0) // 0.0 Math.tanh(1.0) // 0.7615941559557649 ``` */ -@val external tanh: float => float = "Math.tanh" +@val +external tanh: float => float = "Math.tanh" /** `trunc(v)` truncates the argument `v`, i.e., removes fractional digits. @@ -796,4 +843,5 @@ Math.trunc(13.37) // 13.0 Math.trunc(42.84) // 42.0 ``` */ -@val external trunc: float => float = "Math.trunc" +@val +external trunc: float => float = "Math.trunc" From cc497e037e728945896cfba45947b5a0d12ab208 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:55:22 +0100 Subject: [PATCH 05/17] style(array): formatting --- src/Core__Array.resi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core__Array.resi b/src/Core__Array.resi index 268faca4..e97aeaa0 100644 --- a/src/Core__Array.resi +++ b/src/Core__Array.resi @@ -104,7 +104,6 @@ let shuffle: array<'a> => array<'a> let shuffleInPlace: array<'a> => unit let flatMap: (array<'a>, 'a => array<'b>) => array<'b> - /** `at(array, index)` @@ -120,4 +119,5 @@ let flatMap: (array<'a>, 'a => array<'b>) => array<'b> ["a", "b", "c"]->Array.at(-4) // None ``` */ -@send external at: (array<'a>, int) => option<'a> = "at" +@send +external at: (array<'a>, int) => option<'a> = "at" From beba5f319dedac1472d84bb30caec88d3cf18452 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:55:41 +0100 Subject: [PATCH 06/17] feat(console): add assert --- src/Core__Console.res | 8 ++++ src/Core__Console.resi | 94 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index 28743564..26ac31e0 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -1,3 +1,11 @@ +@val external assert_: (bool, 'a) => unit = "console.assert" +@val external assert2: (bool, 'a, 'b) => unit = "console.assert" +@val external assert3: (bool, 'a, 'b, 'c) => unit = "console.assert" +@val external assert4: (bool, 'a, 'b, 'c, 'd) => unit = "console.assert" +@val external assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit = "console.assert" +@val external assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit = "console.assert" +@val @variadic external assertMany: (bool, array<_>) => unit = "console.assert" + @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" @val external log3: ('a, 'b, 'c) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index b4cc30de..98c470d1 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -3,6 +3,100 @@ Functions for interacting with JavaScript console. See: [`Console`](https://developer.mozilla.org/en-US/docs/Web/API/Console). */ +/** +`assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`. +See [`Console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) +on MDN. + +## Examples + +```rescript +Console.assert_(false, "Hello World!") +Console.assert_(n == 42, "The answer") +``` +*/ +@val +external assert_: (bool, 'a) => unit = "console.assert" + +/** +`assert2(v1, v2)`. Like `assert_`, but with two arguments. + +## Examples + +```rescript +Console.assert2(false, "Hello", "World") +Console.assert2(n == 42, [1, 2, 3], '4') +``` +*/ +@val +external assert2: (bool, 'a, 'b) => unit = "console.assert" + +/** +`assert3(v1, v2, v3)`. Like `assert_`, but with three arguments. + +## Examples + +```rescript +Console.assert3(false, "Hello", "World", "ReScript") +Console.assert3(n == 42, "One", 2, #3) +``` +*/ +@val +external assert3: (bool, 'a, 'b, 'c) => unit = "console.assert" + +/** +`assert4(v1, v2, v3, v4)`. Like `assert_`, but with four arguments. + +## Examples + +```rescript +Console.assert4(false, "Hello", "World", "ReScript", "!!!") +Console.assert4(m == 42, [1, 2], (3, 4), [#5, #6], #"polyvar") +``` +*/ +@val +external assert4: (bool, 'a, 'b, 'c, 'd) => unit = "console.assert" + +/** +`assert5(v1, v2, v3, v4, v5)`. Like `assert_`, but with five arguments. + +## Examples + +```rescript +Console.assert5(false, "Hello", "World", "JS", '!', '!') +Console.assert5(n == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) +``` +*/ +@val +external assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit = "console.assert" + +/** +`assert6(v1, v2)`. Like `assert_`, but with six arguments. + +## Examples + +```rescript +Console.assert6(false, "Hello", "World", "JS", '!', '!', '?') +Console.assert6(n == 42, [1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit = "console.assert" + +/** +`assertMany(assertion, arr)`. Like `assert_`, but variadic. + +## Examples + +```rescript +Console.assertMany(false, ["Hello", "World"]) +Console.assertMany(n == 42, [1, 2, 3]) +``` +*/ +@val +@variadic +external assertMany: (bool, array<_>) => unit = "console.assert" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) From 4f5cff3424ca47fab0ff977bc471f6e41b1c9508 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 12:58:50 +0100 Subject: [PATCH 07/17] feat(console): add clear --- src/Core__Console.res | 2 ++ src/Core__Console.resi | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index 26ac31e0..4bb273ea 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -6,6 +6,8 @@ @val external assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit = "console.assert" @val @variadic external assertMany: (bool, array<_>) => unit = "console.assert" +@val external clear: unit => unit = "console.clear" + @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" @val external log3: ('a, 'b, 'c) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 98c470d1..401e79f4 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -97,6 +97,20 @@ Console.assertMany(n == 42, [1, 2, 3]) @variadic external assertMany: (bool, array<_>) => unit = "console.assert" +/** +`clear()` clears the console, if allowed. +See [`Console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear) +on MDN. + +## Examples + +```rescript +Console.clear() +``` +*/ +@val +external clear: unit => unit = "console.clear" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) From 9a5cdf3d1e68747e98c33f885d6264892d576bfb Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:03:37 +0100 Subject: [PATCH 08/17] feat(console): add count and countReset --- src/Core__Console.res | 3 +++ src/Core__Console.resi | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index 4bb273ea..abf87f4b 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -8,6 +8,9 @@ @val external clear: unit => unit = "console.clear" +@val external count: string => unit = "console.count" +@val external countReset: string => unit = "console.countReset" + @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" @val external log3: ('a, 'b, 'c) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 401e79f4..3e1002ce 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -111,6 +111,34 @@ Console.clear() @val external clear: unit => unit = "console.clear" +/** +`count(label)` prints to the console the number of times it's been called with the given label. +See [`Console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count) +on MDN. + +## Examples + +```rescript +Console.count("rescript") +``` +*/ +@val +external count: string => unit = "console.count" + +/** +`countReset(label)` resets the count for the given label to 0. +See [`Console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset) +on MDN. + +## Examples + +```rescript +Console.countReset("rescript") +``` +*/ +@val +external countReset: string => unit = "console.countReset" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) From 025a484a3709c9e34bd054b40aa4bb442968f539 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:09:42 +0100 Subject: [PATCH 09/17] feat(console): add debug and variants --- src/Core__Console.res | 8 ++++ src/Core__Console.resi | 96 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index abf87f4b..c1b1dbc0 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -11,6 +11,14 @@ @val external count: string => unit = "console.count" @val external countReset: string => unit = "console.countReset" +@val external debug: 'a => unit = "console.debug" +@val external debug2: ('a, 'b) => unit = "console.debug" +@val external debug3: ('a, 'b, 'c) => unit = "console.debug" +@val external debug4: ('a, 'b, 'c, 'd) => unit = "console.debug" +@val external debug5: ('a, 'b, 'c, 'd, 'e) => unit = "console.debug" +@val external debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.debug" +@val @variadic external debugMany: array<_> => unit = "console.debug" + @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" @val external log3: ('a, 'b, 'c) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 3e1002ce..15ef53c4 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -139,6 +139,101 @@ Console.countReset("rescript") @val external countReset: string => unit = "console.countReset" +/** +`debug(value)` print a debug message to console. +See [`Console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug) +on MDN. + +## Examples + +```rescript +Console.debug("Hello") +let obj = {"name": "ReScript", "version": 10} +Console.debug(obj) +``` +*/ +@val +external debug: 'a => unit = "console.debug" + +/** +`debug2(v1, v2)`. Like `debug`, but with two arguments. + +## Examples + +```rescript +Console.debug2("Hello", "World") +Console.debug2([1, 2, 3], '4') +``` +*/ +@val +external debug2: ('a, 'b) => unit = "console.debug" + +/** +`debug3(v1, v2, v3)`. Like `debug`, but with three arguments. + +## Examples + +```rescript +Console.debug3("Hello", "World", "ReScript") +Console.debug3("One", 2, #3) +``` +*/ +@val +external debug3: ('a, 'b, 'c) => unit = "console.debug" + +/** +`debug4(v1, v2, v3, v4)`. Like `debug`, but with four arguments. + +## Examples + +```rescript +Console.debug4("Hello", "World", "ReScript", "!!!") +Console.debug4([1, 2], (3, 4), [#5, #6], #"polyvar") +``` +*/ +@val +external debug4: ('a, 'b, 'c, 'd) => unit = "console.debug" + +/** +`debug5(v1, v2, v3, v4, v5)`. Like `debug`, but with five arguments. + +## Examples + +```rescript +Console.debug5("Hello", "World", "JS", '!', '!') +Console.debug5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) +``` +*/ +@val +external debug5: ('a, 'b, 'c, 'd, 'e) => unit = "console.debug" + +/** +`debug6(v1, v2, v3, v4, v5, v6)`. Like `debug`, but with six arguments. + +## Examples + +```rescript +Console.debug6("Hello", "World", "JS", '!', '!', '?') +Console.debug6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +``` +*/ +@val +external debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.debug" + +/** +`debugMany(arr)`. Like `debug`, but variadic. + +## Examples + +```rescript +Console.debugMany(["Hello", "World"]) +Console.debugMany([1, 2, 3]) +``` +*/ +@val +@variadic +external debugMany: array<_> => unit = "console.debug" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) @@ -180,6 +275,7 @@ Console.log3("One", 2, #3) */ @val external log3: ('a, 'b, 'c) => unit = "console.log" + /** `log4(v1, v2, v3, v4)`. Like `log`, but with four arguments. From b30a6ee063ceef7f0999a98169929ac58c8d29a0 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:13:42 +0100 Subject: [PATCH 10/17] feat(console): add dir --- src/Core__Console.res | 2 ++ src/Core__Console.resi | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index c1b1dbc0..1643e324 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -19,6 +19,8 @@ @val external debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.debug" @val @variadic external debugMany: array<_> => unit = "console.debug" +@val external dir: 'a => unit = "console.dir" + @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" @val external log3: ('a, 'b, 'c) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 15ef53c4..83b713e5 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -234,6 +234,20 @@ Console.debugMany([1, 2, 3]) @variadic external debugMany: array<_> => unit = "console.debug" +/** +`dir(object)` displays an interactive view of the object in the console. +See [`Console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir) +on MDN. + +## Examples + +```rescript +Console.dir({"language": "rescript", "version": 10.1.2}) +``` +*/ +@val +external dir: 'a => unit = "console.dir" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) From 146e761209cfbee4f271307dec53f4c23eb78243 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:16:12 +0100 Subject: [PATCH 11/17] feat(console): add dirxml --- src/Core__Console.res | 1 + src/Core__Console.resi | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index 1643e324..65207fb3 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -20,6 +20,7 @@ @val @variadic external debugMany: array<_> => unit = "console.debug" @val external dir: 'a => unit = "console.dir" +@val external dirxml: 'a => unit = "console.dirxml" @val external log: 'a => unit = "console.log" @val external log2: ('a, 'b) => unit = "console.log" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 83b713e5..7a9ed546 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -248,6 +248,14 @@ Console.dir({"language": "rescript", "version": 10.1.2}) @val external dir: 'a => unit = "console.dir" +/** +`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console. +See [`Console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml) +on MDN. +*/ +@val +external dirxml: 'a => unit = "console.dirxml" + /** `log(value)` print a message to console. See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) From e3d26c9315e7f147579104ae0e9c76cca510e485 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:19:28 +0100 Subject: [PATCH 12/17] refactor(console): organize bindings alphabetically --- src/Core__Console.res | 40 +++---- src/Core__Console.resi | 240 ++++++++++++++++++++--------------------- 2 files changed, 140 insertions(+), 140 deletions(-) diff --git a/src/Core__Console.res b/src/Core__Console.res index 65207fb3..a7be6ebb 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -22,13 +22,13 @@ @val external dir: 'a => unit = "console.dir" @val external dirxml: 'a => unit = "console.dirxml" -@val external log: 'a => unit = "console.log" -@val external log2: ('a, 'b) => unit = "console.log" -@val external log3: ('a, 'b, 'c) => unit = "console.log" -@val external log4: ('a, 'b, 'c, 'd) => unit = "console.log" -@val external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" -@val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" -@val @variadic external logMany: array<_> => unit = "console.log" +@val external error: 'a => unit = "console.error" +@val external error2: ('a, 'b) => unit = "console.error" +@val external error3: ('a, 'b, 'c) => unit = "console.error" +@val external error4: ('a, 'b, 'c, 'd) => unit = "console.error" +@val external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" +@val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" +@val @variadic external errorMany: array<_> => unit = "console.error" @val external info: 'a => unit = "console.info" @val external info2: ('a, 'b) => unit = "console.info" @@ -38,6 +38,19 @@ @val external info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.info" @val @variadic external infoMany: array<_> => unit = "console.info" +@val external log: 'a => unit = "console.log" +@val external log2: ('a, 'b) => unit = "console.log" +@val external log3: ('a, 'b, 'c) => unit = "console.log" +@val external log4: ('a, 'b, 'c, 'd) => unit = "console.log" +@val external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" +@val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" +@val @variadic external logMany: array<_> => unit = "console.log" + +@val external time: string => unit = "console.time" +@val external timeEnd: string => unit = "console.timeEnd" + +@val external trace: unit => unit = "console.trace" + @val external warn: 'a => unit = "console.warn" @val external warn2: ('a, 'b) => unit = "console.warn" @val external warn3: ('a, 'b, 'c) => unit = "console.warn" @@ -45,16 +58,3 @@ @val external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" @val external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" @val @variadic external warnMany: array<_> => unit = "console.warn" - -@val external error: 'a => unit = "console.error" -@val external error2: ('a, 'b) => unit = "console.error" -@val external error3: ('a, 'b, 'c) => unit = "console.error" -@val external error4: ('a, 'b, 'c, 'd) => unit = "console.error" -@val external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" -@val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" -@val @variadic external errorMany: array<_> => unit = "console.error" - -@val external trace: unit => unit = "console.trace" - -@val external time: string => unit = "console.time" -@val external timeEnd: string => unit = "console.timeEnd" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 7a9ed546..73636192 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -257,99 +257,98 @@ on MDN. external dirxml: 'a => unit = "console.dirxml" /** -`log(value)` print a message to console. -See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) +`error(value)` prints an error message to console. +See [`Console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) on MDN. ## Examples ```rescript -Console.log("Hello") -let obj = {"name": "ReScript", "version": 10} -Console.log(obj) +Console.error("error message") +Console.error(("error", "invalid value")) ``` */ @val -external log: 'a => unit = "console.log" +external error: 'a => unit = "console.error" /** -`log2(v1, v2)`. Like `log`, but with two arguments. +`error(v1, v2)`. Like `error`, but two arguments. ## Examples ```rescript -Console.log2("Hello", "World") -Console.log2([1, 2, 3], '4') +Console.error2("Error", "here") +Console.error2(("log", "error"), "message") ``` */ @val -external log2: ('a, 'b) => unit = "console.log" +external error2: ('a, 'b) => unit = "console.error" /** -`log3(v1, v2, v3)`. Like `log`, but with three arguments. +`error3(v1, v2, v3)`. Like `error`, but three arguments. ## Examples ```rescript -Console.log3("Hello", "World", "ReScript") -Console.log3("One", 2, #3) +Console.error3("Hello", "World", "!!!") +Console.error3(#first, #second, #third) ``` */ @val -external log3: ('a, 'b, 'c) => unit = "console.log" +external error3: ('a, 'b, 'c) => unit = "console.error" /** -`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments. +`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments. ## Examples ```rescript -Console.log4("Hello", "World", "ReScript", "!!!") -Console.log4([1, 2], (3, 4), [#5, #6], #"polyvar") +Console.error4("Hello", "World", "ReScript", '!') +Console.error4(#first, #second, #third, ("fourth")) ``` */ @val -external log4: ('a, 'b, 'c, 'd) => unit = "console.log" +external error4: ('a, 'b, 'c, 'd) => unit = "console.error" /** -`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments. +`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments. ## Examples ```rescript -Console.log5("Hello", "World", "JS", '!', '!') -Console.log5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) +Console.error5('e', 'r, 'r', 'o', 'r') +Console.error5(1, #second, #third, ("fourth"), 'c') ``` */ @val -external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" +external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" /** -`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments. +`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments. ## Examples ```rescript -Console.log6("Hello", "World", "JS", '!', '!', '?') -Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +Console.error6("Hello", "World", "from", "JS", "!!!", '!') +Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) ``` */ @val -external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" +external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" /** -`logMany(arr)`. Like `log`, but variadic. +`errorMany(arr)`. Like `error`, but variadic. ## Examples ```rescript -Console.logMany(["Hello", "World"]) -Console.logMany([1, 2, 3]) +Console.errorMany(["Hello", "World"]) +Console.errorMany([1, 2, 3]) ``` */ @val @variadic -external logMany: array<_> => unit = "console.log" +external errorMany: array<_> => unit = "console.error" /** `info(value)` print an informational message to console. @@ -446,247 +445,248 @@ Console.infoMany([1, 2, 3]) external infoMany: array<_> => unit = "console.info" /** -`warn(value)` print a warning message to console. -See [`Console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) +`log(value)` print a message to console. +See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) on MDN. ## Examples ```rescript -Console.warn("Warning") -Console.warn(("Warning", "invalid number")) +Console.log("Hello") +let obj = {"name": "ReScript", "version": 10} +Console.log(obj) ``` */ @val -external warn: 'a => unit = "console.warn" +external log: 'a => unit = "console.log" /** -`warn2(v1, v2)`. Like `warn`, but two arguments. +`log2(v1, v2)`. Like `log`, but with two arguments. ## Examples ```rescript -Console.warn2("Hello", "World") -Console.warn2([1, 2, 3], 4) +Console.log2("Hello", "World") +Console.log2([1, 2, 3], '4') ``` */ @val -external warn2: ('a, 'b) => unit = "console.warn" +external log2: ('a, 'b) => unit = "console.log" /** -`warn3(v1, v2, v3)`. Like `warn`, but three arguments. +`log3(v1, v2, v3)`. Like `log`, but with three arguments. ## Examples ```rescript -Console.warn3("Hello", "World", "ReScript") -Console.warn3([1, 2, 3], #4, #5) +Console.log3("Hello", "World", "ReScript") +Console.log3("One", 2, #3) ``` */ @val -external warn3: ('a, 'b, 'c) => unit = "console.warn" +external log3: ('a, 'b, 'c) => unit = "console.log" /** -`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments. +`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments. ## Examples ```rescript -Console.warn4("Hello", "World", "ReScript", "!!!") -Console.warn4(#first, #second, #third, ("fourth")) +Console.log4("Hello", "World", "ReScript", "!!!") +Console.log4([1, 2], (3, 4), [#5, #6], #"polyvar") ``` */ @val -external warn4: ('a, 'b, 'c, 'd) => unit = "console.warn" +external log4: ('a, 'b, 'c, 'd) => unit = "console.log" /** -`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments. +`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments. ## Examples ```rescript -Console.warn5("Hello", "World", "from", "JS", "!!!") -Console.warn5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) +Console.log5("Hello", "World", "JS", '!', '!') +Console.log5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) ``` */ @val -external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" +external log5: ('a, 'b, 'c, 'd, 'e) => unit = "console.log" /** -`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments. +`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments. ## Examples ```rescript -Console.warn6("Hello", "World", "from", "JS", "!!!", '!') -Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +Console.log6("Hello", "World", "JS", '!', '!', '?') +Console.log6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) ``` */ @val -external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" +external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" /** -`warnMany(arr)`. Like `warn`, but variadic. +`logMany(arr)`. Like `log`, but variadic. ## Examples ```rescript -Console.warnMany(["Hello", "World"]) -Console.warnMany([1, 2, 3]) +Console.logMany(["Hello", "World"]) +Console.logMany([1, 2, 3]) ``` */ @val @variadic -external warnMany: array<_> => unit = "console.warn" +external logMany: array<_> => unit = "console.log" /** -`error(value)` prints an error message to console. -See [`Console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) +`time(label)` creates a timer to measure how long an operation takes. `label` +must be a unique name. Call `Console.timeEnd` with the same `label` to print +output time. +See [`Console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time) on MDN. ## Examples ```rescript -Console.error("error message") -Console.error(("error", "invalid value")) +Console.time("for_time") +for x in 3 downto 1 { + Console.log(x) +} +Console.timeEnd("for_time") ``` */ @val -external error: 'a => unit = "console.error" +external time: string => unit = "console.time" /** -`error(v1, v2)`. Like `error`, but two arguments. +`timeEnd(label)` stops a timer created by `time`. +See [`Console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd) +on MDN. ## Examples ```rescript -Console.error2("Error", "here") -Console.error2(("log", "error"), "message") +Console.time("for_time") +for x in 3 downto 1 { + Console.log(x) +} +Console.timeEnd("for_time") ``` */ @val -external error2: ('a, 'b) => unit = "console.error" +external timeEnd: string => unit = "console.timeEnd" /** -`error3(v1, v2, v3)`. Like `error`, but three arguments. +`trace()` print a stack trace to console. +See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) +on MDN. ## Examples ```rescript -Console.error3("Hello", "World", "!!!") -Console.error3(#first, #second, #third) +let main = () => { + Console.trace() +} +main() +// In the console, the following trace will be displayed: +// main +// ``` */ @val -external error3: ('a, 'b, 'c) => unit = "console.error" +external trace: unit => unit = "console.trace" /** -`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments. +`warn(value)` print a warning message to console. +See [`Console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) +on MDN. ## Examples ```rescript -Console.error4("Hello", "World", "ReScript", '!') -Console.error4(#first, #second, #third, ("fourth")) +Console.warn("Warning") +Console.warn(("Warning", "invalid number")) ``` */ @val -external error4: ('a, 'b, 'c, 'd) => unit = "console.error" +external warn: 'a => unit = "console.warn" /** -`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments. +`warn2(v1, v2)`. Like `warn`, but two arguments. ## Examples ```rescript -Console.error5('e', 'r, 'r', 'o', 'r') -Console.error5(1, #second, #third, ("fourth"), 'c') +Console.warn2("Hello", "World") +Console.warn2([1, 2, 3], 4) ``` */ @val -external error5: ('a, 'b, 'c, 'd, 'e) => unit = "console.error" +external warn2: ('a, 'b) => unit = "console.warn" /** -`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments. +`warn3(v1, v2, v3)`. Like `warn`, but three arguments. ## Examples ```rescript -Console.error6("Hello", "World", "from", "JS", "!!!", '!') -Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) +Console.warn3("Hello", "World", "ReScript") +Console.warn3([1, 2, 3], #4, #5) ``` */ @val -external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" +external warn3: ('a, 'b, 'c) => unit = "console.warn" /** -`errorMany(arr)`. Like `error`, but variadic. +`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments. ## Examples ```rescript -Console.errorMany(["Hello", "World"]) -Console.errorMany([1, 2, 3]) +Console.warn4("Hello", "World", "ReScript", "!!!") +Console.warn4(#first, #second, #third, ("fourth")) ``` */ @val -@variadic -external errorMany: array<_> => unit = "console.error" +external warn4: ('a, 'b, 'c, 'd) => unit = "console.warn" /** -`trace()` print a stack trace to console. -See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) -on MDN. +`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments. ## Examples ```rescript -let main = () => { - Console.trace() -} -main() -// In the console, the following trace will be displayed: -// main -// +Console.warn5("Hello", "World", "from", "JS", "!!!") +Console.warn5([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}) ``` */ @val -external trace: unit => unit = "console.trace" +external warn5: ('a, 'b, 'c, 'd, 'e) => unit = "console.warn" /** -`time(label)` creates a timer to measure how long an operation takes. `label` -must be a unique name. Call `Console.timeEnd` with the same `label` to print -output time. -See [`Console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time) -on MDN. +`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments. ## Examples ```rescript -Console.time("for_time") -for x in 3 downto 1 { - Console.log(x) -} -Console.timeEnd("for_time") +Console.warn6("Hello", "World", "from", "JS", "!!!", '!') +Console.warn6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) ``` */ @val -external time: string => unit = "console.time" +external warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.warn" /** -`timeEnd(label)` stops a timer created by `time`. -See [`Console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd) -on MDN. +`warnMany(arr)`. Like `warn`, but variadic. ## Examples ```rescript -Console.time("for_time") -for x in 3 downto 1 { - Console.log(x) -} -Console.timeEnd("for_time") +Console.warnMany(["Hello", "World"]) +Console.warnMany([1, 2, 3]) ``` */ @val -external timeEnd: string => unit = "console.timeEnd" +@variadic +external warnMany: array<_> => unit = "console.warn" From 7f22b90665c6fb82803097a31d4de430729f9b99 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:31:48 +0100 Subject: [PATCH 13/17] feat(console): add group/groupCollapsed/groupEnd --- src/Core__Console.res | 4 ++++ src/Core__Console.resi | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index a7be6ebb..c3efcb2e 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -30,6 +30,10 @@ @val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" @val @variadic external errorMany: array<_> => unit = "console.error" +@val external group: string => unit = "console.group" +@val external groupCollapsed: string => unit = "console.groupCollapsed" +@val external groupEnd: unit => unit = "console.groupEnd" + @val external info: 'a => unit = "console.info" @val external info2: ('a, 'b) => unit = "console.info" @val external info3: ('a, 'b, 'c) => unit = "console.info" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index 73636192..da6080ed 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -336,6 +336,44 @@ Console.error6([1, 2], (3, 4), [#5, #6], #"polyvar", {"name": "ReScript"}, 42) @val external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" +/** +`group(label)` creates a new "group" level with the given label. + +See [`Console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group) +on MDN. + +## Example + +```rescript +Console.group("first group") +Console.group("second group") +Console.log("a message on the second level") +Console.groupEnd() +Console.log("a message message on the first level") +Console.groupEnd() +``` +*/ +@val +external group: string => unit = "console.group" + +/** +`groupCollapsed(label)`. Like `group` but collapses the group initially. + +See [`Console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed) +on MDN. +*/ +@val +external groupCollapsed: string => unit = "console.groupCollapsed" + +/** +`groupEnd()` ends the current group. + +See [`Console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd) +on MDN. +*/ +@val +external groupEnd: unit => unit = "console.groupEnd" + /** `errorMany(arr)`. Like `error`, but variadic. From e49dc65fa7f01adda23c4594f6884126e909e463 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:35:14 +0100 Subject: [PATCH 14/17] feat(console): add table --- src/Core__Console.res | 2 ++ src/Core__Console.resi | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index c3efcb2e..d7a257c2 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -50,6 +50,8 @@ @val external log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.log" @val @variadic external logMany: array<_> => unit = "console.log" +@val external table: 'a => unit = "console.table" + @val external time: string => unit = "console.time" @val external timeEnd: string => unit = "console.timeEnd" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index da6080ed..c1dc90f9 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -577,6 +577,20 @@ Console.logMany([1, 2, 3]) @variadic external logMany: array<_> => unit = "console.log" +/** +`table(object)` displays an tabular view of the object in the console. +See [`Console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table) +on MDN. + +## Examples + +```rescript +Console.table({"language": "rescript", "version": 10.1.2}) +``` +*/ +@val +external table: 'a => unit = "console.table" + /** `time(label)` creates a timer to measure how long an operation takes. `label` must be a unique name. Call `Console.timeEnd` with the same `label` to print From 2f276a63266ed0fc55cb4285b4750a2ccc23b248 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:40:21 +0100 Subject: [PATCH 15/17] feat(console): add timeLog --- src/Core__Console.res | 1 + src/Core__Console.resi | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Core__Console.res b/src/Core__Console.res index d7a257c2..2c85d024 100644 --- a/src/Core__Console.res +++ b/src/Core__Console.res @@ -54,6 +54,7 @@ @val external time: string => unit = "console.time" @val external timeEnd: string => unit = "console.timeEnd" +@val external timeLog: string => unit = "console.timeLog" @val external trace: unit => unit = "console.trace" diff --git a/src/Core__Console.resi b/src/Core__Console.resi index c1dc90f9..fd44ae71 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -604,6 +604,7 @@ on MDN. Console.time("for_time") for x in 3 downto 1 { Console.log(x) + Console.timeLog("for_time") } Console.timeEnd("for_time") ``` @@ -622,6 +623,7 @@ on MDN. Console.time("for_time") for x in 3 downto 1 { Console.log(x) + Console.timeLog("for_time") } Console.timeEnd("for_time") ``` @@ -629,6 +631,25 @@ Console.timeEnd("for_time") @val external timeEnd: string => unit = "console.timeEnd" +/** +`timeLog(label)` prints the current elapsed time of the given timer to the console. +See [`Console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog) +on MDN. + +## Examples + +```rescript +Console.time("for_time") +for x in 3 downto 1 { + Console.log(x) + Console.timeLog("for_time") +} +Console.timeEnd("for_time") +``` +*/ +@val +external timeLog: string => unit = "console.timeLog" + /** `trace()` print a stack trace to console. See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) From c27bd89596cfd76f9ea9a8dba411b2cefa591e07 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:41:43 +0100 Subject: [PATCH 16/17] docs(console): use lower-case for the console object name --- src/Core__Console.resi | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Core__Console.resi b/src/Core__Console.resi index fd44ae71..a79907bd 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -1,11 +1,11 @@ /*** Functions for interacting with JavaScript console. -See: [`Console`](https://developer.mozilla.org/en-US/docs/Web/API/Console). +See: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console). */ /** `assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`. -See [`Console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) +See [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) on MDN. ## Examples @@ -99,7 +99,7 @@ external assertMany: (bool, array<_>) => unit = "console.assert" /** `clear()` clears the console, if allowed. -See [`Console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear) +See [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear) on MDN. ## Examples @@ -113,7 +113,7 @@ external clear: unit => unit = "console.clear" /** `count(label)` prints to the console the number of times it's been called with the given label. -See [`Console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count) +See [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count) on MDN. ## Examples @@ -127,7 +127,7 @@ external count: string => unit = "console.count" /** `countReset(label)` resets the count for the given label to 0. -See [`Console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset) +See [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset) on MDN. ## Examples @@ -141,7 +141,7 @@ external countReset: string => unit = "console.countReset" /** `debug(value)` print a debug message to console. -See [`Console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug) +See [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug) on MDN. ## Examples @@ -236,7 +236,7 @@ external debugMany: array<_> => unit = "console.debug" /** `dir(object)` displays an interactive view of the object in the console. -See [`Console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir) +See [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir) on MDN. ## Examples @@ -250,7 +250,7 @@ external dir: 'a => unit = "console.dir" /** `dirxml(object)` displays an interactive tree view of an XML/HTML element in the console. -See [`Console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml) +See [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml) on MDN. */ @val @@ -258,7 +258,7 @@ external dirxml: 'a => unit = "console.dirxml" /** `error(value)` prints an error message to console. -See [`Console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) +See [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) on MDN. ## Examples @@ -339,7 +339,7 @@ external error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.error" /** `group(label)` creates a new "group" level with the given label. -See [`Console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group) +See [`console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group) on MDN. ## Example @@ -359,7 +359,7 @@ external group: string => unit = "console.group" /** `groupCollapsed(label)`. Like `group` but collapses the group initially. -See [`Console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed) +See [`console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed) on MDN. */ @val @@ -368,7 +368,7 @@ external groupCollapsed: string => unit = "console.groupCollapsed" /** `groupEnd()` ends the current group. -See [`Console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd) +See [`console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd) on MDN. */ @val @@ -390,7 +390,7 @@ external errorMany: array<_> => unit = "console.error" /** `info(value)` print an informational message to console. -See [`Console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info) +See [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info) on MDN. ## Examples @@ -484,7 +484,7 @@ external infoMany: array<_> => unit = "console.info" /** `log(value)` print a message to console. -See [`Console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) +See [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) on MDN. ## Examples @@ -579,7 +579,7 @@ external logMany: array<_> => unit = "console.log" /** `table(object)` displays an tabular view of the object in the console. -See [`Console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table) +See [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table) on MDN. ## Examples @@ -593,9 +593,9 @@ external table: 'a => unit = "console.table" /** `time(label)` creates a timer to measure how long an operation takes. `label` -must be a unique name. Call `Console.timeEnd` with the same `label` to print +must be a unique name. Call `console.timeEnd` with the same `label` to print output time. -See [`Console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time) +See [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time) on MDN. ## Examples @@ -614,7 +614,7 @@ external time: string => unit = "console.time" /** `timeEnd(label)` stops a timer created by `time`. -See [`Console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd) +See [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd) on MDN. ## Examples @@ -633,7 +633,7 @@ external timeEnd: string => unit = "console.timeEnd" /** `timeLog(label)` prints the current elapsed time of the given timer to the console. -See [`Console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog) +See [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog) on MDN. ## Examples @@ -652,7 +652,7 @@ external timeLog: string => unit = "console.timeLog" /** `trace()` print a stack trace to console. -See [`Console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) +See [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) on MDN. ## Examples @@ -672,7 +672,7 @@ external trace: unit => unit = "console.trace" /** `warn(value)` print a warning message to console. -See [`Console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) +See [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) on MDN. ## Examples From 0af4c54b20ea8bccda1ac77ff7da0cb2e96f67f2 Mon Sep 17 00:00:00 2001 From: glennsl Date: Sun, 19 Feb 2023 13:43:44 +0100 Subject: [PATCH 17/17] docs(console): add blank line between paragraphs for readability. --- src/Core__Console.resi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Core__Console.resi b/src/Core__Console.resi index a79907bd..41c7b9fc 100644 --- a/src/Core__Console.resi +++ b/src/Core__Console.resi @@ -1,10 +1,12 @@ /*** Functions for interacting with JavaScript console. + See: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console). */ /** `assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`. + See [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert) on MDN. @@ -99,6 +101,7 @@ external assertMany: (bool, array<_>) => unit = "console.assert" /** `clear()` clears the console, if allowed. + See [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear) on MDN. @@ -113,6 +116,7 @@ external clear: unit => unit = "console.clear" /** `count(label)` prints to the console the number of times it's been called with the given label. + See [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count) on MDN. @@ -127,6 +131,7 @@ external count: string => unit = "console.count" /** `countReset(label)` resets the count for the given label to 0. + See [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset) on MDN. @@ -141,6 +146,7 @@ external countReset: string => unit = "console.countReset" /** `debug(value)` print a debug message to console. + See [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug) on MDN. @@ -236,6 +242,7 @@ external debugMany: array<_> => unit = "console.debug" /** `dir(object)` displays an interactive view of the object in the console. + See [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir) on MDN. @@ -250,6 +257,7 @@ external dir: 'a => unit = "console.dir" /** `dirxml(object)` displays an interactive tree view of an XML/HTML element in the console. + See [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml) on MDN. */ @@ -258,6 +266,7 @@ external dirxml: 'a => unit = "console.dirxml" /** `error(value)` prints an error message to console. + See [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error) on MDN. @@ -390,6 +399,7 @@ external errorMany: array<_> => unit = "console.error" /** `info(value)` print an informational message to console. + See [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info) on MDN. @@ -484,6 +494,7 @@ external infoMany: array<_> => unit = "console.info" /** `log(value)` print a message to console. + See [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log) on MDN. @@ -579,6 +590,7 @@ external logMany: array<_> => unit = "console.log" /** `table(object)` displays an tabular view of the object in the console. + See [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table) on MDN. @@ -595,6 +607,7 @@ external table: 'a => unit = "console.table" `time(label)` creates a timer to measure how long an operation takes. `label` must be a unique name. Call `console.timeEnd` with the same `label` to print output time. + See [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time) on MDN. @@ -614,6 +627,7 @@ external time: string => unit = "console.time" /** `timeEnd(label)` stops a timer created by `time`. + See [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd) on MDN. @@ -633,6 +647,7 @@ external timeEnd: string => unit = "console.timeEnd" /** `timeLog(label)` prints the current elapsed time of the given timer to the console. + See [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog) on MDN. @@ -652,6 +667,7 @@ external timeLog: string => unit = "console.timeLog" /** `trace()` print a stack trace to console. + See [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace) on MDN. @@ -672,6 +688,7 @@ external trace: unit => unit = "console.trace" /** `warn(value)` print a warning message to console. + See [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn) on MDN.