From f98ae0dc9601e1cbb15979fc053f5176d85e17f0 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Fri, 14 Jun 2024 14:19:01 -0300 Subject: [PATCH] update docs API Core: 1.5.0 Compiler: 11.0_release branch --- data/api/latest/core.json | 59 ++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/data/api/latest/core.json b/data/api/latest/core.json index 37bb7d056..e4621e6f6 100644 --- a/data/api/latest/core.json +++ b/data/api/latest/core.json @@ -254,7 +254,7 @@ "docstrings": [ "Type representing the result of a `RegExp` execution." ], - "signature": "type t = array" + "signature": "type t = array>" }, { "id": "Core.Re.Result.fullMatch", @@ -1233,7 +1233,7 @@ "kind": "type", "name": "formatMatcher", "docstrings": [], - "signature": "type formatMatcher = [#basic | #bestFit]" + "signature": "type formatMatcher = [#basic | #\"best fit\"]" }, { "id": "Core.Intl.DateTimeFormat.fractionalSecondDigits", @@ -1436,7 +1436,7 @@ "kind": "type", "name": "localeMatcher", "docstrings": [], - "signature": "type localeMatcher = [#bestFit | #lookup]" + "signature": "type localeMatcher = [#\"best fit\" | #lookup]" }, { "id": "Core.Intl.Common.calendar", @@ -1862,7 +1862,7 @@ "docstrings": [ "Type representing the result of a `RegExp` execution." ], - "signature": "type t = array" + "signature": "type t = array>" }, { "id": "Core.RegExp.Result.fullMatch", @@ -1993,10 +1993,19 @@ "kind": "value", "name": "floor", "docstrings": [ - "floor(v) returns the largest `int` less than or equal to the argument; \n the result is pinned to the range of the `int` data type: -2147483648 to 2147483647. \n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.floor(3.7) == 3\n Math.Int.floor(3.0) == 3\n Math.Int.floor(-3.1) == -4\n Math.Int.floor(-1.0e15) == -2147483648\n Math.Int.floor(1.0e15) == 2147483647\n ```" + "floor(v) returns the largest `int` less than or equal to the argument; \n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.floor(3.7) == 3\n Math.Int.floor(3.0) == 3\n Math.Int.floor(-3.1) == -4\n ```" ], "signature": "let floor: float => int" }, + { + "id": "Core.Math.Int.ceil", + "kind": "value", + "name": "ceil", + "docstrings": [ + "ceil(v) returns the smallest `int` greater than or equal to the argument;\n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.ceil(3.7) == 4\n Math.Int.ceil(3.0) == 3\n Math.Int.ceil(-3.1) == -3\n ```" + ], + "signature": "let ceil: float => int" + }, { "id": "Core.Math.Int.random", "kind": "value", @@ -3176,6 +3185,15 @@ ], "signature": "let lastIndex: t => int" }, + { + "id": "Core.Re.setLastIndex", + "kind": "value", + "name": "setLastIndex", + "docstrings": [ + "`setLastIndex(regexp, index)` set the index the next match will start from.\n\nSee [`RegExp.lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\nlet someStr = \"Many words here.\"\n\nregexp->RegExp.setLastIndex(4)\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `10` to the console\n```" + ], + "signature": "let setLastIndex: (t, int) => unit" + }, { "id": "Core.Re.ignoreCase", "kind": "value", @@ -5401,6 +5419,15 @@ ], "signature": "let get: (string, int) => option" }, + { + "id": "Core.String.getUnsafe", + "kind": "value", + "name": "getUnsafe", + "docstrings": [ + "`getUnsafe(str, index)` returns an `string` at the given `index` number.\n\nThis is _unsafe_, meaning it will return `undefined` value if `index` does not exist in `string`.\n\nUse `String.getUnsafe` only when you are sure the `index` exists.\n## Examples\n\n```rescript\nString.getUnsafe(\"ReScript\", 0) == \"R\"\nString.getUnsafe(\"Hello\", 4) == \"o\"\n```" + ], + "signature": "let getUnsafe: (string, int) => string" + }, { "id": "Core.String.charAt", "kind": "value", @@ -5541,7 +5568,7 @@ "kind": "value", "name": "match", "docstrings": [ - "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\nthere is a match, the return value is `Some(array)` where the array contains:\n- The entire matched string\n- Any capture groups if the regexp had parentheses\nFor regular expressions with the g modifier, a matched expression returns\n`Some(array)` with all the matched substrings and no capture groups.\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) on MDN.\n\n## Examples\n\n```rescript\nString.match(\"The better bats\", %re(\"/b[aeiou]t/\")) == Some([\"bet\"])\nString.match(\"The better bats\", %re(\"/b[aeiou]t/g\")) == Some([\"bet\", \"bat\"])\nString.match(\"Today is 2018-04-05.\", %re(\"/(\\d+)-(\\d+)-(\\d+)/\")) ==\n Some([\"2018-04-05\", \"2018\", \"04\", \"05\"])\nString.match(\"The large container.\", %re(\"/b[aeiou]g/\")) == None\n```" + "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\nthere is a match, the return value is `Some(array)` where the array contains:\n- The entire matched string\n- Any capture groups if the regexp had parentheses\nFor regular expressions with the g modifier, a matched expression returns\n`Some(array)` with all the matched substrings and no capture groups.\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) on MDN.\n\n## Examples\n\n```rescript\nString.match(\"The better bats\", %re(\"/b[aeiou]t/\")) == Some([Some(\"bet\")])\nString.match(\"The better bats\", %re(\"/b[aeiou]t/g\")) == Some([Some(\"bet\"), Some(\"bat\")])\nString.match(\"Today is 2018-04-05.\", %re(\"/(\\d+)-(\\d+)-(\\d+)/\")) ==\n Some([Some(\"2018-04-05\"), Some(\"2018\"), Some(\"04\"), Some(\"05\")])\nString.match(\"The optional example\", %re(\"/(foo)?(example)/\")) == Some([Some(\"example\"), None, Some(\"example\")])\nString.match(\"The large container.\", %re(\"/b[aeiou]g/\")) == None\n```" ], "signature": "let match: (string, Core__RegExp.t) => option" }, @@ -5933,6 +5960,15 @@ ], "signature": "let lastIndex: t => int" }, + { + "id": "Core.RegExp.setLastIndex", + "kind": "value", + "name": "setLastIndex", + "docstrings": [ + "`setLastIndex(regexp, index)` set the index the next match will start from.\n\nSee [`RegExp.lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\nlet someStr = \"Many words here.\"\n\nregexp->RegExp.setLastIndex(4)\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `10` to the console\n```" + ], + "signature": "let setLastIndex: (t, int) => unit" + }, { "id": "Core.RegExp.ignoreCase", "kind": "value", @@ -6523,6 +6559,15 @@ ], "signature": "let undefined: t<'a>" }, + { + "id": "Core.Nullable.isNullable", + "kind": "value", + "name": "isNullable", + "docstrings": [ + "`isNullable(a)` returns `true` if `a` is null or undefined, `false` otherwise.\n\n## Examples\n\n```rescript\nlet myStr = \"Hello\"\nlet asNullable = myStr->Nullable.make\n\n// Can't do the below because we're now forced to check for nullability\n// myStr == asNullable\n\n// Check if asNullable is not null or undefined\nswitch asNullable->Nullable.isNullable {\n| true => assert(false)\n| false => assert(true)\n}\n```" + ], + "signature": "let isNullable: t<'a> => bool" + }, { "id": "Core.Nullable.make", "kind": "value", @@ -9782,7 +9827,7 @@ "kind": "value", "name": "every", "docstrings": [ - "`every(array, predicate)` returns true if `predicate` returns true for all items in `array`.\n\nSee [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.\n\n## Examples\n```rescript\nlet array = [1, 2, 3, 4]\n\nConsole.log(array->Array.every(num => num > 4)) // true\nConsole.log(array->Array.every(num => num === 1)) // false\n```" + "`every(array, predicate)` returns true if `predicate` returns true for all items in `array`.\n\nSee [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.\n\n## Examples\n```rescript\nlet array = [1, 2, 3, 4]\n\nConsole.log(array->Array.every(num => num <= 4)) // true\nConsole.log(array->Array.every(num => num === 1)) // false\n```" ], "signature": "let every: (array<'a>, 'a => bool) => bool" },