Skip to content

Update docs API #887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2024
Merged
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
59 changes: 52 additions & 7 deletions data/api/latest/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"docstrings": [
"Type representing the result of a `RegExp` execution."
],
"signature": "type t = array<string>"
"signature": "type t = array<option<string>>"
},
{
"id": "Core.Re.Result.fullMatch",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1862,7 +1862,7 @@
"docstrings": [
"Type representing the result of a `RegExp` execution."
],
"signature": "type t = array<string>"
"signature": "type t = array<option<string>>"
},
{
"id": "Core.RegExp.Result.fullMatch",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -5401,6 +5419,15 @@
],
"signature": "let get: (string, int) => option<string>"
},
{
"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",
Expand Down Expand Up @@ -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<Core__RegExp.Result.t>"
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down