diff --git a/data/api/v12.0.0/belt.json b/data/api/v12.0.0/belt.json index 86bc0c43e..1ddfea26c 100644 --- a/data/api/v12.0.0/belt.json +++ b/data/api/v12.0.0/belt.json @@ -3,7 +3,7 @@ "id": "Belt", "name": "Belt", "docstrings": [ - "The ReScript standard library.\n\nBelt is currently mostly covering collection types. It has no string or date functions yet, although Belt.String is in the works. In the meantime, use [Js.String](js/string) for string functions and [Js.Date](js/date) for date functions.\n\n## Motivation\n\nBelt provides:\n\n- The **highest quality** immutable data structures in JavaScript.\n- Safety by default: A Belt function will never throw exceptions, unless it is\n indicated explicitly in the function name (suffix \"Exn\").\n- Better performance and smaller code size running on the JS platform.\n- Ready for [Tree Shaking](https://webpack.js.org/guides/tree-shaking/).\n\n## Usage\n\nTo use modules from Belt, either refer to them by their fully qualified name (`Belt.List`, `Belt.Array` etc.) or open the `Belt` module by putting\n\n## Examples\n\n```rescript\nopen Belt\n```\n\nat the top of your source files. After opening Belt this way, `Array` will refer to `Belt.Array`, `List` will refer to `Belt.List` etc. in the subsequent code.\n\nIf you want to open Belt globally for all files in your project instead, you can put\n\n```json\n{\n \"bsc-flags\": [\"-open Belt\"]\n}\n```\n\ninto your `bsconfig.json`.\n\n**Note**: this is the **only** `open` we encourage.\n\nExample usage:\n\n## Examples\n\n```rescript\nlet someNumbers = [1, 1, 4, 2, 3, 6, 3, 4, 2]\n\nlet greaterThan2UniqueAndSorted =\n someNumbers\n ->Belt.Array.keep(x => x > 2)\n // convert to and from set to make values unique\n ->Belt.Set.Int.fromArray\n ->Belt.Set.Int.toArray // output is already sorted\n\nJs.log2(\"result\", greaterThan2UniqueAndSorted)\n```\n\n## Curried vs. Uncurried Callbacks\n\nFor functions taking a callback parameter, there are usually two versions\navailable:\n\n- curried (no suffix)\n- uncurried (suffixed with `U`)\n\nE.g.:\n\n## Examples\n\n```rescript\nlet forEach: (t<'a>, 'a => unit) => unit\n\nlet forEachU: (t<'a>, (. 'a) => unit) => unit\n```\n\nThe uncurried version will be faster in some cases, but for simplicity we recommend to stick with the curried version unless you need the extra performance.\n\nThe two versions can be invoked as follows:\n\n## Examples\n\n```rescript\n[\"a\", \"b\", \"c\"]->Belt.Array.forEach(x => Js.log(x))\n\n[\"a\", \"b\", \"c\"]->Belt.Array.forEachU((. x) => Js.log(x))\n```\n\n## Specialized Collections\n\nFor collections types like set or map, Belt provides both a generic module as well as specialized, more efficient implementations for string and int keys.\n\nFor example, Belt has the following set modules:\n\n- [Belt.Set](belt/set)\n- [Belt.Set.Int](belt/set/int)\n- [Belt.Set.String](belt/set/string)\n\n## Implementation Details\n\n### Array access runtime safety\n\nOne common confusion comes from the way Belt handles array access. It differs from than the default standard library's.\n\n## Examples\n\n```rescript\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == \"a\"\nlet capitalA = Js.String.toUpperCase(a)\nlet k = letters[10] // Raises an exception! The 10th index doesn't exist.\n```\n\nBecause Belt avoids exceptions and returns `options` instead, this code behaves differently:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == Some(\"a\")\nlet captialA = Js.String.toUpperCase(a) // Type error! This code will not compile.\nlet k = letters[10] // k == None\n```\n\nAlthough we've fixed the problem where `k` raises an exception, we now have a type error when trying to capitalize `a`. There are a few things going on here:\n\n- Reason transforms array index access to the function `Array.get`. So `letters[0]` is the same as `Array.get(letters, 0)`.\n- The compiler uses whichever `Array` module is in scope. If you `open Belt`, then it uses `Belt.Array`.\n- `Belt.Array.get` returns values wrapped in options, so `letters[0] == Some(\"a\")`.\n\nFortunately, this is easy to fix:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0]\n\n// Use a switch statement:\nlet capitalA =\n switch a {\n | Some(a) => Some(Js.String.toUpperCase(a))\n | None => None\n }\n\nlet k = letters[10] // k == None\n```\n\nWith that little bit of tweaking, our code now compiles successfully and is 100% free of runtime errors!\n\n### A Special Encoding for Collection Safety\n\nWhen we create a collection library for a custom data type we need a way to provide a comparator function. Take Set for example, suppose its element type is a pair of ints, it needs a custom compare function that takes two tuples and returns their order. The Set could not just be typed as Set.t (int \\* int) , its customized compare function needs to manifest itself in the signature, otherwise, if the user creates another customized compare function, the two collection could mix which would result in runtime error.\n\nWe use a phantom type to solve the problem:\n\n## Examples\n\n```rescript\nmodule Comparable1 =\n Belt.Id.MakeComparable(\n {\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n }\n )\n\nlet mySet1 = Belt.Set.make(~id=module(Comparable1))\n\nmodule Comparable2 =\n Belt.Id.MakeComparable(\n {\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n }\n )\n\nlet mySet2 = Belt.Set.make(~id=module(Comparable2))\n```\n\nHere, the compiler would infer `mySet1` and `mySet2` having different type, so e.g. a `merge` operation that tries to merge these two sets will correctly fail.\n\n## Examples\n\n```rescript\nlet mySet1: t<(int, int), Comparable1.identity>\nlet mySet2: t<(int, int), Comparable2.identity>\n```\n\n`Comparable1.identity` and `Comparable2.identity` are not the same using our encoding scheme." + "The ReScript standard library.\n\nBelt is currently mostly covering collection types. It has no string or date functions yet, although Belt.String is in the works. In the meantime, use [Js.String](js/string) for string functions and [Js.Date](js/date) for date functions.\n\n## Motivation\n\nBelt provides:\n\n- The **highest quality** immutable data structures in JavaScript.\n- Safety by default: A Belt function will never throw exceptions, unless it is\n indicated explicitly in the function name (suffix \"Exn\").\n- Better performance and smaller code size running on the JS platform.\n- Ready for [Tree Shaking](https://webpack.js.org/guides/tree-shaking/).\n\n## Usage\n\nTo use modules from Belt, either refer to them by their fully qualified name (`Belt.List`, `Belt.Array` etc.) or open the `Belt` module by putting\n\n## Examples\n\n```rescript\nopen Belt\n```\n\nat the top of your source files. After opening Belt this way, `Array` will refer to `Belt.Array`, `List` will refer to `Belt.List` etc. in the subsequent code.\n\nIf you want to open Belt globally for all files in your project instead, you can put\n\n```json\n{\n \"bsc-flags\": [\"-open Belt\"]\n}\n```\n\ninto your `bsconfig.json`.\n\n**Note**: this is the **only** `open` we encourage.\n\nExample usage:\n\n## Examples\n\n```rescript\nlet someNumbers = [1, 1, 4, 2, 3, 6, 3, 4, 2]\n\nlet greaterThan2UniqueAndSorted =\n someNumbers\n ->Belt.Array.keep(x => x > 2)\n // convert to and from set to make values unique\n ->Belt.Set.Int.fromArray\n ->Belt.Set.Int.toArray // output is already sorted\n\nJs.log2(\"result\", greaterThan2UniqueAndSorted)\n```\n\n## Specialized Collections\n\nFor collections types like set or map, Belt provides both a generic module as well as specialized, more efficient implementations for string and int keys.\n\nFor example, Belt has the following set modules:\n\n- [Belt.Set](belt/set)\n- [Belt.Set.Int](belt/set/int)\n- [Belt.Set.String](belt/set/string)\n\n## Implementation Details\n\n### Array access runtime safety\n\nOne common confusion comes from the way Belt handles array access. It differs from than the default standard library's.\n\n## Examples\n\n```rescript\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == \"a\"\nlet capitalA = Js.String.toUpperCase(a)\nlet k = letters[10] // Raises an exception! The 10th index doesn't exist.\n```\n\nBecause Belt avoids exceptions and returns `options` instead, this code behaves differently:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0] // a == Some(\"a\")\nlet captialA = Js.String.toUpperCase(a) // Type error! This code will not compile.\nlet k = letters[10] // k == None\n```\n\nAlthough we've fixed the problem where `k` raises an exception, we now have a type error when trying to capitalize `a`. There are a few things going on here:\n\n- Reason transforms array index access to the function `Array.get`. So `letters[0]` is the same as `Array.get(letters, 0)`.\n- The compiler uses whichever `Array` module is in scope. If you `open Belt`, then it uses `Belt.Array`.\n- `Belt.Array.get` returns values wrapped in options, so `letters[0] == Some(\"a\")`.\n\nFortunately, this is easy to fix:\n\n## Examples\n\n```rescript\nopen Belt\nlet letters = [\"a\", \"b\", \"c\"]\nlet a = letters[0]\n\n// Use a switch statement:\nlet capitalA =\n switch a {\n | Some(a) => Some(Js.String.toUpperCase(a))\n | None => None\n }\n\nlet k = letters[10] // k == None\n```\n\nWith that little bit of tweaking, our code now compiles successfully and is 100% free of runtime errors!\n\n### A Special Encoding for Collection Safety\n\nWhen we create a collection library for a custom data type we need a way to provide a comparator function. Take Set for example, suppose its element type is a pair of ints, it needs a custom compare function that takes two tuples and returns their order. The Set could not just be typed as Set.t (int \\* int) , its customized compare function needs to manifest itself in the signature, otherwise, if the user creates another customized compare function, the two collection could mix which would result in runtime error.\n\nWe use a phantom type to solve the problem:\n\n## Examples\n\n```rescript\nmodule Comparable1 =\n Belt.Id.MakeComparable(\n {\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n }\n )\n\nlet mySet1 = Belt.Set.make(~id=module(Comparable1))\n\nmodule Comparable2 =\n Belt.Id.MakeComparable(\n {\n type t = (int, int)\n let cmp = ((a0, a1), (b0, b1)) =>\n switch Pervasives.compare(a0, b0) {\n | 0 => Pervasives.compare(a1, b1)\n | c => c\n }\n }\n )\n\nlet mySet2 = Belt.Set.make(~id=module(Comparable2))\n```\n\nHere, the compiler would infer `mySet1` and `mySet2` having different type, so e.g. a `merge` operation that tries to merge these two sets will correctly fail.\n\n## Examples\n\n```rescript\nlet mySet1: t<(int, int), Comparable1.identity>\nlet mySet2: t<(int, int), Comparable2.identity>\n```\n\n`Comparable1.identity` and `Comparable2.identity` are not the same using our encoding scheme." ], "items": [] }, @@ -91,7 +91,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit" + "signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashMap.String.forEach", @@ -105,7 +106,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c" + "signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashMap.String.reduce", @@ -119,7 +121,8 @@ "kind": "value", "name": "keepMapInPlaceU", "docstrings": [], - "signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit" + "signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit", + "deprecated": "Use `keepMapInPlace` instead" }, { "id": "Belt.HashMap.String.keepMapInPlace", @@ -270,7 +273,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit" + "signature": "let forEachU: (t<'b>, (key, 'b) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashMap.Int.forEach", @@ -284,7 +288,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c" + "signature": "let reduceU: (t<'b>, 'c, ('c, key, 'b) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashMap.Int.reduce", @@ -298,7 +303,8 @@ "kind": "value", "name": "keepMapInPlaceU", "docstrings": [], - "signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit" + "signature": "let keepMapInPlaceU: (t<'a>, (key, 'a) => option<'a>) => unit", + "deprecated": "Use `keepMapInPlace` instead" }, { "id": "Belt.HashMap.Int.keepMapInPlace", @@ -441,7 +447,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, key => unit) => unit" + "signature": "let forEachU: (t, key => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashSet.String.forEach", @@ -455,7 +462,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c" + "signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashSet.String.reduce", @@ -584,7 +592,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, key => unit) => unit" + "signature": "let forEachU: (t, key => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashSet.Int.forEach", @@ -598,7 +607,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c" + "signature": "let reduceU: (t, 'c, ('c, key) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashSet.Int.reduce", @@ -703,7 +713,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int" + "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.MutableMap.String.cmp", @@ -719,7 +730,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.MutableMap.String.eq", @@ -735,7 +747,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a>, (key, 'a) => unit) => unit" + "signature": "let forEachU: (t<'a>, (key, 'a) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableMap.String.forEach", @@ -751,7 +764,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableMap.String.reduce", @@ -767,7 +781,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'a>, (key, 'a) => bool) => bool" + "signature": "let everyU: (t<'a>, (key, 'a) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableMap.String.every", @@ -783,7 +798,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'a>, (key, 'a) => bool) => bool" + "signature": "let someU: (t<'a>, (key, 'a) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableMap.String.some", @@ -963,7 +979,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (t<'a>, key, option<'a> => option<'a>) => unit" + "signature": "let updateU: (t<'a>, key, option<'a> => option<'a>) => unit", + "deprecated": "Use `update` instead" }, { "id": "Belt.MutableMap.String.update", @@ -977,7 +994,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.MutableMap.String.map", @@ -993,7 +1011,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'a>, (key, 'a) => 'b) => t<'b>" + "signature": "let mapWithKeyU: (t<'a>, (key, 'a) => 'b) => t<'b>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.MutableMap.String.mapWithKey", @@ -1056,7 +1075,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int" + "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.MutableMap.Int.cmp", @@ -1072,7 +1092,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.MutableMap.Int.eq", @@ -1088,7 +1109,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a>, (key, 'a) => unit) => unit" + "signature": "let forEachU: (t<'a>, (key, 'a) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableMap.Int.forEach", @@ -1104,7 +1126,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'a>, 'b, ('b, key, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableMap.Int.reduce", @@ -1120,7 +1143,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'a>, (key, 'a) => bool) => bool" + "signature": "let everyU: (t<'a>, (key, 'a) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableMap.Int.every", @@ -1136,7 +1160,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'a>, (key, 'a) => bool) => bool" + "signature": "let someU: (t<'a>, (key, 'a) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableMap.Int.some", @@ -1316,7 +1341,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (t<'a>, key, option<'a> => option<'a>) => unit" + "signature": "let updateU: (t<'a>, key, option<'a> => option<'a>) => unit", + "deprecated": "Use `update` instead" }, { "id": "Belt.MutableMap.Int.update", @@ -1330,7 +1356,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.MutableMap.Int.map", @@ -1346,7 +1373,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'a>, (key, 'a) => 'b) => t<'b>" + "signature": "let mapWithKeyU: (t<'a>, (key, 'a) => 'b) => t<'b>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.MutableMap.Int.mapWithKey", @@ -1514,7 +1542,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, value => unit) => unit" + "signature": "let forEachU: (t, value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableSet.String.forEach", @@ -1530,7 +1559,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a" + "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableSet.String.reduce", @@ -1546,7 +1576,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t, value => bool) => bool" + "signature": "let everyU: (t, value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableSet.String.every", @@ -1562,7 +1593,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t, value => bool) => bool" + "signature": "let someU: (t, value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableSet.String.some", @@ -1578,7 +1610,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t, value => bool) => t" + "signature": "let keepU: (t, value => bool) => t", + "deprecated": "Use `keep` instead" }, { "id": "Belt.MutableSet.String.keep", @@ -1594,7 +1627,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t, value => bool) => (t, t)" + "signature": "let partitionU: (t, value => bool) => (t, t)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.MutableSet.String.partition", @@ -1856,7 +1890,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, value => unit) => unit" + "signature": "let forEachU: (t, value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableSet.Int.forEach", @@ -1872,7 +1907,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a" + "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableSet.Int.reduce", @@ -1888,7 +1924,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t, value => bool) => bool" + "signature": "let everyU: (t, value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableSet.Int.every", @@ -1904,7 +1941,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t, value => bool) => bool" + "signature": "let someU: (t, value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableSet.Int.some", @@ -1920,7 +1958,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t, value => bool) => t" + "signature": "let keepU: (t, value => bool) => t", + "deprecated": "Use `keep` instead" }, { "id": "Belt.MutableSet.Int.keep", @@ -1936,7 +1975,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t, value => bool) => (t, t)" + "signature": "let partitionU: (t, value => bool) => (t, t)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.MutableSet.Int.partition", @@ -2088,7 +2128,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (\n t<'k, 'v, 'id>,\n t<'k, 'v, 'id>,\n ~kcmp: cmp<'k, 'id>,\n ~vcmp: ('v, 'v) => int,\n) => int" + "signature": "let cmpU: (\n t<'k, 'v, 'id>,\n t<'k, 'v, 'id>,\n ~kcmp: cmp<'k, 'id>,\n ~vcmp: ('v, 'v) => int,\n) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Map.Dict.cmp", @@ -2102,7 +2143,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (\n t<'k, 'a, 'id>,\n t<'k, 'a, 'id>,\n ~kcmp: cmp<'k, 'id>,\n ~veq: ('a, 'a) => bool,\n) => bool" + "signature": "let eqU: (\n t<'k, 'a, 'id>,\n t<'k, 'a, 'id>,\n ~kcmp: cmp<'k, 'id>,\n ~veq: ('a, 'a) => bool,\n) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Map.Dict.eq", @@ -2118,7 +2160,8 @@ "kind": "value", "name": "findFirstByU", "docstrings": [], - "signature": "let findFirstByU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>" + "signature": "let findFirstByU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>", + "deprecated": "Use `findFirstBy` instead" }, { "id": "Belt.Map.Dict.findFirstBy", @@ -2134,7 +2177,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit" + "signature": "let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Map.Dict.forEach", @@ -2150,7 +2194,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Map.Dict.reduce", @@ -2166,7 +2211,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool" + "signature": "let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Map.Dict.every", @@ -2182,7 +2228,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool" + "signature": "let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Map.Dict.some", @@ -2358,7 +2405,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (\n t<'a, 'b, 'id>,\n 'a,\n option<'b> => option<'b>,\n ~cmp: cmp<'a, 'id>,\n) => t<'a, 'b, 'id>" + "signature": "let updateU: (\n t<'a, 'b, 'id>,\n 'a,\n option<'b> => option<'b>,\n ~cmp: cmp<'a, 'id>,\n) => t<'a, 'b, 'id>", + "deprecated": "Use `update` instead" }, { "id": "Belt.Map.Dict.update", @@ -2372,7 +2420,8 @@ "kind": "value", "name": "mergeU", "docstrings": [], - "signature": "let mergeU: (\n t<'a, 'b, 'id>,\n t<'a, 'c, 'id>,\n ('a, option<'b>, option<'c>) => option<'d>,\n ~cmp: cmp<'a, 'id>,\n) => t<'a, 'd, 'id>" + "signature": "let mergeU: (\n t<'a, 'b, 'id>,\n t<'a, 'c, 'id>,\n ('a, option<'b>, option<'c>) => option<'d>,\n ~cmp: cmp<'a, 'id>,\n) => t<'a, 'd, 'id>", + "deprecated": "Use `merge` instead" }, { "id": "Belt.Map.Dict.merge", @@ -2395,7 +2444,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => t<'k, 'a, 'id>" + "signature": "let keepU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => t<'k, 'a, 'id>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Map.Dict.keep", @@ -2411,7 +2461,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (\n t<'k, 'a, 'id>,\n ('k, 'a) => bool,\n) => (t<'k, 'a, 'id>, t<'k, 'a, 'id>)" + "signature": "let partitionU: (\n t<'k, 'a, 'id>,\n ('k, 'a) => bool,\n) => (t<'k, 'a, 'id>, t<'k, 'a, 'id>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Map.Dict.partition", @@ -2436,7 +2487,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>" + "signature": "let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Map.Dict.map", @@ -2452,7 +2504,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>" + "signature": "let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.Map.Dict.mapWithKey", @@ -2510,7 +2563,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'v>, t<'v>, ('v, 'v) => int) => int" + "signature": "let cmpU: (t<'v>, t<'v>, ('v, 'v) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Map.String.cmp", @@ -2524,7 +2578,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'v>, t<'v>, ('v, 'v) => bool) => bool" + "signature": "let eqU: (t<'v>, t<'v>, ('v, 'v) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Map.String.eq", @@ -2540,14 +2595,15 @@ "kind": "value", "name": "findFirstByU", "docstrings": [], - "signature": "let findFirstByU: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>" + "signature": "let findFirstByU: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>", + "deprecated": "Use `findFirstBy` instead" }, { "id": "Belt.Map.String.findFirstBy", "kind": "value", "name": "findFirstBy", "docstrings": [ - "`findFirstBy(m, p)` uses funcion `f` to find the first key value pair\nto match predicate `p`.\n\n```rescript\nlet s0 = fromArray(~id=module(IntCmp), [(4, \"4\"), (1, \"1\"), (2, \"2,\"(3, \"\"))])\nfindFirstBy(s0, (k, v) => k == 4) == option((4, \"4\"))\n```" + "`findFirstBy(m, p)` uses funcion `f` to find the first key value pair\nto match predicate `p`.\n\n## Examples\n\n```rescript\nlet mapString = Belt.Map.String.fromArray([(\"1\", \"one\"), (\"2\", \"two\"), (\"3\", \"three\")])\n\nmapString->\nBelt.Map.String.findFirstBy((k, v) => k == \"1\" && v == \"one\")\n->assertEqual(Some(\"1\", \"one\"))\n```" ], "signature": "let findFirstBy: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>" }, @@ -2556,7 +2612,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'v>, (key, 'v) => unit) => unit" + "signature": "let forEachU: (t<'v>, (key, 'v) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Map.String.forEach", @@ -2572,7 +2629,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'v>, 'v2, ('v2, key, 'v) => 'v2) => 'v2" + "signature": "let reduceU: (t<'v>, 'v2, ('v2, key, 'v) => 'v2) => 'v2", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Map.String.reduce", @@ -2588,7 +2646,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'v>, (key, 'v) => bool) => bool" + "signature": "let everyU: (t<'v>, (key, 'v) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Map.String.every", @@ -2604,7 +2663,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'v>, (key, 'v) => bool) => bool" + "signature": "let someU: (t<'v>, (key, 'v) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Map.String.some", @@ -2782,7 +2842,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (t<'v>, key, option<'v> => option<'v>) => t<'v>" + "signature": "let updateU: (t<'v>, key, option<'v> => option<'v>) => t<'v>", + "deprecated": "Use `update` instead" }, { "id": "Belt.Map.String.update", @@ -2796,7 +2857,8 @@ "kind": "value", "name": "mergeU", "docstrings": [], - "signature": "let mergeU: (\n t<'v>,\n t<'v2>,\n (key, option<'v>, option<'v2>) => option<'c>,\n) => t<'c>" + "signature": "let mergeU: (\n t<'v>,\n t<'v2>,\n (key, option<'v>, option<'v2>) => option<'c>,\n) => t<'c>", + "deprecated": "Use `merge` instead" }, { "id": "Belt.Map.String.merge", @@ -2819,7 +2881,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'v>, (key, 'v) => bool) => t<'v>" + "signature": "let keepU: (t<'v>, (key, 'v) => bool) => t<'v>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Map.String.keep", @@ -2835,7 +2898,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t<'v>, (key, 'v) => bool) => (t<'v>, t<'v>)" + "signature": "let partitionU: (t<'v>, (key, 'v) => bool) => (t<'v>, t<'v>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Map.String.partition", @@ -2860,7 +2924,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'v>, 'v => 'v2) => t<'v2>" + "signature": "let mapU: (t<'v>, 'v => 'v2) => t<'v2>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Map.String.map", @@ -2876,7 +2941,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'v>, (key, 'v) => 'v2) => t<'v2>" + "signature": "let mapWithKeyU: (t<'v>, (key, 'v) => 'v2) => t<'v2>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.Map.String.mapWithKey", @@ -2936,7 +3002,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'v>, t<'v>, ('v, 'v) => int) => int" + "signature": "let cmpU: (t<'v>, t<'v>, ('v, 'v) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Map.Int.cmp", @@ -2950,7 +3017,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'v>, t<'v>, ('v, 'v) => bool) => bool" + "signature": "let eqU: (t<'v>, t<'v>, ('v, 'v) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Map.Int.eq", @@ -2966,14 +3034,15 @@ "kind": "value", "name": "findFirstByU", "docstrings": [], - "signature": "let findFirstByU: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>" + "signature": "let findFirstByU: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>", + "deprecated": "Use `findFirstBy` instead" }, { "id": "Belt.Map.Int.findFirstBy", "kind": "value", "name": "findFirstBy", "docstrings": [ - "`findFirstBy(m, p)` uses funcion `f` to find the first key value pair\nto match predicate `p`.\n\n```rescript\nlet s0 = fromArray(~id=module(IntCmp), [(4, \"4\"), (1, \"1\"), (2, \"2,\"(3, \"\"))])\nfindFirstBy(s0, (k, v) => k == 4) == option((4, \"4\"))\n```" + "`findFirstBy(m, p)` uses funcion `f` to find the first key value pair\nto match predicate `p`.\n\n## Examples\n\n```rescript\nlet mapInt = Belt.Map.Int.fromArray([(1, \"one\"), (2, \"two\"), (3, \"three\")])\n\nmapInt->\nBelt.Map.Int.findFirstBy((k, v) => k == 1 && v == \"one\")\n->assertEqual(Some(1, \"one\"))\n```" ], "signature": "let findFirstBy: (t<'v>, (key, 'v) => bool) => option<(key, 'v)>" }, @@ -2982,7 +3051,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'v>, (key, 'v) => unit) => unit" + "signature": "let forEachU: (t<'v>, (key, 'v) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Map.Int.forEach", @@ -2998,7 +3068,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'v>, 'v2, ('v2, key, 'v) => 'v2) => 'v2" + "signature": "let reduceU: (t<'v>, 'v2, ('v2, key, 'v) => 'v2) => 'v2", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Map.Int.reduce", @@ -3014,7 +3085,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'v>, (key, 'v) => bool) => bool" + "signature": "let everyU: (t<'v>, (key, 'v) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Map.Int.every", @@ -3030,7 +3102,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'v>, (key, 'v) => bool) => bool" + "signature": "let someU: (t<'v>, (key, 'v) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Map.Int.some", @@ -3208,7 +3281,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (t<'v>, key, option<'v> => option<'v>) => t<'v>" + "signature": "let updateU: (t<'v>, key, option<'v> => option<'v>) => t<'v>", + "deprecated": "Use `update` instead" }, { "id": "Belt.Map.Int.update", @@ -3222,7 +3296,8 @@ "kind": "value", "name": "mergeU", "docstrings": [], - "signature": "let mergeU: (\n t<'v>,\n t<'v2>,\n (key, option<'v>, option<'v2>) => option<'c>,\n) => t<'c>" + "signature": "let mergeU: (\n t<'v>,\n t<'v2>,\n (key, option<'v>, option<'v2>) => option<'c>,\n) => t<'c>", + "deprecated": "Use `merge` instead" }, { "id": "Belt.Map.Int.merge", @@ -3245,7 +3320,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'v>, (key, 'v) => bool) => t<'v>" + "signature": "let keepU: (t<'v>, (key, 'v) => bool) => t<'v>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Map.Int.keep", @@ -3261,7 +3337,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t<'v>, (key, 'v) => bool) => (t<'v>, t<'v>)" + "signature": "let partitionU: (t<'v>, (key, 'v) => bool) => (t<'v>, t<'v>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Map.Int.partition", @@ -3286,7 +3363,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'v>, 'v => 'v2) => t<'v2>" + "signature": "let mapU: (t<'v>, 'v => 'v2) => t<'v2>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Map.Int.map", @@ -3302,7 +3380,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'v>, (key, 'v) => 'v2) => t<'v2>" + "signature": "let mapWithKeyU: (t<'v>, (key, 'v) => 'v2) => t<'v2>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.Map.Int.mapWithKey", @@ -3481,7 +3560,8 @@ "docstrings": [ "Same as [forEach](##forEach) but takes uncurried functon." ], - "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit" + "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Set.Dict.forEach", @@ -3497,7 +3577,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" + "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Set.Dict.reduce", @@ -3513,7 +3594,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Set.Dict.every", @@ -3529,7 +3611,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Set.Dict.some", @@ -3545,7 +3628,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" + "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Set.Dict.keep", @@ -3561,7 +3645,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" + "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Set.Dict.partition", @@ -3687,7 +3772,7 @@ "name": "String", "docstrings": [ "Specialized when value type is `string`, more efficient than the generic type,\nits compare behavior is fixed using the built-in comparison", - "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\n It is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\n and identity is not needed(using the built-in one)\n\n **See** [`Belt.Set`]()" + "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\nIt is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.Set`]()" ], "items": [ { @@ -3828,7 +3913,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, value => unit) => unit" + "signature": "let forEachU: (t, value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Set.String.forEach", @@ -3844,7 +3930,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a" + "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Set.String.reduce", @@ -3860,7 +3947,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t, value => bool) => bool" + "signature": "let everyU: (t, value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Set.String.every", @@ -3876,7 +3964,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t, value => bool) => bool" + "signature": "let someU: (t, value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Set.String.some", @@ -3892,7 +3981,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t, value => bool) => t" + "signature": "let keepU: (t, value => bool) => t", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Set.String.keep", @@ -3908,7 +3998,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t, value => bool) => (t, t)" + "signature": "let partitionU: (t, value => bool) => (t, t)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Set.String.partition", @@ -4016,7 +4107,7 @@ "name": "Int", "docstrings": [ "Specialized when value type is `int`, more efficient than the generic type, its\ncompare behavior is fixed using the built-in comparison", - "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\n It is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\n and identity is not needed(using the built-in one)\n\n **See** [`Belt.Set`]()" + "This module is [`Belt.Set`]() specialized with value type to be a primitive type.\nIt is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,\nand identity is not needed(using the built-in one)\n\n**See** [`Belt.Set`]()" ], "items": [ { @@ -4157,7 +4248,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t, value => unit) => unit" + "signature": "let forEachU: (t, value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Set.Int.forEach", @@ -4173,7 +4265,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a" + "signature": "let reduceU: (t, 'a, ('a, value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Set.Int.reduce", @@ -4189,7 +4282,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t, value => bool) => bool" + "signature": "let everyU: (t, value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Set.Int.every", @@ -4205,7 +4299,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t, value => bool) => bool" + "signature": "let someU: (t, value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Set.Int.some", @@ -4221,7 +4316,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t, value => bool) => t" + "signature": "let keepU: (t, value => bool) => t", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Set.Int.keep", @@ -4237,7 +4333,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t, value => bool) => (t, t)" + "signature": "let partitionU: (t, value => bool) => (t, t)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Set.Int.partition", @@ -4685,7 +4782,7 @@ "kind": "value", "name": "+", "docstrings": [ - "Addition of two `float` values.\nCan be opened in a module to avoid dot-notation (`+.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nJs.log(2.0 + 2.0 === 4.0) /* true */\n```" + "Addition of two `float` values.\nCan be opened in a module to avoid dot-notation (`+.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nassertEqual(2.0 + 2.0, 4.0)\n```" ], "signature": "let +: (float, float) => float" }, @@ -4694,7 +4791,7 @@ "kind": "value", "name": "-", "docstrings": [ - "Subtraction of two `float` values.\nCan be opened in a module to avoid dot-notation (`-.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nJs.log(2.0 - 1.0 === 1.0) /* true */\n```" + "Subtraction of two `float` values.\nCan be opened in a module to avoid dot-notation (`-.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nassertEqual(2.0 - 1.0, 1.0)\n```" ], "signature": "let -: (float, float) => float" }, @@ -4703,7 +4800,7 @@ "kind": "value", "name": "*", "docstrings": [ - "Multiplication of two `float` values.\nCan be opened in a module to avoid dot-notation (`*.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nJs.log(2.0 * 2.0 === 4.0) /* true */\n```" + "Multiplication of two `float` values.\nCan be opened in a module to avoid dot-notation (`*.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nassertEqual(2.0 * 2.0, 4.0)\n```" ], "signature": "let *: (float, float) => float" }, @@ -4712,7 +4809,7 @@ "kind": "value", "name": "/", "docstrings": [ - "Division of two `float` values.\nCan be opened in a module to avoid dot-notation (`/.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nJs.log(4.0 / 2.0 === 2.0) /* true */\n```" + "Division of two `float` values.\nCan be opened in a module to avoid dot-notation (`/.`), however this yields a shadow warning (Warning number 44) in the default configuration.\n\n## Examples\n\n```rescript\nopen Belt.Float\nassertEqual(4.0 / 2.0, 2.0)\n```" ], "signature": "let /: (float, float) => float" } @@ -4731,7 +4828,7 @@ "kind": "value", "name": "toFloat", "docstrings": [ - "Converts a given `int` to a `float`.\n\n## Examples\n\n```rescript\nJs.log(Belt.Int.toFloat(1) === 1.0) /* true */\n```" + "Converts a given `int` to a `float`.\n\n## Examples\n\n```rescript\nBelt.Int.toFloat(1)->assertEqual(1.0)\n```" ], "signature": "let toFloat: int => float" }, @@ -4740,7 +4837,7 @@ "kind": "value", "name": "fromFloat", "docstrings": [ - "Converts a given `float` to an `int`.\n\n## Examples\n\n```rescript\nJs.log(Belt.Int.fromFloat(1.0) === 1) /* true */\n```" + "Converts a given `float` to an `int`.\n\n## Examples\n\n```rescript\nBelt.Int.fromFloat(1.0)->assertEqual(1)\n```" ], "signature": "let fromFloat: float => int" }, @@ -4749,7 +4846,7 @@ "kind": "value", "name": "fromString", "docstrings": [ - "Converts a given `string` to an `int`. Returns `Some(int)` when the input is a number, `None` otherwise.\n\n## Examples\n\n```rescript\nJs.log(Belt.Int.fromString(\"1\") === Some(1)) /* true */\n```" + "Converts a given `string` to an `int`. Returns `Some(int)` when the input is a number, `None` otherwise.\n\n## Examples\n\n```rescript\nBelt.Int.fromString(\"1\")->assertEqual(Some(1))\n```" ], "signature": "let fromString: string => option" }, @@ -4758,7 +4855,7 @@ "kind": "value", "name": "toString", "docstrings": [ - "Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n## Examples\n\n```rescript\nJs.log(Belt.Int.toString(1) === \"1\") /* true */\n```" + "Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n## Examples\n\n```rescript\nBelt.Int.toString(1)->assertEqual(\"1\")\n```" ], "signature": "let toString: int => string" }, @@ -4767,7 +4864,7 @@ "kind": "value", "name": "+", "docstrings": [ - "Addition of two `int` values. Same as the addition from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nJs.log(2 + 2 === 4) /* true */\n```" + "Addition of two `int` values. Same as the addition from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nassertEqual(2 + 2, 4)\n```" ], "signature": "let +: (int, int) => int" }, @@ -4776,7 +4873,7 @@ "kind": "value", "name": "-", "docstrings": [ - "Subtraction of two `int` values. Same as the subtraction from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nJs.log(2 - 1 === 1) /* true */\n```" + "Subtraction of two `int` values. Same as the subtraction from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nassertEqual(2 - 1, 1)\n```" ], "signature": "let -: (int, int) => int" }, @@ -4785,7 +4882,7 @@ "kind": "value", "name": "*", "docstrings": [ - "Multiplication of two `int` values. Same as the multiplication from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nJs.log(2 * 2 === 4) /* true */\n```" + "Multiplication of two `int` values. Same as the multiplication from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nassertEqual(2 * 2, 4)\n```" ], "signature": "let *: (int, int) => int" }, @@ -4794,7 +4891,7 @@ "kind": "value", "name": "/", "docstrings": [ - "Division of two `int` values. Same as the division from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nJs.log(4 / 2 === 2); /* true */\n```" + "Division of two `int` values. Same as the division from `Pervasives`.\n\n## Examples\n\n```rescript\nopen Belt.Int\nassertEqual(4 / 2, 2)\n```" ], "signature": "let /: (int, int) => int" } @@ -4820,7 +4917,7 @@ "kind": "value", "name": "getExn", "docstrings": [ - "`getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n## Examples\n\n```rescript\nBelt.Result.getExn(Belt.Result.Ok(42)) == 42\n\nBelt.Result.getExn(Belt.Result.Error(\"Invalid data\")) /* raises exception */\n```" + "`getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n## Examples\n\n```rescript\nBelt.Result.Ok(42)\n->Belt.Result.getExn\n->assertEqual(42)\n\n\nswitch Belt.Result.getExn(Belt.Result.Error(\"Invalid data\")) { // raise a exception\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```" ], "signature": "let getExn: t<'a, 'b> => 'a" }, @@ -4829,7 +4926,8 @@ "kind": "value", "name": "mapWithDefaultU", "docstrings": [], - "signature": "let mapWithDefaultU: (t<'a, 'c>, 'b, 'a => 'b) => 'b" + "signature": "let mapWithDefaultU: (t<'a, 'c>, 'b, 'a => 'b) => 'b", + "deprecated": "Use `mapWithDefault` instead" }, { "id": "Belt.Result.mapWithDefault", @@ -4845,7 +4943,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'a, 'c>, 'a => 'b) => t<'b, 'c>" + "signature": "let mapU: (t<'a, 'c>, 'a => 'b) => t<'b, 'c>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Result.map", @@ -4861,7 +4960,8 @@ "kind": "value", "name": "flatMapU", "docstrings": [], - "signature": "let flatMapU: (t<'a, 'c>, 'a => t<'b, 'c>) => t<'b, 'c>" + "signature": "let flatMapU: (t<'a, 'c>, 'a => t<'b, 'c>) => t<'b, 'c>", + "deprecated": "Use `flatMap` instead" }, { "id": "Belt.Result.flatMap", @@ -4904,7 +5004,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool" + "signature": "let eqU: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Result.eq", @@ -4920,7 +5021,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int" + "signature": "let cmpU: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Result.cmp", @@ -4948,7 +5050,8 @@ "docstrings": [ "Uncurried version of `keep`" ], - "signature": "let keepU: (option<'a>, 'a => bool) => option<'a>" + "signature": "let keepU: (option<'a>, 'a => bool) => option<'a>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Option.keep", @@ -4966,7 +5069,8 @@ "docstrings": [ "Uncurried version of `forEach`" ], - "signature": "let forEachU: (option<'a>, 'a => unit) => unit" + "signature": "let forEachU: (option<'a>, 'a => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Option.forEach", @@ -4982,7 +5086,7 @@ "kind": "value", "name": "getExn", "docstrings": [ - "Raises an Error in case `None` is provided. Use with care.\n\n## Examples\n\n```rescript\nBelt.Option.getExn(Some(3)) /* 3 */\n\nBelt.Option.getExn(None) /* Raises an Error */\n```" + "Raises an Error in case `None` is provided. Use with care.\n\n## Examples\n\n```rescript\nSome(3)\n->Belt.Option.getExn\n->assertEqual(3)\n\nswitch Belt.Option.getExn(None) { // Raises an exception\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```" ], "signature": "let getExn: option<'a> => 'a" }, @@ -5002,7 +5106,8 @@ "docstrings": [ "Uncurried version of `mapWithDefault`" ], - "signature": "let mapWithDefaultU: (option<'a>, 'b, 'a => 'b) => 'b" + "signature": "let mapWithDefaultU: (option<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use `mapWithDefault` instead" }, { "id": "Belt.Option.mapWithDefault", @@ -5020,7 +5125,8 @@ "docstrings": [ "Uncurried version of `map`" ], - "signature": "let mapU: (option<'a>, 'a => 'b) => option<'b>" + "signature": "let mapU: (option<'a>, 'a => 'b) => option<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Option.map", @@ -5038,7 +5144,8 @@ "docstrings": [ "Uncurried version of `flatMap`" ], - "signature": "let flatMapU: (option<'a>, 'a => option<'b>) => option<'b>" + "signature": "let flatMapU: (option<'a>, 'a => option<'b>) => option<'b>", + "deprecated": "Use `flatMap` instead" }, { "id": "Belt.Option.flatMap", @@ -5092,7 +5199,8 @@ "docstrings": [ "Uncurried version of `eq`" ], - "signature": "let eqU: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" + "signature": "let eqU: (option<'a>, option<'b>, ('a, 'b) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Option.eq", @@ -5110,7 +5218,8 @@ "docstrings": [ "Uncurried version of `cmp`" ], - "signature": "let cmpU: (option<'a>, option<'b>, ('a, 'b) => int) => int" + "signature": "let cmpU: (option<'a>, option<'b>, ('a, 'b) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Option.cmp", @@ -5128,7 +5237,7 @@ "name": "HashMap", "docstrings": [ "[`Belt.HashMap`]()\n\n The top level provides generic **mutable** hash map operations.\n\n It also has two specialized inner modules\n [`Belt.HashMap.Int`]() and [`Belt.HashMap.String`]()", - "A **mutable** Hash map which allows customized [`hash`]() behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashMaps of ints_ initialized with different\n_hash_ functions will have different type.\n\n## Examples\n\n```rescript\ntype t = int\nmodule I0 = unpack(Belt.Id.hashableU(~hash=(. a: t) => \"&\"(a, 0xff_ff), ~eq=(. a, b) => a == b))\nlet s0: t<_, string, _> = make(~hintSize=40, ~id=module(I0))\n\nmodule I1 = unpack(Belt.Id.hashableU(~hash=(. a: t) => \"&\"(a, 0xff), ~eq=(. a, b) => a == b))\nlet s1: t<_, string, _> = make(~hintSize=40, ~id=module(I1))\n```\n\nThe invariant must be held: for two elements who are _equal_,\ntheir hashed value should be the same\n\nHere the compiler would infer `s0` and `s1` having different type so that\nit would not mix.\n\n## Examples\n\n```rescript\nlet s0: t\nlet s1: t\n```\n\nWe can add elements to the collection:\n\n## Examples\n\n```rescript\nlet () = {\n add(s1, 0, \"3\")\n add(s1, 1, \"3\")\n}\n```\n\nSince this is an mutable data strucure, `s1` will contain two pairs." + "A **mutable** Hash map which allows customized [`hash`]() behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashMaps of ints_ initialized with different\n_hash_ functions will have different type.\n\n## Examples\n\n```rescript\ntype t = int\nmodule I0 = unpack(Belt.Id.hashable(~hash=(_: t) => 0xff_ff, ~eq=(a, b) => a == b))\nlet s0: Belt.HashMap.t = Belt.HashMap.make(~hintSize=40, ~id=module(I0))\n\nmodule I1 = unpack(Belt.Id.hashable(~hash=(_: t) => 0xff, ~eq=(a, b) => a == b))\nlet s1: Belt.HashMap.t = Belt.HashMap.make(~hintSize=40, ~id=module(I1))\n```\n\nThe invariant must be held: for two elements who are _equal_,\ntheir hashed value should be the same\n\nHere the compiler would infer `s0` and `s1` having different type so that\nit would not mix.\n\n## Examples\n\n```\nlet s0: t\nlet s1: t\n```\n\nWe can add elements to the collection:\n\n## Examples\n\n```rescript\nlet () = {\n Belt.HashMap.set(s0, 0, 3)\n Belt.HashMap.set(s1, 1, \"3\")\n}\n```\n\nSince this is an mutable data strucure, `s1` will contain two pairs." ], "items": [ { @@ -5228,7 +5337,8 @@ "docstrings": [ "Same as [forEach](#forEach) but takes uncurried function." ], - "signature": "let forEachU: (t<'key, 'value, 'id>, ('key, 'value) => unit) => unit" + "signature": "let forEachU: (t<'key, 'value, 'id>, ('key, 'value) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashMap.forEach", @@ -5244,14 +5354,15 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'key, 'value, 'id>, 'c, ('c, 'key, 'value) => 'c) => 'c" + "signature": "let reduceU: (t<'key, 'value, 'id>, 'c, ('c, 'key, 'value) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashMap.reduce", "kind": "value", "name": "reduce", "docstrings": [ - "`reduce(tbl, init, f)` computes `(f(kN, dN) ... (f(k1, d1, init))...)`, where `k1 ... kN` are the keys of all bindings in `tbl`, and `d1 ... dN` are the associated values. Each binding is presented exactly once to `f`.\n\nThe order in which the bindings are passed to `f` is unspecified. However, if the table contains several bindings for the same key, they are passed to `f` in reverse order of introduction, that is, the most recent binding is passed first.\n\n## Examples\n\n```rescript\nmodule IntHash = Belt.Id.MakeHashable({\n type t = int\n let hash = a => a\n let eq = (a, b) => a == b\n})\n\nlet s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))\nBelt.HashMap.set(s0, 1, \"value1\")\nBelt.HashMap.set(s0, 2, \"value2\")\n\nBelt.HashMap.reduce(s0, \"\", (acc, key, value) => acc ++ (\", \" ++ value)) == \"value1, value2\"\n```" + "`reduce(tbl, init, f)` computes `(f(kN, dN) ... (f(k1, d1, init))...)`, where `k1 ... kN` are the keys of all bindings in `tbl`, and `d1 ... dN` are the associated values. Each binding is presented exactly once to `f`.\n\nThe order in which the bindings are passed to `f` is unspecified. However, if the table contains several bindings for the same key, they are passed to `f` in reverse order of introduction, that is, the most recent binding is passed first.\n\n## Examples\n\n```rescript\nmodule IntHash = Belt.Id.MakeHashable({\n type t = int\n let hash = a => a\n let eq = (a, b) => a == b\n})\n\nlet s0 = Belt.HashMap.make(~hintSize=10, ~id=module(IntHash))\n\nBelt.HashMap.set(s0, 1, \"value1\")\nBelt.HashMap.set(s0, 2, \"value2\")\n\ns0\n->Belt.HashMap.reduce(\"\", (acc, _, value) => acc ++ (\", \" ++ value))\n->assertEqual(\", value1, value2\")\n```\n\n## More Examples\n\n```rescript\nConsole.log(\"lol\")\n```" ], "signature": "let reduce: (t<'key, 'value, 'id>, 'c, ('c, 'key, 'value) => 'c) => 'c" }, @@ -5262,7 +5373,8 @@ "docstrings": [ "Same as [keepMapInPlace](#keepMapInPlace) but takes uncurried function." ], - "signature": "let keepMapInPlaceU: (\n t<'key, 'value, 'id>,\n ('key, 'value) => option<'value>,\n) => unit" + "signature": "let keepMapInPlaceU: (\n t<'key, 'value, 'id>,\n ('key, 'value) => option<'value>,\n) => unit", + "deprecated": "Use `keepMapInPlace` instead" }, { "id": "Belt.HashMap.keepMapInPlace", @@ -5352,7 +5464,7 @@ "name": "HashSet", "docstrings": [ "[`Belt.HashSet`]()\n\n The top level provides generic **mutable** hash set operations.\n\n It also has two specialized inner modules\n [`Belt.HashSet.Int`]() and [`Belt.HashSet.String`]()", - "A **mutable** Hash set which allows customized `hash` behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashSets of ints_ initialized with\ndifferent _hash_ functions will have different type.\n\n## Examples\n\n```rescript\nmodule I0 = unpack(\n Belt.Id.hashableU(\n ~hash=(. a: int) => land(a, 65535),\n ~eq=(. a, b) => a == b,\n )\n)\n\nlet s0 = Belt.HashSet.make(~id=module(I0), ~hintSize=40)\n\nmodule I1 = unpack(\n Belt.Id.hashableU(\n ~hash=(. a: int) => land(a, 255),\n ~eq=(. a, b) => a == b,\n )\n)\n\nlet s1 = Belt.HashSet.make(~id=module(I1), ~hintSize=40)\n\nBelt.HashSet.add(s1, 0)\nBelt.HashSet.add(s1, 1)\n```\n\nThe invariant must be held: for two elements who are equal, their hashed\nvalue should be the same.\n\nHere the compiler would infer `s0` and `s1` having different type so that it\nwould not mix.\n\n## Examples\n\n```rescript\nlet s0: Belt.HashSet.t\nlet s1: Belt.HashSet.t\n```\n\nWe can add elements to the collection (see last two lines in the example\nabove). Since this is an mutable data structure, `s1` will contain two pairs." + "A **mutable** Hash set which allows customized `hash` behavior.\n\nAll data are parameterized by not its only type but also a unique identity in\nthe time of initialization, so that two _HashSets of ints_ initialized with\ndifferent _hash_ functions will have different type.\n\n## Examples\n\n```rescript\nmodule I0 = unpack(\n Belt.Id.hashable(\n ~hash=(a: int) => land(a, 65535),\n ~eq=(a, b) => a == b,\n )\n)\n\nlet s0 = Belt.HashSet.make(~id=module(I0), ~hintSize=40)\n\nmodule I1 = unpack(\n Belt.Id.hashable(\n ~hash=(a: int) => land(a, 255),\n ~eq=(a, b) => a == b,\n )\n)\n\nlet s1 = Belt.HashSet.make(~id=module(I1), ~hintSize=40)\n\nBelt.HashSet.add(s1, 0)\nBelt.HashSet.add(s1, 1)\n```\n\nThe invariant must be held: for two elements who are equal, their hashed\nvalue should be the same.\n\nHere the compiler would infer `s0` and `s1` having different type so that it\nwould not mix.\n\nSignatures:\n\n```\nlet s0: Belt.HashSet.t\nlet s1: Belt.HashSet.t\n```\n\nWe can add elements to the collection (see last two lines in the example\nabove). Since this is an mutable data structure, `s1` will contain two pairs." ], "items": [ { @@ -5425,7 +5537,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a, 'id>, 'a => unit) => unit" + "signature": "let forEachU: (t<'a, 'id>, 'a => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.HashSet.forEach", @@ -5441,7 +5554,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'a, 'id>, 'c, ('c, 'a) => 'c) => 'c" + "signature": "let reduceU: (t<'a, 'id>, 'c, ('c, 'a) => 'c) => 'c", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.HashSet.reduce", @@ -5550,7 +5664,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => int" + "signature": "let cmpU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.MutableMap.cmp", @@ -5566,7 +5681,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => bool" + "signature": "let eqU: (t<'k, 'a, 'id>, t<'k, 'a, 'id>, ('a, 'a) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.MutableMap.eq", @@ -5582,7 +5698,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit" + "signature": "let forEachU: (t<'k, 'a, 'id>, ('k, 'a) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableMap.forEach", @@ -5598,7 +5715,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'k, 'a, 'id>, 'b, ('b, 'k, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableMap.reduce", @@ -5614,7 +5732,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool" + "signature": "let everyU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableMap.every", @@ -5630,7 +5749,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool" + "signature": "let someU: (t<'k, 'a, 'id>, ('k, 'a) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableMap.some", @@ -5808,7 +5928,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unit" + "signature": "let updateU: (t<'k, 'a, 'id>, 'k, option<'a> => option<'a>) => unit", + "deprecated": "Use `update` instead" }, { "id": "Belt.MutableMap.update", @@ -5829,7 +5950,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>" + "signature": "let mapU: (t<'k, 'a, 'id>, 'a => 'b) => t<'k, 'b, 'id>", + "deprecated": "Use `map` instead" }, { "id": "Belt.MutableMap.map", @@ -5845,7 +5967,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>" + "signature": "let mapWithKeyU: (t<'k, 'a, 'id>, ('k, 'a) => 'b) => t<'k, 'b, 'id>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.MutableMap.mapWithKey", @@ -6047,7 +6170,8 @@ "docstrings": [ "Same as `Belt.MutableSet.forEach` but takes uncurried functon." ], - "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit" + "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableSet.forEach", @@ -6063,7 +6187,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" + "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableSet.reduce", @@ -6079,7 +6204,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.MutableSet.every", @@ -6095,7 +6221,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.MutableSet.some", @@ -6111,7 +6238,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" + "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.MutableSet.keep", @@ -6127,7 +6255,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" + "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.MutableSet.partition", @@ -6306,7 +6435,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'k, 'v, 'id>, t<'k, 'v, 'id>, ('v, 'v) => int) => int" + "signature": "let cmpU: (t<'k, 'v, 'id>, t<'k, 'v, 'id>, ('v, 'v) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Map.cmp", @@ -6322,7 +6452,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'k, 'v, 'id>, t<'k, 'v, 'id>, ('v, 'v) => bool) => bool" + "signature": "let eqU: (t<'k, 'v, 'id>, t<'k, 'v, 'id>, ('v, 'v) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Map.eq", @@ -6338,14 +6469,15 @@ "kind": "value", "name": "findFirstByU", "docstrings": [], - "signature": "let findFirstByU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>" + "signature": "let findFirstByU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>", + "deprecated": "Use `findFirstBy` instead" }, { "id": "Belt.Map.findFirstBy", "kind": "value", "name": "findFirstBy", "docstrings": [ - "`\nfindFirstBy(m, p)` uses function `f` to find the first key value pair to match predicate `p`.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = (a, b) => Pervasives.compare(a, b)\n})\n\nlet s0 = Belt.Map.fromArray(~id=module(IntCmp), [(4, \"4\"), (1, \"1\"), (2, \"2\"), (3, \"\")])\n\nBelt.Map.findFirstBy(s0, (k, v) => k == 4) /* (4, \"4\") */\n```" + "`\nfindFirstBy(m, p)` uses function `f` to find the first key value pair to match predicate `p`.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = (a, b) => Pervasives.compare(a, b)\n})\n\nlet s0 = Belt.Map.fromArray(~id=module(IntCmp), [(4, \"4\"), (1, \"1\"), (2, \"2\"), (3, \"\")])\n\ns0\n->Belt.Map.findFirstBy((k, _) => k == 4)\n->assertEqual(Some(4, \"4\"))\n```" ], "signature": "let findFirstBy: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>" }, @@ -6354,7 +6486,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'k, 'v, 'id>, ('k, 'v) => unit) => unit" + "signature": "let forEachU: (t<'k, 'v, 'id>, ('k, 'v) => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Map.forEach", @@ -6370,7 +6503,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'k, 'v, 'id>, 'acc, ('acc, 'k, 'v) => 'acc) => 'acc" + "signature": "let reduceU: (t<'k, 'v, 'id>, 'acc, ('acc, 'k, 'v) => 'acc) => 'acc", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Map.reduce", @@ -6386,7 +6520,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => bool" + "signature": "let everyU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Map.every", @@ -6402,7 +6537,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => bool" + "signature": "let someU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Map.some", @@ -6607,7 +6743,8 @@ "kind": "value", "name": "updateU", "docstrings": [], - "signature": "let updateU: (\n t<'k, 'v, 'id>,\n 'k,\n option<'v> => option<'v>,\n) => t<'k, 'v, 'id>" + "signature": "let updateU: (\n t<'k, 'v, 'id>,\n 'k,\n option<'v> => option<'v>,\n) => t<'k, 'v, 'id>", + "deprecated": "Use `update` instead" }, { "id": "Belt.Map.update", @@ -6632,7 +6769,8 @@ "kind": "value", "name": "mergeU", "docstrings": [], - "signature": "let mergeU: (\n t<'k, 'v, 'id>,\n t<'k, 'v2, 'id>,\n ('k, option<'v>, option<'v2>) => option<'v3>,\n) => t<'k, 'v3, 'id>" + "signature": "let mergeU: (\n t<'k, 'v, 'id>,\n t<'k, 'v2, 'id>,\n ('k, option<'v>, option<'v2>) => option<'v3>,\n) => t<'k, 'v3, 'id>", + "deprecated": "Use `merge` instead" }, { "id": "Belt.Map.merge", @@ -6648,7 +6786,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => t<'k, 'v, 'id>" + "signature": "let keepU: (t<'k, 'v, 'id>, ('k, 'v) => bool) => t<'k, 'v, 'id>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Map.keep", @@ -6664,7 +6803,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (\n t<'k, 'v, 'id>,\n ('k, 'v) => bool,\n) => (t<'k, 'v, 'id>, t<'k, 'v, 'id>)" + "signature": "let partitionU: (\n t<'k, 'v, 'id>,\n ('k, 'v) => bool,\n) => (t<'k, 'v, 'id>, t<'k, 'v, 'id>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Map.partition", @@ -6689,7 +6829,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'k, 'v, 'id>, 'v => 'v2) => t<'k, 'v2, 'id>" + "signature": "let mapU: (t<'k, 'v, 'id>, 'v => 'v2) => t<'k, 'v2, 'id>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Map.map", @@ -6705,7 +6846,8 @@ "kind": "value", "name": "mapWithKeyU", "docstrings": [], - "signature": "let mapWithKeyU: (t<'k, 'v, 'id>, ('k, 'v) => 'v2) => t<'k, 'v2, 'id>" + "signature": "let mapWithKeyU: (t<'k, 'v, 'id>, ('k, 'v) => 'v2) => t<'k, 'v2, 'id>", + "deprecated": "Use `mapWithKey` instead" }, { "id": "Belt.Map.mapWithKey", @@ -6785,7 +6927,7 @@ "kind": "value", "name": "make", "docstrings": [ - "Creates a new set by taking in the comparator\n\n## Examples\n\n```rescript\nlet set = Belt.Set.make(~id=module(IntCmp))\n```" + "Creates a new set by taking in the comparator\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet set = Belt.Set.make(~id=module(IntCmp))\n\nBelt.Set.isEmpty(set)->assertEqual(true)\n```" ], "signature": "let make: (~id: id<'value, 'id>) => t<'value, 'id>" }, @@ -6794,7 +6936,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "Creates new set from array of elements.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\ns0->Belt.Set.toArray /* [1, 2, 3, 4] */\n```" + "Creates new set from array of elements.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\ns0->Belt.Set.toArray->assertEqual([1, 2, 3, 4])\n```" ], "signature": "let fromArray: (array<'value>, ~id: id<'value, 'id>) => t<'value, 'id>" }, @@ -6812,7 +6954,7 @@ "kind": "value", "name": "isEmpty", "docstrings": [ - "Checks if set is empty.\n\n## Examples\n\n```rescript\nlet empty = Belt.Set.fromArray([], ~id=module(IntCmp))\nlet notEmpty = Belt.Set.fromArray([1],~id=module(IntCmp))\n\nBelt.Set.isEmpty(empty) /* true */\nBelt.Set.isEmpty(notEmpty) /* false */\n```" + "Checks if set is empty.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet empty = Belt.Set.fromArray([], ~id=module(IntCmp))\nlet notEmpty = Belt.Set.fromArray([1], ~id=module(IntCmp))\n\nBelt.Set.isEmpty(empty)->assertEqual(true)\nBelt.Set.isEmpty(notEmpty)->assertEqual(false)\n```" ], "signature": "let isEmpty: t<'a, 'b> => bool" }, @@ -6821,7 +6963,7 @@ "kind": "value", "name": "has", "docstrings": [ - "Checks if element exists in set.\n\n## Examples\n\n```rescript\nlet set = Belt.Set.fromArray([1, 4, 2, 5], ~id=module(IntCmp))\n\nset->Belt.Set.has(3) /* false */\nset->Belt.Set.has(1) /* true */\n```" + "Checks if element exists in set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet set = Belt.Set.fromArray([1, 4, 2, 5], ~id=module(IntCmp))\n\nset->Belt.Set.has(3)->assertEqual(false)\nset->Belt.Set.has(1)->assertEqual(true)\n```" ], "signature": "let has: (t<'value, 'id>, 'value) => bool" }, @@ -6830,7 +6972,7 @@ "kind": "value", "name": "add", "docstrings": [ - "Adds element to set. If element existed in set, value is unchanged.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = s0->Belt.Set.add(1)\nlet s2 = s1->Belt.Set.add(2)\nlet s3 = s2->Belt.Set.add(2)\ns0->Belt.Set.toArray /* [] */\ns1->Belt.Set.toArray /* [1] */\ns2->Belt.Set.toArray /* [1, 2] */\ns3->Belt.Set.toArray /* [1,2 ] */\ns2 == s3 /* true */\n```" + "Adds element to set. If element existed in set, value is unchanged.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.make(~id=module(IntCmp))\n\nlet s1 = s0->Belt.Set.add(1)\nlet s2 = s1->Belt.Set.add(2)\nlet s3 = s2->Belt.Set.add(2)\n\ns0->Belt.Set.toArray->assertEqual([])\ns1->Belt.Set.toArray->assertEqual([1])\ns2->Belt.Set.toArray->assertEqual([1, 2])\ns3->Belt.Set.toArray->assertEqual([1, 2])\nassertEqual(s2, s3)\n```" ], "signature": "let add: (t<'value, 'id>, 'value) => t<'value, 'id>" }, @@ -6839,7 +6981,7 @@ "kind": "value", "name": "mergeMany", "docstrings": [ - "Adds each element of array to set. Unlike `Belt.Set.add`](#add), the reference of return value might be changed even if all values in array already exist in set\n\n## Examples\n\n```rescript\nlet set = Belt.Set.make(~id=module(IntCmp))\n\nlet newSet = set->Belt.Set.mergeMany([5, 4, 3, 2, 1])\nnewSet->Belt.Set.toArray /* [1, 2, 3, 4, 5] */\n```" + "Adds each element of array to set. Unlike `Belt.Set.add`](#add), the reference of return value might be changed even if all values in array already exist in set\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet set = Belt.Set.make(~id=module(IntCmp))\n\nlet newSet = set->Belt.Set.mergeMany([5, 4, 3, 2, 1])\n\nnewSet\n->Belt.Set.toArray\n->assertEqual([1, 2, 3, 4, 5])\n```" ], "signature": "let mergeMany: (t<'value, 'id>, array<'value>) => t<'value, 'id>" }, @@ -6848,7 +6990,7 @@ "kind": "value", "name": "remove", "docstrings": [ - "Removes element from set. If element did not exist in set, value is unchanged.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([2,3,1,4,5], ~id=module(IntCmp))\nlet s1 = s0->Belt.Set.remove(1)\nlet s2 = s1->Belt.Set.remove(3)\nlet s3 = s2->Belt.Set.remove(3)\n\ns1->Belt.Set.toArray /* [2,3,4,5] */\ns2->Belt.Set.toArray /* [2,4,5] */\ns2 == s3 /* true */\n```" + "Removes element from set. If element did not exist in set, value is unchanged.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([2,3,1,4,5], ~id=module(IntCmp))\nlet s1 = s0->Belt.Set.remove(1)\nlet s2 = s1->Belt.Set.remove(3)\nlet s3 = s2->Belt.Set.remove(3)\n\ns1->Belt.Set.toArray->assertEqual([2,3,4,5])\ns2->Belt.Set.toArray->assertEqual([2,4,5])\nassertEqual(s2, s3)\n```" ], "signature": "let remove: (t<'value, 'id>, 'value) => t<'value, 'id>" }, @@ -6857,7 +6999,7 @@ "kind": "value", "name": "removeMany", "docstrings": [ - "Removes each element of array from set. Unlike [remove](#remove), the reference of return value might be changed even if none of values in array existed in set.\n\n## Examples\n\n```rescript\nlet set = Belt.Set.fromArray([1, 2, 3, 4],~id=module(IntCmp))\n\nlet newSet = set->Belt.Set.removeMany([5, 4, 3, 2, 1])\nnewSet->Belt.Set.toArray /* [] */\n```" + "Removes each element of array from set. Unlike [remove](#remove), the reference of return value might be changed even if none of values in array existed in set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet set = Belt.Set.fromArray([1, 2, 3, 4],~id=module(IntCmp))\n\nlet newSet = set->Belt.Set.removeMany([5, 4, 3, 2, 1])\n\nnewSet\n->Belt.Set.toArray\n->assertEqual([])\n```" ], "signature": "let removeMany: (t<'value, 'id>, array<'value>) => t<'value, 'id>" }, @@ -6866,7 +7008,7 @@ "kind": "value", "name": "union", "docstrings": [ - "Returns union of two sets.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nlet union = Belt.Set.union(s0, s1)\nunion->Belt.Set.toArray /* [1,2,3,4,5,6] */\n```" + "Returns union of two sets.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nlet union = Belt.Set.union(s0, s1)\n\nunion\n->Belt.Set.toArray\n->assertEqual([1,2,3,4,5,6])\n```" ], "signature": "let union: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6875,7 +7017,7 @@ "kind": "value", "name": "intersect", "docstrings": [ - "Returns intersection of two sets.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nlet intersect = Belt.Set.intersect(s0, s1)\nintersect->Belt.Set.toArray /* [2,3,5] */\n```" + "Returns intersection of two sets.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\n\nlet intersect = Belt.Set.intersect(s0, s1)\n\nintersect\n->Belt.Set.toArray\n->assertEqual([2,3,5])\n```" ], "signature": "let intersect: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6884,7 +7026,7 @@ "kind": "value", "name": "diff", "docstrings": [ - "Returns elements from first set, not existing in second set.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nBelt.Set.toArray(Belt.Set.diff(s0, s1)) /* [6] */\nBelt.Set.toArray(Belt.Set.diff(s1,s0)) /* [1,4] */\n```" + "Returns elements from first set, not existing in second set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\n\nBelt.Set.diff(s0, s1)\n->Belt.Set.toArray\n->assertEqual([6])\n\nBelt.Set.diff(s1,s0)\n->Belt.Set.toArray\n->assertEqual([1,4])\n```" ], "signature": "let diff: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6893,7 +7035,7 @@ "kind": "value", "name": "subset", "docstrings": [ - "Checks if second set is subset of first set.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nlet s2 = Belt.Set.intersect(s0, s1)\nBelt.Set.subset(s2, s0) /* true */\nBelt.Set.subset(s2, s1) /* true */\nBelt.Set.subset(s1, s0) /* false */\n```" + "Checks if second set is subset of first set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([5,2,3,1,5,4], ~id=module(IntCmp))\nlet s2 = Belt.Set.intersect(s0, s1)\n\nBelt.Set.subset(s2, s0)->assertEqual(true)\nBelt.Set.subset(s2, s1)->assertEqual(true)\nBelt.Set.subset(s1, s0)->assertEqual(false)\n```" ], "signature": "let subset: (t<'value, 'id>, t<'value, 'id>) => bool" }, @@ -6911,7 +7053,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "Checks if two sets are equal.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,5], ~id=module(IntCmp))\n\nBelt.Set.eq(s0, s1) /* true */\n```" + "Checks if two sets are equal.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3], ~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,5], ~id=module(IntCmp))\n\nBelt.Set.eq(s0, s1)->assertEqual(true)\n```" ], "signature": "let eq: (t<'value, 'id>, t<'value, 'id>) => bool" }, @@ -6922,14 +7064,15 @@ "docstrings": [ "Same as [forEach](#forEach) but takes uncurried functon." ], - "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit" + "signature": "let forEachU: (t<'value, 'id>, 'value => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Set.forEach", "kind": "value", "name": "forEach", "docstrings": [ - "Applies function `f` in turn to all elements of set in increasing order.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\nlet acc = ref(list{})\ns0->Belt.Set.forEach(x => {\n acc := Belt.List.add(acc.contents, x)\n})\nacc /* [6,5,3,2] */\n```" + "Applies function `f` in turn to all elements of set in increasing order.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\n\nlet acc = ref(list{})\n\ns0->Belt.Set.forEach(x => {\n acc := Belt.List.add(acc.contents, x)\n})\n\nacc.contents->assertEqual(list{6,5,3,2})\n```" ], "signature": "let forEach: (t<'value, 'id>, 'value => unit) => unit" }, @@ -6938,14 +7081,15 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" + "signature": "let reduceU: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Set.reduce", "kind": "value", "name": "reduce", "docstrings": [ - "Applies function `f` to each element of set in increasing order. Function `f` has two parameters: the item from the set and an “accumulator”, which starts with a value of `initialValue`. `reduce` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\ns0->Belt.Set.reduce(list{}, (acc, element) =>\n acc->Belt.List.add(element)\n) /* [6,5,3,2] */\n```" + "Applies function `f` to each element of set in increasing order. Function `f` has two parameters: the item from the set and an “accumulator”, which starts with a value of `initialValue`. `reduce` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([5,2,3,5,6], ~id=module(IntCmp))\ns0\n->Belt.Set.reduce(list{}, (acc, element) =>\n acc->Belt.List.add(element)\n)->assertEqual(list{6,5,3,2})\n```" ], "signature": "let reduce: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" }, @@ -6954,14 +7098,15 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let everyU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Set.every", "kind": "value", "name": "every", "docstrings": [ - "Checks if all elements of the set satisfy the predicate. Order unspecified.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nlet s0 = Belt.Set.fromArray([2,4,6,8], ~id=module(IntCmp))\ns0->Belt.Set.every(isEven) /* true */\n```" + "Checks if all elements of the set satisfy the predicate. Order unspecified.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet isEven = x => mod(x, 2) == 0\n\nlet s0 = Belt.Set.fromArray([2,4,6,8], ~id=module(IntCmp))\ns0->Belt.Set.every(isEven)->assertEqual(true)\n```" ], "signature": "let every: (t<'value, 'id>, 'value => bool) => bool" }, @@ -6970,14 +7115,15 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool" + "signature": "let someU: (t<'value, 'id>, 'value => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Set.some", "kind": "value", "name": "some", "docstrings": [ - "Checks if at least one element of the set satisfies the predicate.\n\n## Examples\n\n```rescript\nlet isOdd = x => mod(x, 2) != 0\n\nlet s0 = Belt.Set.fromArray([1,2,4,6,8], ~id=module(IntCmp))\ns0->Belt.Set.some(isOdd) /* true */\n```" + "Checks if at least one element of the set satisfies the predicate.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet isOdd = x => mod(x, 2) != 0\n\nlet s0 = Belt.Set.fromArray([1,2,4,6,8], ~id=module(IntCmp))\ns0->Belt.Set.some(isOdd)->assertEqual(true)\n```" ], "signature": "let some: (t<'value, 'id>, 'value => bool) => bool" }, @@ -6986,14 +7132,15 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" + "signature": "let keepU: (t<'value, 'id>, 'value => bool) => t<'value, 'id>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Set.keep", "kind": "value", "name": "keep", "docstrings": [ - "Returns the set of all elements that satisfy the predicate.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\nlet s1 = s0->Belt.Set.keep(isEven)\n\ns1->Belt.Set.toArray /* [2,4] */\n```" + "Returns the set of all elements that satisfy the predicate.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet isEven = x => mod(x, 2) == 0\n\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\nlet s1 = s0->Belt.Set.keep(isEven)\n\ns1->Belt.Set.toArray->assertEqual([2, 4])\n```" ], "signature": "let keep: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" }, @@ -7002,14 +7149,15 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" + "signature": "let partitionU: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Set.partition", "kind": "value", "name": "partition", "docstrings": [ - "Returns a pair of sets, where first is the set of all the elements of set that satisfy the predicate, and second is the set of all the elements of set that do not satisfy the predicate.\n\n## Examples\n\n```rescript\nlet isOdd = x => mod(x, 2) != 0\n\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\nlet (s1, s2) = s0->Belt.Set.partition(isOdd)\n\ns1->Belt.Set.toArray /* [1,3,5] */\ns2->Belt.Set.toArray /* [2,4] */\n```" + "Returns a pair of sets, where first is the set of all the elements of set that satisfy the predicate, and second is the set of all the elements of set that do not satisfy the predicate.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet isOdd = x => mod(x, 2) != 0\n\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\nlet (s1, s2) = s0->Belt.Set.partition(isOdd)\n\ns1->Belt.Set.toArray->assertEqual([1,3,5])\ns2->Belt.Set.toArray->assertEqual([2,4])\n```" ], "signature": "let partition: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" }, @@ -7018,7 +7166,7 @@ "kind": "value", "name": "size", "docstrings": [ - "Returns size of the set.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([1,2,3,4], ~id=module(IntCmp))\n\ns0->Belt.Set.size /* 4 */\n```" + "Returns size of the set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([1,2,3,4], ~id=module(IntCmp))\n\ns0->Belt.Set.size->assertEqual(4)\n```" ], "signature": "let size: t<'value, 'id> => int" }, @@ -7027,7 +7175,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "Returns array of ordered set elements.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.toArray /* [1,2,3,5] */\n```" + "Returns array of ordered set elements.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.toArray->assertEqual([1,2,3,5])\n```" ], "signature": "let toArray: t<'value, 'id> => array<'value>" }, @@ -7036,7 +7184,7 @@ "kind": "value", "name": "toList", "docstrings": [ - "Returns list of ordered set elements.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.toList /* [1,2,3,5] */\n```" + "Returns list of ordered set elements.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.toList->assertEqual(list{1,2,3,5})\n```" ], "signature": "let toList: t<'value, 'id> => list<'value>" }, @@ -7045,7 +7193,7 @@ "kind": "value", "name": "minimum", "docstrings": [ - "Returns minimum value of the collection. `None` if collection is empty.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.minimum /* None */\ns1->Belt.Set.minimum /* Some(1) */\n```" + "Returns minimum value of the collection. `None` if collection is empty.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.minimum->assertEqual(None)\ns1->Belt.Set.minimum->assertEqual(Some(1))\n```" ], "signature": "let minimum: t<'value, 'id> => option<'value>" }, @@ -7054,7 +7202,7 @@ "kind": "value", "name": "minUndefined", "docstrings": [ - "Returns minimum value of the collection. `undefined` if collection is empty.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.minUndefined /* undefined */\ns1->Belt.Set.minUndefined /* 1 */\n```" + "Returns minimum value of the collection. `undefined` if collection is empty.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.minUndefined->Js.Undefined.toOption->assertEqual(None)\ns1->Belt.Set.minUndefined->Js.Undefined.toOption->assertEqual(Some(1))\n```" ], "signature": "let minUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -7063,7 +7211,7 @@ "kind": "value", "name": "maximum", "docstrings": [ - "Returns maximum value of the collection. `None` if collection is empty.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.maximum /* None */\ns1->Belt.Set.maximum /* Some(5) */\n```" + "Returns maximum value of the collection. `None` if collection is empty.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.maximum->assertEqual(None)\ns1->Belt.Set.maximum->assertEqual(Some(5))\n```" ], "signature": "let maximum: t<'value, 'id> => option<'value>" }, @@ -7072,7 +7220,7 @@ "kind": "value", "name": "maxUndefined", "docstrings": [ - "Returns maximum value of the collection. `undefined` if collection is empty.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0->Belt.Set.maxUndefined /* undefined */\ns1->Belt.Set.maxUndefined /* 5 */\n```" + "Returns maximum value of the collection. `undefined` if collection is empty.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.make(~id=module(IntCmp))\nlet s1 = Belt.Set.fromArray([3,2,1,5], ~id=module(IntCmp))\n\ns0\n->Belt.Set.maxUndefined\n->Js.Undefined.toOption\n->assertEqual(None)\n\ns1\n->Belt.Set.maxUndefined\n->Js.Undefined.toOption\n->assertEqual(Some(5))\n```" ], "signature": "let maxUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -7081,7 +7229,7 @@ "kind": "value", "name": "get", "docstrings": [ - "Returns the reference of the value which is equivalent to value using the comparator specifiecd by this collection. Returns `None` if element does not exist.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\n\ns0->Belt.Set.get(3) /* Some(3) */\ns0->Belt.Set.get(20) /* None */\n```" + "Returns the reference of the value which is equivalent to value using the comparator specifiecd by this collection. Returns `None` if element does not exist.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\n\ns0->Belt.Set.get(3)->assertEqual(Some(3))\ns0->Belt.Set.get(20)->assertEqual(None)\n```" ], "signature": "let get: (t<'value, 'id>, 'value) => option<'value>" }, @@ -7108,7 +7256,7 @@ "kind": "value", "name": "split", "docstrings": [ - "Returns a tuple `((smaller, larger), present)`, `present` is true when element exist in set.\n\n## Examples\n\n```rescript\nlet s0 = Belt.Set.fromArray([1,2,3,4,5], ~id=module(IntCmp))\n\nlet ((smaller, larger), present) = s0->Belt.Set.split(3)\n\npresent /* true */\nsmaller->Belt.Set.toArray /* [1,2] */\nlarger->Belt.Set.toArray /* [4,5] */\n\n```" + "Returns a tuple `((smaller, larger), present)`, `present` is true when element exist in set.\n\n## Examples\n\n```rescript\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\n\nlet ((smaller, larger), present) = s0->Belt.Set.split(3)\n\npresent->assertEqual(true)\nsmaller->Belt.Set.toArray->assertEqual([1,2])\nlarger->Belt.Set.toArray->assertEqual([4,5])\n```" ], "signature": "let split: (\n t<'value, 'id>,\n 'value,\n) => ((t<'value, 'id>, t<'value, 'id>), bool)" }, @@ -7163,7 +7311,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (int, int, int => unit) => unit" + "signature": "let forEachU: (int, int, int => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Range.forEach", @@ -7179,7 +7328,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (int, int, int => bool) => bool" + "signature": "let everyU: (int, int, int => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Range.every", @@ -7195,7 +7345,8 @@ "kind": "value", "name": "everyByU", "docstrings": [], - "signature": "let everyByU: (int, int, ~step: int, int => bool) => bool" + "signature": "let everyByU: (int, int, ~step: int, int => bool) => bool", + "deprecated": "Use `everyBy` instead" }, { "id": "Belt.Range.everyBy", @@ -7211,7 +7362,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (int, int, int => bool) => bool" + "signature": "let someU: (int, int, int => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Range.some", @@ -7227,7 +7379,8 @@ "kind": "value", "name": "someByU", "docstrings": [], - "signature": "let someByU: (int, int, ~step: int, int => bool) => bool" + "signature": "let someByU: (int, int, ~step: int, int => bool) => bool", + "deprecated": "Use `someBy` instead" }, { "id": "Belt.Range.someBy", @@ -7289,7 +7442,7 @@ "kind": "value", "name": "headExn", "docstrings": [ - "Same as `Belt.List.head` but raises an exception if `someList` is empty. Use\nwith care.\n\n## Examples\n\n```rescript\nBelt.List.headExn(list{1, 2, 3}) // 1\n\nBelt.List.headExn(list{}) // Raises an Error\n```" + "Same as `Belt.List.head` but raises an exception if `someList` is empty. Use\nwith care.\n\n## Examples\n\n```rescript\nBelt.List.headExn(list{1, 2, 3})->assertEqual(1)\n\nswitch Belt.List.headExn(list{}) { // Raises an Error\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```" ], "signature": "let headExn: t<'a> => 'a" }, @@ -7307,7 +7460,7 @@ "kind": "value", "name": "tailExn", "docstrings": [ - "Same as `Belt.List.tail` but raises an exception if `someList` is empty. Use\nwith care.\n\n## Examples\n\n```rescript\nBelt.List.tailExn(list{1, 2, 3}) // list{2, 3}\n\nBelt.List.tailExn(list{}) // Raises an Error\n```" + "Same as `Belt.List.tail` but raises an exception if `someList` is empty. Use\nwith care.\n\n## Examples\n\n```rescript\nBelt.List.tailExn(list{1, 2, 3})->assertEqual(list{2, 3})\n\nswitch Belt.List.tailExn(list{}) { // Raises an Error\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```" ], "signature": "let tailExn: t<'a> => t<'a>" }, @@ -7334,7 +7487,7 @@ "kind": "value", "name": "getExn", "docstrings": [ - "Same as `Belt.List.get` but raises an exception if `index` is larger than the\nlength. Use with care.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->Belt.List.getExn(1) // \"B\"\n\nabc->Belt.List.getExn(4) // Raises an Error\n```" + "Same as `Belt.List.get` but raises an exception if `index` is larger than the\nlength. Use with care.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->Belt.List.getExn(1)->assertEqual(\"B\")\n\nswitch abc->Belt.List.getExn(4) { // Raises an Error\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```" ], "signature": "let getExn: (t<'a>, int) => 'a" }, @@ -7354,7 +7507,8 @@ "docstrings": [ "Uncurried version of [makeBy](#makeBy)" ], - "signature": "let makeByU: (int, int => 'a) => t<'a>" + "signature": "let makeByU: (int, int => 'a) => t<'a>", + "deprecated": "Use `makeBy` instead" }, { "id": "Belt.List.makeBy", @@ -7444,7 +7598,8 @@ "docstrings": [ "Uncurried version of [map](#map)." ], - "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.List.map", @@ -7471,7 +7626,8 @@ "docstrings": [ "Uncurried version of [zipBy](#zipBy)." ], - "signature": "let zipByU: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "signature": "let zipByU: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", + "deprecated": "Use `zipBy` instead" }, { "id": "Belt.List.zipBy", @@ -7489,7 +7645,8 @@ "docstrings": [ "Uncurried version of [mapWithIndex](#mapWithIndex)." ], - "signature": "let mapWithIndexU: (t<'a>, (int, 'a) => 'b) => t<'b>" + "signature": "let mapWithIndexU: (t<'a>, (int, 'a) => 'b) => t<'b>", + "deprecated": "Use `mapWithIndex` instead" }, { "id": "Belt.List.mapWithIndex", @@ -7534,14 +7691,15 @@ "docstrings": [ "Uncurried version of [mapReverse](#mapReverse)." ], - "signature": "let mapReverseU: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let mapReverseU: (t<'a>, 'a => 'b) => t<'b>", + "deprecated": "Use `mapReverse` instead" }, { "id": "Belt.List.mapReverse", "kind": "value", "name": "mapReverse", "docstrings": [ - "Equivalent to:\n\n```res\nmap(someList, f)->reverse\n```\n\n## Examples\n\n```rescript\nlist{3, 4, 5}->Belt.List.mapReverse(x => x * x) /* list{25, 16, 9} */\n```" + "Equivalent to `Belt.List.map(someList, f)->Belt.List.reverse`\n\n## Examples\n\n```rescript\nlist{3, 4, 5}\n->Belt.List.mapReverse(x => x * x)\n->assertEqual(list{25, 16, 9})\n```" ], "signature": "let mapReverse: (t<'a>, 'a => 'b) => t<'b>" }, @@ -7552,7 +7710,8 @@ "docstrings": [ "Uncurried version of [forEach](#forEach)." ], - "signature": "let forEachU: (t<'a>, 'a => 'b) => unit" + "signature": "let forEachU: (t<'a>, 'a => 'b) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.List.forEach", @@ -7570,7 +7729,8 @@ "docstrings": [ "Uncurried version of [forEachWithIndex](#forEachWithIndex)." ], - "signature": "let forEachWithIndexU: (t<'a>, (int, 'a) => 'b) => unit" + "signature": "let forEachWithIndexU: (t<'a>, (int, 'a) => 'b) => unit", + "deprecated": "Use `forEachWithIndex` instead" }, { "id": "Belt.List.forEachWithIndex", @@ -7588,7 +7748,8 @@ "docstrings": [ "Uncurried version of [reduce](#reduce)." ], - "signature": "let reduceU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.List.reduce", @@ -7606,7 +7767,8 @@ "docstrings": [ "Uncurried version of [reduceWithIndex](#reduceWithIndex)." ], - "signature": "let reduceWithIndexU: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + "signature": "let reduceWithIndexU: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b", + "deprecated": "Use `reduceWithIndex` instead" }, { "id": "Belt.List.reduceWithIndex", @@ -7624,7 +7786,8 @@ "docstrings": [ "Uncurried version of [reduceReverse](#reduceReverse)." ], - "signature": "let reduceReverseU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "signature": "let reduceReverseU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b", + "deprecated": "Use `reduceReverse` instead" }, { "id": "Belt.List.reduceReverse", @@ -7642,7 +7805,8 @@ "docstrings": [ "Uncurried version of [mapReverse2](#mapReverse2)." ], - "signature": "let mapReverse2U: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "signature": "let mapReverse2U: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", + "deprecated": "Use `mapReverse2` instead" }, { "id": "Belt.List.mapReverse2", @@ -7660,7 +7824,8 @@ "docstrings": [ "Uncurried version of [forEach2](#forEach2)." ], - "signature": "let forEach2U: (t<'a>, t<'b>, ('a, 'b) => 'c) => unit" + "signature": "let forEach2U: (t<'a>, t<'b>, ('a, 'b) => 'c) => unit", + "deprecated": "Use `forEach2` instead" }, { "id": "Belt.List.forEach2", @@ -7678,7 +7843,8 @@ "docstrings": [ "Uncurried version of [reduce2](#reduce2)." ], - "signature": "let reduce2U: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" + "signature": "let reduce2U: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a", + "deprecated": "Use `reduce2` instead" }, { "id": "Belt.List.reduce2", @@ -7696,7 +7862,8 @@ "docstrings": [ "Uncurried version of [reduceReverse2](#reduceReverse2)." ], - "signature": "let reduceReverse2U: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" + "signature": "let reduceReverse2U: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c", + "deprecated": "Use `reduceReverse2` instead" }, { "id": "Belt.List.reduceReverse2", @@ -7714,7 +7881,8 @@ "docstrings": [ "Uncurried version of [every](#every)." ], - "signature": "let everyU: (t<'a>, 'a => bool) => bool" + "signature": "let everyU: (t<'a>, 'a => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.List.every", @@ -7732,7 +7900,8 @@ "docstrings": [ "Uncurried version of [some](#some)." ], - "signature": "let someU: (t<'a>, 'a => bool) => bool" + "signature": "let someU: (t<'a>, 'a => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.List.some", @@ -7750,7 +7919,8 @@ "docstrings": [ "Uncurried version of [every2](#every2)." ], - "signature": "let every2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "signature": "let every2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool", + "deprecated": "Use `every2` instead" }, { "id": "Belt.List.every2", @@ -7768,7 +7938,8 @@ "docstrings": [ "Uncurried version of [some2](#some2)." ], - "signature": "let some2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "signature": "let some2U: (t<'a>, t<'b>, ('a, 'b) => bool) => bool", + "deprecated": "Use `some2` instead" }, { "id": "Belt.List.some2", @@ -7795,7 +7966,8 @@ "docstrings": [ "Uncurried version of [cmp](#cmp)." ], - "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int" + "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.List.cmp", @@ -7813,7 +7985,8 @@ "docstrings": [ "Uncurried version of [eq](#eq)." ], - "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.List.eq", @@ -7831,7 +8004,8 @@ "docstrings": [ "Uncurried version of [has](#has)." ], - "signature": "let hasU: (t<'a>, 'b, ('a, 'b) => bool) => bool" + "signature": "let hasU: (t<'a>, 'b, ('a, 'b) => bool) => bool", + "deprecated": "Use `has` instead" }, { "id": "Belt.List.has", @@ -7849,7 +8023,8 @@ "docstrings": [ "Uncurried version of [getBy](#getBy)." ], - "signature": "let getByU: (t<'a>, 'a => bool) => option<'a>" + "signature": "let getByU: (t<'a>, 'a => bool) => option<'a>", + "deprecated": "Use `getBy` instead" }, { "id": "Belt.List.getBy", @@ -7867,7 +8042,8 @@ "docstrings": [ "Uncurried version of [keep](#keep)." ], - "signature": "let keepU: (t<'a>, 'a => bool) => t<'a>" + "signature": "let keepU: (t<'a>, 'a => bool) => t<'a>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.List.keep", @@ -7895,7 +8071,8 @@ "docstrings": [ "Uncurried version of [keepWithIndex](#keepWithIndex)." ], - "signature": "let keepWithIndexU: (t<'a>, ('a, int) => bool) => t<'a>" + "signature": "let keepWithIndexU: (t<'a>, ('a, int) => bool) => t<'a>", + "deprecated": "Use `keepWithIndex` instead" }, { "id": "Belt.List.keepWithIndex", @@ -7923,7 +8100,8 @@ "docstrings": [ "Uncurried version of [keepMap](#keepMap)." ], - "signature": "let keepMapU: (t<'a>, 'a => option<'b>) => t<'b>" + "signature": "let keepMapU: (t<'a>, 'a => option<'b>) => t<'b>", + "deprecated": "Use `keepMap` instead" }, { "id": "Belt.List.keepMap", @@ -7941,14 +8119,15 @@ "docstrings": [ "Uncurried version of [partition](#partition)." ], - "signature": "let partitionU: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" + "signature": "let partitionU: (t<'a>, 'a => bool) => (t<'a>, t<'a>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.List.partition", "kind": "value", "name": "partition", "docstrings": [ - "Creates a pair of lists; the first list consists of all elements of `someList` that satisfy the predicate function `pred`; the second list consists of all elements of `someList` that _do not_ satisfy `pred.\n\nIn other words:\n\n```rescript\n(elementsThatSatisfies, elementsThatDoesNotSatisfy)\n```\n\n## Examples\n\n```rescript\nBelt.List.partition(list{1, 2, 3, 4}, x => x > 2) /* (list{3, 4}, list{1, 2}) */\n```" + "Creates a pair of lists; the first list consists of all elements of `someList` that satisfy the predicate function `pred`; the second list consists of all elements of `someList` that _do not_ satisfy `pred.\n\nIn other words:\n\n```\n(elementsThatSatisfies, elementsThatDoesNotSatisfy)\n```\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}\n->Belt.List.partition(x => x > 2)\n->assertEqual((list{3, 4}, list{1, 2}))\n```" ], "signature": "let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" }, @@ -7968,7 +8147,8 @@ "docstrings": [ "Uncurried version of [getAssoc](#getAssoc)." ], - "signature": "let getAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>" + "signature": "let getAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>", + "deprecated": "Use `getAssoc` instead" }, { "id": "Belt.List.getAssoc", @@ -7986,7 +8166,8 @@ "docstrings": [ "Uncurried version of [hasAssoc](#hasAssoc)." ], - "signature": "let hasAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool" + "signature": "let hasAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool", + "deprecated": "Use `hasAssoc` instead" }, { "id": "Belt.List.hasAssoc", @@ -8004,7 +8185,8 @@ "docstrings": [ "Uncurried version of [removeAssoc](#removeAssoc)." ], - "signature": "let removeAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>" + "signature": "let removeAssocU: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>", + "deprecated": "Use `removeAssoc` instead" }, { "id": "Belt.List.removeAssoc", @@ -8022,7 +8204,8 @@ "docstrings": [ "Uncurried version of [setAssoc](#setAssoc)." ], - "signature": "let setAssocU: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>" + "signature": "let setAssocU: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>", + "deprecated": "Use `setAssoc` instead" }, { "id": "Belt.List.setAssoc", @@ -8040,7 +8223,8 @@ "docstrings": [ "Uncurried version of [sort](#sort)." ], - "signature": "let sortU: (t<'a>, ('a, 'a) => int) => t<'a>" + "signature": "let sortU: (t<'a>, ('a, 'a) => int) => t<'a>", + "deprecated": "Use `sort` instead" }, { "id": "Belt.List.sort", @@ -8149,7 +8333,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a>, 'a => unit) => unit" + "signature": "let forEachU: (t<'a>, 'a => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableStack.forEach", @@ -8163,7 +8348,8 @@ "kind": "value", "name": "dynamicPopIterU", "docstrings": [], - "signature": "let dynamicPopIterU: (t<'a>, 'a => unit) => unit" + "signature": "let dynamicPopIterU: (t<'a>, 'a => unit) => unit", + "deprecated": "Use `dynamicPopIter` instead" }, { "id": "Belt.MutableStack.dynamicPopIter", @@ -8315,7 +8501,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let mapU: (t<'a>, 'a => 'b) => t<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.MutableQueue.map", @@ -8329,7 +8516,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a>, 'a => unit) => unit" + "signature": "let forEachU: (t<'a>, 'a => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.MutableQueue.forEach", @@ -8345,7 +8533,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "signature": "let reduceU: (t<'a>, 'b, ('b, 'a) => 'b) => 'b", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.MutableQueue.reduce", @@ -8389,7 +8578,8 @@ "kind": "value", "name": "strictlySortedLengthU", "docstrings": [], - "signature": "let strictlySortedLengthU: (array<'a>, ('a, 'a) => bool) => int" + "signature": "let strictlySortedLengthU: (array<'a>, ('a, 'a) => bool) => int", + "deprecated": "Use `strictlySortedLength` instead" }, { "id": "Belt.SortArray.strictlySortedLength", @@ -8405,7 +8595,8 @@ "kind": "value", "name": "isSortedU", "docstrings": [], - "signature": "let isSortedU: (array<'a>, ('a, 'a) => int) => bool" + "signature": "let isSortedU: (array<'a>, ('a, 'a) => int) => bool", + "deprecated": "Use `isSorted` instead" }, { "id": "Belt.SortArray.isSorted", @@ -8421,7 +8612,8 @@ "kind": "value", "name": "stableSortInPlaceByU", "docstrings": [], - "signature": "let stableSortInPlaceByU: (array<'a>, ('a, 'a) => int) => unit" + "signature": "let stableSortInPlaceByU: (array<'a>, ('a, 'a) => int) => unit", + "deprecated": "Use `stableSortInPlaceBy` instead" }, { "id": "Belt.SortArray.stableSortInPlaceBy", @@ -8435,7 +8627,8 @@ "kind": "value", "name": "stableSortByU", "docstrings": [], - "signature": "let stableSortByU: (array<'a>, ('a, 'a) => int) => array<'a>" + "signature": "let stableSortByU: (array<'a>, ('a, 'a) => int) => array<'a>", + "deprecated": "Use `stableSortBy` instead" }, { "id": "Belt.SortArray.stableSortBy", @@ -8451,7 +8644,8 @@ "kind": "value", "name": "binarySearchByU", "docstrings": [], - "signature": "let binarySearchByU: (array<'a>, 'a, ('a, 'a) => int) => int" + "signature": "let binarySearchByU: (array<'a>, 'a, ('a, 'a) => int) => int", + "deprecated": "Use `binarySearchBy` instead" }, { "id": "Belt.SortArray.binarySearchBy", @@ -8467,7 +8661,8 @@ "kind": "value", "name": "unionU", "docstrings": [], - "signature": "let unionU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int" + "signature": "let unionU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int", + "deprecated": "Use `union` instead" }, { "id": "Belt.SortArray.union", @@ -8483,7 +8678,8 @@ "kind": "value", "name": "intersectU", "docstrings": [], - "signature": "let intersectU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int" + "signature": "let intersectU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int", + "deprecated": "Use `intersect` instead" }, { "id": "Belt.SortArray.intersect", @@ -8499,7 +8695,8 @@ "kind": "value", "name": "diffU", "docstrings": [], - "signature": "let diffU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int" + "signature": "let diffU: (\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n int,\n array<'a>,\n int,\n ('a, 'a) => int,\n) => int", + "deprecated": "Use `diff` instead" }, { "id": "Belt.SortArray.diff", @@ -8690,7 +8887,8 @@ "kind": "value", "name": "makeByU", "docstrings": [], - "signature": "let makeByU: (int, int => 'a) => t<'a>" + "signature": "let makeByU: (int, int => 'a) => t<'a>", + "deprecated": "Use `makeBy` instead" }, { "id": "Belt.Array.makeBy", @@ -8706,7 +8904,8 @@ "kind": "value", "name": "makeByAndShuffleU", "docstrings": [], - "signature": "let makeByAndShuffleU: (int, int => 'a) => t<'a>" + "signature": "let makeByAndShuffleU: (int, int => 'a) => t<'a>", + "deprecated": "Use `makeByAndShuffle` instead" }, { "id": "Belt.Array.makeByAndShuffle", @@ -8731,7 +8930,8 @@ "kind": "value", "name": "zipByU", "docstrings": [], - "signature": "let zipByU: (t<'a>, array<'b>, ('a, 'b) => 'c) => array<'c>" + "signature": "let zipByU: (t<'a>, array<'b>, ('a, 'b) => 'c) => array<'c>", + "deprecated": "Use `zipBy` instead" }, { "id": "Belt.Array.zipBy", @@ -8801,7 +9001,7 @@ "kind": "value", "name": "fill", "docstrings": [ - "`fill(arr, ~offset, ~len, x)` modifies `arr` in place, storing `x` in elements\nnumber `offset` to `offset + len - 1`. `offset` can be negative; and is evaluated\nas `length(arr - offset)`.\n\n`fill(arr, ~offset=-1, ~len=1)` means fill the last element, if the array does not have enough data; `fill` will ignore it\n\n## Examples\n\n```rescript\nlet arr = Belt.Array.makeBy(5, (i) => i)\n\nBelt.Array.fill(arr, ~offset=2, ~len=2, 9)\n\narr == [0, 1, 9, 9, 4]\n\nBelt.Array.fill(arr, ~offset=7, ~len=2, 8)\n\narr == [0, 1, 9, 9, 4]" + "`fill(arr, ~offset, ~len, x)` modifies `arr` in place, storing `x` in elements\nnumber `offset` to `offset + len - 1`. `offset` can be negative; and is evaluated\nas `length(arr - offset)`.\n\n`fill(arr, ~offset=-1, ~len=1)` means fill the last element, if the array does not have enough data; `fill` will ignore it\n\n## Examples\n\n```rescript\nlet arr = Belt.Array.makeBy(5, (i) => i)\n\nBelt.Array.fill(arr, ~offset=2, ~len=2, 9)\n\narr == [0, 1, 9, 9, 4]\n\nBelt.Array.fill(arr, ~offset=7, ~len=2, 8)\n\narr == [0, 1, 9, 9, 4]\n```" ], "signature": "let fill: (t<'a>, ~offset: int, ~len: int, 'a) => unit" }, @@ -8828,7 +9028,8 @@ "kind": "value", "name": "forEachU", "docstrings": [], - "signature": "let forEachU: (t<'a>, 'a => unit) => unit" + "signature": "let forEachU: (t<'a>, 'a => unit) => unit", + "deprecated": "Use `forEach` instead" }, { "id": "Belt.Array.forEach", @@ -8844,7 +9045,8 @@ "kind": "value", "name": "mapU", "docstrings": [], - "signature": "let mapU: (t<'a>, 'a => 'b) => array<'b>" + "signature": "let mapU: (t<'a>, 'a => 'b) => array<'b>", + "deprecated": "Use `map` instead" }, { "id": "Belt.Array.map", @@ -8860,7 +9062,8 @@ "kind": "value", "name": "flatMapU", "docstrings": [], - "signature": "let flatMapU: (t<'a>, 'a => array<'b>) => array<'b>" + "signature": "let flatMapU: (t<'a>, 'a => array<'b>) => array<'b>", + "deprecated": "Use `flatMap` instead" }, { "id": "Belt.Array.flatMap", @@ -8876,7 +9079,8 @@ "kind": "value", "name": "getByU", "docstrings": [], - "signature": "let getByU: (t<'a>, 'a => bool) => option<'a>" + "signature": "let getByU: (t<'a>, 'a => bool) => option<'a>", + "deprecated": "Use `getBy` instead" }, { "id": "Belt.Array.getBy", @@ -8892,7 +9096,8 @@ "kind": "value", "name": "getIndexByU", "docstrings": [], - "signature": "let getIndexByU: (t<'a>, 'a => bool) => option" + "signature": "let getIndexByU: (t<'a>, 'a => bool) => option", + "deprecated": "Use `getIndexBy` instead" }, { "id": "Belt.Array.getIndexBy", @@ -8908,7 +9113,8 @@ "kind": "value", "name": "keepU", "docstrings": [], - "signature": "let keepU: (t<'a>, 'a => bool) => t<'a>" + "signature": "let keepU: (t<'a>, 'a => bool) => t<'a>", + "deprecated": "Use `keep` instead" }, { "id": "Belt.Array.keep", @@ -8924,7 +9130,8 @@ "kind": "value", "name": "keepWithIndexU", "docstrings": [], - "signature": "let keepWithIndexU: (t<'a>, ('a, int) => bool) => t<'a>" + "signature": "let keepWithIndexU: (t<'a>, ('a, int) => bool) => t<'a>", + "deprecated": "Use `keepWithIndex` instead" }, { "id": "Belt.Array.keepWithIndex", @@ -8940,7 +9147,8 @@ "kind": "value", "name": "keepMapU", "docstrings": [], - "signature": "let keepMapU: (t<'a>, 'a => option<'b>) => array<'b>" + "signature": "let keepMapU: (t<'a>, 'a => option<'b>) => array<'b>", + "deprecated": "Use `keepMap` instead" }, { "id": "Belt.Array.keepMap", @@ -8956,7 +9164,8 @@ "kind": "value", "name": "forEachWithIndexU", "docstrings": [], - "signature": "let forEachWithIndexU: (t<'a>, (int, 'a) => unit) => unit" + "signature": "let forEachWithIndexU: (t<'a>, (int, 'a) => unit) => unit", + "deprecated": "Use `forEachWithIndex` instead" }, { "id": "Belt.Array.forEachWithIndex", @@ -8972,7 +9181,8 @@ "kind": "value", "name": "mapWithIndexU", "docstrings": [], - "signature": "let mapWithIndexU: (t<'a>, (int, 'a) => 'b) => array<'b>" + "signature": "let mapWithIndexU: (t<'a>, (int, 'a) => 'b) => array<'b>", + "deprecated": "Use `mapWithIndex` instead" }, { "id": "Belt.Array.mapWithIndex", @@ -8988,7 +9198,8 @@ "kind": "value", "name": "partitionU", "docstrings": [], - "signature": "let partitionU: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" + "signature": "let partitionU: (t<'a>, 'a => bool) => (t<'a>, t<'a>)", + "deprecated": "Use `partition` instead" }, { "id": "Belt.Array.partition", @@ -9004,7 +9215,8 @@ "kind": "value", "name": "reduceU", "docstrings": [], - "signature": "let reduceU: (array<'b>, 'a, ('a, 'b) => 'a) => 'a" + "signature": "let reduceU: (array<'b>, 'a, ('a, 'b) => 'a) => 'a", + "deprecated": "Use `reduce` instead" }, { "id": "Belt.Array.reduce", @@ -9020,7 +9232,8 @@ "kind": "value", "name": "reduceReverseU", "docstrings": [], - "signature": "let reduceReverseU: (array<'b>, 'a, ('a, 'b) => 'a) => 'a" + "signature": "let reduceReverseU: (array<'b>, 'a, ('a, 'b) => 'a) => 'a", + "deprecated": "Use `reduceReverse` instead" }, { "id": "Belt.Array.reduceReverse", @@ -9036,7 +9249,8 @@ "kind": "value", "name": "reduceReverse2U", "docstrings": [], - "signature": "let reduceReverse2U: (t<'a>, array<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" + "signature": "let reduceReverse2U: (t<'a>, array<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c", + "deprecated": "Use `reduceReverse2` instead" }, { "id": "Belt.Array.reduceReverse2", @@ -9052,7 +9266,8 @@ "kind": "value", "name": "reduceWithIndexU", "docstrings": [], - "signature": "let reduceWithIndexU: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + "signature": "let reduceWithIndexU: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b", + "deprecated": "Use `reduceWithIndex` instead" }, { "id": "Belt.Array.reduceWithIndex", @@ -9068,7 +9283,8 @@ "kind": "value", "name": "joinWithU", "docstrings": [], - "signature": "let joinWithU: (t<'a>, string, 'a => string) => string" + "signature": "let joinWithU: (t<'a>, string, 'a => string) => string", + "deprecated": "Use `joinWith` instead" }, { "id": "Belt.Array.joinWith", @@ -9084,7 +9300,8 @@ "kind": "value", "name": "someU", "docstrings": [], - "signature": "let someU: (t<'a>, 'a => bool) => bool" + "signature": "let someU: (t<'a>, 'a => bool) => bool", + "deprecated": "Use `some` instead" }, { "id": "Belt.Array.some", @@ -9100,7 +9317,8 @@ "kind": "value", "name": "everyU", "docstrings": [], - "signature": "let everyU: (t<'a>, 'a => bool) => bool" + "signature": "let everyU: (t<'a>, 'a => bool) => bool", + "deprecated": "Use `every` instead" }, { "id": "Belt.Array.every", @@ -9116,7 +9334,8 @@ "kind": "value", "name": "every2U", "docstrings": [], - "signature": "let every2U: (t<'a>, array<'b>, ('a, 'b) => bool) => bool" + "signature": "let every2U: (t<'a>, array<'b>, ('a, 'b) => bool) => bool", + "deprecated": "Use `every2` instead" }, { "id": "Belt.Array.every2", @@ -9132,7 +9351,8 @@ "kind": "value", "name": "some2U", "docstrings": [], - "signature": "let some2U: (t<'a>, array<'b>, ('a, 'b) => bool) => bool" + "signature": "let some2U: (t<'a>, array<'b>, ('a, 'b) => bool) => bool", + "deprecated": "Use `some2` instead" }, { "id": "Belt.Array.some2", @@ -9148,7 +9368,8 @@ "kind": "value", "name": "cmpU", "docstrings": [], - "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int" + "signature": "let cmpU: (t<'a>, t<'a>, ('a, 'a) => int) => int", + "deprecated": "Use `cmp` instead" }, { "id": "Belt.Array.cmp", @@ -9164,7 +9385,8 @@ "kind": "value", "name": "eqU", "docstrings": [], - "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "signature": "let eqU: (t<'a>, t<'a>, ('a, 'a) => bool) => bool", + "deprecated": "Use `eq` instead" }, { "id": "Belt.Array.eq", @@ -9189,7 +9411,8 @@ "kind": "value", "name": "initU", "docstrings": [], - "signature": "let initU: (int, int => 'a) => t<'a>" + "signature": "let initU: (int, int => 'a) => t<'a>", + "deprecated": "Use `init` instead" }, { "id": "Belt.Array.init", @@ -9258,15 +9481,14 @@ "kind": "value", "name": "comparableU", "docstrings": [], - "signature": "let comparableU: (\n ~cmp: ('a, 'a) => int,\n) => module(Comparable with type t = 'a)" + "signature": "let comparableU: (\n ~cmp: ('a, 'a) => int,\n) => module(Comparable with type t = 'a)", + "deprecated": "Use `comparable` instead" }, { "id": "Belt.Id.comparable", "kind": "value", "name": "comparable", - "docstrings": [ - "## Examples\n\n```rescript\nmodule C = (\n val Belt.Id.comparable ~cmp:(compare : int -> int -> int)\n)\nlet m = Belt.Set.make(module C)\n```\nNote that the name of C can not be ignored" - ], + "docstrings": [], "signature": "let comparable: (\n ~cmp: ('a, 'a) => int,\n) => module(Comparable with type t = 'a)" }, { @@ -9283,7 +9505,8 @@ "kind": "value", "name": "hashableU", "docstrings": [], - "signature": "let hashableU: (\n ~hash: 'a => int,\n ~eq: ('a, 'a) => bool,\n) => module(Hashable with type t = 'a)" + "signature": "let hashableU: (\n ~hash: 'a => int,\n ~eq: ('a, 'a) => bool,\n) => module(Hashable with type t = 'a)", + "deprecated": "Use `hashable` instead" }, { "id": "Belt.Id.hashable", diff --git a/data/api/v12.0.0/core.json b/data/api/v12.0.0/core.json index ab511e0aa..a5bc9ccf4 100644 --- a/data/api/v12.0.0/core.json +++ b/data/api/v12.0.0/core.json @@ -11,14 +11,14 @@ "docstrings": [ "An `id` representing a timeout started via `setTimeout`.\n\nSee [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) on MDN." ], - "signature": "type timeoutId = Js.Global.timeoutId" + "signature": "type timeoutId = Global.timeoutId" }, { "id": "Core.setTimeout", "kind": "value", "name": "setTimeout", "docstrings": [ - "`setTimeout(callback, durationInMilliseconds)` starts a timer that will execute `callback` after `durationInMilliseconds`.\n\nSee [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) on MDN.\n\n## Examples\n```rescript\n// Log to the console after 2 seconds (2000 milliseconds).\nlet timeoutId = setTimeout(() => {\n Console.log(\"This prints in 2 seconds.\")\n}, 2000)\n```" + "`setTimeout(callback, durationInMilliseconds)` starts a timer that will execute `callback` after `durationInMilliseconds`.\n\nSee [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) on MDN.\n\n## Examples\n\n```rescript\n// Log to the console after 200 milliseconds.\nlet timeoutId = setTimeout(() => {\n Console.log(\"This prints in 200 ms.\")\n}, 200)\n```" ], "signature": "let setTimeout: (unit => unit, int) => timeoutId" }, @@ -27,7 +27,7 @@ "kind": "value", "name": "setTimeoutFloat", "docstrings": [ - "`setTimeoutFloat(callback, durationInMilliseconds)` starts a timer that will execute `callback` after `durationInMilliseconds`.\n\nThe same as `setTimeout`, but allows you to pass a `float` instead of an `int` for the duration.\n\nSee [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) on MDN.\n\n## Examples\n```rescript\n// Log to the console after 2 seconds (2000 milliseconds).\nlet timeoutId = setTimeoutFloat(() => {\n Console.log(\"This prints in 2 seconds.\")\n}, 2000.)\n```" + "`setTimeoutFloat(callback, durationInMilliseconds)` starts a timer that will execute `callback` after `durationInMilliseconds`.\n\nThe same as `setTimeout`, but allows you to pass a `float` instead of an `int` for the duration.\n\nSee [`setTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) on MDN.\n\n## Examples\n\n```rescript\n// Log to the console after 200 milliseconds.\nlet timeoutId = setTimeoutFloat(() => {\n Console.log(\"This prints in 200 ms.\")\n}, 200.)\n```" ], "signature": "let setTimeoutFloat: (unit => unit, float) => timeoutId" }, @@ -36,7 +36,7 @@ "kind": "value", "name": "clearTimeout", "docstrings": [ - "`clearTimeout(timeoutId)` clears a scheduled timeout if it hasn't already executed.\n\nSee [`clearTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout) on MDN.\n\n## Examples\n```rescript\nlet timeoutId = setTimeout(() => {\n Console.log(\"This prints in 2 seconds.\")\n}, 2000)\n\n// Clearing the timeout right away, before 2 seconds has passed, means that the above callback logging to the console will never run.\nclearTimeout(timeoutId)\n```" + "`clearTimeout(timeoutId)` clears a scheduled timeout if it hasn't already executed.\n\nSee [`clearTimeout`](https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout) on MDN.\n\n## Examples\n\n```rescript\nlet timeoutId = setTimeout(() => {\n Console.log(\"This prints in 2 seconds.\")\n}, 2000)\n\n// Clearing the timeout right away, before 2 seconds has passed, means that the above callback logging to the console will never run.\nclearTimeout(timeoutId)\n```" ], "signature": "let clearTimeout: timeoutId => unit" }, @@ -47,14 +47,14 @@ "docstrings": [ "An `id` representing an interval started via `setInterval`.\n\nSee [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) on MDN." ], - "signature": "type intervalId = Js.Global.intervalId" + "signature": "type intervalId = Global.intervalId" }, { "id": "Core.setInterval", "kind": "value", "name": "setInterval", "docstrings": [ - "`setInterval(callback, intervalInMilliseconds)` starts an interval that will execute `callback` every `durationInMilliseconds` milliseconds.\n\nSee [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) on MDN.\n\n## Examples\n```rescript\n// Log to the console ever 2 seconds (2000 milliseconds).\nlet intervalId = setInterval(() => {\n Console.log(\"This prints every 2 seconds.\")\n}, 2000)\n```" + "`setInterval(callback, intervalInMilliseconds)` starts an interval that will execute `callback` every `durationInMilliseconds` milliseconds.\n\nSee [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) on MDN.\n\n## Examples\n\n```rescript\n// Log to the console ever 200 ms (200 milliseconds).\nlet intervalId = setInterval(() => {\n Console.log(\"This prints every 200 ms.\")\n}, 200)\n\nlet timeoutId = setTimeout(() => {\n clearInterval(intervalId)\n}, 500)\n```" ], "signature": "let setInterval: (unit => unit, int) => intervalId" }, @@ -63,7 +63,7 @@ "kind": "value", "name": "setIntervalFloat", "docstrings": [ - "`setIntervalFloat(callback, intervalInMilliseconds)` starts an interval that will execute `callback` every `durationInMilliseconds` milliseconds.\n\nThe same as `setInterval`, but allows you to pass a `float` instead of an `int` for the duration.\n\nSee [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) on MDN.\n\n## Examples\n```rescript\n// Log to the console ever 2 seconds (2000 milliseconds).\nlet intervalId = setIntervalFloat(() => {\n Console.log(\"This prints every 2 seconds.\")\n}, 2000.)\n```" + "`setIntervalFloat(callback, intervalInMilliseconds)` starts an interval that will execute `callback` every `durationInMilliseconds` milliseconds.\n\nThe same as `setInterval`, but allows you to pass a `float` instead of an `int` for the duration.\n\nSee [`setInterval`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) on MDN.\n\n## Examples\n\n```rescript\n// Log to the console ever 2 seconds (200 milliseconds).\nlet intervalId = setIntervalFloat(() => {\n Console.log(\"This prints every 200 ms\")\n}, 200.)\n\n// Stop the interval after 500 ms\nlet timeoutId = setTimeoutFloat(() => {\n clearInterval(intervalId)\n}, 500.0)\n```" ], "signature": "let setIntervalFloat: (unit => unit, float) => intervalId" }, @@ -72,7 +72,7 @@ "kind": "value", "name": "clearInterval", "docstrings": [ - "`clearInterval(intervalId)` clears a scheduled interval.\n\nSee [`clearInterval`](https://developer.mozilla.org/en-US/docs/Web/API/clearInterval) on MDN.\n\n## Examples\n```rescript\nlet intervalId = setInterval(() => {\n Console.log(\"This prints in 2 seconds.\")\n}, 2000)\n\n// Stop the interval after 10 seconds\nlet timeoutId = setTimeout(() => {\n clearInterval(intervalId)\n}, 10000)\n```" + "`clearInterval(intervalId)` clears a scheduled interval.\n\nSee [`clearInterval`](https://developer.mozilla.org/en-US/docs/Web/API/clearInterval) on MDN.\n\n## Examples\n\n```rescript\nlet intervalId = setInterval(() => {\n Console.log(\"This prints in 100 ms\")\n}, 100)\n\n// Stop the interval after 500 ms\nlet timeoutId = setTimeout(() => {\n clearInterval(intervalId)\n}, 500)\n```" ], "signature": "let clearInterval: intervalId => unit" }, @@ -112,19 +112,49 @@ ], "signature": "let decodeURIComponent: string => string" }, + { + "id": "Core.date", + "kind": "type", + "name": "date", + "docstrings": [], + "signature": "type date = Date.t" + }, + { + "id": "Core.null", + "kind": "type", + "name": "null", + "docstrings": [], + "signature": "type null<'a> = null<'a>" + }, + { + "id": "Core.undefined", + "kind": "type", + "name": "undefined", + "docstrings": [], + "signature": "type undefined<'a> = undefined<'a>" + }, + { + "id": "Core.nullable", + "kind": "type", + "name": "nullable", + "docstrings": [], + "signature": "type nullable<'a> = nullable<'a>" + }, { "id": "Core.window", "kind": "value", "name": "window", "docstrings": [], - "signature": "let window: Dom.window" + "signature": "let window: Dom.window", + "deprecated": "Use rescript-webapi instead" }, { "id": "Core.document", "kind": "value", "name": "document", "docstrings": [], - "signature": "let document: Dom.document" + "signature": "let document: Dom.document", + "deprecated": "Use rescript-webapi instead" }, { "id": "Core.globalThis", @@ -134,62 +164,50 @@ "signature": "let globalThis: {..}" }, { - "id": "Core.null", - "kind": "value", - "name": "null", - "docstrings": [], - "signature": "let null: Core__Nullable.t<'a>" - }, - { - "id": "Core.undefined", + "id": "Core.import", "kind": "value", - "name": "undefined", - "docstrings": [], - "signature": "let undefined: Core__Nullable.t<'a>" + "name": "import", + "docstrings": [ + "`import(value)` dynamically import a value or function from a ReScript\nmodule. The import call will return a `promise`, resolving to the dynamically loaded\nvalue.\n\n## Examples\n\n`Array.res` file:\n\n```rescript\n@send external indexOf: (array<'a>, 'a) => int = \"indexOf\"\n\nlet indexOfOpt = (arr, item) =>\n switch arr->indexOf(item) {\n | -1 => None\n | index => Some(index)\n }\n```\nIn other file you can import the `indexOfOpt` value defined in `Array.res`\n\n```rescript\nlet main = async () => {\n let indexOfOpt = await import(Array.indexOfOpt)\n let index = indexOfOpt([1, 2], 2)\n Console.log(index)\n}\n```\n\nCompiles to:\n\n```javascript\nasync function main() {\n var add = await import(\"./Array.mjs\").then(function(m) {\n return m.indexOfOpt;\n });\n var index = indexOfOpt([1, 2], 2);\n console.log(index);\n}\n```" + ], + "signature": "let import: 'a => promise<'a>" }, { - "id": "Core.typeof", + "id": "Core.panic", "kind": "value", - "name": "typeof", + "name": "panic", "docstrings": [], - "signature": "let typeof: 'a => Core__Type.t" + "signature": "let panic: string => 'a" }, { - "id": "Core.import", + "id": "Core.assertEqual", "kind": "value", - "name": "import", + "name": "assertEqual", "docstrings": [ - "`import(value)` dynamically import a value or function from a ReScript\nmodule. The import call will return a `promise`, resolving to the dynamically loaded\nvalue.\n\n## Examples\n\n`Core__Array.res` file:\n\n```rescript\n@send external indexOf: (array<'a>, 'a) => int = \"indexOf\"\n\nlet indexOfOpt = (arr, item) =>\n switch arr->indexOf(item) {\n | -1 => None\n | index => Some(index)\n }\n```\nIn other file you can import the `indexOfOpt` value defined in `Core__Array.res`\n\n```rescript\nlet main = async () => {\n let indexOfOpt = await import(Core__Array.indexOfOpt)\n let index = indexOfOpt([1, 2], 2)\n Console.log(index)\n}\n```\n\nCompiles to:\n\n```javascript\nasync function main() {\n var add = await import(\"./Core__Array.mjs\").then(function(m) {\n return m.indexOfOpt;\n });\n var index = indexOfOpt([1, 2], 2);\n console.log(index);\n}\n```" + "`assertEqual(a, b)` check if `a` is equal `b`. If not raise a panic exception\n\n## Examples\n\n```rescript\nlist{1, 2}\n->List.tailExn\n->assertEqual(list{2})\n```" ], - "signature": "let import: 'a => promise<'a>" + "signature": "let assertEqual: ('a, 'a) => unit" }, { "id": "Core.null", - "kind": "type", + "kind": "value", "name": "null", "docstrings": [], - "signature": "type null<'a> = Js.null<'a>" + "signature": "let null: nullable<'a>" }, { "id": "Core.undefined", - "kind": "type", + "kind": "value", "name": "undefined", "docstrings": [], - "signature": "type undefined<'a> = Js.undefined<'a>" + "signature": "let undefined: nullable<'a>" }, { - "id": "Core.nullable", - "kind": "type", - "name": "nullable", - "docstrings": [], - "signature": "type nullable<'a> = Js.nullable<'a>" - }, - { - "id": "Core.panic", + "id": "Core.typeof", "kind": "value", - "name": "panic", + "name": "typeof", "docstrings": [], - "signature": "let panic: string => 'a" + "signature": "let typeof: 'a => Type.t" } ] }, @@ -235,1809 +253,1880 @@ } ] }, - "core/intl/segments": { - "id": "Core.Intl.Segments", - "name": "Segments", - "docstrings": [ - "A Segments instance is an object that represents the segments of a specific string, subject to the locale and options of its constructing Intl.Segmenter instance.\nhttps://tc39.es/ecma402/#sec-segments-objects" - ], + "core/biguint64array/constants": { + "id": "Core.BigUint64Array.Constants", + "name": "Constants", + "docstrings": [], "items": [ { - "id": "Core.Intl.Segments.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.Segments.segmentData", - "kind": "type", - "name": "segmentData", - "docstrings": [], - "signature": "type segmentData = {\n segment: string,\n index: int,\n isWordLike: option,\n input: string,\n}" - }, - { - "id": "Core.Intl.Segments.containing", + "id": "Core.BigUint64Array.Constants.bytesPerElement", "kind": "value", - "name": "containing", - "docstrings": [], - "signature": "let containing: t => segmentData" - }, + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/bigint64array/constants": { + "id": "Core.BigInt64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.Segments.containingWithIndex", + "id": "Core.BigInt64Array.Constants.bytesPerElement", "kind": "value", - "name": "containingWithIndex", - "docstrings": [], - "signature": "let containingWithIndex: (t, int) => segmentData" + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" } ] }, - "core/intl/segmenter": { - "id": "Core.Intl.Segmenter", - "name": "Segmenter", - "docstrings": [ - "Not supported in Firefox" - ], + "core/uint8clampedarray/constants": { + "id": "Core.Uint8ClampedArray.Constants", + "name": "Constants", + "docstrings": [], "items": [ { - "id": "Core.Intl.Segmenter.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.Segmenter.granularity", - "kind": "type", - "name": "granularity", - "docstrings": [], - "signature": "type granularity = [#grapheme | #sentence | #word]" - }, - { - "id": "Core.Intl.Segmenter.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Core__Intl__Common.localeMatcher,\n granularity?: granularity,\n}" - }, - { - "id": "Core.Intl.Segmenter.pluralCategories", - "kind": "type", - "name": "pluralCategories", - "docstrings": [], - "signature": "type pluralCategories = [\n | #few\n | #many\n | #one\n | #other\n | #two\n | #zero\n]" - }, - { - "id": "Core.Intl.Segmenter.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n granularity: granularity,\n}" - }, - { - "id": "Core.Intl.Segmenter.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.Segmenter.make", + "id": "Core.Uint8ClampedArray.Constants.bytesPerElement", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/uint32array/constants": { + "id": "Core.Uint32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.Segmenter.supportedLocalesOf", + "id": "Core.Uint32Array.Constants.bytesPerElement", "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/uint16array/constants": { + "id": "Core.Uint16Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.Segmenter.resolvedOptions", + "id": "Core.Uint16Array.Constants.bytesPerElement", "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/uint8array/constants": { + "id": "Core.Uint8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.Segmenter.segment", + "id": "Core.Uint8Array.Constants.bytesPerElement", "kind": "value", - "name": "segment", - "docstrings": [], - "signature": "let segment: (t, string) => Core__Intl__Segments.t" + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" } ] }, - "core/intl/relativetimeformat": { - "id": "Core.Intl.RelativeTimeFormat", - "name": "RelativeTimeFormat", + "core/int32array/constants": { + "id": "Core.Int32Array.Constants", + "name": "Constants", "docstrings": [], "items": [ { - "id": "Core.Intl.RelativeTimeFormat.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, + "id": "Core.Int32Array.Constants.bytesPerElement", + "kind": "value", + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/int16array/constants": { + "id": "Core.Int16Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.RelativeTimeFormat.numeric", - "kind": "type", - "name": "numeric", - "docstrings": [], - "signature": "type numeric = [#always | #auto]" - }, - { - "id": "Core.Intl.RelativeTimeFormat.style", - "kind": "type", - "name": "style", - "docstrings": [], - "signature": "type style = [#long | #narrow | #short]" - }, + "id": "Core.Int16Array.Constants.bytesPerElement", + "kind": "value", + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/int8array/constants": { + "id": "Core.Int8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.RelativeTimeFormat.timeUnit", - "kind": "type", - "name": "timeUnit", - "docstrings": [], - "signature": "type timeUnit = [\n | #day\n | #hour\n | #minute\n | #month\n | #quarter\n | #second\n | #week\n | #year\n]" - }, + "id": "Core.Int8Array.Constants.bytesPerElement", + "kind": "value", + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/float64array/constants": { + "id": "Core.Float64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.RelativeTimeFormat.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Core__Intl__Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" - }, + "id": "Core.Float64Array.Constants.bytesPerElement", + "kind": "value", + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/float32array/constants": { + "id": "Core.Float32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" - }, + "id": "Core.Float32Array.Constants.bytesPerElement", + "kind": "value", + "name": "bytesPerElement", + "docstrings": [ + "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" + ], + "signature": "let bytesPerElement: int" + } + ] + }, + "core/type/classify": { + "id": "Core.Type.Classify", + "name": "Classify", + "docstrings": [], + "items": [ { - "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", + "id": "Core.Type.Classify.function", "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n numeric: numeric,\n style: style,\n numberingSystem: string,\n}" + "name": "function", + "docstrings": [ + "An abstract type representing a JavaScript function.\n\n See [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) on MDN." + ], + "signature": "type function" }, { - "id": "Core.Intl.RelativeTimeFormat.relativeTimePartComponent", + "id": "Core.Type.Classify.object", "kind": "type", - "name": "relativeTimePartComponent", - "docstrings": [], - "signature": "type relativeTimePartComponent = [#integer | #literal]" + "name": "object", + "docstrings": [ + "An abstract type representing a JavaScript object.\n\n See [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) on MDN." + ], + "signature": "type object" }, { - "id": "Core.Intl.RelativeTimeFormat.relativeTimePart", + "id": "Core.Type.Classify.t", "kind": "type", - "name": "relativeTimePart", - "docstrings": [], - "signature": "type relativeTimePart = {\n \\\"type\": relativeTimePartComponent,\n value: string,\n unit?: timeUnit,\n}" + "name": "t", + "docstrings": [ + "The type representing a classified JavaScript value." + ], + "signature": "type t =\n | Bool(bool)\n | Null\n | Undefined\n | String(string)\n | Number(float)\n | Object(object)\n | Function(function)\n | Symbol(Symbol.t)\n | BigInt(bigint)" }, { - "id": "Core.Intl.RelativeTimeFormat.make", + "id": "Core.Type.Classify.classify", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" + "name": "classify", + "docstrings": [ + "`classify(anyValue)`\nClassifies a JavaScript value.\n\n## Examples\n```rescript\nswitch %raw(`null`)->Type.Classify.classify {\n| Null => Console.log(\"Yup, that's null.\")\n| _ => Console.log(\"This doesn't actually appear to be null...\")\n}\n```" + ], + "signature": "let classify: 'a => t" + } + ] + }, + "core/regexp/result": { + "id": "Core.RegExp.Result", + "name": "Result", + "docstrings": [], + "items": [ + { + "id": "Core.RegExp.Result.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing the result of a `RegExp` execution." + ], + "signature": "type t = array>" }, { - "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOf", + "id": "Core.RegExp.Result.fullMatch", "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + "name": "fullMatch", + "docstrings": [ + "`fullMatch(regExpResult)` returns the full string that matched in this result.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints the full string that matched, \"ReScript is\"\n }\n ```" + ], + "signature": "let fullMatch: t => string" }, { - "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", + "id": "Core.RegExp.Result.matches", "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" + "name": "matches", + "docstrings": [ + "`matches(regExpResult)` returns all matches for `regExpResult`.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n // This below will log \"ReScript\" and \"is\" to the console.\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => switch result->RegExp.Result.matches {\n | [firstWord, secondWord] => Console.log2(firstWord, secondWord)\n | _ => Console.log(\"Didn't find exactly two words...\")\n }\n }\n ```" + ], + "signature": "let matches: t => array" }, { - "id": "Core.Intl.RelativeTimeFormat.format", + "id": "Core.RegExp.Result.index", "kind": "value", - "name": "format", + "name": "index", "docstrings": [], - "signature": "let format: (t, int, timeUnit) => string" + "signature": "let index: t => int" }, { - "id": "Core.Intl.RelativeTimeFormat.formatToParts", + "id": "Core.RegExp.Result.input", "kind": "value", - "name": "formatToParts", - "docstrings": [], - "signature": "let formatToParts: (t, int, timeUnit) => array" + "name": "input", + "docstrings": [ + "`input(regExpResult)` returns the full input string that was passed to what produced the `RegExp.Result.t`.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n // This below will log the full input string \"ReScript is pretty cool, right?\" to the console.\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => Console.log(result->RegExp.Result.input)\n }\n ```" + ], + "signature": "let input: t => string" } ] }, - "core/intl/pluralrules": { - "id": "Core.Intl.PluralRules", - "name": "PluralRules", - "docstrings": [], + "core/math/int": { + "id": "Core.Math.Int", + "name": "Int", + "docstrings": [ + "Provide Math utilities for `int`" + ], "items": [ { - "id": "Core.Intl.PluralRules.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.PluralRules.localeType", - "kind": "type", - "name": "localeType", - "docstrings": [], - "signature": "type localeType = [#cardinal | #ordinal]" + "id": "Core.Math.Int.abs", + "kind": "value", + "name": "abs", + "docstrings": [ + "`abs(v)` returns absolute value of `v`.\n See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.abs(-2) // 2\n Math.Int.abs(3) // 3\n ```" + ], + "signature": "let abs: int => int" }, { - "id": "Core.Intl.PluralRules.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Core__Intl__Common.localeMatcher,\n \\\"type\"?: localeType,\n minimumIntegerDigits?: Core__Intl__Common.oneTo21,\n minimumFractionDigits?: Core__Intl__Common.zeroTo20,\n maximumFractionDigits?: Core__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Core__Intl__Common.oneTo21,\n maximumSignificantDigits?: Core__Intl__Common.oneTo21,\n}" + "id": "Core.Math.Int.clz32", + "kind": "value", + "name": "clz32", + "docstrings": [ + "`clz32(v)` returns the number of leading zero bits of the argument's 32 bit\n int representation.\n See [`Math.clz32`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32) on MDN.\n\n ## Examples\n\n ```rescript\n // 00000000000000000000000000000001\n Math.Int.clz32(1) // 31\n // 00000000000000000000000000000100\n Math.Int.clz32(4) // 29\n ```" + ], + "signature": "let clz32: int => int" }, { - "id": "Core.Intl.PluralRules.pluralCategories", - "kind": "type", - "name": "pluralCategories", - "docstrings": [], - "signature": "type pluralCategories = [\n | #few\n | #many\n | #one\n | #other\n | #two\n | #zero\n]" + "id": "Core.Math.Int.imul", + "kind": "value", + "name": "imul", + "docstrings": [ + "`imul(a, b)` returns 32-bit integer multiplication. Use this only when you\n need to optimize performance of multiplication of numbers stored as 32-bit\n integers.\n See [`Math.imul`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.imul(3, 4) // 12\n Math.Int.imul(-5, 12) // 60\n ```" + ], + "signature": "let imul: (int, int) => int" }, { - "id": "Core.Intl.PluralRules.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n pluralCategories: array,\n \\\"type\": localeType,\n minimumIntegerDigits?: Core__Intl__Common.oneTo21,\n minimumFractionDigits?: Core__Intl__Common.zeroTo20,\n maximumFractionDigits?: Core__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Core__Intl__Common.oneTo21,\n maximumSignificantDigits?: Core__Intl__Common.oneTo21,\n}" + "id": "Core.Math.Int.min", + "kind": "value", + "name": "min", + "docstrings": [ + "`min(a, b)` returns the minimum of its two integer arguments.\n See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.min(1, 2) // 1\n Math.Int.min(-1, -2) // -2\n ```" + ], + "signature": "let min: (int, int) => int" }, { - "id": "Core.Intl.PluralRules.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" + "id": "Core.Math.Int.minMany", + "kind": "value", + "name": "minMany", + "docstrings": [ + "`minMany(arr)` returns the minimum of the integers in the given array `arr`.\n Returns `Infinity` if `arr` is empty.\n See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.minMany([1, 2]) // 1\n Math.Int.minMany([-1, -2]) // -2\n Math.Int.minMany([])->Int.toFloat->Float.isFinite // false\n ```" + ], + "signature": "let minMany: array => int" }, { - "id": "Core.Intl.PluralRules.make", + "id": "Core.Math.Int.max", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.PluralRules.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.PluralRules.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.PluralRules.rule", - "kind": "type", - "name": "rule", - "docstrings": [], - "signature": "type rule = [#few | #many | #one | #other | #two | #zero]" + "name": "max", + "docstrings": [ + "`max(a, b)` returns the maximum of its two integer arguments.\n See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.max(1, 2) // 2\n Math.Int.max(-1, -2) // -1\n ```" + ], + "signature": "let max: (int, int) => int" }, { - "id": "Core.Intl.PluralRules.select", + "id": "Core.Math.Int.maxMany", "kind": "value", - "name": "select", - "docstrings": [], - "signature": "let select: (t, float) => rule" + "name": "maxMany", + "docstrings": [ + "`maxMany(arr)` returns the maximum of the integers in the given array `arr`.\n Returns `Infinity` if `arr` is empty.\n See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.maxMany([1, 2]) // 2\n Math.Int.maxMany([-1, -2]) // -1\n Math.Int.maxMany([])->Int.toFloat->Float.isFinite // false\n ```" + ], + "signature": "let maxMany: array => int" }, { - "id": "Core.Intl.PluralRules.selectInt", + "id": "Core.Math.Int.pow", "kind": "value", - "name": "selectInt", - "docstrings": [], - "signature": "let selectInt: (t, int) => rule" + "name": "pow", + "docstrings": [ + "`pow(a, ~exp)` raises the given base `a` to the given exponent `exp`.\n See [`Math.pow`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.pow(2, ~exp=4) // 16\n Math.Int.pow(3, ~exp=4) // 81\n ```" + ], + "signature": "let pow: (int, ~exp: int) => int" }, { - "id": "Core.Intl.PluralRules.selectBigInt", + "id": "Core.Math.Int.sign", "kind": "value", - "name": "selectBigInt", - "docstrings": [], - "signature": "let selectBigInt: (t, bigint) => rule" + "name": "sign", + "docstrings": [ + "`sign(v)` returns the sign of its integer argument: `-1` if negative, `0` if\n zero, `1` if positive.\n See [`Math.sign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.sign(3) // 1\n Math.Int.sign(-3) // -1\n Math.Int.sign(0) // 0\n ```" + ], + "signature": "let sign: int => int" }, { - "id": "Core.Intl.PluralRules.selectRange", + "id": "Core.Math.Int.floor", "kind": "value", - "name": "selectRange", - "docstrings": [], - "signature": "let selectRange: (t, ~start: float, ~end: float) => rule" + "name": "floor", + "docstrings": [ + "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.Intl.PluralRules.selectRangeInt", + "id": "Core.Math.Int.ceil", "kind": "value", - "name": "selectRangeInt", - "docstrings": [], - "signature": "let selectRangeInt: (t, ~start: int, ~end: int) => rule" + "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.Intl.PluralRules.selectRangeBigInt", + "id": "Core.Math.Int.random", "kind": "value", - "name": "selectRangeBigInt", - "docstrings": [], - "signature": "let selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule" + "name": "random", + "docstrings": [ + "`random(minVal, maxVal)` returns a random integer number in the half-closed interval [minVal, maxVal).\n See [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.random(2, 5) == 4\n Math.Int.random(505, 2000) == 1276\n Math.Int.random(-7, -2) == -4\n ```" + ], + "signature": "let random: (int, int) => int" } ] }, - "core/intl/numberformat": { - "id": "Core.Intl.NumberFormat", - "name": "NumberFormat", - "docstrings": [], + "core/math/constants": { + "id": "Core.Math.Constants", + "name": "Constants", + "docstrings": [ + "Mathematical Constants" + ], "items": [ { - "id": "Core.Intl.NumberFormat.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" + "id": "Core.Math.Constants.e", + "kind": "value", + "name": "e", + "docstrings": [ + "`Math.Constants.e` returns Euler's number, ≈ 2.718281828459045.\n See [`Math.E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.e\n ```" + ], + "signature": "let e: float" }, { - "id": "Core.Intl.NumberFormat.currency", - "kind": "type", - "name": "currency", + "id": "Core.Math.Constants.ln2", + "kind": "value", + "name": "ln2", "docstrings": [ - "An ISO 4217 currency code. e.g. USD, EUR, CNY" + "`Math.Constants.ln2` returns Natural logarithm of 2, ≈ 0.6931471805599453.\n See [`Math.LN2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN2) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.ln2\n ```" ], - "signature": "type currency = string" + "signature": "let ln2: float" }, { - "id": "Core.Intl.NumberFormat.currencyDisplay", - "kind": "type", - "name": "currencyDisplay", - "docstrings": [], - "signature": "type currencyDisplay = [\n | #code\n | #name\n | #narrowSymbol\n | #symbol\n]" + "id": "Core.Math.Constants.ln10", + "kind": "value", + "name": "ln10", + "docstrings": [ + "`Math.Constants.ln10` returns Natural logarithm of 10, ≈ 2.302585092994046.\n See [`Math.LN10`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN10) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.ln10\n ```" + ], + "signature": "let ln10: float" }, { - "id": "Core.Intl.NumberFormat.currencySign", - "kind": "type", - "name": "currencySign", - "docstrings": [], - "signature": "type currencySign = [#accounting | #standard]" + "id": "Core.Math.Constants.log2e", + "kind": "value", + "name": "log2e", + "docstrings": [ + "`Math.Constants.log2e` returns Base 2 logarithm of E, ≈ 1.4426950408889634.\n See [`Math.LOG2E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG2E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.log2e\n ```" + ], + "signature": "let log2e: float" }, { - "id": "Core.Intl.NumberFormat.notation", - "kind": "type", - "name": "notation", - "docstrings": [], - "signature": "type notation = [\n | #compact\n | #engineering\n | #scientific\n | #standard\n]" + "id": "Core.Math.Constants.log10e", + "kind": "value", + "name": "log10e", + "docstrings": [ + "`Math.Constants.log10e` returns Base 10 logarithm of E, ≈ 0.4342944819032518.\n See [`Math.LOG10E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG10E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.log10e\n ```" + ], + "signature": "let log10e: float" }, { - "id": "Core.Intl.NumberFormat.compactDisplay", - "kind": "type", - "name": "compactDisplay", + "id": "Core.Math.Constants.pi", + "kind": "value", + "name": "pi", "docstrings": [ - "Used only when notation is #compact" + "`Math.Constants.pi` returns Pi - ratio of the circumference to the diameter\n of a circle, ≈ 3.141592653589793.\n See [`Math.PI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.pi\n ```" ], - "signature": "type compactDisplay = [#long | #short]" + "signature": "let pi: float" }, { - "id": "Core.Intl.NumberFormat.signDisplay", - "kind": "type", - "name": "signDisplay", - "docstrings": [], - "signature": "type signDisplay = [\n | #always\n | #auto\n | #exceptZero\n | #negative\n | #never\n]" + "id": "Core.Math.Constants.sqrt1_2", + "kind": "value", + "name": "sqrt1_2", + "docstrings": [ + "`Math.Constants.sqrt1_2` returns Square root of 1/2, ≈ 0.7071067811865476.\n See [`Math.SQRT1_2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.sqrt1_2\n ```" + ], + "signature": "let sqrt1_2: float" }, { - "id": "Core.Intl.NumberFormat.style", - "kind": "type", - "name": "style", - "docstrings": [], - "signature": "type style = [#currency | #decimal | #percent | #unit]" - }, + "id": "Core.Math.Constants.sqrt2", + "kind": "value", + "name": "sqrt2", + "docstrings": [ + "`Math.Constants.e` returns Absolute value for integer argument.\n See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.sqrt2\n ```" + ], + "signature": "let sqrt2: float" + } + ] + }, + "core/json/decode": { + "id": "Core.JSON.Decode", + "name": "Decode", + "docstrings": [], + "items": [ { - "id": "Core.Intl.NumberFormat.unitSystem", - "kind": "type", - "name": "unitSystem", + "id": "Core.JSON.Decode.bool", + "kind": "value", + "name": "bool", "docstrings": [ - "Defined in https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier\nOnly used when style is #unit" + "Decodes a single JSON value. If the value is a bool, it will return `Some(bool)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`true`)->JSON.Decode.bool\n // Some(true)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.bool\n // None\n ```" ], - "signature": "type unitSystem = string" + "signature": "let bool: t => option" }, { - "id": "Core.Intl.NumberFormat.unitDisplay", - "kind": "type", - "name": "unitDisplay", + "id": "Core.JSON.Decode.null", + "kind": "value", + "name": "null", "docstrings": [ - "Only used when style is #unit" + "Decodes a single JSON value. If the value is null, it will return `Some(Null.t)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`null`)->JSON.Decode.null\n // Some(null)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.null\n // None\n ```" ], - "signature": "type unitDisplay = [#long | #narrow | #short]" + "signature": "let null: t => option>" }, { - "id": "Core.Intl.NumberFormat.rounding", - "kind": "type", - "name": "rounding", - "docstrings": [], - "signature": "type rounding = [\n | #ceil\n | #expand\n | #floor\n | #halfCeil\n | #halfEven\n | #halfExpand\n | #halfFloor\n | #halfTrunc\n | #trunc\n]" + "id": "Core.JSON.Decode.string", + "kind": "value", + "name": "string", + "docstrings": [ + "Decodes a single JSON value. If the value is a string, it will return `Some(string)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.string\n // Some(\"hello world\")\n\n JSON.parseExn(`42`)->JSON.Decode.string\n // None \n ```" + ], + "signature": "let string: t => option" }, { - "id": "Core.Intl.NumberFormat.roundingPriority", - "kind": "type", - "name": "roundingPriority", - "docstrings": [], - "signature": "type roundingPriority = [\n | #auto\n | #lessPrecision\n | #morePrecision\n]" + "id": "Core.JSON.Decode.float", + "kind": "value", + "name": "float", + "docstrings": [ + "Decodes a single JSON value. If the value is a float, it will return `Some(float)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`42.0`)->JSON.Decode.float\n // Some(42.0)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.float\n // None\n ```" + ], + "signature": "let float: t => option" }, { - "id": "Core.Intl.NumberFormat.roundingIncrement", - "kind": "type", - "name": "roundingIncrement", - "docstrings": [], - "signature": "type roundingIncrement = [\n | #1\n | #10\n | #100\n | #1000\n | #2\n | #20\n | #200\n | #2000\n | #25\n | #250\n | #2500\n | #5\n | #50\n | #500\n | #5000\n]" + "id": "Core.JSON.Decode.object", + "kind": "value", + "name": "object", + "docstrings": [ + "Decodes a single JSON value. If the value is an object, it will return `Some(dict)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`{\"foo\":\"bar\"}`)->JSON.Decode.object\n // Some({ foo: 'bar' })\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.object\n // None\n ```" + ], + "signature": "let object: t => option>" }, { - "id": "Core.Intl.NumberFormat.trailingZeroDisplay", - "kind": "type", - "name": "trailingZeroDisplay", - "docstrings": [], - "signature": "type trailingZeroDisplay = [\n | #auto\n | #lessPrecision\n | #stripIfInteger\n]" + "id": "Core.JSON.Decode.array", + "kind": "value", + "name": "array", + "docstrings": [ + "Decodes a single JSON value. If the value is an array, it will return `Some(array)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`[\"foo\", \"bar\"]`)->JSON.Decode.array\n // Some([ 'foo', 'bar' ])\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.array\n // None\n ```" + ], + "signature": "let array: t => option>" + } + ] + }, + "core/json/encode": { + "id": "Core.JSON.Encode", + "name": "Encode", + "docstrings": [], + "items": [ + { + "id": "Core.JSON.Encode.bool", + "kind": "value", + "name": "bool", + "docstrings": [ + "Returns a boolean as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.bool(true)\n ```" + ], + "signature": "let bool: bool => t" }, { - "id": "Core.Intl.NumberFormat.options", + "id": "Core.JSON.Encode.null", + "kind": "value", + "name": "null", + "docstrings": [ + "Returns null as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.null\n ```" + ], + "signature": "let null: t" + }, + { + "id": "Core.JSON.Encode.string", + "kind": "value", + "name": "string", + "docstrings": [ + "Returns a string as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.string(\"hello world\")\n ```" + ], + "signature": "let string: string => t" + }, + { + "id": "Core.JSON.Encode.int", + "kind": "value", + "name": "int", + "docstrings": [ + "Returns an int as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.int(42)\n ```" + ], + "signature": "let int: int => t" + }, + { + "id": "Core.JSON.Encode.float", + "kind": "value", + "name": "float", + "docstrings": [ + "Returns a float as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.float(42.0)\n ```" + ], + "signature": "let float: float => t" + }, + { + "id": "Core.JSON.Encode.object", + "kind": "value", + "name": "object", + "docstrings": [ + "Returns a dict as a JSON object.\n\n ## Examples\n ```rescript\n let dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n ])\n\n JSON.Encode.object(dict)\n ```" + ], + "signature": "let object: dict => t" + }, + { + "id": "Core.JSON.Encode.array", + "kind": "value", + "name": "array", + "docstrings": [ + "Returns an array as a JSON object.\n\n ## Examples\n ```rescript\n let array = [JSON.Encode.string(\"hello world\"), JSON.Encode.int(42)]\n\n JSON.Encode.array(array)\n ```" + ], + "signature": "let array: array => t" + } + ] + }, + "core/json/classify": { + "id": "Core.JSON.Classify", + "name": "Classify", + "docstrings": [], + "items": [ + { + "id": "Core.JSON.Classify.t", "kind": "type", - "name": "options", + "name": "t", + "docstrings": [ + "A type representing a JavaScript type." + ], + "signature": "type t =\n | Bool(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(dict)\n | Array(array)" + }, + { + "id": "Core.JSON.Classify.classify", + "kind": "value", + "name": "classify", + "docstrings": [ + "Returns the JSON type of any value.\n\n ## Examples\n ```rescript\n JSON.Classify.classify(\"hello world\")\n // String(\"hello world\")\n\n JSON.Classify.classify(42)\n // Number(42)\n ```" + ], + "signature": "let classify: 'a => t", + "deprecated": "Directly switch on the JSON object instead" + } + ] + }, + "core/intl/segments": { + "id": "Core.Intl.Segments", + "name": "Segments", + "docstrings": [ + "A Segments instance is an object that represents the segments of a specific string, subject to the locale and options of its constructing Intl.Segmenter instance.\nhttps://tc39.es/ecma402/#sec-segments-objects" + ], + "items": [ + { + "id": "Core.Intl.Segments.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "type options = {\n compactDisplay?: compactDisplay,\n numberingSystem?: Core__Intl__Common.numberingSystem,\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n localeMatcher?: Core__Intl__Common.localeMatcher,\n notation?: notation,\n signDisplay?: signDisplay,\n style?: style,\n unit?: unitSystem,\n unitDisplay?: unitDisplay,\n useGrouping?: Grouping.t,\n roundingMode?: rounding,\n roundingPriority?: roundingPriority,\n roundingIncrement?: roundingIncrement,\n trailingZeroDisplay?: trailingZeroDisplay,\n minimumIntegerDigits?: Core__Intl__Common.oneTo21,\n minimumFractionDigits?: Core__Intl__Common.zeroTo20,\n maximumFractionDigits?: Core__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Core__Intl__Common.oneTo21,\n maximumSignificantDigits?: Core__Intl__Common.oneTo21,\n}" + "signature": "type t" }, { - "id": "Core.Intl.NumberFormat.resolvedOptions", + "id": "Core.Intl.Segments.segmentData", "kind": "type", - "name": "resolvedOptions", + "name": "segmentData", "docstrings": [], - "signature": "type resolvedOptions = {\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n compactDisplay?: compactDisplay,\n unit: unitSystem,\n unitDisplay: unitDisplay,\n roundingMode?: rounding,\n roundingPriority?: roundingPriority,\n roundingIncrement?: roundingIncrement,\n minimumIntegerDigits?: Core__Intl__Common.oneTo21,\n minimumFractionDigits?: Core__Intl__Common.zeroTo20,\n maximumFractionDigits?: Core__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Core__Intl__Common.oneTo21,\n maximumSignificantDigits?: Core__Intl__Common.oneTo21,\n locale: string,\n notation: notation,\n numberingSystem: Core__Intl__Common.numberingSystem,\n signDisplay: signDisplay,\n style: style,\n useGrouping: Grouping.t,\n}" + "signature": "type segmentData = {\n segment: string,\n index: int,\n isWordLike: option,\n input: string,\n}" }, { - "id": "Core.Intl.NumberFormat.supportedLocalesOptions", + "id": "Core.Intl.Segments.containing", + "kind": "value", + "name": "containing", + "docstrings": [], + "signature": "let containing: t => segmentData" + }, + { + "id": "Core.Intl.Segments.containingWithIndex", + "kind": "value", + "name": "containingWithIndex", + "docstrings": [], + "signature": "let containingWithIndex: (t, int) => segmentData" + } + ] + }, + "core/intl/segmenter": { + "id": "Core.Intl.Segmenter", + "name": "Segmenter", + "docstrings": [ + "Not supported in Firefox" + ], + "items": [ + { + "id": "Core.Intl.Segmenter.t", "kind": "type", - "name": "supportedLocalesOptions", + "name": "t", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" + "signature": "type t" }, { - "id": "Core.Intl.NumberFormat.numberFormatPartType", + "id": "Core.Intl.Segmenter.granularity", "kind": "type", - "name": "numberFormatPartType", + "name": "granularity", "docstrings": [], - "signature": "type numberFormatPartType = [\n | #compact\n | #currency\n | #decimal\n | #exponentInteger\n | #exponentMinusSign\n | #exponentSeparator\n | #fraction\n | #group\n | #infinity\n | #integer\n | #literal\n | #minusSign\n | #nan\n | #percentSign\n | #plusSign\n | #unit\n | #unknown\n]" + "signature": "type granularity = [#grapheme | #sentence | #word]" }, { - "id": "Core.Intl.NumberFormat.numberFormatPart", + "id": "Core.Intl.Segmenter.options", "kind": "type", - "name": "numberFormatPart", + "name": "options", "docstrings": [], - "signature": "type numberFormatPart = {\n \\\"type\": numberFormatPartType,\n value: string,\n}" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n granularity?: granularity,\n}" }, { - "id": "Core.Intl.NumberFormat.rangeSource", + "id": "Core.Intl.Segmenter.pluralCategories", "kind": "type", - "name": "rangeSource", + "name": "pluralCategories", "docstrings": [], - "signature": "type rangeSource = [#endRange | #shared | #startRange]" + "signature": "type pluralCategories = [\n | #few\n | #many\n | #one\n | #other\n | #two\n | #zero\n]" }, { - "id": "Core.Intl.NumberFormat.numberFormatRangePart", + "id": "Core.Intl.Segmenter.resolvedOptions", "kind": "type", - "name": "numberFormatRangePart", + "name": "resolvedOptions", "docstrings": [], - "signature": "type numberFormatRangePart = {\n \\\"type\": numberFormatPartType,\n value: string,\n source: rangeSource,\n}" + "signature": "type resolvedOptions = {\n locale: string,\n granularity: granularity,\n}" }, { - "id": "Core.Intl.NumberFormat.make", + "id": "Core.Intl.Segmenter.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" + }, + { + "id": "Core.Intl.Segmenter.make", "kind": "value", "name": "make", "docstrings": [], "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Intl.NumberFormat.supportedLocalesOf", + "id": "Core.Intl.Segmenter.supportedLocalesOf", "kind": "value", "name": "supportedLocalesOf", "docstrings": [], "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" }, { - "id": "Core.Intl.NumberFormat.resolvedOptions", + "id": "Core.Intl.Segmenter.resolvedOptions", "kind": "value", "name": "resolvedOptions", "docstrings": [], "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.Intl.NumberFormat.format", + "id": "Core.Intl.Segmenter.segment", "kind": "value", - "name": "format", + "name": "segment", "docstrings": [], - "signature": "let format: (t, float) => string" - }, + "signature": "let segment: (t, string) => Intl_Segments.t" + } + ] + }, + "core/intl/relativetimeformat": { + "id": "Core.Intl.RelativeTimeFormat", + "name": "RelativeTimeFormat", + "docstrings": [], + "items": [ { - "id": "Core.Intl.NumberFormat.formatRange", - "kind": "value", - "name": "formatRange", + "id": "Core.Intl.RelativeTimeFormat.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let formatRange: (t, ~start: float, ~end: float) => array" + "signature": "type t" }, { - "id": "Core.Intl.NumberFormat.formatToParts", - "kind": "value", - "name": "formatToParts", + "id": "Core.Intl.RelativeTimeFormat.numeric", + "kind": "type", + "name": "numeric", "docstrings": [], - "signature": "let formatToParts: (t, float) => array" + "signature": "type numeric = [#always | #auto]" }, { - "id": "Core.Intl.NumberFormat.formatRangeToParts", - "kind": "value", - "name": "formatRangeToParts", + "id": "Core.Intl.RelativeTimeFormat.style", + "kind": "type", + "name": "style", "docstrings": [], - "signature": "let formatRangeToParts: (\n t,\n ~start: float,\n ~end: float,\n) => array" + "signature": "type style = [#long | #narrow | #short]" }, { - "id": "Core.Intl.NumberFormat.formatInt", - "kind": "value", - "name": "formatInt", + "id": "Core.Intl.RelativeTimeFormat.timeUnit", + "kind": "type", + "name": "timeUnit", "docstrings": [], - "signature": "let formatInt: (t, int) => string" + "signature": "type timeUnit = [\n | #day\n | #hour\n | #minute\n | #month\n | #quarter\n | #second\n | #week\n | #year\n]" }, { - "id": "Core.Intl.NumberFormat.formatIntRange", - "kind": "value", - "name": "formatIntRange", + "id": "Core.Intl.RelativeTimeFormat.options", + "kind": "type", + "name": "options", "docstrings": [], - "signature": "let formatIntRange: (t, ~start: int, ~end: int) => array" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" }, { - "id": "Core.Intl.NumberFormat.formatIntToParts", - "kind": "value", - "name": "formatIntToParts", + "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", "docstrings": [], - "signature": "let formatIntToParts: (t, int) => array" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { - "id": "Core.Intl.NumberFormat.formatIntRangeToParts", - "kind": "value", - "name": "formatIntRangeToParts", + "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", "docstrings": [], - "signature": "let formatIntRangeToParts: (t, ~start: int, ~end: int) => array" + "signature": "type resolvedOptions = {\n locale: string,\n numeric: numeric,\n style: style,\n numberingSystem: string,\n}" }, { - "id": "Core.Intl.NumberFormat.formatBigInt", - "kind": "value", - "name": "formatBigInt", + "id": "Core.Intl.RelativeTimeFormat.relativeTimePartComponent", + "kind": "type", + "name": "relativeTimePartComponent", "docstrings": [], - "signature": "let formatBigInt: (t, bigint) => string" + "signature": "type relativeTimePartComponent = [#integer | #literal]" }, { - "id": "Core.Intl.NumberFormat.formatBigIntRange", + "id": "Core.Intl.RelativeTimeFormat.relativeTimePart", + "kind": "type", + "name": "relativeTimePart", + "docstrings": [], + "signature": "type relativeTimePart = {\n \\\"type\": relativeTimePartComponent,\n value: string,\n unit?: timeUnit,\n}" + }, + { + "id": "Core.Intl.RelativeTimeFormat.make", "kind": "value", - "name": "formatBigIntRange", + "name": "make", "docstrings": [], - "signature": "let formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array" + "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Intl.NumberFormat.formatBigIntToParts", + "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOf", "kind": "value", - "name": "formatBigIntToParts", + "name": "supportedLocalesOf", "docstrings": [], - "signature": "let formatBigIntToParts: (t, bigint) => array" + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" }, { - "id": "Core.Intl.NumberFormat.formatBigIntRangeToParts", + "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", "kind": "value", - "name": "formatBigIntRangeToParts", + "name": "resolvedOptions", "docstrings": [], - "signature": "let formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array" + "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.Intl.NumberFormat.formatString", + "id": "Core.Intl.RelativeTimeFormat.format", "kind": "value", - "name": "formatString", + "name": "format", "docstrings": [], - "signature": "let formatString: (t, string) => string" + "signature": "let format: (t, int, timeUnit) => string" }, { - "id": "Core.Intl.NumberFormat.formatStringToParts", + "id": "Core.Intl.RelativeTimeFormat.formatToParts", "kind": "value", - "name": "formatStringToParts", + "name": "formatToParts", "docstrings": [], - "signature": "let formatStringToParts: (t, string) => array" + "signature": "let formatToParts: (t, int, timeUnit) => array" } ] }, - "core/intl/locale": { - "id": "Core.Intl.Locale", - "name": "Locale", + "core/intl/pluralrules": { + "id": "Core.Intl.PluralRules", + "name": "PluralRules", "docstrings": [], "items": [ { - "id": "Core.Intl.Locale.t", + "id": "Core.Intl.PluralRules.t", "kind": "type", "name": "t", "docstrings": [], "signature": "type t" }, { - "id": "Core.Intl.Locale.options", + "id": "Core.Intl.PluralRules.localeType", + "kind": "type", + "name": "localeType", + "docstrings": [], + "signature": "type localeType = [#cardinal | #ordinal]" + }, + { + "id": "Core.Intl.PluralRules.options", "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n baseName?: string,\n calendar?: Core__Intl__Common.calendar,\n collation?: Core__Intl__Common.collation,\n hourCycle?: [#h11 | #h12 | #h23 | #h24],\n caseFirst?: [#\"false\" | #lower | #upper],\n numberingSystem?: Core__Intl__Common.numberingSystem,\n numeric?: bool,\n language?: string,\n script?: string,\n region?: string,\n}" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n \\\"type\"?: localeType,\n minimumIntegerDigits?: Intl_Common.oneTo21,\n minimumFractionDigits?: Intl_Common.zeroTo20,\n maximumFractionDigits?: Intl_Common.zeroTo20,\n minimumSignificantDigits?: Intl_Common.oneTo21,\n maximumSignificantDigits?: Intl_Common.oneTo21,\n}" }, { - "id": "Core.Intl.Locale.make", - "kind": "value", - "name": "make", + "id": "Core.Intl.PluralRules.pluralCategories", + "kind": "type", + "name": "pluralCategories", "docstrings": [], - "signature": "let make: (string, ~options: options=?) => t" + "signature": "type pluralCategories = [\n | #few\n | #many\n | #one\n | #other\n | #two\n | #zero\n]" }, { - "id": "Core.Intl.Locale.baseName", - "kind": "value", - "name": "baseName", + "id": "Core.Intl.PluralRules.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", "docstrings": [], - "signature": "let baseName: t => string" + "signature": "type resolvedOptions = {\n locale: string,\n pluralCategories: array,\n \\\"type\": localeType,\n minimumIntegerDigits?: Intl_Common.oneTo21,\n minimumFractionDigits?: Intl_Common.zeroTo20,\n maximumFractionDigits?: Intl_Common.zeroTo20,\n minimumSignificantDigits?: Intl_Common.oneTo21,\n maximumSignificantDigits?: Intl_Common.oneTo21,\n}" }, { - "id": "Core.Intl.Locale.calendar", - "kind": "value", - "name": "calendar", + "id": "Core.Intl.PluralRules.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", "docstrings": [], - "signature": "let calendar: t => option" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { - "id": "Core.Intl.Locale.caseFirst", + "id": "Core.Intl.PluralRules.make", "kind": "value", - "name": "caseFirst", + "name": "make", "docstrings": [], - "signature": "let caseFirst: t => option" + "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Intl.Locale.collation", + "id": "Core.Intl.PluralRules.supportedLocalesOf", "kind": "value", - "name": "collation", + "name": "supportedLocalesOf", "docstrings": [], - "signature": "let collation: t => option" + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" }, { - "id": "Core.Intl.Locale.hourCycle", + "id": "Core.Intl.PluralRules.resolvedOptions", "kind": "value", - "name": "hourCycle", + "name": "resolvedOptions", "docstrings": [], - "signature": "let hourCycle: t => option" + "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.Intl.Locale.language", - "kind": "value", - "name": "language", + "id": "Core.Intl.PluralRules.rule", + "kind": "type", + "name": "rule", "docstrings": [], - "signature": "let language: t => string" + "signature": "type rule = [#few | #many | #one | #other | #two | #zero]" }, { - "id": "Core.Intl.Locale.numberingSystem", + "id": "Core.Intl.PluralRules.select", "kind": "value", - "name": "numberingSystem", + "name": "select", "docstrings": [], - "signature": "let numberingSystem: t => option" + "signature": "let select: (t, float) => rule" }, { - "id": "Core.Intl.Locale.numeric", + "id": "Core.Intl.PluralRules.selectInt", "kind": "value", - "name": "numeric", + "name": "selectInt", "docstrings": [], - "signature": "let numeric: t => bool" + "signature": "let selectInt: (t, int) => rule" }, { - "id": "Core.Intl.Locale.region", + "id": "Core.Intl.PluralRules.selectBigInt", "kind": "value", - "name": "region", + "name": "selectBigInt", "docstrings": [], - "signature": "let region: t => option" + "signature": "let selectBigInt: (t, bigint) => rule" }, { - "id": "Core.Intl.Locale.script", + "id": "Core.Intl.PluralRules.selectRange", "kind": "value", - "name": "script", + "name": "selectRange", "docstrings": [], - "signature": "let script: t => option" + "signature": "let selectRange: (t, ~start: float, ~end: float) => rule" }, { - "id": "Core.Intl.Locale.maximize", + "id": "Core.Intl.PluralRules.selectRangeInt", "kind": "value", - "name": "maximize", + "name": "selectRangeInt", "docstrings": [], - "signature": "let maximize: t => t" + "signature": "let selectRangeInt: (t, ~start: int, ~end: int) => rule" }, { - "id": "Core.Intl.Locale.minimize", + "id": "Core.Intl.PluralRules.selectRangeBigInt", "kind": "value", - "name": "minimize", + "name": "selectRangeBigInt", "docstrings": [], - "signature": "let minimize: t => t" + "signature": "let selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule" } ] }, - "core/intl/listformat": { - "id": "Core.Intl.ListFormat", - "name": "ListFormat", + "core/intl/numberformat": { + "id": "Core.Intl.NumberFormat", + "name": "NumberFormat", "docstrings": [], "items": [ { - "id": "Core.Intl.ListFormat.t", + "id": "Core.Intl.NumberFormat.t", "kind": "type", "name": "t", "docstrings": [], "signature": "type t" }, { - "id": "Core.Intl.ListFormat.listType", + "id": "Core.Intl.NumberFormat.currency", "kind": "type", - "name": "listType", - "docstrings": [], - "signature": "type listType = [#conjunction | #disjunction | #unit]" + "name": "currency", + "docstrings": [ + "An ISO 4217 currency code. e.g. USD, EUR, CNY" + ], + "signature": "type currency = string" }, { - "id": "Core.Intl.ListFormat.style", + "id": "Core.Intl.NumberFormat.currencyDisplay", "kind": "type", - "name": "style", + "name": "currencyDisplay", "docstrings": [], - "signature": "type style = [#long | #narrow | #short]" + "signature": "type currencyDisplay = [\n | #code\n | #name\n | #narrowSymbol\n | #symbol\n]" }, { - "id": "Core.Intl.ListFormat.options", + "id": "Core.Intl.NumberFormat.currencySign", "kind": "type", - "name": "options", + "name": "currencySign", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Core__Intl__Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" + "signature": "type currencySign = [#accounting | #standard]" }, { - "id": "Core.Intl.ListFormat.listPartComponentType", + "id": "Core.Intl.NumberFormat.notation", "kind": "type", - "name": "listPartComponentType", + "name": "notation", "docstrings": [], - "signature": "type listPartComponentType = [#element | #literal]" + "signature": "type notation = [\n | #compact\n | #engineering\n | #scientific\n | #standard\n]" }, { - "id": "Core.Intl.ListFormat.listPart", + "id": "Core.Intl.NumberFormat.compactDisplay", "kind": "type", - "name": "listPart", - "docstrings": [], - "signature": "type listPart = {\n \\\"type\": listPartComponentType,\n value: string,\n}" + "name": "compactDisplay", + "docstrings": [ + "Used only when notation is #compact" + ], + "signature": "type compactDisplay = [#long | #short]" }, { - "id": "Core.Intl.ListFormat.resolvedOptions", + "id": "Core.Intl.NumberFormat.signDisplay", "kind": "type", - "name": "resolvedOptions", + "name": "signDisplay", "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n style: style,\n \\\"type\": listType,\n}" + "signature": "type signDisplay = [\n | #always\n | #auto\n | #exceptZero\n | #negative\n | #never\n]" }, { - "id": "Core.Intl.ListFormat.supportedLocalesOptions", + "id": "Core.Intl.NumberFormat.style", "kind": "type", - "name": "supportedLocalesOptions", + "name": "style", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" + "signature": "type style = [#currency | #decimal | #percent | #unit]" }, { - "id": "Core.Intl.ListFormat.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" + "id": "Core.Intl.NumberFormat.unitSystem", + "kind": "type", + "name": "unitSystem", + "docstrings": [ + "Defined in https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier\nOnly used when style is #unit" + ], + "signature": "type unitSystem = string" }, { - "id": "Core.Intl.ListFormat.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + "id": "Core.Intl.NumberFormat.unitDisplay", + "kind": "type", + "name": "unitDisplay", + "docstrings": [ + "Only used when style is #unit" + ], + "signature": "type unitDisplay = [#long | #narrow | #short]" }, { - "id": "Core.Intl.ListFormat.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", + "id": "Core.Intl.NumberFormat.rounding", + "kind": "type", + "name": "rounding", "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" + "signature": "type rounding = [\n | #ceil\n | #expand\n | #floor\n | #halfCeil\n | #halfEven\n | #halfExpand\n | #halfFloor\n | #halfTrunc\n | #trunc\n]" }, { - "id": "Core.Intl.ListFormat.format", - "kind": "value", - "name": "format", + "id": "Core.Intl.NumberFormat.roundingPriority", + "kind": "type", + "name": "roundingPriority", "docstrings": [], - "signature": "let format: (t, array) => string" + "signature": "type roundingPriority = [\n | #auto\n | #lessPrecision\n | #morePrecision\n]" }, { - "id": "Core.Intl.ListFormat.formatToParts", - "kind": "value", - "name": "formatToParts", - "docstrings": [], - "signature": "let formatToParts: (t, array) => array" - } - ] - }, - "core/intl/datetimeformat": { - "id": "Core.Intl.DateTimeFormat", - "name": "DateTimeFormat", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.DateTimeFormat.t", + "id": "Core.Intl.NumberFormat.roundingIncrement", "kind": "type", - "name": "t", + "name": "roundingIncrement", "docstrings": [], - "signature": "type t" + "signature": "type roundingIncrement = [\n | #1\n | #10\n | #100\n | #1000\n | #2\n | #20\n | #200\n | #2000\n | #25\n | #250\n | #2500\n | #5\n | #50\n | #500\n | #5000\n]" }, { - "id": "Core.Intl.DateTimeFormat.dateStyle", - "kind": "type", - "name": "dateStyle", - "docstrings": [], - "signature": "type dateStyle = [#full | #long | #medium | #short]" - }, - { - "id": "Core.Intl.DateTimeFormat.timeStyle", - "kind": "type", - "name": "timeStyle", - "docstrings": [], - "signature": "type timeStyle = [#full | #long | #medium | #short]" - }, - { - "id": "Core.Intl.DateTimeFormat.dayPeriod", - "kind": "type", - "name": "dayPeriod", - "docstrings": [], - "signature": "type dayPeriod = [#long | #narrow | #short]" - }, - { - "id": "Core.Intl.DateTimeFormat.weekday", + "id": "Core.Intl.NumberFormat.trailingZeroDisplay", "kind": "type", - "name": "weekday", + "name": "trailingZeroDisplay", "docstrings": [], - "signature": "type weekday = [#long | #narrow | #short]" + "signature": "type trailingZeroDisplay = [\n | #auto\n | #lessPrecision\n | #stripIfInteger\n]" }, { - "id": "Core.Intl.DateTimeFormat.era", + "id": "Core.Intl.NumberFormat.options", "kind": "type", - "name": "era", + "name": "options", "docstrings": [], - "signature": "type era = [#long | #narrow | #short]" + "signature": "type options = {\n compactDisplay?: compactDisplay,\n numberingSystem?: Intl_Common.numberingSystem,\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n localeMatcher?: Intl_Common.localeMatcher,\n notation?: notation,\n signDisplay?: signDisplay,\n style?: style,\n unit?: unitSystem,\n unitDisplay?: unitDisplay,\n useGrouping?: Grouping.t,\n roundingMode?: rounding,\n roundingPriority?: roundingPriority,\n roundingIncrement?: roundingIncrement,\n trailingZeroDisplay?: trailingZeroDisplay,\n minimumIntegerDigits?: Intl_Common.oneTo21,\n minimumFractionDigits?: Intl_Common.zeroTo20,\n maximumFractionDigits?: Intl_Common.zeroTo20,\n minimumSignificantDigits?: Intl_Common.oneTo21,\n maximumSignificantDigits?: Intl_Common.oneTo21,\n}" }, { - "id": "Core.Intl.DateTimeFormat.year", + "id": "Core.Intl.NumberFormat.resolvedOptions", "kind": "type", - "name": "year", + "name": "resolvedOptions", "docstrings": [], - "signature": "type year = [#\"2-digit\" | #numeric]" + "signature": "type resolvedOptions = {\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n compactDisplay?: compactDisplay,\n unit: unitSystem,\n unitDisplay: unitDisplay,\n roundingMode?: rounding,\n roundingPriority?: roundingPriority,\n roundingIncrement?: roundingIncrement,\n minimumIntegerDigits?: Intl_Common.oneTo21,\n minimumFractionDigits?: Intl_Common.zeroTo20,\n maximumFractionDigits?: Intl_Common.zeroTo20,\n minimumSignificantDigits?: Intl_Common.oneTo21,\n maximumSignificantDigits?: Intl_Common.oneTo21,\n locale: string,\n notation: notation,\n numberingSystem: Intl_Common.numberingSystem,\n signDisplay: signDisplay,\n style: style,\n useGrouping: Grouping.t,\n}" }, { - "id": "Core.Intl.DateTimeFormat.month", + "id": "Core.Intl.NumberFormat.supportedLocalesOptions", "kind": "type", - "name": "month", + "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type month = [\n | #\"2-digit\"\n | #long\n | #narrow\n | #numeric\n | #short\n]" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { - "id": "Core.Intl.DateTimeFormat.day", + "id": "Core.Intl.NumberFormat.numberFormatPartType", "kind": "type", - "name": "day", + "name": "numberFormatPartType", "docstrings": [], - "signature": "type day = [#\"2-digit\" | #numeric]" + "signature": "type numberFormatPartType = [\n | #compact\n | #currency\n | #decimal\n | #exponentInteger\n | #exponentMinusSign\n | #exponentSeparator\n | #fraction\n | #group\n | #infinity\n | #integer\n | #literal\n | #minusSign\n | #nan\n | #percentSign\n | #plusSign\n | #unit\n | #unknown\n]" }, { - "id": "Core.Intl.DateTimeFormat.hour", + "id": "Core.Intl.NumberFormat.numberFormatPart", "kind": "type", - "name": "hour", + "name": "numberFormatPart", "docstrings": [], - "signature": "type hour = [#\"2-digit\" | #numeric]" + "signature": "type numberFormatPart = {\n \\\"type\": numberFormatPartType,\n value: string,\n}" }, { - "id": "Core.Intl.DateTimeFormat.minute", + "id": "Core.Intl.NumberFormat.rangeSource", "kind": "type", - "name": "minute", + "name": "rangeSource", "docstrings": [], - "signature": "type minute = [#\"2-digit\" | #numeric]" + "signature": "type rangeSource = [#endRange | #shared | #startRange]" }, { - "id": "Core.Intl.DateTimeFormat.second", + "id": "Core.Intl.NumberFormat.numberFormatRangePart", "kind": "type", - "name": "second", + "name": "numberFormatRangePart", "docstrings": [], - "signature": "type second = [#\"2-digit\" | #numeric]" - }, - { - "id": "Core.Intl.DateTimeFormat.timeZoneName", - "kind": "type", - "name": "timeZoneName", - "docstrings": [ - "Firefox also supports IANA time zone names here\nNode v19+ supports \"shortOffset\", \"shortGeneric\", \"longOffset\", and \"longGeneric\"." - ], - "signature": "type timeZoneName = [\n | #long\n | #longGeneric\n | #longOffset\n | #short\n | #shortGeneric\n | #shortOffset\n]" + "signature": "type numberFormatRangePart = {\n \\\"type\": numberFormatPartType,\n value: string,\n source: rangeSource,\n}" }, { - "id": "Core.Intl.DateTimeFormat.hourCycle", - "kind": "type", - "name": "hourCycle", + "id": "Core.Intl.NumberFormat.make", + "kind": "value", + "name": "make", "docstrings": [], - "signature": "type hourCycle = [#h11 | #h12 | #h23 | #h24]" + "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Intl.DateTimeFormat.formatMatcher", - "kind": "type", - "name": "formatMatcher", + "id": "Core.Intl.NumberFormat.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", "docstrings": [], - "signature": "type formatMatcher = [#basic | #\"best fit\"]" + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" }, { - "id": "Core.Intl.DateTimeFormat.fractionalSecondDigits", - "kind": "type", - "name": "fractionalSecondDigits", + "id": "Core.Intl.NumberFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", "docstrings": [], - "signature": "type fractionalSecondDigits = [#0 | #1 | #2 | #3]" + "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.Intl.DateTimeFormat.options", - "kind": "type", - "name": "options", + "id": "Core.Intl.NumberFormat.format", + "kind": "value", + "name": "format", "docstrings": [], - "signature": "type options = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n calendar?: Core__Intl__Common.calendar,\n dayPeriod?: dayPeriod,\n numberingSystem?: Core__Intl__Common.numberingSystem,\n localeMatcher?: Core__Intl__Common.localeMatcher,\n timeZone?: string,\n hour12?: bool,\n hourCycle?: hourCycle,\n formatMatcher?: formatMatcher,\n weekday?: weekday,\n era?: era,\n year?: year,\n month?: month,\n day?: day,\n hour?: hour,\n minute?: minute,\n second?: second,\n fractionalSecondDigits?: fractionalSecondDigits,\n timeZoneName?: timeZoneName,\n}" + "signature": "let format: (t, float) => string" }, { - "id": "Core.Intl.DateTimeFormat.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", + "id": "Core.Intl.NumberFormat.formatRange", + "kind": "value", + "name": "formatRange", "docstrings": [], - "signature": "type resolvedOptions = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n weekday?: weekday,\n era?: era,\n year?: year,\n month?: month,\n day?: day,\n hour?: hour,\n minute?: minute,\n second?: second,\n fractionalSecondDigits?: fractionalSecondDigits,\n timeZoneName?: timeZoneName,\n calendar: Core__Intl__Common.calendar,\n hour12: bool,\n hourCycle: hourCycle,\n locale: string,\n numberingSystem: Core__Intl__Common.numberingSystem,\n timeZone: string,\n}" + "signature": "let formatRange: (t, ~start: float, ~end: float) => array" }, { - "id": "Core.Intl.DateTimeFormat.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", + "id": "Core.Intl.NumberFormat.formatToParts", + "kind": "value", + "name": "formatToParts", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" + "signature": "let formatToParts: (t, float) => array" }, { - "id": "Core.Intl.DateTimeFormat.dateTimeComponent", - "kind": "type", - "name": "dateTimeComponent", + "id": "Core.Intl.NumberFormat.formatRangeToParts", + "kind": "value", + "name": "formatRangeToParts", "docstrings": [], - "signature": "type dateTimeComponent = [\n | #day\n | #dayPeriod\n | #era\n | #fractionalSecond\n | #hour\n | #literal\n | #minute\n | #month\n | #relatedYear\n | #second\n | #timeZone\n | #weekday\n | #year\n | #yearName\n]" + "signature": "let formatRangeToParts: (\n t,\n ~start: float,\n ~end: float,\n) => array" }, { - "id": "Core.Intl.DateTimeFormat.dateTimePart", - "kind": "type", - "name": "dateTimePart", + "id": "Core.Intl.NumberFormat.formatInt", + "kind": "value", + "name": "formatInt", "docstrings": [], - "signature": "type dateTimePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n}" + "signature": "let formatInt: (t, int) => string" }, { - "id": "Core.Intl.DateTimeFormat.dateTimeRangeSource", - "kind": "type", - "name": "dateTimeRangeSource", + "id": "Core.Intl.NumberFormat.formatIntRange", + "kind": "value", + "name": "formatIntRange", "docstrings": [], - "signature": "type dateTimeRangeSource = [\n | #endRange\n | #shared\n | #startRange\n]" + "signature": "let formatIntRange: (t, ~start: int, ~end: int) => array" }, { - "id": "Core.Intl.DateTimeFormat.dateTimeRangePart", - "kind": "type", - "name": "dateTimeRangePart", + "id": "Core.Intl.NumberFormat.formatIntToParts", + "kind": "value", + "name": "formatIntToParts", "docstrings": [], - "signature": "type dateTimeRangePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n source: dateTimeRangeSource,\n}" + "signature": "let formatIntToParts: (t, int) => array" }, { - "id": "Core.Intl.DateTimeFormat.make", + "id": "Core.Intl.NumberFormat.formatIntRangeToParts", "kind": "value", - "name": "make", + "name": "formatIntRangeToParts", "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" + "signature": "let formatIntRangeToParts: (t, ~start: int, ~end: int) => array" }, { - "id": "Core.Intl.DateTimeFormat.supportedLocalesOf", + "id": "Core.Intl.NumberFormat.formatBigInt", "kind": "value", - "name": "supportedLocalesOf", + "name": "formatBigInt", "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + "signature": "let formatBigInt: (t, bigint) => string" }, { - "id": "Core.Intl.DateTimeFormat.resolvedOptions", + "id": "Core.Intl.NumberFormat.formatBigIntRange", "kind": "value", - "name": "resolvedOptions", + "name": "formatBigIntRange", "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" + "signature": "let formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array" }, { - "id": "Core.Intl.DateTimeFormat.format", + "id": "Core.Intl.NumberFormat.formatBigIntToParts", "kind": "value", - "name": "format", + "name": "formatBigIntToParts", "docstrings": [], - "signature": "let format: (t, Core__Date.t) => string" + "signature": "let formatBigIntToParts: (t, bigint) => array" }, { - "id": "Core.Intl.DateTimeFormat.formatToParts", + "id": "Core.Intl.NumberFormat.formatBigIntRangeToParts", "kind": "value", - "name": "formatToParts", + "name": "formatBigIntRangeToParts", "docstrings": [], - "signature": "let formatToParts: (t, Core__Date.t) => array" + "signature": "let formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array" }, { - "id": "Core.Intl.DateTimeFormat.formatRange", + "id": "Core.Intl.NumberFormat.formatString", "kind": "value", - "name": "formatRange", + "name": "formatString", "docstrings": [], - "signature": "let formatRange: (\n t,\n ~startDate: Core__Date.t,\n ~endDate: Core__Date.t,\n) => string" + "signature": "let formatString: (t, string) => string" }, { - "id": "Core.Intl.DateTimeFormat.formatRangeToParts", + "id": "Core.Intl.NumberFormat.formatStringToParts", "kind": "value", - "name": "formatRangeToParts", + "name": "formatStringToParts", "docstrings": [], - "signature": "let formatRangeToParts: (\n t,\n ~startDate: Core__Date.t,\n ~endDate: Core__Date.t,\n) => array" + "signature": "let formatStringToParts: (t, string) => array" } ] }, - "core/intl/collator": { - "id": "Core.Intl.Collator", - "name": "Collator", + "core/intl/locale": { + "id": "Core.Intl.Locale", + "name": "Locale", "docstrings": [], "items": [ { - "id": "Core.Intl.Collator.t", + "id": "Core.Intl.Locale.t", "kind": "type", "name": "t", "docstrings": [], "signature": "type t" }, { - "id": "Core.Intl.Collator.usage", + "id": "Core.Intl.Locale.options", "kind": "type", - "name": "usage", + "name": "options", "docstrings": [], - "signature": "type usage = [#search | #sort]" + "signature": "type options = {\n baseName?: string,\n calendar?: Intl_Common.calendar,\n collation?: Intl_Common.collation,\n hourCycle?: [#h11 | #h12 | #h23 | #h24],\n caseFirst?: [#\"false\" | #lower | #upper],\n numberingSystem?: Intl_Common.numberingSystem,\n numeric?: bool,\n language?: string,\n script?: string,\n region?: string,\n}" }, { - "id": "Core.Intl.Collator.sensitivity", - "kind": "type", - "name": "sensitivity", + "id": "Core.Intl.Locale.make", + "kind": "value", + "name": "make", "docstrings": [], - "signature": "type sensitivity = [#accent | #base | #case | #variant]" + "signature": "let make: (string, ~options: options=?) => t" }, { - "id": "Core.Intl.Collator.caseFirst", - "kind": "type", - "name": "caseFirst", + "id": "Core.Intl.Locale.baseName", + "kind": "value", + "name": "baseName", "docstrings": [], - "signature": "type caseFirst = [#\"false\" | #lower | #upper]" + "signature": "let baseName: t => string" }, { - "id": "Core.Intl.Collator.options", - "kind": "type", - "name": "options", + "id": "Core.Intl.Locale.calendar", + "kind": "value", + "name": "calendar", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Core__Intl__Common.localeMatcher,\n usage?: usage,\n sensitivity?: sensitivity,\n ignorePunctuation?: bool,\n numeric?: bool,\n caseFirst?: caseFirst,\n}" + "signature": "let calendar: t => option" }, { - "id": "Core.Intl.Collator.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", + "id": "Core.Intl.Locale.caseFirst", + "kind": "value", + "name": "caseFirst", "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n usage: usage,\n sensitivity: sensitivity,\n ignorePunctuation: bool,\n collation: [\n | #compat\n | #default\n | #dict\n | #emoji\n | #eor\n | #phonebk\n | #phonetic\n | #pinyin\n | #stroke\n | #trad\n | #unihan\n | #zhuyin\n ],\n numeric?: bool,\n caseFirst?: caseFirst,\n}" + "signature": "let caseFirst: t => option" }, { - "id": "Core.Intl.Collator.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", + "id": "Core.Intl.Locale.collation", + "kind": "value", + "name": "collation", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Core__Intl__Common.localeMatcher,\n}" + "signature": "let collation: t => option" }, { - "id": "Core.Intl.Collator.make", + "id": "Core.Intl.Locale.hourCycle", "kind": "value", - "name": "make", + "name": "hourCycle", "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" + "signature": "let hourCycle: t => option" }, { - "id": "Core.Intl.Collator.supportedLocalesOf", + "id": "Core.Intl.Locale.language", "kind": "value", - "name": "supportedLocalesOf", + "name": "language", "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + "signature": "let language: t => string" }, { - "id": "Core.Intl.Collator.resolvedOptions", + "id": "Core.Intl.Locale.numberingSystem", "kind": "value", - "name": "resolvedOptions", + "name": "numberingSystem", "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" + "signature": "let numberingSystem: t => option" }, { - "id": "Core.Intl.Collator.compare", + "id": "Core.Intl.Locale.numeric", "kind": "value", - "name": "compare", + "name": "numeric", "docstrings": [], - "signature": "let compare: (t, string, string) => int" + "signature": "let numeric: t => bool" + }, + { + "id": "Core.Intl.Locale.region", + "kind": "value", + "name": "region", + "docstrings": [], + "signature": "let region: t => option" + }, + { + "id": "Core.Intl.Locale.script", + "kind": "value", + "name": "script", + "docstrings": [], + "signature": "let script: t => option" + }, + { + "id": "Core.Intl.Locale.maximize", + "kind": "value", + "name": "maximize", + "docstrings": [], + "signature": "let maximize: t => t" + }, + { + "id": "Core.Intl.Locale.minimize", + "kind": "value", + "name": "minimize", + "docstrings": [], + "signature": "let minimize: t => t" } ] }, - "core/intl/common": { - "id": "Core.Intl.Common", - "name": "Common", + "core/intl/listformat": { + "id": "Core.Intl.ListFormat", + "name": "ListFormat", "docstrings": [], "items": [ { - "id": "Core.Intl.Common.localeMatcher", + "id": "Core.Intl.ListFormat.t", "kind": "type", - "name": "localeMatcher", + "name": "t", "docstrings": [], - "signature": "type localeMatcher = [#\"best fit\" | #lookup]" + "signature": "type t" }, { - "id": "Core.Intl.Common.calendar", + "id": "Core.Intl.ListFormat.listType", "kind": "type", - "name": "calendar", + "name": "listType", "docstrings": [], - "signature": "type calendar = [\n | #buddhist\n | #chinese\n | #coptic\n | #dangi\n | #ethioaa\n | #ethiopic\n | #gregory\n | #hebrew\n | #indian\n | #islamic\n | #\"islamic-civil\"\n | #\"islamic-rgsa\"\n | #\"islamic-tbla\"\n | #\"islamic-umalqura\"\n | #iso8601\n | #japanese\n | #persian\n | #roc\n]" + "signature": "type listType = [#conjunction | #disjunction | #unit]" }, { - "id": "Core.Intl.Common.collation", + "id": "Core.Intl.ListFormat.style", "kind": "type", - "name": "collation", + "name": "style", "docstrings": [], - "signature": "type collation = [\n | #compat\n | #dict\n | #emoji\n | #eor\n | #phonebk\n | #phonetic\n | #pinyin\n | #stroke\n | #trad\n | #unihan\n | #zhuyin\n]" + "signature": "type style = [#long | #narrow | #short]" }, { - "id": "Core.Intl.Common.numberingSystem", + "id": "Core.Intl.ListFormat.options", "kind": "type", - "name": "numberingSystem", + "name": "options", "docstrings": [], - "signature": "type numberingSystem = [\n | #adlm\n | #ahom\n | #arab\n | #arabext\n | #bali\n | #beng\n | #bhks\n | #brah\n | #cakm\n | #cham\n | #deva\n | #diak\n | #fullwide\n | #gong\n | #gonm\n | #gujr\n | #guru\n | #hanidec\n | #hmng\n | #hmnp\n | #java\n | #kali\n | #kawi\n | #khmr\n | #knda\n | #lana\n | #lanatham\n | #laoo\n | #latn\n | #lepc\n | #limb\n | #mathbold\n | #mathdbl\n | #mathmono\n | #mathsanb\n | #mathsans\n | #mlym\n | #modi\n | #mong\n | #mroo\n | #mtei\n | #mymr\n | #mymrshan\n | #mymrtlng\n | #nagm\n | #newa\n | #nkoo\n | #olck\n | #orya\n | #osma\n | #rohg\n | #saur\n | #segment\n | #shrd\n | #sind\n | #sinh\n | #sora\n | #sund\n | #takr\n | #talu\n | #tamldec\n | #telu\n | #thai\n | #tibt\n | #tirh\n | #tnsa\n | #vaii\n | #wara\n | #wcho\n]" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" }, { - "id": "Core.Intl.Common.oneTo21", + "id": "Core.Intl.ListFormat.listPartComponentType", "kind": "type", - "name": "oneTo21", + "name": "listPartComponentType", "docstrings": [], - "signature": "type oneTo21 = [\n | #1\n | #10\n | #11\n | #12\n | #13\n | #14\n | #15\n | #16\n | #17\n | #18\n | #19\n | #2\n | #20\n | #21\n | #3\n | #4\n | #5\n | #6\n | #7\n | #8\n | #9\n]" + "signature": "type listPartComponentType = [#element | #literal]" }, { - "id": "Core.Intl.Common.zeroTo20", + "id": "Core.Intl.ListFormat.listPart", "kind": "type", - "name": "zeroTo20", + "name": "listPart", "docstrings": [], - "signature": "type zeroTo20 = [\n | #0\n | #1\n | #10\n | #11\n | #12\n | #13\n | #14\n | #15\n | #16\n | #17\n | #18\n | #19\n | #2\n | #20\n | #3\n | #4\n | #5\n | #6\n | #7\n | #8\n | #9\n]" - } - ] - }, - "core/biguint64array/constants": { - "id": "Core.BigUint64Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "id": "Core.BigUint64Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/bigint64array/constants": { - "id": "Core.BigInt64Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "signature": "type listPart = {\n \\\"type\": listPartComponentType,\n value: string,\n}" + }, { - "id": "Core.BigInt64Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/uint8clampedarray/constants": { - "id": "Core.Uint8ClampedArray.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "id": "Core.Intl.ListFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n style: style,\n \\\"type\": listType,\n}" + }, { - "id": "Core.Uint8ClampedArray.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/uint32array/constants": { - "id": "Core.Uint32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "id": "Core.Intl.ListFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" + }, { - "id": "Core.Uint32Array.Constants.bytesPerElement", + "id": "Core.Intl.ListFormat.make", "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/uint16array/constants": { - "id": "Core.Uint16Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, { - "id": "Core.Uint16Array.Constants.bytesPerElement", + "id": "Core.Intl.ListFormat.supportedLocalesOf", "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/uint8array/constants": { - "id": "Core.Uint8Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, { - "id": "Core.Uint8Array.Constants.bytesPerElement", + "id": "Core.Intl.ListFormat.resolvedOptions", "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/int32array/constants": { - "id": "Core.Int32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, { - "id": "Core.Int32Array.Constants.bytesPerElement", + "id": "Core.Intl.ListFormat.format", "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/int16array/constants": { - "id": "Core.Int16Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "name": "format", + "docstrings": [], + "signature": "let format: (t, array) => string" + }, { - "id": "Core.Int16Array.Constants.bytesPerElement", + "id": "Core.Intl.ListFormat.formatToParts", "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, array) => array" } ] }, - "core/int8array/constants": { - "id": "Core.Int8Array.Constants", - "name": "Constants", + "core/intl/datetimeformat": { + "id": "Core.Intl.DateTimeFormat", + "name": "DateTimeFormat", "docstrings": [], "items": [ { - "id": "Core.Int8Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/float64array/constants": { - "id": "Core.Float64Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, { - "id": "Core.Float64Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/float32array/constants": { - "id": "Core.Float32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.dateStyle", + "kind": "type", + "name": "dateStyle", + "docstrings": [], + "signature": "type dateStyle = [#full | #long | #medium | #short]" + }, { - "id": "Core.Float32Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", - "docstrings": [ - "`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT)" - ], - "signature": "let bytesPerElement: int" - } - ] - }, - "core/json/decode": { - "id": "Core.JSON.Decode", - "name": "Decode", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.timeStyle", + "kind": "type", + "name": "timeStyle", + "docstrings": [], + "signature": "type timeStyle = [#full | #long | #medium | #short]" + }, { - "id": "Core.JSON.Decode.bool", - "kind": "value", - "name": "bool", - "docstrings": [ - "Decodes a single JSON value. If the value is a bool, it will return `Some(bool)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`true`)->JSON.Decode.bool\n // Some(true)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.bool\n // None\n ```" - ], - "signature": "let bool: t => option" + "id": "Core.Intl.DateTimeFormat.dayPeriod", + "kind": "type", + "name": "dayPeriod", + "docstrings": [], + "signature": "type dayPeriod = [#long | #narrow | #short]" }, { - "id": "Core.JSON.Decode.null", - "kind": "value", - "name": "null", - "docstrings": [ - "Decodes a single JSON value. If the value is null, it will return `Some(Null.t)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`null`)->JSON.Decode.null\n // Some(null)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.null\n // None\n ```" - ], - "signature": "let null: t => option>" + "id": "Core.Intl.DateTimeFormat.weekday", + "kind": "type", + "name": "weekday", + "docstrings": [], + "signature": "type weekday = [#long | #narrow | #short]" }, { - "id": "Core.JSON.Decode.string", - "kind": "value", - "name": "string", - "docstrings": [ - "Decodes a single JSON value. If the value is a string, it will return `Some(string)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.string\n // Some(\"hello world\")\n\n JSON.parseExn(`42`)->JSON.Decode.string\n // None \n ```" - ], - "signature": "let string: t => option" + "id": "Core.Intl.DateTimeFormat.era", + "kind": "type", + "name": "era", + "docstrings": [], + "signature": "type era = [#long | #narrow | #short]" }, { - "id": "Core.JSON.Decode.float", - "kind": "value", - "name": "float", - "docstrings": [ - "Decodes a single JSON value. If the value is a float, it will return `Some(float)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`42.0`)->JSON.Decode.float\n // Some(42.0)\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.float\n // None\n ```" - ], - "signature": "let float: t => option" + "id": "Core.Intl.DateTimeFormat.year", + "kind": "type", + "name": "year", + "docstrings": [], + "signature": "type year = [#\"2-digit\" | #numeric]" }, { - "id": "Core.JSON.Decode.object", - "kind": "value", - "name": "object", - "docstrings": [ - "Decodes a single JSON value. If the value is an object, it will return `Some(Dict.t)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`{\"foo\":\"bar\"}`)->JSON.Decode.object\n // Some({ foo: 'bar' })\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.object\n // None\n ```" - ], - "signature": "let object: t => option>" + "id": "Core.Intl.DateTimeFormat.month", + "kind": "type", + "name": "month", + "docstrings": [], + "signature": "type month = [\n | #\"2-digit\"\n | #long\n | #narrow\n | #numeric\n | #short\n]" }, { - "id": "Core.JSON.Decode.array", - "kind": "value", - "name": "array", - "docstrings": [ - "Decodes a single JSON value. If the value is an array, it will return `Some(array)` - otherwise it will return `None`.\n\n ## Examples\n ```rescript\n JSON.parseExn(`[\"foo\", \"bar\"]`)->JSON.Decode.array\n // Some([ 'foo', 'bar' ])\n\n JSON.parseExn(`\"hello world\"`)->JSON.Decode.array\n // None\n ```" - ], - "signature": "let array: t => option>" - } - ] - }, - "core/json/encode": { - "id": "Core.JSON.Encode", - "name": "Encode", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.day", + "kind": "type", + "name": "day", + "docstrings": [], + "signature": "type day = [#\"2-digit\" | #numeric]" + }, { - "id": "Core.JSON.Encode.bool", - "kind": "value", - "name": "bool", - "docstrings": [ - "Returns a boolean as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.bool(true)\n ```" - ], - "signature": "let bool: bool => t" + "id": "Core.Intl.DateTimeFormat.hour", + "kind": "type", + "name": "hour", + "docstrings": [], + "signature": "type hour = [#\"2-digit\" | #numeric]" }, { - "id": "Core.JSON.Encode.null", - "kind": "value", - "name": "null", - "docstrings": [ - "Returns null as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.null\n ```" - ], - "signature": "let null: t" + "id": "Core.Intl.DateTimeFormat.minute", + "kind": "type", + "name": "minute", + "docstrings": [], + "signature": "type minute = [#\"2-digit\" | #numeric]" }, { - "id": "Core.JSON.Encode.string", - "kind": "value", - "name": "string", - "docstrings": [ - "Returns a string as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.string(\"hello world\")\n ```" - ], - "signature": "let string: string => t" + "id": "Core.Intl.DateTimeFormat.second", + "kind": "type", + "name": "second", + "docstrings": [], + "signature": "type second = [#\"2-digit\" | #numeric]" }, { - "id": "Core.JSON.Encode.int", - "kind": "value", - "name": "int", + "id": "Core.Intl.DateTimeFormat.timeZoneName", + "kind": "type", + "name": "timeZoneName", "docstrings": [ - "Returns an int as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.int(42)\n ```" + "Firefox also supports IANA time zone names here\nNode v19+ supports \"shortOffset\", \"shortGeneric\", \"longOffset\", and \"longGeneric\"." ], - "signature": "let int: int => t" + "signature": "type timeZoneName = [\n | #long\n | #longGeneric\n | #longOffset\n | #short\n | #shortGeneric\n | #shortOffset\n]" }, { - "id": "Core.JSON.Encode.float", - "kind": "value", - "name": "float", - "docstrings": [ - "Returns a float as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.float(42.0)\n ```" - ], - "signature": "let float: float => t" + "id": "Core.Intl.DateTimeFormat.hourCycle", + "kind": "type", + "name": "hourCycle", + "docstrings": [], + "signature": "type hourCycle = [#h11 | #h12 | #h23 | #h24]" }, { - "id": "Core.JSON.Encode.object", - "kind": "value", - "name": "object", - "docstrings": [ - "Returns a dict as a JSON object.\n\n ## Examples\n ```rescript\n let dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n ])\n\n JSON.Encode.object(dict)\n ```" - ], - "signature": "let object: Core__Dict.t => t" + "id": "Core.Intl.DateTimeFormat.formatMatcher", + "kind": "type", + "name": "formatMatcher", + "docstrings": [], + "signature": "type formatMatcher = [#basic | #\"best fit\"]" }, { - "id": "Core.JSON.Encode.array", - "kind": "value", - "name": "array", - "docstrings": [ - "Returns an array as a JSON object.\n\n ## Examples\n ```rescript\n let array = [JSON.Encode.string(\"hello world\"), JSON.Encode.int(42)]\n\n JSON.Encode.array(array)\n ```" - ], - "signature": "let array: array => t" - } - ] - }, - "core/json/classify": { - "id": "Core.JSON.Classify", - "name": "Classify", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.fractionalSecondDigits", + "kind": "type", + "name": "fractionalSecondDigits", + "docstrings": [], + "signature": "type fractionalSecondDigits = [#0 | #1 | #2 | #3]" + }, { - "id": "Core.JSON.Classify.t", + "id": "Core.Intl.DateTimeFormat.options", "kind": "type", - "name": "t", - "docstrings": [ - "A type representing a JavaScript type." - ], - "signature": "type t =\n | Bool(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Core__Dict.t)\n | Array(array)" + "name": "options", + "docstrings": [], + "signature": "type options = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n calendar?: Intl_Common.calendar,\n dayPeriod?: dayPeriod,\n numberingSystem?: Intl_Common.numberingSystem,\n localeMatcher?: Intl_Common.localeMatcher,\n timeZone?: string,\n hour12?: bool,\n hourCycle?: hourCycle,\n formatMatcher?: formatMatcher,\n weekday?: weekday,\n era?: era,\n year?: year,\n month?: month,\n day?: day,\n hour?: hour,\n minute?: minute,\n second?: second,\n fractionalSecondDigits?: fractionalSecondDigits,\n timeZoneName?: timeZoneName,\n}" }, { - "id": "Core.JSON.Classify.classify", - "kind": "value", - "name": "classify", - "docstrings": [ - "Returns the JSON type of any value.\n\n ## Examples\n ```rescript\n JSON.Classify.classify(\"hello world\")\n // String(\"hello world\")\n\n JSON.Classify.classify(42)\n // Number(42)\n ```" - ], - "signature": "let classify: 'a => t" - } - ] - }, - "core/type/classify": { - "id": "Core.Type.Classify", - "name": "Classify", - "docstrings": [], - "items": [ + "id": "Core.Intl.DateTimeFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n weekday?: weekday,\n era?: era,\n year?: year,\n month?: month,\n day?: day,\n hour?: hour,\n minute?: minute,\n second?: second,\n fractionalSecondDigits?: fractionalSecondDigits,\n timeZoneName?: timeZoneName,\n calendar: Intl_Common.calendar,\n hour12: bool,\n hourCycle: hourCycle,\n locale: string,\n numberingSystem: Intl_Common.numberingSystem,\n timeZone: string,\n}" + }, { - "id": "Core.Type.Classify.function", + "id": "Core.Intl.DateTimeFormat.supportedLocalesOptions", "kind": "type", - "name": "function", - "docstrings": [ - "An abstract type representing a JavaScript function.\n\n See [`function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) on MDN." - ], - "signature": "type function" + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" + }, + { + "id": "Core.Intl.DateTimeFormat.dateTimeComponent", + "kind": "type", + "name": "dateTimeComponent", + "docstrings": [], + "signature": "type dateTimeComponent = [\n | #day\n | #dayPeriod\n | #era\n | #fractionalSecond\n | #hour\n | #literal\n | #minute\n | #month\n | #relatedYear\n | #second\n | #timeZone\n | #weekday\n | #year\n | #yearName\n]" + }, + { + "id": "Core.Intl.DateTimeFormat.dateTimePart", + "kind": "type", + "name": "dateTimePart", + "docstrings": [], + "signature": "type dateTimePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n}" + }, + { + "id": "Core.Intl.DateTimeFormat.dateTimeRangeSource", + "kind": "type", + "name": "dateTimeRangeSource", + "docstrings": [], + "signature": "type dateTimeRangeSource = [\n | #endRange\n | #shared\n | #startRange\n]" }, { - "id": "Core.Type.Classify.object", + "id": "Core.Intl.DateTimeFormat.dateTimeRangePart", "kind": "type", - "name": "object", - "docstrings": [ - "An abstract type representing a JavaScript object.\n\n See [`object`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) on MDN." - ], - "signature": "type object" + "name": "dateTimeRangePart", + "docstrings": [], + "signature": "type dateTimeRangePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n source: dateTimeRangeSource,\n}" }, { - "id": "Core.Type.Classify.t", - "kind": "type", - "name": "t", - "docstrings": [ - "The type representing a classified JavaScript value." - ], - "signature": "type t =\n | Bool(bool)\n | Null\n | Undefined\n | String(string)\n | Number(float)\n | Object(object)\n | Function(function)\n | Symbol(Core__Symbol.t)\n | BigInt(bigint)" + "id": "Core.Intl.DateTimeFormat.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Type.Classify.classify", + "id": "Core.Intl.DateTimeFormat.supportedLocalesOf", "kind": "value", - "name": "classify", - "docstrings": [ - "`classify(anyValue)`\nClassifies a JavaScript value.\n\n## Examples\n```rescript\nswitch %raw(`null`)->Type.Classify.classify {\n| Null => Console.log(\"Yup, that's null.\")\n| _ => Console.log(\"This doesn't actually appear to be null...\")\n}\n```" - ], - "signature": "let classify: 'a => t" - } - ] - }, - "core/regexp/result": { - "id": "Core.RegExp.Result", - "name": "Result", - "docstrings": [], - "items": [ + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, { - "id": "Core.RegExp.Result.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Type representing the result of a `RegExp` execution." - ], - "signature": "type t = array>" + "id": "Core.Intl.DateTimeFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.RegExp.Result.fullMatch", + "id": "Core.Intl.DateTimeFormat.format", "kind": "value", - "name": "fullMatch", - "docstrings": [ - "`fullMatch(regExpResult)` returns the full string that matched in this result.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints the full string that matched, \"ReScript is\"\n }\n ```" - ], - "signature": "let fullMatch: t => string" + "name": "format", + "docstrings": [], + "signature": "let format: (t, Date.t) => string" }, { - "id": "Core.RegExp.Result.matches", + "id": "Core.Intl.DateTimeFormat.formatToParts", "kind": "value", - "name": "matches", - "docstrings": [ - "`matches(regExpResult)` returns all matches for `regExpResult`.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n // This below will log \"ReScript\" and \"is\" to the console.\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => switch result->RegExp.Result.matches {\n | [firstWord, secondWord] => Console.log2(firstWord, secondWord)\n | _ => Console.log(\"Didn't find exactly two words...\")\n }\n }\n ```" - ], - "signature": "let matches: t => array" + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, Date.t) => array" }, { - "id": "Core.RegExp.Result.index", + "id": "Core.Intl.DateTimeFormat.formatRange", "kind": "value", - "name": "index", + "name": "formatRange", "docstrings": [], - "signature": "let index: t => int" + "signature": "let formatRange: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => string" }, { - "id": "Core.RegExp.Result.input", + "id": "Core.Intl.DateTimeFormat.formatRangeToParts", "kind": "value", - "name": "input", - "docstrings": [ - "`input(regExpResult)` returns the full input string that was passed to what produced the `RegExp.Result.t`.\n\n ## Examples\n ```rescript\n // Match the first two words separated by a space\n let regexp = RegExp.fromString(\"(\\\\w+) (\\\\w+)\")\n\n // This below will log the full input string \"ReScript is pretty cool, right?\" to the console.\n switch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n | None => Console.log(\"Nope, no match...\")\n | Some(result) => Console.log(result->RegExp.Result.input)\n }\n ```" - ], - "signature": "let input: t => string" + "name": "formatRangeToParts", + "docstrings": [], + "signature": "let formatRangeToParts: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => array" } ] }, - "core/math/int": { - "id": "Core.Math.Int", - "name": "Int", - "docstrings": [ - "Provide Math utilities for `int`" - ], + "core/intl/collator": { + "id": "Core.Intl.Collator", + "name": "Collator", + "docstrings": [], "items": [ { - "id": "Core.Math.Int.abs", - "kind": "value", - "name": "abs", - "docstrings": [ - "`abs(v)` returns absolute value of `v`.\n See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.abs(-2) // 2\n Math.Int.abs(3) // 3\n ```" - ], - "signature": "let abs: int => int" + "id": "Core.Intl.Collator.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" }, { - "id": "Core.Math.Int.clz32", - "kind": "value", - "name": "clz32", - "docstrings": [ - "`clz32(v)` returns the number of leading zero bits of the argument's 32 bit\n int representation.\n See [`Math.clz32`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32) on MDN.\n\n ## Examples\n\n ```rescript\n // 00000000000000000000000000000001\n Math.Int.clz32(1) // 31\n // 00000000000000000000000000000100\n Math.Int.clz32(4) // 29\n ```" - ], - "signature": "let clz32: int => int" + "id": "Core.Intl.Collator.usage", + "kind": "type", + "name": "usage", + "docstrings": [], + "signature": "type usage = [#search | #sort]" }, { - "id": "Core.Math.Int.imul", - "kind": "value", - "name": "imul", - "docstrings": [ - "`imul(a, b)` returns 32-bit integer multiplication. Use this only when you\n need to optimize performance of multiplication of numbers stored as 32-bit\n integers.\n See [`Math.imul`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.imul(3, 4) // 12\n Math.Int.imul(-5, 12) // 60\n ```" - ], - "signature": "let imul: (int, int) => int" + "id": "Core.Intl.Collator.sensitivity", + "kind": "type", + "name": "sensitivity", + "docstrings": [], + "signature": "type sensitivity = [#accent | #base | #case | #variant]" }, { - "id": "Core.Math.Int.min", - "kind": "value", - "name": "min", - "docstrings": [ - "`min(a, b)` returns the minimum of its two integer arguments.\n See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.min(1, 2) // 1\n Math.Int.min(-1, -2) // -2\n ```" - ], - "signature": "let min: (int, int) => int" + "id": "Core.Intl.Collator.caseFirst", + "kind": "type", + "name": "caseFirst", + "docstrings": [], + "signature": "type caseFirst = [#\"false\" | #lower | #upper]" }, { - "id": "Core.Math.Int.minMany", - "kind": "value", - "name": "minMany", - "docstrings": [ - "`minMany(arr)` returns the minimum of the integers in the given array `arr`.\n Returns `Infinity` if `arr` is empty.\n See [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.minMany([1, 2]) // 1\n Math.Int.minMany([-1, -2]) // -2\n Math.Int.minMany([])->Int.toFloat->Float.isFinite // false\n ```" - ], - "signature": "let minMany: array => int" + "id": "Core.Intl.Collator.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n usage?: usage,\n sensitivity?: sensitivity,\n ignorePunctuation?: bool,\n numeric?: bool,\n caseFirst?: caseFirst,\n}" }, { - "id": "Core.Math.Int.max", - "kind": "value", - "name": "max", - "docstrings": [ - "`max(a, b)` returns the maximum of its two integer arguments.\n See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.max(1, 2) // 2\n Math.Int.max(-1, -2) // -1\n ```" - ], - "signature": "let max: (int, int) => int" + "id": "Core.Intl.Collator.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n usage: usage,\n sensitivity: sensitivity,\n ignorePunctuation: bool,\n collation: [\n | #compat\n | #default\n | #dict\n | #emoji\n | #eor\n | #phonebk\n | #phonetic\n | #pinyin\n | #stroke\n | #trad\n | #unihan\n | #zhuyin\n ],\n numeric?: bool,\n caseFirst?: caseFirst,\n}" }, { - "id": "Core.Math.Int.maxMany", - "kind": "value", - "name": "maxMany", - "docstrings": [ - "`maxMany(arr)` returns the maximum of the integers in the given array `arr`.\n Returns `Infinity` if `arr` is empty.\n See [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.maxMany([1, 2]) // 2\n Math.Int.maxMany([-1, -2]) // -1\n Math.Int.maxMany([])->Int.toFloat->Float.isFinite // false\n ```" - ], - "signature": "let maxMany: array => int" + "id": "Core.Intl.Collator.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { - "id": "Core.Math.Int.pow", + "id": "Core.Intl.Collator.make", "kind": "value", - "name": "pow", - "docstrings": [ - "`pow(a, ~exp)` raises the given base `a` to the given exponent `exp`.\n See [`Math.pow`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.pow(2, ~exp=4) // 16\n Math.Int.pow(3, ~exp=4) // 81\n ```" - ], - "signature": "let pow: (int, ~exp: int) => int" + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" }, { - "id": "Core.Math.Int.sign", + "id": "Core.Intl.Collator.supportedLocalesOf", "kind": "value", - "name": "sign", - "docstrings": [ - "`sign(v)` returns the sign of its integer argument: `-1` if negative, `0` if\n zero, `1` if positive.\n See [`Math.sign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.sign(3) // 1\n Math.Int.sign(-3) // 1\n Math.Int.sign(0) // 0\n ```" - ], - "signature": "let sign: int => int" + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" }, { - "id": "Core.Math.Int.floor", + "id": "Core.Intl.Collator.resolvedOptions", "kind": "value", - "name": "floor", - "docstrings": [ - "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" + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" }, { - "id": "Core.Math.Int.ceil", + "id": "Core.Intl.Collator.compare", "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" + "name": "compare", + "docstrings": [], + "signature": "let compare: (t, string, string) => int" + } + ] + }, + "core/intl/common": { + "id": "Core.Intl.Common", + "name": "Common", + "docstrings": [], + "items": [ + { + "id": "Core.Intl.Common.localeMatcher", + "kind": "type", + "name": "localeMatcher", + "docstrings": [], + "signature": "type localeMatcher = [#\"best fit\" | #lookup]" + }, + { + "id": "Core.Intl.Common.calendar", + "kind": "type", + "name": "calendar", + "docstrings": [], + "signature": "type calendar = [\n | #buddhist\n | #chinese\n | #coptic\n | #dangi\n | #ethioaa\n | #ethiopic\n | #gregory\n | #hebrew\n | #indian\n | #islamic\n | #\"islamic-civil\"\n | #\"islamic-rgsa\"\n | #\"islamic-tbla\"\n | #\"islamic-umalqura\"\n | #iso8601\n | #japanese\n | #persian\n | #roc\n]" + }, + { + "id": "Core.Intl.Common.collation", + "kind": "type", + "name": "collation", + "docstrings": [], + "signature": "type collation = [\n | #compat\n | #dict\n | #emoji\n | #eor\n | #phonebk\n | #phonetic\n | #pinyin\n | #stroke\n | #trad\n | #unihan\n | #zhuyin\n]" + }, + { + "id": "Core.Intl.Common.numberingSystem", + "kind": "type", + "name": "numberingSystem", + "docstrings": [], + "signature": "type numberingSystem = [\n | #adlm\n | #ahom\n | #arab\n | #arabext\n | #bali\n | #beng\n | #bhks\n | #brah\n | #cakm\n | #cham\n | #deva\n | #diak\n | #fullwide\n | #gong\n | #gonm\n | #gujr\n | #guru\n | #hanidec\n | #hmng\n | #hmnp\n | #java\n | #kali\n | #kawi\n | #khmr\n | #knda\n | #lana\n | #lanatham\n | #laoo\n | #latn\n | #lepc\n | #limb\n | #mathbold\n | #mathdbl\n | #mathmono\n | #mathsanb\n | #mathsans\n | #mlym\n | #modi\n | #mong\n | #mroo\n | #mtei\n | #mymr\n | #mymrshan\n | #mymrtlng\n | #nagm\n | #newa\n | #nkoo\n | #olck\n | #orya\n | #osma\n | #rohg\n | #saur\n | #segment\n | #shrd\n | #sind\n | #sinh\n | #sora\n | #sund\n | #takr\n | #talu\n | #tamldec\n | #telu\n | #thai\n | #tibt\n | #tirh\n | #tnsa\n | #vaii\n | #wara\n | #wcho\n]" + }, + { + "id": "Core.Intl.Common.oneTo21", + "kind": "type", + "name": "oneTo21", + "docstrings": [], + "signature": "type oneTo21 = [\n | #1\n | #10\n | #11\n | #12\n | #13\n | #14\n | #15\n | #16\n | #17\n | #18\n | #19\n | #2\n | #20\n | #21\n | #3\n | #4\n | #5\n | #6\n | #7\n | #8\n | #9\n]" }, { - "id": "Core.Math.Int.random", - "kind": "value", - "name": "random", - "docstrings": [ - "`random(minVal, maxVal)` returns a random integer number in the half-closed interval [minVal, maxVal).\n See [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.random(2, 5) == 4\n Math.Int.random(505, 2000) == 1276\n Math.Int.random(-7, -2) == -4\n ```" - ], - "signature": "let random: (int, int) => int" + "id": "Core.Intl.Common.zeroTo20", + "kind": "type", + "name": "zeroTo20", + "docstrings": [], + "signature": "type zeroTo20 = [\n | #0\n | #1\n | #10\n | #11\n | #12\n | #13\n | #14\n | #15\n | #16\n | #17\n | #18\n | #19\n | #2\n | #20\n | #3\n | #4\n | #5\n | #6\n | #7\n | #8\n | #9\n]" } ] }, - "core/math/constants": { - "id": "Core.Math.Constants", - "name": "Constants", - "docstrings": [ - "Mathematical Constants" - ], + "core/int/bitwise": { + "id": "Core.Int.Bitwise", + "name": "Bitwise", + "docstrings": [], "items": [ { - "id": "Core.Math.Constants.e", - "kind": "value", - "name": "e", - "docstrings": [ - "`Math.Constants.e` returns Euler's number, ≈ 2.718281828459045.\n See [`Math.E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.e\n ```" - ], - "signature": "let e: float" - }, - { - "id": "Core.Math.Constants.ln2", + "id": "Core.Int.Bitwise.land", "kind": "value", - "name": "ln2", + "name": "land", "docstrings": [ - "`Math.Constants.ln2` returns Natural logarithm of 2, ≈ 0.6931471805599453.\n See [`Math.LN2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN2) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.ln2\n ```" + "`land(n1, n2)` calculates the bitwise logical AND of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.land(7, 4) == 4\n ```" ], - "signature": "let ln2: float" + "signature": "let land: (int, int) => int" }, { - "id": "Core.Math.Constants.ln10", + "id": "Core.Int.Bitwise.lor", "kind": "value", - "name": "ln10", + "name": "lor", "docstrings": [ - "`Math.Constants.ln10` returns Natural logarithm of 10, ≈ 2.302585092994046.\n See [`Math.LN10`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LN10) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.ln10\n ```" + "`lor(n1, n2)` calculates the bitwise logical OR of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lor(7, 4) == 7\n ```" ], - "signature": "let ln10: float" + "signature": "let lor: (int, int) => int" }, { - "id": "Core.Math.Constants.log2e", + "id": "Core.Int.Bitwise.lxor", "kind": "value", - "name": "log2e", + "name": "lxor", "docstrings": [ - "`Math.Constants.log2e` returns Base 2 logarithm of E, ≈ 1.4426950408889634.\n See [`Math.LOG2E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG2E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.log2e\n ```" + "`lxor(n1, n2)` calculates the bitwise logical XOR of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lxor(7, 4) == 3\n ```" ], - "signature": "let log2e: float" + "signature": "let lxor: (int, int) => int" }, { - "id": "Core.Math.Constants.log10e", + "id": "Core.Int.Bitwise.lnot", "kind": "value", - "name": "log10e", + "name": "lnot", "docstrings": [ - "`Math.Constants.log10e` returns Base 10 logarithm of E, ≈ 0.4342944819032518.\n See [`Math.LOG10E`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/LOG10E) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.log10e\n ```" + "`lnot(n)` calculates the bitwise logical NOT of an integer.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lnot(2) == -3\n ```" ], - "signature": "let log10e: float" + "signature": "let lnot: int => int" }, { - "id": "Core.Math.Constants.pi", + "id": "Core.Int.Bitwise.lsl", "kind": "value", - "name": "pi", + "name": "lsl", "docstrings": [ - "`Math.Constants.pi` returns Pi - ratio of the circumference to the diameter\n of a circle, ≈ 3.141592653589793.\n See [`Math.PI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.pi\n ```" + "`lsl(n, length)` calculates the bitwise logical left shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lsl(4, 1) == 8\n ```" ], - "signature": "let pi: float" + "signature": "let lsl: (int, int) => int" }, { - "id": "Core.Math.Constants.sqrt1_2", + "id": "Core.Int.Bitwise.lsr", "kind": "value", - "name": "sqrt1_2", + "name": "lsr", "docstrings": [ - "`Math.Constants.sqrt1_2` returns Square root of 1/2, ≈ 0.7071067811865476.\n See [`Math.SQRT1_2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.sqrt1_2\n ```" + "`lsr(n, length)` calculates the bitwise logical right shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lsr(8, 1) == 4\n ```" ], - "signature": "let sqrt1_2: float" + "signature": "let lsr: (int, int) => int" }, { - "id": "Core.Math.Constants.sqrt2", + "id": "Core.Int.Bitwise.asr", "kind": "value", - "name": "sqrt2", + "name": "asr", "docstrings": [ - "`Math.Constants.e` returns Absolute value for integer argument.\n See [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n ## Examples\n\n ```rescript\n Math.Constants.sqrt2\n ```" + "`asr(n, length)` calculates the bitwise arithmetic right shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.asr(4, 1) == 2\n ```" ], - "signature": "let sqrt2: float" + "signature": "let asr: (int, int) => int" } ] }, @@ -2244,4960 +2333,5025 @@ "kind": "value", "name": "makeWithYMD", "docstrings": [ - "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=20)\n // 1676851200000\n\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=-1)\n // 1675036800000\n\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~date=29)\n // 1677628800000\n ```" + "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~day=20)\n // 1676851200000\n\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~day=-1)\n // 1675036800000\n\n Date.UTC.makeWithYMD(~year=2023, ~month=1, ~day=29)\n // 1677628800000\n ```" ], - "signature": "let makeWithYMD: (~year: int, ~month: int, ~date: int) => msSinceEpoch" + "signature": "let makeWithYMD: (~year: int, ~month: int, ~day: int) => msSinceEpoch" }, { "id": "Core.Date.UTC.makeWithYMDH", "kind": "value", "name": "makeWithYMDH", "docstrings": [ - "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=16)\n // 1676908800000\n\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=24)\n // 1676937600000\n\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=-1)\n // 1676847600000\n ```" + "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=16)\n // 1676908800000\n\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=24)\n // 1676937600000\n\n Date.UTC.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=-1)\n // 1676847600000\n ```" ], - "signature": "let makeWithYMDH: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n) => msSinceEpoch" + "signature": "let makeWithYMDH: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n) => msSinceEpoch" }, { "id": "Core.Date.UTC.makeWithYMDHM", "kind": "value", "name": "makeWithYMDHM", "docstrings": [ - "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40)\n // 1676911200000\n\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=60)\n // 1676912400000\n\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=-1)\n // 1676908740000\n ```" + "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40)\n // 1676911200000\n\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=60)\n // 1676912400000\n\n Date.UTC.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=-1)\n // 1676908740000\n ```" ], - "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n) => msSinceEpoch" + "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n) => msSinceEpoch" }, { "id": "Core.Date.UTC.makeWithYMDHMS", "kind": "value", "name": "makeWithYMDHMS", "docstrings": [ - "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0)\n // 1676911200000\n\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=60)\n // 1676911260000\n\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=-1)\n // 1676911199000\n ```" + "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0)\n // 1676911200000\n\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=60)\n // 1676911260000\n\n Date.UTC.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=-1)\n // 1676911199000\n ```" ], - "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => msSinceEpoch" + "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => msSinceEpoch" }, { "id": "Core.Date.UTC.makeWithYMDHMSM", "kind": "value", "name": "makeWithYMDHMSM", "docstrings": [ - "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=0)->Console.log\n // 1676911200000\n\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=1000)->Console.log\n // 1676911201000\n\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=-1)->Console.log\n // 1676911199999\n ```" + "Returns the time, in milliseconds, since UNIX epoch (January 1, 1970 00:00:00 UTC).\n Be aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\n Months are 0-indexed (0 = January, 11 = December).\n Values, which are out of range, will be carried over to the next bigger unit (s. example).\n\n ## Examples\n ```rescript\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=0)->Console.log\n // 1676911200000\n\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=1000)->Console.log\n // 1676911201000\n\n Date.UTC.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=-1)->Console.log\n // 1676911199999\n ```" ], - "signature": "let makeWithYMDHMSM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => msSinceEpoch" + "signature": "let makeWithYMDHMSM: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => msSinceEpoch" } ] }, - "core/result": { - "id": "Core.Result", - "name": "Result", + "core/biguint64array": { + "id": "Core.BigUint64Array", + "name": "BigUint64Array", "docstrings": [], "items": [ { - "id": "Core.Result.getExn", - "kind": "value", - "name": "getExn", - "docstrings": [ - "Result types are really useful to describe the result of a certain operation\n without relying on exceptions or `option` types.\n\n This module gives you useful utilities to create and combine `Result` data." - ], - "signature": "let getExn: result<'a, 'b> => 'a" - }, - { - "id": "Core.Result.mapOr", - "kind": "value", - "name": "mapOr", - "docstrings": [ - "`mapOr(res, default, f)`: When res is `Ok(n)`, returns `f(n)`, otherwise `default`.\n\n## Examples\n\n```rescript\nlet ok = Ok(42)\nResult.mapOr(ok, 0, (x) => x / 2) == 21\n\nlet error = Error(\"Invalid data\")\nResult.mapOr(error, 0, (x) => x / 2) == 0\n```" - ], - "signature": "let mapOr: (result<'a, 'c>, 'b, 'a => 'b) => 'b" - }, - { - "id": "Core.Result.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (result<'a, 'c>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" - }, - { - "id": "Core.Result.map", - "kind": "value", - "name": "map", - "docstrings": [ - "`map(res, f)`: When res is `Ok(n)`, returns `Ok(f(n))`. Otherwise returns res\nunchanged. Function `f` takes a value of the same type as `n` and returns an\nordinary value.\n\n## Examples\n\n```rescript\nlet f = (x) => sqrt(Int.toFloat(x))\n\nResult.map(Ok(64), f) == Ok(8.0)\n\nResult.map(Error(\"Invalid data\"), f) == Error(\"Invalid data\")\n```" - ], - "signature": "let map: (result<'a, 'c>, 'a => 'b) => result<'b, 'c>" - }, - { - "id": "Core.Result.flatMap", - "kind": "value", - "name": "flatMap", + "id": "Core.BigUint64Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`flatMap(res, f)`: When res is `Ok(n)`, returns `f(n)`. Otherwise, returns res\nunchanged. Function `f` takes a value of the same type as `n` and returns a\n`Result`.\n\n## Examples\n\n```rescript\nlet recip = (x) =>\n if (x !== 0.0) {\n Ok(1.0 /. x)\n } else {\n Error(\"Divide by zero\")\n }\n\nResult.flatMap(Ok(2.0), recip) == Ok(0.5)\n\nResult.flatMap(Ok(0.0), recip) == Error(\"Divide by zero\")\n\nResult.flatMap(Error(\"Already bad\"), recip) == Error(\"Already bad\")\n```" + "The `BigUint64Array` typed array represents an array of 64-bit unsigned integers in platform byte order. See [BigUint64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array)" ], - "signature": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.Result.getOr", + "id": "Core.BigUint64Array.fromArray", "kind": "value", - "name": "getOr", + "name": "fromArray", "docstrings": [ - "`getOr(res, defaultValue)`: If `res` is `Ok(n)`, returns `n`, otherwise `default`\n\n## Examples\n\n```rescript\nResult.getOr(Ok(42), 0) == 42\n\nResult.getOr(Error(\"Invalid Data\"), 0) == 0\n```" + "`fromArray` creates a `BigUint64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)" ], - "signature": "let getOr: (result<'a, 'b>, 'a) => 'a" - }, - { - "id": "Core.Result.getWithDefault", - "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (result<'a, 'b>, 'a) => 'a", - "deprecated": "Use getOr instead" + "signature": "let fromArray: array => t" }, { - "id": "Core.Result.isOk", + "id": "Core.BigUint64Array.fromBuffer", "kind": "value", - "name": "isOk", + "name": "fromBuffer", "docstrings": [ - "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." + "`fromBuffer` creates a `BigUint64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let isOk: result<'a, 'b> => bool" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.Result.isError", + "id": "Core.BigUint64Array.fromBufferToEnd", "kind": "value", - "name": "isError", + "name": "fromBufferToEnd", "docstrings": [ - "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." + "`fromBufferToEnd` creates a `BigUint64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let isError: result<'a, 'b> => bool" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.Result.equal", + "id": "Core.BigUint64Array.fromBufferWithRange", "kind": "value", - "name": "equal", + "name": "fromBufferWithRange", "docstrings": [ - "`equal(res1, res2, f)`: Determine if two `Result` variables are equal with\nrespect to an equality function. If `res1` and `res2` are of the form `Ok(n)`\nand `Ok(m)`, return the result of `f(n, m)`. If one of `res1` and `res2` are of\nthe form `Error(e)`, return false If both `res1` and `res2` are of the form\n`Error(e)`, return true\n\n## Examples\n\n```rescript\nlet good1 = Ok(42)\n\nlet good2 = Ok(32)\n\nlet bad1 = Error(\"invalid\")\n\nlet bad2 = Error(\"really invalid\")\n\nlet mod10equal = (a, b) => mod(a, 10) === mod(b, 10)\n\nResult.equal(good1, good2, mod10equal) == true\n\nResult.equal(good1, bad1, mod10equal) == false\n\nResult.equal(bad2, good2, mod10equal) == false\n\nResult.equal(bad1, bad2, mod10equal) == true\n```" + "`fromBufferWithRange` creates a `BigUint64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.Result.compare", + "id": "Core.BigUint64Array.fromLength", "kind": "value", - "name": "compare", + "name": "fromLength", "docstrings": [ - "`compare(res1, res2, f)`: Compare two `Result` variables with respect to a\ncomparison function. The comparison function returns -1. if the first variable\nis \"less than\" the second, 0. if the two variables are equal, and 1. if the first\nis \"greater than\" the second.\n\nIf `res1` and `res2` are of the form `Ok(n)` and `Ok(m)`, return the result of\n`f(n, m)`. If `res1` is of the form `Error(e)` and `res2` of the form `Ok(n)`,\nreturn -1. (nothing is less than something) If `res1` is of the form `Ok(n)` and\n`res2` of the form `Error(e)`, return 1. (something is greater than nothing) If\nboth `res1` and `res2` are of the form `Error(e)`, return 0. (equal)\n\n## Examples\n\n```rescript\nlet good1 = Ok(59)\n\nlet good2 = Ok(37)\n\nlet bad1 = Error(\"invalid\")\n\nlet bad2 = Error(\"really invalid\")\n\nlet mod10cmp = (a, b) => Int.compare(mod(a, 10), mod(b, 10))\n\nResult.compare(Ok(39), Ok(57), mod10cmp) == 1.\n\nResult.compare(Ok(57), Ok(39), mod10cmp) == (-1.)\n\nResult.compare(Ok(39), Error(\"y\"), mod10cmp) == 1.\n\nResult.compare(Error(\"x\"), Ok(57), mod10cmp) == (-1.)\n\nResult.compare(Error(\"x\"), Error(\"y\"), mod10cmp) == 0.\n```" + "`fromLength` creates a zero-initialized `BigUint64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Core__Ordering.t,\n) => Core__Ordering.t" + "signature": "let fromLength: int => t" }, { - "id": "Core.Result.forEach", + "id": "Core.BigUint64Array.fromArrayLikeOrIterable", "kind": "value", - "name": "forEach", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`forEach(res, f)` runs the provided function `f` on the `Ok` value. If `res` is `Error`, nothing happens.\n\n## Examples\n\n```rescript\nResult.forEach(Ok(3), Console.log) // Logs \"3\", returns ()\nResult.forEach(Error(\"x\"), Console.log) // Does nothing, returns ()\n```" + "`fromArrayLikeOrIterable` creates a `BigUint64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let forEach: (result<'a, 'b>, 'a => unit) => unit" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.Result.mapError", + "id": "Core.BigUint64Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "mapError", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`mapError(r, f)` generates a new `result` by applying the function `f` to the `Error` value. If the source is `Ok`, return it as-is.\n\n## Examples\n\n```rescript\nlet format = n => `Error code: ${n->Int.toString}`\nResult.mapError(Error(14), format) // Error(\"Error code: 14\")\nResult.mapError(Ok(\"abc\"), format) // Ok(\"abc\")\n```" + "`fromArrayLikeOrIterableWithMap` creates a `BigUint64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" } ] }, - "core/list": { - "id": "Core.List", - "name": "List", + "core/bigint64array": { + "id": "Core.BigInt64Array", + "name": "BigInt64Array", "docstrings": [], "items": [ { - "id": "Core.List.t", + "id": "Core.BigInt64Array.t", "kind": "type", "name": "t", "docstrings": [ - "Collection functions for manipulating the `list` data structures, a singly-linked list.\n\n**Prefer Array** if you need any of the following:\n\n- Random access of element\n- Better interop with JavaScript\n- Better memory usage & performance." - ], - "signature": "type t<'a> = list<'a>" - }, - { - "id": "Core.List.length", - "kind": "value", - "name": "length", - "docstrings": [ - "`length(list)` returns the length of `list`.\n\n## Examples\n\n```rescript\nList.length(list{1, 2, 3}) // 3\n```" - ], - "signature": "let length: t<'a> => int" - }, - { - "id": "Core.List.size", - "kind": "value", - "name": "size", - "docstrings": [ - "`size(list)`. See [`length`](#length)\n\n## Examples\n\n```rescript\nList.size(list{1, 2, 3}) // 3\n```" - ], - "signature": "let size: t<'a> => int" - }, - { - "id": "Core.List.head", - "kind": "value", - "name": "head", - "docstrings": [ - "`head(list)` returns `Some(value)` where `value` is the first element in the\nlist, or `None` if `list` is an empty list.\n\n## Examples\n\n```rescript\nList.head(list{}) // None\nList.head(list{1, 2, 3}) // Some(1)\n```" - ], - "signature": "let head: t<'a> => option<'a>" - }, - { - "id": "Core.List.headExn", - "kind": "value", - "name": "headExn", - "docstrings": [ - "`headExn(list)` same as [`head`](#head).\n\n## Examples\n\n```rescript\nList.headExn(list{1, 2, 3}) // 1\n\nList.headExn(list{}) // Raises an Error\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." - ], - "signature": "let headExn: t<'a> => 'a" - }, - { - "id": "Core.List.tail", - "kind": "value", - "name": "tail", - "docstrings": [ - "`tail(list)` returns `None` if `list` is empty, otherwise it returns `Some(tail)`\nwhere `tail` is everything except the first element of `list`.\n\n## Examples\n\n```rescript\nList.tail(list{1, 2, 3}) // Some(list{2, 3})\n\nList.tail(list{}) // None\n```" - ], - "signature": "let tail: t<'a> => option>" - }, - { - "id": "Core.List.tailExn", - "kind": "value", - "name": "tailExn", - "docstrings": [ - "`tailExn(list)` same as [`tail`](#tail).\n\n## Examples\n\n```rescript\nList.tailExn(list{1, 2, 3}) // list{2, 3}\n\nList.tailExn(list{}) // Raises an Error\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." - ], - "signature": "let tailExn: t<'a> => t<'a>" - }, - { - "id": "Core.List.add", - "kind": "value", - "name": "add", - "docstrings": [ - "`add(list, value)` adds a `value` to the beginning of list `list`.\n\n## Examples\n\n```rescript\nList.add(list{2, 3}, 1) // list{1, 2, 3}\n\nList.add(list{\"World\", \"!\"}, \"Hello\") // list{\"Hello\", \"World\", \"!\"}\n```" - ], - "signature": "let add: (t<'a>, 'a) => t<'a>" - }, - { - "id": "Core.List.get", - "kind": "value", - "name": "get", - "docstrings": [ - "`get(list, index)` return the `index` element in `list`, or `None` if `index`\nis larger than the length of list `list`.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->List.get(1) // Some(\"B\")\n\nabc->List.get(4) // None\n```" + "The `BigInt64Array` typed array represents an array of 64-bit signed integers in platform byte order. See [BigInt64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array)" ], - "signature": "let get: (t<'a>, int) => option<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.getExn", + "id": "Core.BigInt64Array.fromArray", "kind": "value", - "name": "getExn", + "name": "fromArray", "docstrings": [ - "`getExn(list, index)` same as [`get`](#get).\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->List.getExn(1) // \"B\"\n\nabc->List.getExn(4) // Raises an Error\n```\n\n## Exceptions\n\n- Raises an Error if `index` is larger than the length of list." + "`fromArray` creates a `BigInt64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)" ], - "signature": "let getExn: (t<'a>, int) => 'a" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.make", + "id": "Core.BigInt64Array.fromBuffer", "kind": "value", - "name": "make", + "name": "fromBuffer", "docstrings": [ - "`make(length, value)` returns a list of length `length` with each element filled\nwith `value`. Returns an empty list if `value` is negative.\n\n## Examples\n\n```rescript\nList.make(~length=3, 1) // list{1, 1, 1}\n```" + "`fromBuffer` creates a `BigInt64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let make: (~length: int, 'a) => t<'a>" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.fromInitializer", + "id": "Core.BigInt64Array.fromBufferToEnd", "kind": "value", - "name": "fromInitializer", + "name": "fromBufferToEnd", "docstrings": [ - "`makeBy(length, f)` return a list of length `length` with element initialized\nwith `f`. Returns an empty list if `length` is negative.\n\n## Examples\n\n```rescript\nList.fromInitializer(~length=5, i => i) // list{0, 1, 2, 3, 4}\n\nList.fromInitializer(~length=5, i => i * i) // list{0, 1, 4, 9, 16}\n```" + "`fromBufferToEnd` creates a `BigInt64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromInitializer: (~length: int, int => 'a) => t<'a>" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.toShuffled", + "id": "Core.BigInt64Array.fromBufferWithRange", "kind": "value", - "name": "toShuffled", + "name": "fromBufferWithRange", "docstrings": [ - "`toShuffled(list)` returns a new list in random order.\n\n## Examples\n\n```rescript\nList.toShuffled(list{1, 2, 3}) // list{2, 1, 3}\n```" + "`fromBufferWithRange` creates a `BigInt64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let toShuffled: t<'a> => t<'a>" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.drop", + "id": "Core.BigInt64Array.fromLength", "kind": "value", - "name": "drop", + "name": "fromLength", "docstrings": [ - "`drop(list, value)` return a new list, dropping the first `value` element.\nReturns `None` if `list` has fewer than `value` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.drop(2) // Some(list{3})\n\nlist{1, 2, 3}->List.drop(3) // Some(list{})\n\nlist{1, 2, 3}->List.drop(4) // None\n```" + "`fromLength` creates a zero-initialized `BigInt64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let drop: (t<'a>, int) => option>" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.take", + "id": "Core.BigInt64Array.fromArrayLikeOrIterable", "kind": "value", - "name": "take", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`take(list, value)` returns a list with the first `value` elements from `list`,\nor `None` if `list` has fewer than `value` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.take(1) // Some(list{1})\n\nlist{1, 2, 3}->List.take(2) // Some(list{1, 2})\n\nlist{1, 2, 3}->List.take(4) // None\n```" + "`fromArrayLikeOrIterable` creates a `BigInt64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let take: (t<'a>, int) => option>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.splitAt", + "id": "Core.BigInt64Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "splitAt", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`splitAt(list, n)` split the list `list` at `n`. Returns `None` when the length\nof `list` is less than `n`.\n\n## Examples\n\n```rescript\nlist{\"Hello\", \"World\"}->List.splitAt(1) // Some((list{\"Hello\"}, list{\"World\"}))\n\nlist{0, 1, 2, 3, 4}->List.splitAt(2) // Some((list{0, 1}, list{2, 3, 4}))\n```" + "`fromArrayLikeOrIterableWithMap` creates a `BigInt64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let splitAt: (t<'a>, int) => option<(list<'a>, list<'a>)>" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + } + ] + }, + "core/uint8clampedarray": { + "id": "Core.Uint8ClampedArray", + "name": "Uint8ClampedArray", + "docstrings": [], + "items": [ { - "id": "Core.List.concat", - "kind": "value", - "name": "concat", + "id": "Core.Uint8ClampedArray.t", + "kind": "type", + "name": "t", "docstrings": [ - "`concat(list1, list2)` returns the list obtained by adding `list1` after `list2`.\n\n## Examples\n\n```rescript\nList.concat(list{1, 2, 3}, list{4, 5}) // list{1, 2, 3, 4, 5}\n```" + "The `Uint8ClampedArray` typed array represents an array of 8-bit unsigned integers clamped to 0-255. See [Uint8ClampedArray on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray)" ], - "signature": "let concat: (t<'a>, t<'a>) => t<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.concatMany", + "id": "Core.Uint8ClampedArray.fromArray", "kind": "value", - "name": "concatMany", + "name": "fromArray", "docstrings": [ - "`concatMany(arr)` returns the list obtained by concatenating all the lists in\narray `arr`, in order.\n\n## Examples\n\n```rescript\nList.concatMany([list{1, 2, 3}, list{}, list{3}]) // list{1, 2, 3, 3}\n```" + "`fromArray` creates a `Uint8ClampedArray` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)" ], - "signature": "let concatMany: array> => t<'a>" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.reverseConcat", + "id": "Core.Uint8ClampedArray.fromBuffer", "kind": "value", - "name": "reverseConcat", + "name": "fromBuffer", "docstrings": [ - "`reverseConcat(list1, list2)` is equivalent to writing: `concat(reverse(list1, list2)`\n\n## Examples\n\n```rescript\nList.reverseConcat(list{1, 2}, list{3, 4}) // list{2, 1, 3, 4}\n```" + "`fromBuffer` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let reverseConcat: (t<'a>, t<'a>) => t<'a>" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.flat", + "id": "Core.Uint8ClampedArray.fromBufferToEnd", "kind": "value", - "name": "flat", + "name": "fromBufferToEnd", "docstrings": [ - "`flat(list)` return the list obtained by concatenating all the lists in\n`list`, in order.\n\n## Examples\n\n```rescript\nList.flat(list{list{1, 2, 3}, list{}, list{3}}) // list{1, 2, 3, 3}\n```" + "`fromBufferToEnd` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let flat: t> => t<'a>" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.map", + "id": "Core.Uint8ClampedArray.fromBufferWithRange", "kind": "value", - "name": "map", + "name": "fromBufferWithRange", "docstrings": [ - "`map(list, f)` returns a new list with `f` applied to each element of `list`.\n\n## Examples\n\n```rescript\nlist{1, 2}->List.map(x => x + 1) // list{3, 4}\n```" + "`fromBufferWithRange` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.zip", + "id": "Core.Uint8ClampedArray.fromLength", "kind": "value", - "name": "zip", + "name": "fromLength", "docstrings": [ - "`zip(list1, list2)` returns a list of pairs from the two lists with the length\nof the shorter list.\n\n## Examples\n\n```rescript\nList.zip(list{1, 2}, list{3, 4, 5}) // list{(1, 3), (2, 4)}\n```" + "`fromLength` creates a zero-initialized `Uint8ClampedArray` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let zip: (t<'a>, t<'b>) => t<('a, 'b)>" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.zipBy", + "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterable", "kind": "value", - "name": "zipBy", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`zipBy(list1, list2, f)`. See [`zip`](#zip)\n\n## Examples\n\n```rescript\nList.zipBy(list{1, 2, 3}, list{4, 5}, (a, b) => 2 * a + b) // list{6, 9}\n```" + "`fromArrayLikeOrIterable` creates a `Uint8ClampedArray` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let zipBy: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.mapWithIndex", + "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "mapWithIndex", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`mapWithIndex(list, f)` applies `f` to each element of `list`. Function `f`\ntakes two arguments: the index starting from 0 and the element from `list`, in\nthat order.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.mapWithIndex((x, index) => index + x) // list{1, 3, 5}\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Uint8ClampedArray` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "core/uint32array": { + "id": "Core.Uint32Array", + "name": "Uint32Array", + "docstrings": [], + "items": [ { - "id": "Core.List.fromArray", - "kind": "value", - "name": "fromArray", + "id": "Core.Uint32Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`fromArray(arr)` converts the given array `arr` to a list.\n\n## Examples\n\n```rescript\nList.fromArray([1, 2, 3]) // list{1, 2, 3}\n```" + "The `Uint32Array` typed array represents an array of 32-bit unsigned integers in platform byte order. See [Uint32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array)" ], - "signature": "let fromArray: array<'a> => t<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.toArray", + "id": "Core.Uint32Array.fromArray", "kind": "value", - "name": "toArray", + "name": "fromArray", "docstrings": [ - "`toArray(list)` converts the given list `list` to an array.\n\n## Examples\n\n```rescript\nList.toArray(list{1, 2, 3}) // [1, 2, 3]\n```" + "`fromArray` creates a `Uint32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)" ], - "signature": "let toArray: t<'a> => array<'a>" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.reverse", + "id": "Core.Uint32Array.fromBuffer", "kind": "value", - "name": "reverse", + "name": "fromBuffer", "docstrings": [ - "`reverse(list)` returns a new list whose elements are those of `list` in\nreversed order.\n\n## Examples\n\n```rescript\nList.reverse(list{1, 2, 3}) // list{3, 2, 1}\n```" + "`fromBuffer` creates a `Uint32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let reverse: t<'a> => t<'a>" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.mapReverse", + "id": "Core.Uint32Array.fromBufferToEnd", "kind": "value", - "name": "mapReverse", + "name": "fromBufferToEnd", "docstrings": [ - "`mapReverse(list, f)` is equivalent to `map` function.\n\n## Examples\n\n```rescript\nlet f = x => x * x\nlet l = list{3, 4, 5}\n\nlet withMap = List.map(l, f)->List.reverse\nlet withMapReverse = l->List.mapReverse(f)\n\nConsole.log(withMap == withMapReverse) // true\n```" + "`fromBufferToEnd` creates a `Uint32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let mapReverse: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.forEach", + "id": "Core.Uint32Array.fromBufferWithRange", "kind": "value", - "name": "forEach", + "name": "fromBufferWithRange", "docstrings": [ - "`forEach(list, f)` call `f` on each element of `list` from the beginning to end.\n`f` returns `unit`, so no new array is created. Use `forEach` when you are primarily\nconcerned with repetitively creating side effects.\n\n## Examples\n\n```rescript\nList.forEach(list{\"a\", \"b\", \"c\"}, x => Console.log(\"Item: \" ++ x))\n/*\n prints:\n Item: a\n Item: b\n Item: c\n*/\n```" + "`fromBufferWithRange` creates a `Uint32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.forEachWithIndex", + "id": "Core.Uint32Array.fromLength", "kind": "value", - "name": "forEachWithIndex", + "name": "fromLength", "docstrings": [ - "`forEachWithIndex(list, f, index)` call `f` on each element of `list` from beginning\nto end. Function `f` takes two arguments: the `index` starting from 0 and the\nelement from `list`. `f` returns `unit`.\n\n## Examples\n\n```rescript\nList.forEachWithIndex(list{\"a\", \"b\", \"c\"}, (x, index) => {\n Console.log(\"Item \" ++ Int.toString(index) ++ \" is \" ++ x)\n})\n/*\n prints:\n Item 0 is a\n Item 1 is b\n Item 2 is cc\n*/\n```" + "`fromLength` creates a zero-initialized `Uint32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.reduce", + "id": "Core.Uint32Array.fromArrayLikeOrIterable", "kind": "value", - "name": "reduce", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`reduce(list, initialValue, f)` applies `f` to each element of `list` from\nbeginning to end. Function `f` has two parameters: the item from the list and\nan \"accumulator\", which starts with a value of `initialValue`. `reduce` returns\nthe final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduce(0, (a, b) => a + b) // 10\n\n// same as\n\nlist{1, 2, 3, 4}->List.reduce(0, (acc, item) => acc + item) // 10\n```" + "`fromArrayLikeOrIterable` creates a `Uint32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let reduce: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.reduceWithIndex", + "id": "Core.Uint32Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "reduceWithIndex", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`reduceWithIndex(list, initialValue, f)` applies `f` to each element of `list`\nfrom beginning to end. Function `f` has three parameters: the item from the list\nand an \"accumulator\", which starts with a value of `initialValue` and the index\nof each element. `reduceWithIndex` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduceWithIndex(0, (acc, item, index) => acc + item + index) // 16\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Uint32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let reduceWithIndex: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "core/uint16array": { + "id": "Core.Uint16Array", + "name": "Uint16Array", + "docstrings": [], + "items": [ { - "id": "Core.List.reduceReverse", - "kind": "value", - "name": "reduceReverse", + "id": "Core.Uint16Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`reduceReverse(list, initialValue, f)` works like `reduce`, except that\nfunction `f` is applied to each item of `list` from the last back to the first.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduceReverse(0, (a, b) => a + b) // 10\n\nlist{1, 2, 3, 4}->List.reduceReverse(10, (a, b) => a - b) // 0\n\nlist{1, 2, 3, 4}->List.reduceReverse(list{}, List.add) // list{1, 2, 3, 4}\n```" + "The `Uint16Array` typed array represents an array of 16-bit unsigned integers in platform byte order. See [Uint16Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array)" ], - "signature": "let reduceReverse: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.mapReverse2", + "id": "Core.Uint16Array.fromArray", "kind": "value", - "name": "mapReverse2", + "name": "fromArray", "docstrings": [ - "`mapReverse2(list1, list2, f)` is equivalent to `List.zipBy(list1, list2, f)->List.reverse`.\n\n## Examples\n\n```rescript\nList.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b) // list{4, 2}\n```" + "`fromArray` creates a `Uint16Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)" ], - "signature": "let mapReverse2: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.forEach2", + "id": "Core.Uint16Array.fromBuffer", "kind": "value", - "name": "forEach2", + "name": "fromBuffer", "docstrings": [ - "`forEach2(list1, list2, f)` is similar to `forEach`, but accepts two lists and\nstops at the length of the shorter list.\n\n## Examples\n\n```rescript\nList.forEach2(list{\"Z\", \"Y\"}, list{\"A\", \"B\", \"C\"}, (x, y) => Console.log2(x, y))\n\n/*\n prints:\n \"Z\" \"A\"\n \"Y\" \"B\"\n*/\n```" + "`fromBuffer` creates a `Uint16Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let forEach2: (t<'a>, t<'b>, ('a, 'b) => 'c) => unit" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.reduce2", + "id": "Core.Uint16Array.fromBufferToEnd", "kind": "value", - "name": "reduce2", + "name": "fromBufferToEnd", "docstrings": [ - "`reduce2(list1, list2, initialValue, f)` applies `f` to each element of `list1`\nand `list2` from beginning to end. Stops with the shorter list. Function `f` has\nthree parameters: an accumulator which starts with a value of `initialValue`, an\nitem from `l1`, and an item from `l2`. `reduce2` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nList.reduce2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) // 0 + (1 * 1 + 4) + (2 * 2 + 5)\n```" + "`fromBufferToEnd` creates a `Uint16Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let reduce2: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.reduceReverse2", + "id": "Core.Uint16Array.fromBufferWithRange", "kind": "value", - "name": "reduceReverse2", + "name": "fromBufferWithRange", "docstrings": [ - "`reduceReverse2(list1, list2, initialValue, f)` applies `f` to each element of\n`list1` and `list2`from end to beginning. Stops with the shorter list. Function\n`f` has three parameters: an accumulator which starts with a value of\n`initialValue`, an item from `l1`, and an item from `l2`. `reduce2` returns the\nfinal value of the accumulator.\n\n## Examples\n\n```rescript\nList.reduceReverse2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) // + (1 * 1 + 4) + (2 * 2 + 5)\n```" + "`fromBufferWithRange` creates a `Uint16Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let reduceReverse2: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.every", + "id": "Core.Uint16Array.fromLength", "kind": "value", - "name": "every", + "name": "fromLength", "docstrings": [ - "`every(list, f)` returns `true` if all elements in `list` satisfy `f`, where `f`\nis a predicate: a function taking an element and returning a bool.\n\n## Examples\n\n```rescript\nlet isBelow10 = value => value < 10\n\nlist{1, 9, 8, 2}->List.every(isBelow10) // true\n\nlist{1, 99, 8, 2}->List.every(isBelow10) // false\n```" + "`fromLength` creates a zero-initialized `Uint16Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let every: (t<'a>, 'a => bool) => bool" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.some", + "id": "Core.Uint16Array.fromArrayLikeOrIterable", "kind": "value", - "name": "some", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`some(list, f)` returns `true` if at least _one_ of the elements in `list`\nsatisfies `f`, where `f` is a predicate: a function taking an element and\nreturning a bool.\n\n## Examples\n\n```rescript\nlet isAbove100 = value => value > 100\n\nlist{101, 1, 2, 3}->List.some(isAbove100) // true\n\nlist{1, 2, 3, 4}->List.some(isAbove100) // false\n```" + "`fromArrayLikeOrIterable` creates a `Uint16Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let some: (t<'a>, 'a => bool) => bool" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.every2", + "id": "Core.Uint16Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "every2", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`every2(list1, list2, f)` returns `true` if predicate `f` is `true` for all\npairs of elements up to the shorter length (i.e. `min(length(list1), length(list2))`)\n\n## Examples\n\n```rescript\nList.every2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) // true\n\nList.every2(list{}, list{1}, (a, b) => a > b) // true\n\nList.every2(list{2, 3}, list{1}, (a, b) => a > b) // true\n\nList.every2(list{0, 1}, list{5, 0}, (a, b) => a > b) // false\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Uint16Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let every2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "core/uint8array": { + "id": "Core.Uint8Array", + "name": "Uint8Array", + "docstrings": [], + "items": [ { - "id": "Core.List.some2", - "kind": "value", - "name": "some2", + "id": "Core.Uint8Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`some2(list1, list2, f)` returns `true` if predicate `f` is `true` for any pair\nof elements up to the shorter length (i.e. `min(length(list1), length(list2))`)\n\n## Examples\n\n```rescript\nList.some2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) // true\n\nList.some2(list{}, list{1}, (a, b) => a > b) // false\n\nList.some2(list{2, 3}, list{1}, (a, b) => a > b) // true\n\nList.some2(list{0, 1}, list{5, 0}, (a, b) => a > b) // true\n```" + "The `Uint8Array` typed array represents an array of 8-bit unsigned integers. See [Uint8Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)" ], - "signature": "let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.compareLength", + "id": "Core.Uint8Array.fromArray", "kind": "value", - "name": "compareLength", + "name": "fromArray", "docstrings": [ - "`compareLength(list1, list2)` compare two lists solely by length. Returns `-1.` if\n`length(list1)` is less than `length(list2)`, `0.` if `length(list1)` equals\n`length(list2)`, and `1.` if `length(list1)` is greater than `length(list2)`.\n\n## Examples\n\n```rescript\nList.compareLength(list{1, 2}, list{3, 4, 5, 6}) // -1.\n\nList.compareLength(list{1, 2, 3}, list{4, 5, 6}) // 0.\n\nList.compareLength(list{1, 2, 3, 4}, list{5, 6}) // 1.\n```" + "`fromArray` creates a `Uint8Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)" ], - "signature": "let compareLength: (t<'a>, t<'a>) => Core__Ordering.t" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.compare", + "id": "Core.Uint8Array.fromBuffer", "kind": "value", - "name": "compare", + "name": "fromBuffer", "docstrings": [ - "`compare(list1, list2, f)` compare elements one by one `f`. `f` returns a negative\nnumber if `list1` is \"less than\" `list2`, zero if `list1` is \"equal to\" `list2`,\na positive number if `list1` is \"greater than\" `list2`.\n\nThe comparison returns the first non-zero result of `f`, or zero if `f` returns\nzero for all `list1` and `list2`.\n\n- If all items have compared equal, but `list1` is exhausted first, return `-1.`. (`list1` is shorter).\n- If all items have compared equal, but `list2` is exhausted first, return `1.` (`list1` is longer).\n\n## Examples\n\n```rescript\nList.compare(list{3}, list{3, 7}, (a, b) => Int.compare(a, b)) // -1.\nList.compare(list{5, 3}, list{5}, (a, b) => Int.compare(a, b)) // 1.\nList.compare(list{1, 3, 5}, list{1, 4, 2}, (a, b) => Int.compare(a, b)) // -1.\nList.compare(list{1, 3, 5}, list{1, 2, 3}, (a, b) => Int.compare(a, b)) // 1.\nList.compare(list{1, 3, 5}, list{1, 3, 5}, (a, b) => Int.compare(a, b)) // 0.\n```\n\n**Please note:** The total ordering of List is different from Array,\nfor Array, we compare the length first and, only if the lengths are equal, elements one by one.\nFor lists, we just compare elements one by one." + "`fromBuffer` creates a `Uint8Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let compare: (\n t<'a>,\n t<'a>,\n ('a, 'a) => Core__Ordering.t,\n) => Core__Ordering.t" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.equal", + "id": "Core.Uint8Array.fromBufferToEnd", "kind": "value", - "name": "equal", + "name": "fromBufferToEnd", "docstrings": [ - "`equal(list1, list2, f)` check equality of `list2` and `list2` using `f` for\nequality on elements, where `f` is a function that returns `true` if items `x` and\n`y` meet some criterion for equality, `false` otherwise. equal `false` if length\nof `list1` and `list2` are not the same.\n\n## Examples\n\n```rescript\nList.equal(list{1, 2, 3}, list{1, 2}, (a, b) => a == b) // false\n\nList.equal(list{1, 2}, list{1, 2}, (a, b) => a == b) // true\n\nList.equal(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)) // true\n```" + "`fromBufferToEnd` creates a `Uint8Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let equal: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.has", + "id": "Core.Uint8Array.fromBufferWithRange", "kind": "value", - "name": "has", + "name": "fromBufferWithRange", "docstrings": [ - "`has(list, element, f)` returns `true` if the list contains at least one\n`element` for which `f` returns `true'.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.has(2, (a, b) => a == b) // true\n\nlist{1, 2, 3}->List.has(4, (a, b) => a == b) // false\n\nlist{(-1), (-2), (-3)}->List.has(2, (a, b) => abs(a) == abs(b)) // true\n```" + "`fromBufferWithRange` creates a `Uint8Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let has: (t<'a>, 'b, ('a, 'b) => bool) => bool" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.find", + "id": "Core.Uint8Array.fromLength", "kind": "value", - "name": "find", + "name": "fromLength", "docstrings": [ - "`find(list, f)` returns `Some(value)` for the first value in `list` that\nsatisfies the predicate function `f`. Returns `None` if no element satisfies\nthe function.\n\n## Examples\n\n```rescript\nList.find(list{1, 4, 3, 2}, x => x > 3) // Some(4)\n\nList.find(list{1, 4, 3, 2}, x => x > 4) // None\n```" + "`fromLength` creates a zero-initialized `Uint8Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.filter", + "id": "Core.Uint8Array.fromArrayLikeOrIterable", "kind": "value", - "name": "filter", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`filter(list, f)` returns a list of all elements in `list` which satisfy the\npredicate function `f`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nList.filter(list{1, 2, 3, 4}, isEven) // list{2, 4}\n\nList.filter(list{None, Some(2), Some(3), None}, Option.isSome) // list{Some(2), Some(3)}\n```" + "`fromArrayLikeOrIterable` creates a `Uint8Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.filterWithIndex", + "id": "Core.Uint8Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "filterWithIndex", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`filterWithIndex(list, f)` returns a list of all elements in `list` which\nsatisfy the predicate function `f`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nList.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)) // list{1, 3}\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Uint8Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "core/int32array": { + "id": "Core.Int32Array", + "name": "Int32Array", + "docstrings": [], + "items": [ { - "id": "Core.List.filterMap", - "kind": "value", - "name": "filterMap", + "id": "Core.Int32Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`filterMap(list, f)` applies `f` to each element of `list`. If `f` returns\n`Some(value)`, then `value` is _kept_ in the resulting list. If `f` returns\n`None`, the element is _not_ retained in the result.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nlist{1, 2, 3, 4}\n->List.filterMap(x =>\n if (isEven(x)) {\n Some(x)\n } else {\n None\n }\n ) // list{2, 4}\n\nlist{Some(1), Some(2), None}->List.filterMap(x => x) // list{1, 2}\n```" + "The `Int32Array` typed array represents an array of twos-complemenet 32-bit signed integers in platform byte order. See [Int32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array)" ], - "signature": "let filterMap: (t<'a>, 'a => option<'b>) => t<'b>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.List.partition", + "id": "Core.Int32Array.fromArray", "kind": "value", - "name": "partition", + "name": "fromArray", "docstrings": [ - "`partition(list, f)` creates a pair of lists; the first list consists of all\nelements of `list` that satisfy the predicate function `f`, the second list\nconsists of all elements of `list` that _do not_ satisfy `f`.\n\n## Examples\n\n```rescript\n// (elementsThatSatisfies, elementsThatDoesNotSatisfy)\n\nList.partition(list{1, 2, 3, 4}, x => x > 2) // (list{3, 4}, list{1, 2})\n```" + "`fromArray` creates a `Int32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)" ], - "signature": "let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" + "signature": "let fromArray: array => t" }, { - "id": "Core.List.unzip", + "id": "Core.Int32Array.fromBuffer", "kind": "value", - "name": "unzip", + "name": "fromBuffer", "docstrings": [ - "`unzip(list)` takes a list of pairs and creates a pair of lists. The first list\ncontains all the first items of the pairs, the second list contains all the\nsecond items.\n\n## Examples\n\n```rescript\nList.unzip(list{(1, 2), (3, 4)}) // (list{1, 3}, list{2, 4})\n\nList.unzip(list{(\"H\", \"W\"), (\"e\", \"o\"), (\"l\", \"r\"), (\"l\", \"l\"), (\"o\", \"d\"), (\" \", \"!\")})\n// (list{\"H\", \"e\", \"l\", \"l\", \"o\", \" \"}, list{\"W\", \"o\", \"r\", \"l\", \"d\", \"!\"})\n```" + "`fromBuffer` creates a `Int32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let unzip: t<('a, 'b)> => (t<'a>, t<'b>)" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.List.getAssoc", + "id": "Core.Int32Array.fromBufferToEnd", "kind": "value", - "name": "getAssoc", + "name": "fromBufferToEnd", "docstrings": [ - "`getAssoc(list, k, f)` return the second element of a pair in `list` where\nthe first element equals `k` as per the predicate function `f`, or `None` if\nnot found.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.getAssoc(3, (a, b) => a == b) // Some(\"c\")\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.getAssoc(15, (k, item) => k /* 15 */ == item /* 9, 5, 22 */)\n// Some(\"afternoon\")\n```" + "`fromBufferToEnd` creates a `Int32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let getAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.List.hasAssoc", + "id": "Core.Int32Array.fromBufferWithRange", "kind": "value", - "name": "hasAssoc", + "name": "fromBufferWithRange", "docstrings": [ - "`hasAssoc(list, k, f)` returns `true` if there is a pair in `list` where the\nfirst element equals `k` as per the predicate function `f`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.hasAssoc(1, (a, b) => a == b) // true\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.hasAssoc(25, (k, item) => k /* 25 */ == item /* 9, 5, 22 */) // false\n```" + "`fromBufferWithRange` creates a `Int32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let hasAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.List.removeAssoc", + "id": "Core.Int32Array.fromLength", "kind": "value", - "name": "removeAssoc", + "name": "fromLength", "docstrings": [ - "`removeAssoc(list, k, f)` return a list after removing the first pair whose\nfirst value is `k` per the equality predicate `f`, if not found, return a new\nlist identical to `list`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.removeAssoc(1, (a, b) => a == b) // list{(2, \"b\"), (3, \"c\")}\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.removeAssoc(9, (k, item) => k /* 9 */ == item /* 9, 5, 22 */)\n// list{(15, \"afternoon\"), (22, \"night\")}\n```" + "`fromLength` creates a zero-initialized `Int32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let removeAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>" + "signature": "let fromLength: int => t" }, { - "id": "Core.List.setAssoc", + "id": "Core.Int32Array.fromArrayLikeOrIterable", "kind": "value", - "name": "setAssoc", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`setAssoc(list, k, v, f)`. If `k` exists in `list` by satisfying the `f`\npredicate, return a new list with the key and value replaced by the new `k` and\n`v`, otherwise, return a new list with the pair `k`, `v` added to the head of\n`list`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.setAssoc(2, \"x\", (a, b) => a == b) // list{(1, \"a\"), (2, \"x\"), (3, \"c\")}\n\nlist{(1, \"a\"), (3, \"c\")}->List.setAssoc(2, \"b\", (a, b) => a == b) // list{(2, \"b\"), (1, \"a\"), (3, \"c\")}\n\nlist{(9, \"morning\"), (3, \"morning?!\"), (22, \"night\")}\n->List.setAssoc(15, \"afternoon\", (a, b) => mod(a, 12) == mod(b, 12))\n// list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n```\n\n**Please note**: In the last example, since: `15 mod 12` equals `3 mod 12`. Both\nthe key _and_ the value are replaced in the list." + "`fromArrayLikeOrIterable` creates a `Int32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let setAssoc: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.List.sort", + "id": "Core.Int32Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "sort", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`sort(list, f)` returns a sorted list.\n\n## Examples\n\n```rescript\nList.sort(list{5, 4, 9, 3, 7}, Int.compare) // list{3, 4, 5, 7, 9}\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Int32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let sort: (t<'a>, ('a, 'a) => Core__Ordering.t) => t<'a>" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" } ] }, - "core/option": { - "id": "Core.Option", - "name": "Option", - "docstrings": [ - "We represent the existence and nonexistence of a value by wrapping it with\nthe `option` type. In order to make it a bit more convenient to work with\noption-types, we provide utility-functions for it.\n\nThe `option` type is a part of the ReScript standard library which is defined\nlike this:\n\n```rescript\ntype option<'a> = None | Some('a)\n```\n\n```rescript\nlet someString: option = Some(\"hello\")\n```" - ], + "core/int16array": { + "id": "Core.Int16Array", + "name": "Int16Array", + "docstrings": [], "items": [ { - "id": "Core.Option.filter", - "kind": "value", - "name": "filter", + "id": "Core.Int16Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`filter(opt, f)` applies `f` to `opt`, if `f` returns `true`, then it returns `Some(value)`, otherwise returns `None`.\n\n## Examples\n\n```rescript\nOption.filter(Some(10), x => x > 5) // Some(10)\nOption.filter(Some(4), x => x > 5) // None\nOption.filter(None, x => x > 5) // None\n```" + "The `Int16Array` typed array represents an array of twos-complement 16-bit signed integers in platform byte order. See [Int16Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array)" ], - "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.Option.forEach", + "id": "Core.Int16Array.fromArray", "kind": "value", - "name": "forEach", + "name": "fromArray", "docstrings": [ - "`forEach(opt, f)` call `f` on `opt`. if `opt` is `Some(value)`, then if calls\n`f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nOption.forEach(Some(\"thing\"), x => Console.log(x)) // logs \"thing\"\nOption.forEach(None, x => Console.log(x)) // returns ()\n```" + "`fromArray` creates a `Int16Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)" ], - "signature": "let forEach: (option<'a>, 'a => unit) => unit" + "signature": "let fromArray: array => t" }, { - "id": "Core.Option.getExn", + "id": "Core.Int16Array.fromBuffer", "kind": "value", - "name": "getExn", + "name": "fromBuffer", "docstrings": [ - "`getExn(opt, ~message=?)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception with the message provided, or a generic message if no message was provided.\n\n```rescript\nOption.getExn(Some(3)) // 3\nOption.getExn(None) /* Raises an Error */\nOption.getExn(None, ~message=\"was None!\") /* Raises an Error with the message \"was None!\" */\n```\n\n## Exceptions\n\n- Raises an error if `opt` is `None`" + "`fromBuffer` creates a `Int16Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.Option.getUnsafe", + "id": "Core.Int16Array.fromBufferToEnd", "kind": "value", - "name": "getUnsafe", + "name": "fromBufferToEnd", "docstrings": [ - "`getUnsafe(opt)` returns `value` if `opt` is `Some(value)`, otherwise `undefined`.\n\n## Examples\n\n```rescript\nOption.getUnsafe(Some(3)) == 3\nOption.getUnsafe(None: option) // Returns `undefined`, which is not a valid `int`\n```\n\n## Notes\n\n- This is an unsafe operation. It assumes `value` is not `None`, and may cause undefined behaviour if it is." + "`fromBufferToEnd` creates a `Int16Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let getUnsafe: option<'a> => 'a" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.Option.mapOr", + "id": "Core.Int16Array.fromBufferWithRange", "kind": "value", - "name": "mapOr", + "name": "fromBufferWithRange", "docstrings": [ - "`mapOr(opt, default, f)` returns `f(value)` if `opt` is `Some(value)`, otherwise `default`.\n\n## Examples\n\n```rescript\nlet someValue = Some(3)\nsomeValue->Option.mapOr(0, x => x + 5) // 8\n\nlet noneValue = None\nnoneValue->Option.mapOr(0, x => x + 5) // 0\n```" + "`fromBufferWithRange` creates a `Int16Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let mapOr: (option<'a>, 'b, 'a => 'b) => 'b" - }, - { - "id": "Core.Option.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.Option.map", + "id": "Core.Int16Array.fromLength", "kind": "value", - "name": "map", + "name": "fromLength", "docstrings": [ - "`map(opt, f)` returns `Some(f(value))` if `opt` is `Some(value)`, otherwise `None`.\n\n## Examples\n\n```rescript\nOption.map(Some(3), x => x * x) // Some(9)\nOption.map(None, x => x * x) // None\n```" + "`fromLength` creates a zero-initialized `Int16Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" + "signature": "let fromLength: int => t" }, { - "id": "Core.Option.flatMap", + "id": "Core.Int16Array.fromArrayLikeOrIterable", "kind": "value", - "name": "flatMap", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "`flatMap(opt, f)` returns `f(value)` if `opt` is `Some(value)`, otherwise `None`.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Some(value + 1)\n } else {\n None\n }\n\nOption.flatMap(Some(2), addIfAboveOne) // Some(3)\nOption.flatMap(Some(-4), addIfAboveOne) // None\nOption.flatMap(None, addIfAboveOne) // None\n```" + "`fromArrayLikeOrIterable` creates a `Int16Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.Option.getOr", + "id": "Core.Int16Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "getOr", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`getOr(opt, default)` returns `value` if `opt` is `Some(value)`, otherwise `default`.\n\n## Examples\n\n```rescript\nOption.getOr(None, \"Banana\") // Banana\nOption.getOr(Some(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nSome(\"Jane\")->greet // \"Greetings Jane\"\nNone->greet // \"Greetings Anonymous\"\n```" + "`fromArrayLikeOrIterableWithMap` creates a `Int16Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let getOr: (option<'a>, 'a) => 'a" - }, - { - "id": "Core.Option.getWithDefault", - "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (option<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" - }, + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "core/int8array": { + "id": "Core.Int8Array", + "name": "Int8Array", + "docstrings": [], + "items": [ { - "id": "Core.Option.orElse", - "kind": "value", - "name": "orElse", + "id": "Core.Int8Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "`orElse(opt1, opt2)` returns `opt2` if `opt1` is `None`, otherwise `opt1`.\n\n## Examples\n\n```rescript\nOption.orElse(Some(1812), Some(1066)) == Some(1812)\nOption.orElse(None, Some(1066)) == Some(1066)\nOption.orElse(None, None) == None\n```" + "The `Int8Array` typed array represents an array of twos-complement 8-bit signed integers. See [Int8Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array)" ], - "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Core.Option.isSome", + "id": "Core.Int8Array.fromArray", "kind": "value", - "name": "isSome", + "name": "fromArray", "docstrings": [ - "`isSome(opt)` returns `true` if `opt` is `Some(value)`, otherwise returns `false`.\n\n## Examples\n\n```rescript\nOption.isSome(None) // false\nOption.isSome(Some(1)) // true\n```" + "`fromArray` creates a `Int8Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)" ], - "signature": "let isSome: option<'a> => bool" + "signature": "let fromArray: array => t" }, { - "id": "Core.Option.isNone", + "id": "Core.Int8Array.fromBuffer", "kind": "value", - "name": "isNone", + "name": "fromBuffer", "docstrings": [ - "`isNone(opt)` returns `true` if `opt` is `None`, false otherwise.\n\n## Examples\n\n```rescript\nOption.isNone(None) // true\nOption.isNone(Some(1)) // false\n```" + "`fromBuffer` creates a `Int8Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let isNone: option<'a> => bool" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.Option.equal", + "id": "Core.Int8Array.fromBufferToEnd", "kind": "value", - "name": "equal", + "name": "fromBufferToEnd", "docstrings": [ - "`equal(opt1, opt2, f)` evaluates two optional values for equality with respect to a predicate function `f`. If both `opt1` and `opt2` are `None`, returns `true`.\nIf one of the arguments is `Some(value)` and the other is `None`, returns\n`false`.\nIf arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`f(value1, value2)`, the predicate function `f` must return a bool.\n\n## Examples\n\n```rescript\nlet clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\nopen Option\n\nequal(Some(3), Some(15), clockEqual) // true\nequal(Some(3), None, clockEqual) // false\nequal(None, Some(3), clockEqual) // false\nequal(None, None, clockEqual) // true\n```" + "`fromBufferToEnd` creates a `Int8Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.Option.compare", + "id": "Core.Int8Array.fromBufferWithRange", "kind": "value", - "name": "compare", + "name": "fromBufferWithRange", "docstrings": [ - "`compare(opt1, opt2, f)` compares two optional values with respect to given `f`.\n\nIf both `opt1` and `opt2` are `None`, it returns `0.`. If the first argument is `Some(value1)` and the second is `None`, returns `1.` (something is greater than nothing).\n\nIf the first argument is `None` and the second is `Some(value2)`, returns `-1.`\n(nothing is less than something).\n\nIf the arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`f(value1, value2)`, `f` takes two arguments and returns `-1.` if the first\nargument is less than the second, `0.` if the arguments are equal, and `1.` if\nthe first argument is greater than the second.\n\n## Examples\n\n```rescript\nlet clockCompare = (a, b) => Int.compare(mod(a, 12), mod(b, 12))\n\nOption.compare(Some(3), Some(15), clockCompare) // 0.\nOption.compare(Some(3), Some(14), clockCompare) // 1.\nOption.compare(Some(2), Some(15), clockCompare) // (-1.)\nOption.compare(None, Some(15), clockCompare) // (-1.)\nOption.compare(Some(14), None, clockCompare) // 1.\nOption.compare(None, None, clockCompare) // 0.\n```" - ], - "signature": "let compare: (\n option<'a>,\n option<'b>,\n ('a, 'b) => Core__Ordering.t,\n) => Core__Ordering.t" - } - ] - }, - "core/exn": { - "id": "Core.Exn", - "name": "Exn", - "docstrings": [], - "items": [] - }, - "core/intl": { - "id": "Core.Intl", - "name": "Intl", - "docstrings": [], - "items": [ + "`fromBufferWithRange` creates a `Int8Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + ], + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, { - "id": "Core.Intl.getCanonicalLocalesExn", + "id": "Core.Int8Array.fromLength", "kind": "value", - "name": "getCanonicalLocalesExn", + "name": "fromLength", "docstrings": [ - "@throws RangeError" + "`fromLength` creates a zero-initialized `Int8Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let getCanonicalLocalesExn: string => array" + "signature": "let fromLength: int => t" }, { - "id": "Core.Intl.getCanonicalLocalesManyExn", + "id": "Core.Int8Array.fromArrayLikeOrIterable", "kind": "value", - "name": "getCanonicalLocalesManyExn", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "@throws RangeError" + "`fromArrayLikeOrIterable` creates a `Int8Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let getCanonicalLocalesManyExn: array => array" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.Intl.supportedValuesOfExn", + "id": "Core.Int8Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "supportedValuesOfExn", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "@throws RangeError" + "`fromArrayLikeOrIterableWithMap` creates a `Int8Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let supportedValuesOfExn: string => array" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" } ] }, - "core/biguint64array": { - "id": "Core.BigUint64Array", - "name": "BigUint64Array", + "core/float64array": { + "id": "Core.Float64Array", + "name": "Float64Array", "docstrings": [], "items": [ { - "id": "Core.BigUint64Array.t", + "id": "Core.Float64Array.t", "kind": "type", "name": "t", "docstrings": [ - "The `BigUint64Array` typed array represents an array of 64-bit unsigned integers in platform byte order. See [BigUint64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array)" + "The `Float64Array` typed array represents an array of 64-bit floating point numbers in platform byte order. See [Float64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array)" ], - "signature": "type t = Core__TypedArray.t" + "signature": "type t = TypedArray.t" }, { - "id": "Core.BigUint64Array.fromArray", + "id": "Core.Float64Array.fromArray", "kind": "value", "name": "fromArray", "docstrings": [ - "`fromArray` creates a `BigUint64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)" + "`fromArray` creates a `Float64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)" ], - "signature": "let fromArray: array => t" + "signature": "let fromArray: array => t" }, { - "id": "Core.BigUint64Array.fromBuffer", + "id": "Core.Float64Array.fromBuffer", "kind": "value", "name": "fromBuffer", "docstrings": [ - "`fromBuffer` creates a `BigUint64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBuffer` creates a `Float64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.BigUint64Array.fromBufferToEnd", + "id": "Core.Float64Array.fromBufferToEnd", "kind": "value", "name": "fromBufferToEnd", "docstrings": [ - "`fromBufferToEnd` creates a `BigUint64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBufferToEnd` creates a `Float64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.BigUint64Array.fromBufferWithRange", + "id": "Core.Float64Array.fromBufferWithRange", "kind": "value", "name": "fromBufferWithRange", "docstrings": [ - "`fromBufferWithRange` creates a `BigUint64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBufferWithRange` creates a `Float64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.BigUint64Array.fromLength", + "id": "Core.Float64Array.fromLength", "kind": "value", "name": "fromLength", "docstrings": [ - "`fromLength` creates a zero-initialized `BigUint64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromLength` creates a zero-initialized `Float64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], "signature": "let fromLength: int => t" }, { - "id": "Core.BigUint64Array.fromArrayLikeOrIterable", + "id": "Core.Float64Array.fromArrayLikeOrIterable", "kind": "value", "name": "fromArrayLikeOrIterable", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `BigUint64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "`fromArrayLikeOrIterable` creates a `Float64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.BigUint64Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Float64Array.fromArrayLikeOrIterableWithMap", "kind": "value", "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `BigUint64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "`fromArrayLikeOrIterableWithMap` creates a `Float64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" } ] }, - "core/bigint64array": { - "id": "Core.BigInt64Array", - "name": "BigInt64Array", + "core/float32array": { + "id": "Core.Float32Array", + "name": "Float32Array", "docstrings": [], "items": [ { - "id": "Core.BigInt64Array.t", + "id": "Core.Float32Array.t", "kind": "type", "name": "t", "docstrings": [ - "The `BigInt64Array` typed array represents an array of 64-bit signed integers in platform byte order. See [BigInt64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array)" + "The `Float32Array` typed array represents an array of 32-bit floating point numbers in platform byte order. See [Float32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array)" ], - "signature": "type t = Core__TypedArray.t" + "signature": "type t = TypedArray.t" }, { - "id": "Core.BigInt64Array.fromArray", + "id": "Core.Float32Array.fromArray", "kind": "value", "name": "fromArray", "docstrings": [ - "`fromArray` creates a `BigInt64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)" + "`fromArray` creates a `Float32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)" ], - "signature": "let fromArray: array => t" + "signature": "let fromArray: array => t" }, { - "id": "Core.BigInt64Array.fromBuffer", + "id": "Core.Float32Array.fromBuffer", "kind": "value", "name": "fromBuffer", "docstrings": [ - "`fromBuffer` creates a `BigInt64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBuffer` creates a `Float32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Core.BigInt64Array.fromBufferToEnd", + "id": "Core.Float32Array.fromBufferToEnd", "kind": "value", "name": "fromBufferToEnd", "docstrings": [ - "`fromBufferToEnd` creates a `BigInt64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBufferToEnd` creates a `Float32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Core.BigInt64Array.fromBufferWithRange", + "id": "Core.Float32Array.fromBufferWithRange", "kind": "value", "name": "fromBufferWithRange", "docstrings": [ - "`fromBufferWithRange` creates a `BigInt64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromBufferWithRange` creates a `Float32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Core.BigInt64Array.fromLength", + "id": "Core.Float32Array.fromLength", "kind": "value", "name": "fromLength", "docstrings": [ - "`fromLength` creates a zero-initialized `BigInt64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "`fromLength` creates a zero-initialized `Float32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." ], "signature": "let fromLength: int => t" }, { - "id": "Core.BigInt64Array.fromArrayLikeOrIterable", + "id": "Core.Float32Array.fromArrayLikeOrIterable", "kind": "value", "name": "fromArrayLikeOrIterable", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `BigInt64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "`fromArrayLikeOrIterable` creates a `Float32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Core.BigInt64Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Float32Array.fromArrayLikeOrIterableWithMap", "kind": "value", "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `BigInt64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "`fromArrayLikeOrIterableWithMap` creates a `Float32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" } ] }, - "core/uint8clampedarray": { - "id": "Core.Uint8ClampedArray", - "name": "Uint8ClampedArray", + "core/typedarray": { + "id": "Core.TypedArray", + "name": "TypedArray", "docstrings": [], "items": [ { - "id": "Core.Uint8ClampedArray.t", + "id": "Core.TypedArray.t", "kind": "type", "name": "t", - "docstrings": [ - "The `Uint8ClampedArray` typed array represents an array of 8-bit unsigned integers clamped to 0-255. See [Uint8ClampedArray on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray)" - ], - "signature": "type t = Core__TypedArray.t" + "docstrings": [], + "signature": "type t<'a>" + }, + { + "id": "Core.TypedArray.get", + "kind": "value", + "name": "get", + "docstrings": [], + "signature": "let get: (t<'a>, int) => option<'a>" + }, + { + "id": "Core.TypedArray.set", + "kind": "value", + "name": "set", + "docstrings": [], + "signature": "let set: (t<'a>, int, 'a) => unit" + }, + { + "id": "Core.TypedArray.buffer", + "kind": "value", + "name": "buffer", + "docstrings": [], + "signature": "let buffer: t<'a> => ArrayBuffer.t" + }, + { + "id": "Core.TypedArray.byteLength", + "kind": "value", + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t<'a> => int" + }, + { + "id": "Core.TypedArray.byteOffset", + "kind": "value", + "name": "byteOffset", + "docstrings": [], + "signature": "let byteOffset: t<'a> => int" + }, + { + "id": "Core.TypedArray.setArray", + "kind": "value", + "name": "setArray", + "docstrings": [], + "signature": "let setArray: (t<'a>, array<'a>) => unit" + }, + { + "id": "Core.TypedArray.setArrayFrom", + "kind": "value", + "name": "setArrayFrom", + "docstrings": [], + "signature": "let setArrayFrom: (t<'a>, array<'a>, int) => unit" + }, + { + "id": "Core.TypedArray.length", + "kind": "value", + "name": "length", + "docstrings": [], + "signature": "let length: t<'a> => int" + }, + { + "id": "Core.TypedArray.copyAllWithin", + "kind": "value", + "name": "copyAllWithin", + "docstrings": [], + "signature": "let copyAllWithin: (t<'a>, ~target: int) => array<'a>" + }, + { + "id": "Core.TypedArray.copyWithinToEnd", + "kind": "value", + "name": "copyWithinToEnd", + "docstrings": [], + "signature": "let copyWithinToEnd: (t<'a>, ~target: int, ~start: int) => array<'a>" + }, + { + "id": "Core.TypedArray.copyWithin", + "kind": "value", + "name": "copyWithin", + "docstrings": [], + "signature": "let copyWithin: (t<'a>, ~target: int, ~start: int, ~end: int) => array<'a>" + }, + { + "id": "Core.TypedArray.fillAll", + "kind": "value", + "name": "fillAll", + "docstrings": [], + "signature": "let fillAll: (t<'a>, 'a) => t<'a>" + }, + { + "id": "Core.TypedArray.fillToEnd", + "kind": "value", + "name": "fillToEnd", + "docstrings": [], + "signature": "let fillToEnd: (t<'a>, 'a, ~start: int) => t<'a>" + }, + { + "id": "Core.TypedArray.fill", + "kind": "value", + "name": "fill", + "docstrings": [], + "signature": "let fill: (t<'a>, 'a, ~start: int, ~end: int) => t<'a>" + }, + { + "id": "Core.TypedArray.reverse", + "kind": "value", + "name": "reverse", + "docstrings": [], + "signature": "let reverse: t<'a> => unit" + }, + { + "id": "Core.TypedArray.toReversed", + "kind": "value", + "name": "toReversed", + "docstrings": [], + "signature": "let toReversed: t<'a> => t<'a>" + }, + { + "id": "Core.TypedArray.sort", + "kind": "value", + "name": "sort", + "docstrings": [], + "signature": "let sort: (t<'a>, ('a, 'a) => Ordering.t) => unit" + }, + { + "id": "Core.TypedArray.toSorted", + "kind": "value", + "name": "toSorted", + "docstrings": [], + "signature": "let toSorted: (t<'a>, ('a, 'a) => Ordering.t) => t<'a>" + }, + { + "id": "Core.TypedArray.with", + "kind": "value", + "name": "with", + "docstrings": [], + "signature": "let with: (t<'a>, int, 'a) => t<'a>" + }, + { + "id": "Core.TypedArray.includes", + "kind": "value", + "name": "includes", + "docstrings": [], + "signature": "let includes: (t<'a>, 'a) => bool" }, { - "id": "Core.Uint8ClampedArray.fromArray", + "id": "Core.TypedArray.indexOf", "kind": "value", - "name": "fromArray", - "docstrings": [ - "`fromArray` creates a `Uint8ClampedArray` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)" - ], - "signature": "let fromArray: array => t" + "name": "indexOf", + "docstrings": [], + "signature": "let indexOf: (t<'a>, 'a) => int" }, { - "id": "Core.Uint8ClampedArray.fromBuffer", + "id": "Core.TypedArray.indexOfFrom", "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "`fromBuffer` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "name": "indexOfFrom", + "docstrings": [], + "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" }, { - "id": "Core.Uint8ClampedArray.fromBufferToEnd", + "id": "Core.TypedArray.joinWith", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [ - "`fromBufferToEnd` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "joinWith", + "docstrings": [], + "signature": "let joinWith: (t<'a>, string) => string" }, { - "id": "Core.Uint8ClampedArray.fromBufferWithRange", + "id": "Core.TypedArray.lastIndexOf", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [ - "`fromBufferWithRange` creates a `Uint8ClampedArray` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "lastIndexOf", + "docstrings": [], + "signature": "let lastIndexOf: (t<'a>, 'a) => int" }, { - "id": "Core.Uint8ClampedArray.fromLength", + "id": "Core.TypedArray.lastIndexOfFrom", "kind": "value", - "name": "fromLength", - "docstrings": [ - "`fromLength` creates a zero-initialized `Uint8ClampedArray` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray/Uint8ClampedArray)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromLength: int => t" + "name": "lastIndexOfFrom", + "docstrings": [], + "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" }, { - "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterable", + "id": "Core.TypedArray.slice", "kind": "value", - "name": "fromArrayLikeOrIterable", - "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Uint8ClampedArray` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "slice", + "docstrings": [], + "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" }, { - "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", + "id": "Core.TypedArray.sliceToEnd", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Uint8ClampedArray` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/uint32array": { - "id": "Core.Uint32Array", - "name": "Uint32Array", - "docstrings": [], - "items": [ - { - "id": "Core.Uint32Array.t", - "kind": "type", - "name": "t", - "docstrings": [ - "The `Uint32Array` typed array represents an array of 32-bit unsigned integers in platform byte order. See [Uint32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array)" - ], - "signature": "type t = Core__TypedArray.t" + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" }, { - "id": "Core.Uint32Array.fromArray", + "id": "Core.TypedArray.copy", "kind": "value", - "name": "fromArray", - "docstrings": [ - "`fromArray` creates a `Uint32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)" - ], - "signature": "let fromArray: array => t" + "name": "copy", + "docstrings": [], + "signature": "let copy: t<'a> => t<'a>" }, { - "id": "Core.Uint32Array.fromBuffer", + "id": "Core.TypedArray.subarray", "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "`fromBuffer` creates a `Uint32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "name": "subarray", + "docstrings": [], + "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" }, { - "id": "Core.Uint32Array.fromBufferToEnd", + "id": "Core.TypedArray.subarrayToEnd", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [ - "`fromBufferToEnd` creates a `Uint32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "subarrayToEnd", + "docstrings": [], + "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" }, { - "id": "Core.Uint32Array.fromBufferWithRange", + "id": "Core.TypedArray.toString", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [ - "`fromBufferWithRange` creates a `Uint32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "toString", + "docstrings": [], + "signature": "let toString: t<'a> => string" }, { - "id": "Core.Uint32Array.fromLength", + "id": "Core.TypedArray.toLocaleString", "kind": "value", - "name": "fromLength", - "docstrings": [ - "`fromLength` creates a zero-initialized `Uint32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array/Uint32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromLength: int => t" + "name": "toLocaleString", + "docstrings": [], + "signature": "let toLocaleString: t<'a> => string" }, { - "id": "Core.Uint32Array.fromArrayLikeOrIterable", + "id": "Core.TypedArray.every", "kind": "value", - "name": "fromArrayLikeOrIterable", - "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Uint32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "every", + "docstrings": [], + "signature": "let every: (t<'a>, 'a => bool) => bool" }, { - "id": "Core.Uint32Array.fromArrayLikeOrIterableWithMap", + "id": "Core.TypedArray.everyWithIndex", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Uint32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/uint16array": { - "id": "Core.Uint16Array", - "name": "Uint16Array", - "docstrings": [], - "items": [ + "name": "everyWithIndex", + "docstrings": [], + "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" + }, { - "id": "Core.Uint16Array.t", - "kind": "type", - "name": "t", - "docstrings": [ - "The `Uint16Array` typed array represents an array of 16-bit unsigned integers in platform byte order. See [Uint16Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array)" - ], - "signature": "type t = Core__TypedArray.t" + "id": "Core.TypedArray.filter", + "kind": "value", + "name": "filter", + "docstrings": [], + "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" }, { - "id": "Core.Uint16Array.fromArray", + "id": "Core.TypedArray.filterWithIndex", "kind": "value", - "name": "fromArray", - "docstrings": [ - "`fromArray` creates a `Uint16Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)" - ], - "signature": "let fromArray: array => t" + "name": "filterWithIndex", + "docstrings": [], + "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" }, { - "id": "Core.Uint16Array.fromBuffer", + "id": "Core.TypedArray.find", "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "`fromBuffer` creates a `Uint16Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "name": "find", + "docstrings": [], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" }, { - "id": "Core.Uint16Array.fromBufferToEnd", + "id": "Core.TypedArray.findWithIndex", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [ - "`fromBufferToEnd` creates a `Uint16Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "findWithIndex", + "docstrings": [], + "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" }, { - "id": "Core.Uint16Array.fromBufferWithRange", + "id": "Core.TypedArray.findIndex", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [ - "`fromBufferWithRange` creates a `Uint16Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "findIndex", + "docstrings": [], + "signature": "let findIndex: (t<'a>, 'a => bool) => int" }, { - "id": "Core.Uint16Array.fromLength", + "id": "Core.TypedArray.findIndexWithIndex", "kind": "value", - "name": "fromLength", - "docstrings": [ - "`fromLength` creates a zero-initialized `Uint16Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array/Uint16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromLength: int => t" + "name": "findIndexWithIndex", + "docstrings": [], + "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" }, { - "id": "Core.Uint16Array.fromArrayLikeOrIterable", + "id": "Core.TypedArray.forEach", "kind": "value", - "name": "fromArrayLikeOrIterable", - "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Uint16Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "forEach", + "docstrings": [], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Core.Uint16Array.fromArrayLikeOrIterableWithMap", + "id": "Core.TypedArray.forEachWithIndex", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Uint16Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/uint8array": { - "id": "Core.Uint8Array", - "name": "Uint8Array", - "docstrings": [], - "items": [ + "name": "forEachWithIndex", + "docstrings": [], + "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + }, { - "id": "Core.Uint8Array.t", - "kind": "type", - "name": "t", - "docstrings": [ - "The `Uint8Array` typed array represents an array of 8-bit unsigned integers. See [Uint8Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)" - ], - "signature": "type t = Core__TypedArray.t" + "id": "Core.TypedArray.map", + "kind": "value", + "name": "map", + "docstrings": [], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Core.Uint8Array.fromArray", + "id": "Core.TypedArray.mapWithIndex", "kind": "value", - "name": "fromArray", - "docstrings": [ - "`fromArray` creates a `Uint8Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)" - ], - "signature": "let fromArray: array => t" + "name": "mapWithIndex", + "docstrings": [], + "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" }, { - "id": "Core.Uint8Array.fromBuffer", + "id": "Core.TypedArray.reduce", "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "`fromBuffer` creates a `Uint8Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "name": "reduce", + "docstrings": [], + "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" }, { - "id": "Core.Uint8Array.fromBufferToEnd", + "id": "Core.TypedArray.reduceWithIndex", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [ - "`fromBufferToEnd` creates a `Uint8Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "reduceWithIndex", + "docstrings": [], + "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" }, { - "id": "Core.Uint8Array.fromBufferWithRange", + "id": "Core.TypedArray.reduceRight", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [ - "`fromBufferWithRange` creates a `Uint8Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "reduceRight", + "docstrings": [], + "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" }, { - "id": "Core.Uint8Array.fromLength", + "id": "Core.TypedArray.reduceRightWithIndex", "kind": "value", - "name": "fromLength", - "docstrings": [ - "`fromLength` creates a zero-initialized `Uint8Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromLength: int => t" + "name": "reduceRightWithIndex", + "docstrings": [], + "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" }, { - "id": "Core.Uint8Array.fromArrayLikeOrIterable", + "id": "Core.TypedArray.some", "kind": "value", - "name": "fromArrayLikeOrIterable", - "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Uint8Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "some", + "docstrings": [], + "signature": "let some: (t<'a>, 'a => bool) => bool" }, { - "id": "Core.Uint8Array.fromArrayLikeOrIterableWithMap", + "id": "Core.TypedArray.someWithIndex", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Uint8Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "name": "someWithIndex", + "docstrings": [], + "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" } ] }, - "core/int32array": { - "id": "Core.Int32Array", - "name": "Int32Array", + "core/arraybuffer": { + "id": "Core.ArrayBuffer", + "name": "ArrayBuffer", "docstrings": [], "items": [ { - "id": "Core.Int32Array.t", + "id": "Core.ArrayBuffer.t", "kind": "type", "name": "t", - "docstrings": [ - "The `Int32Array` typed array represents an array of twos-complemenet 32-bit signed integers in platform byte order. See [Int32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array)" - ], - "signature": "type t = Core__TypedArray.t" + "docstrings": [], + "signature": "type t" }, { - "id": "Core.Int32Array.fromArray", + "id": "Core.ArrayBuffer.make", "kind": "value", - "name": "fromArray", - "docstrings": [ - "`fromArray` creates a `Int32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)" - ], - "signature": "let fromArray: array => t" + "name": "make", + "docstrings": [], + "signature": "let make: int => t" }, { - "id": "Core.Int32Array.fromBuffer", + "id": "Core.ArrayBuffer.byteLength", "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "`fromBuffer` creates a `Int32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t => int" }, { - "id": "Core.Int32Array.fromBufferToEnd", + "id": "Core.ArrayBuffer.slice", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [ - "`fromBufferToEnd` creates a `Int32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "slice", + "docstrings": [], + "signature": "let slice: (t, ~start: int, ~end: int) => t" }, { - "id": "Core.Int32Array.fromBufferWithRange", + "id": "Core.ArrayBuffer.sliceToEnd", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [ - "`fromBufferWithRange` creates a `Int32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t, ~start: int) => t" + } + ] + }, + "core/weakset": { + "id": "Core.WeakSet", + "name": "WeakSet", + "docstrings": [], + "items": [ + { + "id": "Core.WeakSet.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a>" }, { - "id": "Core.Int32Array.fromLength", + "id": "Core.WeakSet.make", "kind": "value", - "name": "fromLength", - "docstrings": [ - "`fromLength` creates a zero-initialized `Int32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array/Int32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." - ], - "signature": "let fromLength: int => t" + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'a>" }, { - "id": "Core.Int32Array.fromArrayLikeOrIterable", + "id": "Core.WeakSet.add", "kind": "value", - "name": "fromArrayLikeOrIterable", - "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Int32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "add", + "docstrings": [], + "signature": "let add: (t<'a>, 'a) => t<'a>" }, { - "id": "Core.Int32Array.fromArrayLikeOrIterableWithMap", + "id": "Core.WeakSet.delete", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Int32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "name": "delete", + "docstrings": [], + "signature": "let delete: (t<'a>, 'a) => bool" + }, + { + "id": "Core.WeakSet.has", + "kind": "value", + "name": "has", + "docstrings": [], + "signature": "let has: (t<'a>, 'a) => bool" } ] }, - "core/int16array": { - "id": "Core.Int16Array", - "name": "Int16Array", - "docstrings": [], + "core/set": { + "id": "Core.Set", + "name": "Set", + "docstrings": [ + "Bindings to the mutable JavaScript `Set`.\n\nSee [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) on MDN." + ], "items": [ { - "id": "Core.Int16Array.t", + "id": "Core.Set.t", "kind": "type", "name": "t", "docstrings": [ - "The `Int16Array` typed array represents an array of twos-complement 16-bit signed integers in platform byte order. See [Int16Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array)" + "Type representing an instance of `Set`." ], - "signature": "type t = Core__TypedArray.t" + "signature": "type t<'a>" }, { - "id": "Core.Int16Array.fromArray", + "id": "Core.Set.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new, mutable JavaScript `Set`. A `Set` is a collection of unique values.\n\nSee [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) on MDN.\n\n\n\n## Examples\n```rescript\n// You can annotate the type of your set if you want to\nlet mySet: Set.t = Set.make()\n\n// Or you can let ReScript infer what's in your Set\nlet set = Set.make()\nset->Set.add(\"Fine name\") // Inferred as Set.t\n```\n\n## Alternatives\nA JavaScript `Set` is mutable. If you're looking for an immutable alternative, check out `Belt.Set`." + ], + "signature": "let make: unit => t<'a>" + }, + { + "id": "Core.Set.fromArray", "kind": "value", "name": "fromArray", "docstrings": [ - "`fromArray` creates a `Int16Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)" + "Turns an array of values into a Set. Meaning only unique values are preserved.\n\n## Examples\n```rescript\ntype languages = ReScript | JavaScript | TypeScript\nlet languageRank = [ReScript, JavaScript, TypeScript]\n\nlet set = Set.fromArray(languageRank) // Set.t\n\nswitch set->Set.has(ReScript) {\n| true => Console.log(\"Yay, ReScript is in there!\")\n| false => Console.log(\"Uh-oh, something is _terribly_ wrong with this program... abort.\")\n}\n```" ], - "signature": "let fromArray: array => t" + "signature": "let fromArray: array<'a> => t<'a>" }, { - "id": "Core.Int16Array.fromBuffer", + "id": "Core.Set.fromIterator", "kind": "value", - "name": "fromBuffer", + "name": "fromIterator", "docstrings": [ - "`fromBuffer` creates a `Int16Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Turns an iterator into a `Set`.\n\n## Examples\n\n```rescript\n// Let's pretend we have an interator\nlet iterator: Iterator.t = %raw(`\n (() => {\n var array1 = ['a', 'b', 'c'];\n var iterator1 = array1[Symbol.iterator]();\n return iterator1\n })()\n`)\n\niterator\n->Set.fromIterator\n->Set.size\n->assertEqual(3)\n```" ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let fromIterator: Iterator.t<'a> => t<'a>" }, { - "id": "Core.Int16Array.fromBufferToEnd", + "id": "Core.Set.size", "kind": "value", - "name": "fromBufferToEnd", + "name": "size", "docstrings": [ - "`fromBufferToEnd` creates a `Int16Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns the size, the number of unique values, of the set.\n\nSee [`Set.prototype.size`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/size) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\n\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue2\")\n\nlet size = set->Set.size // 2\n```" ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let size: t<'a> => int" }, { - "id": "Core.Int16Array.fromBufferWithRange", + "id": "Core.Set.clear", "kind": "value", - "name": "fromBufferWithRange", + "name": "clear", "docstrings": [ - "`fromBufferWithRange` creates a `Int16Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Clears all entries in the set.\n\nSee [`Set.clear`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/clear) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\n\nset->Set.add(\"someKey\")\nset->Set.size // 1\n\nset->Set.clear\nset->Set.size // 0\n```" ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let clear: t<'a> => unit" }, { - "id": "Core.Int16Array.fromLength", + "id": "Core.Set.add", "kind": "value", - "name": "fromLength", + "name": "add", "docstrings": [ - "`fromLength` creates a zero-initialized `Int16Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array/Int16Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Adds a new value to the set.\n\nSee [`Set.add`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/add) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\n```" ], - "signature": "let fromLength: int => t" + "signature": "let add: (t<'a>, 'a) => unit" }, { - "id": "Core.Int16Array.fromArrayLikeOrIterable", + "id": "Core.Set.delete", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "delete", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Int16Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Deletes the provided `value` from the set. Returns a `bool` for whether the value existed, and was deleted.\n\nSee [`Set.delete`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/delete) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nlet didDeleteValue = set->Set.delete(\"someValue\")\nConsole.log(didDeleteValue) // Logs `true` to the console, becuase the set had the value, so it was successfully deleted\n\nlet didDeleteValue = set->Set.delete(\"someNonExistantKey\")\nConsole.log(didDeleteValue) // Logs `false` to the console, becuase the value did not exist in the set\n```" ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "signature": "let delete: (t<'a>, 'a) => bool" }, { - "id": "Core.Int16Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Set.has", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "has", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Int16Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Checks whether the set has a specific value.\n\nSee [`Set.has`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/has) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\n\nswitch set->Set.has(\"someValue\") {\n| false => Console.log(\"Nope, didn't have it.\")\n| true => Console.log(\"Yay, we have the value!\")\n}\n```" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/int8array": { - "id": "Core.Int8Array", - "name": "Int8Array", - "docstrings": [], - "items": [ + "signature": "let has: (t<'a>, 'a) => bool" + }, + { + "id": "Core.Set.forEach", + "kind": "value", + "name": "forEach", + "docstrings": [ + "Iterates through all values of the set.\n\nSee [`Set.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/forEach) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue2\")\n\nset->Set.forEach(value => {\n Console.log(value)\n})\n```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, { - "id": "Core.Int8Array.t", - "kind": "type", - "name": "t", + "id": "Core.Set.values", + "kind": "value", + "name": "values", "docstrings": [ - "The `Int8Array` typed array represents an array of twos-complement 8-bit signed integers. See [Int8Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array)" + "Returns an iterator that holds all values of the set.\n\nSee [`Set.values`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/values) on MDN.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nset->Set.add(\"anotherValue\")\n\nlet values = set->Set.values\n\n// Logs the first value\nConsole.log(Iterator.next(values).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh values iterator to get an array of all values, since we consumed a value via `next` above already.\nConsole.log(set->Set.values->Iterator.toArray)\n```" ], - "signature": "type t = Core__TypedArray.t" + "signature": "let values: t<'a> => Iterator.t<'a>" }, { - "id": "Core.Int8Array.fromArray", + "id": "Core.Set.difference", "kind": "value", - "name": "fromArray", + "name": "difference", "docstrings": [ - "`fromArray` creates a `Int8Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)" + "Returns a new set with the values of the set that are not in the other set.\n\nSee [`Set.difference`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/difference) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"orange\", \"banana\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nset1->Set.difference(set2) // Set.fromArray([\"orange\"])\n```" ], - "signature": "let fromArray: array => t" + "signature": "let difference: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Core.Int8Array.fromBuffer", + "id": "Core.Set.symmetricDifference", "kind": "value", - "name": "fromBuffer", + "name": "symmetricDifference", "docstrings": [ - "`fromBuffer` creates a `Int8Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns a new set with the values containing the values which are in either the set, but not in both.\n\nSee [`Set.symmetricDifference`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/symmetricDifference) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"orange\", \"banana\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nset1->Set.symmetricDifference(set2) // Set.fromArray([\"orange\", \"pear\"])\n```" ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let symmetricDifference: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Core.Int8Array.fromBufferToEnd", + "id": "Core.Set.intersection", "kind": "value", - "name": "fromBufferToEnd", + "name": "intersection", "docstrings": [ - "`fromBufferToEnd` creates a `Int8Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns a new set with the values containing the values which are in both the set and the other set.\n\nSee [`Set.intersection`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/intersection) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"orange\", \"banana\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nset1->Set.intersection(set2) // Set.fromArray([\"apple\", \"banana\"])\n```" ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let intersection: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Core.Int8Array.fromBufferWithRange", + "id": "Core.Set.isDisjointFrom", "kind": "value", - "name": "fromBufferWithRange", + "name": "isDisjointFrom", "docstrings": [ - "`fromBufferWithRange` creates a `Int8Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns a bool indicating if this set has no elements in common with the given set.\n\nSee [`Set.isDisjointFrom`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/isDisjointFrom) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"orange\", \"banana\"])\nlet set2 = Set.fromArray([\"kiwi\", \"melon\", \"pear\"])\nset1->Set.isDisjointFrom(set2) // true\n```" ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let isDisjointFrom: (t<'a>, t<'a>) => bool" }, { - "id": "Core.Int8Array.fromLength", + "id": "Core.Set.isSubsetOf", "kind": "value", - "name": "fromLength", + "name": "isSubsetOf", "docstrings": [ - "`fromLength` creates a zero-initialized `Int8Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array/Int8Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns a bool indicating if the all values in the set are in the given set.\n\nSee [`Set.isSubsetOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/isSubsetOf) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"banana\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nset1->Set.isSubsetOf(set2) // true\n```" ], - "signature": "let fromLength: int => t" + "signature": "let isSubsetOf: (t<'a>, t<'a>) => bool" }, { - "id": "Core.Int8Array.fromArrayLikeOrIterable", + "id": "Core.Set.isSupersetOf", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "isSupersetOf", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Int8Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Returns a bool indicating if the all values in the given set are in the set.\n\nSee [`Set.isSupersetOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/isSupersetOf) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\"])\nset1->Set.isSupersetOf(set2) // true\n ```" ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "signature": "let isSupersetOf: (t<'a>, t<'a>) => bool" }, { - "id": "Core.Int8Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Set.union", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "union", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Int8Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Returns a new set with the values of the set that are in both the set and the other set.\n\nSee [`Set.union`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/union) on MDN.\n\n## Examples\n```rescript\nlet set1 = Set.fromArray([\"apple\", \"orange\", \"banana\"])\nlet set2 = Set.fromArray([\"apple\", \"banana\", \"pear\"])\nset1->Set.union(set2) // Set.fromArray([\"apple\", \"orange\", \"banana\", \"pear\"])\n```" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let union: (t<'a>, t<'a>) => t<'a>" + }, + { + "id": "Core.Set.toArray", + "kind": "value", + "name": "toArray", + "docstrings": [ + "`toArray(set)` returns an array of all values of the set.\n\nSee [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN.\n\n## Examples\n```rescript\nlet set = Set.fromArray([\"apple\", \"orange\", \"apple\", \"banana\"])\nset->Set.toArray // [\"apple\", \"orange\", \"banana\"]\n```" + ], + "signature": "let toArray: t<'a> => array<'a>" } ] }, - "core/float64array": { - "id": "Core.Float64Array", - "name": "Float64Array", + "core/weakmap": { + "id": "Core.WeakMap", + "name": "WeakMap", "docstrings": [], "items": [ { - "id": "Core.Float64Array.t", + "id": "Core.WeakMap.t", "kind": "type", "name": "t", - "docstrings": [ - "The `Float64Array` typed array represents an array of 64-bit floating point numbers in platform byte order. See [Float64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array)" - ], - "signature": "type t = Core__TypedArray.t" + "docstrings": [], + "signature": "type t<'k, 'v>" }, { - "id": "Core.Float64Array.fromArray", + "id": "Core.WeakMap.make", "kind": "value", - "name": "fromArray", + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'k, 'v>" + }, + { + "id": "Core.WeakMap.get", + "kind": "value", + "name": "get", + "docstrings": [], + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + }, + { + "id": "Core.WeakMap.has", + "kind": "value", + "name": "has", + "docstrings": [], + "signature": "let has: (t<'k, 'v>, 'k) => bool" + }, + { + "id": "Core.WeakMap.set", + "kind": "value", + "name": "set", + "docstrings": [], + "signature": "let set: (t<'k, 'v>, 'k, 'v) => t<'k, 'v>" + }, + { + "id": "Core.WeakMap.delete", + "kind": "value", + "name": "delete", + "docstrings": [], + "signature": "let delete: (t<'k, 'v>, 'k) => bool" + } + ] + }, + "core/map": { + "id": "Core.Map", + "name": "Map", + "docstrings": [ + "Bindings to the mutable JavaScript `Map`.\n\nSee [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) on MDN." + ], + "items": [ + { + "id": "Core.Map.t", + "kind": "type", + "name": "t", "docstrings": [ - "`fromArray` creates a `Float64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)" + "Type representing an instance of `Map`." ], - "signature": "let fromArray: array => t" + "signature": "type t<'k, 'v>" }, { - "id": "Core.Float64Array.fromBuffer", + "id": "Core.Map.make", "kind": "value", - "name": "fromBuffer", + "name": "make", "docstrings": [ - "`fromBuffer` creates a `Float64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Creates a new, mutable JavaScript `Map`. A `Map` can have any values as both keys and values.\n\nSee [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) on MDN.\n\n\n\n## Examples\n```rescript\n`make()`\n// You can annotate the type of your map if you want to\nlet myMap: Map.t = Map.make()\n\n// Or you can let ReScript infer what's in your map\nlet map = Map.make()\nmap->Map.set(\"lang\", \"ReScript\") // Inferred as Map.t\n```\n\n## Alternatives\nA JavaScript `Map` is mutable. If you're looking for an immutable alternative, check out`Belt.Map`." ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let make: unit => t<'k, 'v>" }, { - "id": "Core.Float64Array.fromBufferToEnd", + "id": "Core.Map.fromArray", "kind": "value", - "name": "fromBufferToEnd", + "name": "fromArray", "docstrings": [ - "`fromBufferToEnd` creates a `Float64Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Turns an array of key/value pairs into a Map.\n\n## Examples\n```rescript\ntype languages = ReScript | JavaScript | TypeScript\nlet languageRank = [(ReScript, 1), (JavaScript, 2), (TypeScript, 3)]\n\nlet map = Map.fromArray(languageRank) // Map.t\n\nswitch map->Map.get(ReScript) {\n| Some(1) => Console.log(\"Yay, ReScript is #1!\")\n| _ => Console.log(\"Uh-oh, something is _terribly_ wrong with this program... abort.\")\n}\n```" ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromArray: array<('k, 'v)> => t<'k, 'v>" }, { - "id": "Core.Float64Array.fromBufferWithRange", + "id": "Core.Map.fromIterator", "kind": "value", - "name": "fromBufferWithRange", + "name": "fromIterator", "docstrings": [ - "`fromBufferWithRange` creates a `Float64Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Turns an iterator in the shape of `('key, 'value)` into a `Map`.\n\n## Examples\n\n```rescript\n// Let's pretend we have an interator in the correct shape\nlet iterator: Iterator.t<(string, string)> = %raw(`\n (() => {\n var map1 = new Map();\n\n map1.set('first', '1');\n map1.set('second', '2');\n\n var iterator1 = map1[Symbol.iterator]();\n return iterator1;\n })()\n`)\n\niterator\n->Map.fromIterator\n->Map.size\n->assertEqual(2)\n```" ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let fromIterator: Iterator.t<('k, 'v)> => t<'k, 'v>" }, { - "id": "Core.Float64Array.fromLength", + "id": "Core.Map.size", "kind": "value", - "name": "fromLength", + "name": "size", "docstrings": [ - "`fromLength` creates a zero-initialized `Float64Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array/Float64Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns the size, the number of key/value pairs, of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\n\nmap->Map.set(\"someKey\", \"someValue\")\n\nlet size = map->Map.size // 1\n```" ], - "signature": "let fromLength: int => t" + "signature": "let size: t<'k, 'v> => int" }, { - "id": "Core.Float64Array.fromArrayLikeOrIterable", + "id": "Core.Map.clear", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "clear", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Float64Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Clears all entries in the map.\n\n## Examples\n```rescript\nlet map = Map.make()\n\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.size // 1\n\nmap->Map.clear\nmap->Map.size // 0\n```" ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "signature": "let clear: t<'k, 'v> => unit" }, { - "id": "Core.Float64Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Map.forEach", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "forEach", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Float64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Iterates through all values of the map.\n\n> Please note that this is *without the keys*, just the values. If you need the key as well, use `Map.forEachWithKey`.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\nmap->Map.forEach(value => {\n Console.log(value)\n})\n```" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" - } - ] - }, - "core/float32array": { - "id": "Core.Float32Array", - "name": "Float32Array", - "docstrings": [], - "items": [ + "signature": "let forEach: (t<'k, 'v>, 'v => unit) => unit" + }, { - "id": "Core.Float32Array.t", - "kind": "type", - "name": "t", + "id": "Core.Map.forEachWithKey", + "kind": "value", + "name": "forEachWithKey", "docstrings": [ - "The `Float32Array` typed array represents an array of 32-bit floating point numbers in platform byte order. See [Float32Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array)" + "Iterates through all values of the map, including the key for each value.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\nmap->Map.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" ], - "signature": "type t = Core__TypedArray.t" + "signature": "let forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" }, { - "id": "Core.Float32Array.fromArray", + "id": "Core.Map.get", "kind": "value", - "name": "fromArray", + "name": "get", "docstrings": [ - "`fromArray` creates a `Float32Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)" + "Returns the value for a key, if a value exists at that key.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n\nswitch map->Map.get(\"someKey\") {\n| None => Console.log(\"Nope, didn't have it.\")\n| Some(value) => Console.log2(\"Yay, had the value, and it's:\", value)\n}\n```" ], - "signature": "let fromArray: array => t" + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" }, { - "id": "Core.Float32Array.fromBuffer", + "id": "Core.Map.has", "kind": "value", - "name": "fromBuffer", + "name": "has", "docstrings": [ - "`fromBuffer` creates a `Float32Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Checks whether the map has a specific key.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n\nswitch map->Map.has(\"someKey\") {\n| false => Console.log(\"Nope, didn't have it.\")\n| true => Console.log(\"Yay, we have the value!\")\n}\n```" ], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let has: (t<'k, 'v>, 'k) => bool" }, { - "id": "Core.Float32Array.fromBufferToEnd", + "id": "Core.Map.set", "kind": "value", - "name": "fromBufferToEnd", + "name": "set", "docstrings": [ - "`fromBufferToEnd` creates a `Float32Array` from an `ArrayBuffer.t`, starting at a particular offset and continuing through to the end. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Sets the provided `value` to the provided `key`.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n```" ], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let set: (t<'k, 'v>, 'k, 'v) => unit" }, { - "id": "Core.Float32Array.fromBufferWithRange", + "id": "Core.Map.delete", "kind": "value", - "name": "fromBufferWithRange", + "name": "delete", "docstrings": [ - "`fromBufferWithRange` creates a `Float32Array` from an `ArrayBuffer.t`, starting at a particular offset and consuming `length` **bytes**. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Deletes the provided `key` and its value from the map. Returns a `bool` for whether the key existed, and was deleted.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nlet didDeleteKey = map->Map.delete(\"someKey\")\nConsole.log(didDeleteKey) // Logs `true` to the console, becuase the map had the key, so it was successfully deleted\n\nlet didDeleteKey = map->Map.delete(\"someNonExistantKey\")\nConsole.log(didDeleteKey) // Logs `false` to the console, becuase the key did not exist\n```" ], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let delete: (t<'k, 'v>, 'k) => bool" }, { - "id": "Core.Float32Array.fromLength", + "id": "Core.Map.keys", "kind": "value", - "name": "fromLength", + "name": "keys", "docstrings": [ - "`fromLength` creates a zero-initialized `Float32Array` to hold the specified count of numbers; this is **not** a byte length. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array/Float32Array)\n\n**Note:** This is a potentially unsafe operation. Ensure the buffer is large enough and only accessed within its bounds." + "Returns an iterator that holds all keys of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet keys = map->Map.keys\n\n// Logs the first key\nConsole.log(Iterator.next(keys).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh keys iterator to get an array of all keys, since we consumed a value via `next` above already.\nConsole.log(map->Map.keys->Iterator.toArray)\n```" ], - "signature": "let fromLength: int => t" + "signature": "let keys: t<'k, 'v> => Iterator.t<'k>" }, { - "id": "Core.Float32Array.fromArrayLikeOrIterable", + "id": "Core.Map.values", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "values", "docstrings": [ - "`fromArrayLikeOrIterable` creates a `Float32Array` from an array-like or iterable object. See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Returns an iterator that holds all values of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet values = map->Map.values\n\n// Logs the first value\nConsole.log(Iterator.next(values).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh values iterator to get an array of all values, since we consumed a value via `next` above already.\nConsole.log(map->Map.values->Iterator.toArray)\n```" ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "signature": "let values: t<'k, 'v> => Iterator.t<'v>" }, { - "id": "Core.Float32Array.fromArrayLikeOrIterableWithMap", + "id": "Core.Map.entries", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "entries", "docstrings": [ - "`fromArrayLikeOrIterableWithMap` creates a `Float32Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from)" + "Returns an iterator that holds all entries of the map.\nAn entry is represented as a tuple of `('key, 'value)`,\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet entries = map->Map.entries\n\n// Logs the first value\nConsole.log(Iterator.next(entries).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes entries. We'll need a fresh entries iterator to get an array of all entries, since we consumed a value via `next` above already.\nConsole.log(map->Map.entries->Iterator.toArray)\n```" ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" + "signature": "let entries: t<'k, 'v> => Iterator.t<('k, 'v)>" } ] }, - "core/typedarray": { - "id": "Core.TypedArray", - "name": "TypedArray", - "docstrings": [], + "core/asynciterator": { + "id": "Core.AsyncIterator", + "name": "AsyncIterator", + "docstrings": [ + "Bindings to async iterators, a way to do async iteration in JavaScript.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN." + ], "items": [ { - "id": "Core.TypedArray.t", + "id": "Core.AsyncIterator.t", "kind": "type", "name": "t", - "docstrings": [], + "docstrings": [ + "The type representing an async iterator." + ], "signature": "type t<'a>" }, { - "id": "Core.TypedArray.get", - "kind": "value", - "name": "get", + "id": "Core.AsyncIterator.value", + "kind": "type", + "name": "value", "docstrings": [], - "signature": "let get: (t<'a>, int) => option<'a>" + "signature": "type value<'a> = {done: bool, value: option<'a>}" }, { - "id": "Core.TypedArray.set", + "id": "Core.AsyncIterator.make", "kind": "value", - "name": "set", - "docstrings": [], - "signature": "let set: (t<'a>, int, 'a) => unit" + "name": "make", + "docstrings": [ + "`make(nextFn)`\n\nCreates an async iterator from a function that returns the next value of the iterator.\n\n## Examples\n\n- A simple example, creating an async iterator that returns 1, 2, 3:\n\n```rescript\nlet context = ref(0)\n\nlet asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n\n {\n AsyncIterator.value: Some(currentValue),\n done: currentValue >= 3\n }\n})\n\n// This will log 1, 2, 3\nlet main = async () => await asyncIterator->AsyncIterator.forEach(value =>\n switch value {\n | Some(value) => Console.log(value)\n | None => ()\n }\n)\n\nmain()->ignore\n```" + ], + "signature": "let make: (unit => promise>) => t<'value>" }, { - "id": "Core.TypedArray.buffer", + "id": "Core.AsyncIterator.value", "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t<'a> => Core__ArrayBuffer.t" + "name": "value", + "docstrings": [ + "`value(value)`\n\nShorthand for creating a value object with the provided value, and the `done` property set to false.\n\n## Examples\n\n```rescript\nlet context = ref(0)\n\nlet asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n \n if currentValue >= 3 {\n AsyncIterator.done()\n } else {\n AsyncIterator.value(currentValue)\n }\n})\n```" + ], + "signature": "let value: 'value => value<'value>" }, { - "id": "Core.TypedArray.byteLength", + "id": "Core.AsyncIterator.done", "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t<'a> => int" + "name": "done", + "docstrings": [ + "`done(~finalValue=?)`\n\n Shorthand for creating a value object with the `done` property set to true, and the provided value as the final value, if any.\n\n ## Examples\n ```rescript\n let context = ref(0)\n\n let asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n \n if currentValue >= 3 {\n AsyncIterator.done()\n } else {\n AsyncIterator.value(currentValue)\n }\n })\n ```" + ], + "signature": "let done: (~finalValue: 'value=?) => value<'value>" }, { - "id": "Core.TypedArray.byteOffset", + "id": "Core.AsyncIterator.next", "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t<'a> => int" + "name": "next", + "docstrings": [ + "`next(asyncIterator)`\n\nReturns the next value of the iterator, if any.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN.\n\n## Examples\n\n- A simple example, getting the next value:\n\n```rescript\nlet asyncIterator: AsyncIterator.t<(string, string)> = %raw(`\n (() => {\n var map1 = new Map();\n\n map1.set('first', '1');\n map1.set('second', '2');\n\n var iterator1 = map1[Symbol.iterator]();\n return iterator1;\n })()\n`)\n\nlet processMyAsyncIterator = async () => {\n // ReScript doesn't have `for ... of` loops, but it's easy to mimic using a while loop.\n let break = ref(false)\n\n while !break.contents {\n // Await the next iterator value\n let {value, done} = await asyncIterator->AsyncIterator.next\n\n // Exit the while loop if the iterator says it's done\n break := done\n\n if done {\n value\n ->Option.isNone\n ->assertEqual(true)\n }\n }\n}\n\nprocessMyAsyncIterator()->ignore\n```" + ], + "signature": "let next: t<'a> => promise>" }, { - "id": "Core.TypedArray.setArray", + "id": "Core.AsyncIterator.forEach", "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (t<'a>, array<'a>) => unit" + "name": "forEach", + "docstrings": [ + "`forEach(iterator, fn)` consumes all values in the async iterator and runs the callback `fn` for each value.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n\n```rescript\n// Let's pretend we get an async iterator returning ints from somewhere.\nlet asyncIterator: AsyncIterator.t<(string, string)> = %raw(`\n (() => {\n var map1 = new Map();\n\n map1.set('first', '1');\n map1.set('second', '2');\n\n var iterator1 = map1[Symbol.iterator]();\n return iterator1;\n })()\n`)\n\nlet main = async () =>\n await asyncIterator->AsyncIterator.forEach(v => {\n switch v {\n | Some((\"second\", value)) => assertEqual(value, \"2\")\n | _ => ()\n }\n })\n\nmain()->ignore\n```" + ], + "signature": "let forEach: (t<'a>, option<'a> => unit) => promise" + } + ] + }, + "core/iterator": { + "id": "Core.Iterator", + "name": "Iterator", + "docstrings": [ + "Bindings to JavaScript iterators.\n\nSee [`iterator protocols`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN." + ], + "items": [ + { + "id": "Core.Iterator.t", + "kind": "type", + "name": "t", + "docstrings": [ + "The type representing an iterator." + ], + "signature": "type t<'a>" }, { - "id": "Core.TypedArray.setArrayFrom", - "kind": "value", - "name": "setArrayFrom", - "docstrings": [], - "signature": "let setArrayFrom: (t<'a>, array<'a>, int) => unit" + "id": "Core.Iterator.value", + "kind": "type", + "name": "value", + "docstrings": [ + "The current value of an iterator." + ], + "signature": "type value<'a> = {done: bool, value: option<'a>}" }, { - "id": "Core.TypedArray.length", + "id": "Core.Iterator.next", "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t<'a> => int" + "name": "next", + "docstrings": [ + "Returns the next value of the iterator, if any.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n\n```rescript\nlet iterator: Iterator.t = %raw(`\n (() => {\n var array1 = ['a'];\n var iterator1 = array1[Symbol.iterator]();\n return iterator1\n })()\n`)\n(iterator->Iterator.next).done->assertEqual(false)\n(iterator->Iterator.next).done->assertEqual(true)\n```" + ], + "signature": "let next: t<'a> => value<'a>" }, { - "id": "Core.TypedArray.copyAllWithin", + "id": "Core.Iterator.toArray", "kind": "value", - "name": "copyAllWithin", - "docstrings": [], - "signature": "let copyAllWithin: (t<'a>, ~target: int) => array<'a>" + "name": "toArray", + "docstrings": [ + "Turns an iterator into an array of the remaining values.\nRemember that each invocation of `next` of an iterator consumes a value. `Iterator.toArray` will consume all remaining values of the iterator and return them in an array to you.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\n// `Map.keys` returns all keys of the map as an iterator.\nlet mapKeysAsArray = map->Map.keys->Iterator.toArray\n\nConsole.log(mapKeysAsArray) // Logs [\"someKey\", \"someKey2\"] to the console.\n```" + ], + "signature": "let toArray: t<'a> => array<'a>" }, { - "id": "Core.TypedArray.copyWithinToEnd", + "id": "Core.Iterator.toArrayWithMapper", "kind": "value", - "name": "copyWithinToEnd", - "docstrings": [], - "signature": "let copyWithinToEnd: (t<'a>, ~target: int, ~start: int) => array<'a>" + "name": "toArrayWithMapper", + "docstrings": [ + "`toArray(iterator)` turns `iterator` into an array of its remaining values, applying the provided mapper function on each item.\nRemember that each invocation of `next` of an iterator consumes a value. `Iterator.toArrayWithMapper` will consume all remaining values of the iterator and return them in an array to you.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\n// `Map.keys` returns all keys of the map as an iterator.\nlet mapKeysAsArray = map\n ->Map.keys\n ->Iterator.toArrayWithMapper(key => key->String.length)\n\nConsole.log(mapKeysAsArray) // Logs [7, 8] to the console.\n```" + ], + "signature": "let toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b>" }, { - "id": "Core.TypedArray.copyWithin", + "id": "Core.Iterator.forEach", "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (t<'a>, ~target: int, ~start: int, ~end: int) => array<'a>" + "name": "forEach", + "docstrings": [ + "`forEach(iterator, fn)` consumes all values in the iterator and runs the callback `fn` for each value.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\nlet iterator: Iterator.t = %raw(`\n (() => {\n var array1 = ['a', 'b', 'c'];\n var iterator1 = array1[Symbol.iterator]();\n return iterator1\n })()\n`)\niterator->Iterator.forEach(v => {\n switch v {\n | Some(\"a\" | \"b\" | \"c\") => assert(true)\n | other =>\n other\n ->Option.isNone\n ->assertEqual(true)\n }\n})\n```" + ], + "signature": "let forEach: (t<'a>, option<'a> => unit) => unit" + } + ] + }, + "core/type": { + "id": "Core.Type", + "name": "Type", + "docstrings": [ + "Utilities for classifying the type of JavaScript values at runtime." + ], + "items": [ + { + "id": "Core.Type.t", + "kind": "type", + "name": "t", + "docstrings": [ + "The possible types of JavaScript values." + ], + "signature": "type t = [\n | #bigint\n | #boolean\n | #function\n | #number\n | #object\n | #string\n | #symbol\n | #undefined\n]" }, { - "id": "Core.TypedArray.fillAll", + "id": "Core.Type.typeof", "kind": "value", - "name": "fillAll", + "name": "typeof", + "docstrings": [ + "`typeof(someValue)`\n\nReturns the underlying JavaScript type of any runtime value.\n\nSee [`typeof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) on MDN.\n\n## Examples\n```rescript\nConsole.log(Type.typeof(\"Hello\")) // Logs \"string\" to the console.\n\nlet someVariable = true\n\nswitch someVariable->Type.typeof {\n| #boolean => Console.log(\"This is a bool, yay!\")\n| _ => Console.log(\"Oh, not a bool sadly...\")\n}\n```" + ], + "signature": "let typeof: 'a => t" + } + ] + }, + "core/symbol": { + "id": "Core.Symbol", + "name": "Symbol", + "docstrings": [], + "items": [ + { + "id": "Core.Symbol.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let fillAll: (t<'a>, 'a) => t<'a>" + "signature": "type t" }, { - "id": "Core.TypedArray.fillToEnd", + "id": "Core.Symbol.make", "kind": "value", - "name": "fillToEnd", + "name": "make", "docstrings": [], - "signature": "let fillToEnd: (t<'a>, 'a, ~start: int) => t<'a>" + "signature": "let make: string => t" }, { - "id": "Core.TypedArray.fill", + "id": "Core.Symbol.getFor", "kind": "value", - "name": "fill", + "name": "getFor", "docstrings": [], - "signature": "let fill: (t<'a>, 'a, ~start: int, ~end: int) => t<'a>" + "signature": "let getFor: string => t" }, { - "id": "Core.TypedArray.reverse", + "id": "Core.Symbol.keyFor", "kind": "value", - "name": "reverse", + "name": "keyFor", "docstrings": [], - "signature": "let reverse: t<'a> => unit" + "signature": "let keyFor: t => option" }, { - "id": "Core.TypedArray.toReversed", + "id": "Core.Symbol.asyncIterator", "kind": "value", - "name": "toReversed", + "name": "asyncIterator", "docstrings": [], - "signature": "let toReversed: t<'a> => t<'a>" + "signature": "let asyncIterator: t" }, { - "id": "Core.TypedArray.sort", + "id": "Core.Symbol.hasInstance", "kind": "value", - "name": "sort", + "name": "hasInstance", "docstrings": [], - "signature": "let sort: (t<'a>, ('a, 'a) => Core__Ordering.t) => unit" + "signature": "let hasInstance: t" }, { - "id": "Core.TypedArray.toSorted", + "id": "Core.Symbol.isConcatSpreadable", "kind": "value", - "name": "toSorted", + "name": "isConcatSpreadable", "docstrings": [], - "signature": "let toSorted: (t<'a>, ('a, 'a) => Core__Ordering.t) => t<'a>" + "signature": "let isConcatSpreadable: t" }, { - "id": "Core.TypedArray.with", + "id": "Core.Symbol.iterator", "kind": "value", - "name": "with", + "name": "iterator", "docstrings": [], - "signature": "let with: (t<'a>, int, 'a) => t<'a>" + "signature": "let iterator: t" }, { - "id": "Core.TypedArray.includes", + "id": "Core.Symbol.match", "kind": "value", - "name": "includes", + "name": "match", "docstrings": [], - "signature": "let includes: (t<'a>, 'a) => bool" + "signature": "let match: t" }, { - "id": "Core.TypedArray.indexOf", + "id": "Core.Symbol.matchAll", "kind": "value", - "name": "indexOf", + "name": "matchAll", "docstrings": [], - "signature": "let indexOf: (t<'a>, 'a) => int" + "signature": "let matchAll: t" }, { - "id": "Core.TypedArray.indexOfFrom", + "id": "Core.Symbol.replace", "kind": "value", - "name": "indexOfFrom", + "name": "replace", "docstrings": [], - "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" + "signature": "let replace: t" }, { - "id": "Core.TypedArray.joinWith", + "id": "Core.Symbol.search", "kind": "value", - "name": "joinWith", + "name": "search", "docstrings": [], - "signature": "let joinWith: (t<'a>, string) => string" + "signature": "let search: t" }, { - "id": "Core.TypedArray.lastIndexOf", + "id": "Core.Symbol.species", "kind": "value", - "name": "lastIndexOf", + "name": "species", "docstrings": [], - "signature": "let lastIndexOf: (t<'a>, 'a) => int" + "signature": "let species: t" }, { - "id": "Core.TypedArray.lastIndexOfFrom", + "id": "Core.Symbol.split", "kind": "value", - "name": "lastIndexOfFrom", + "name": "split", "docstrings": [], - "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" + "signature": "let split: t" }, { - "id": "Core.TypedArray.slice", + "id": "Core.Symbol.toPrimitive", "kind": "value", - "name": "slice", + "name": "toPrimitive", "docstrings": [], - "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" + "signature": "let toPrimitive: t" }, { - "id": "Core.TypedArray.sliceToEnd", + "id": "Core.Symbol.toStringTag", "kind": "value", - "name": "sliceToEnd", + "name": "toStringTag", "docstrings": [], - "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" + "signature": "let toStringTag: t" }, { - "id": "Core.TypedArray.copy", + "id": "Core.Symbol.unscopables", "kind": "value", - "name": "copy", + "name": "unscopables", "docstrings": [], - "signature": "let copy: t<'a> => t<'a>" + "signature": "let unscopables: t" + } + ] + }, + "core/string": { + "id": "Core.String", + "name": "String", + "docstrings": [ + "Functions for interacting with JavaScript strings.\nSee: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)." + ], + "items": [ + { + "id": "Core.String.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing a string." + ], + "signature": "type t = string" }, { - "id": "Core.TypedArray.subarray", + "id": "Core.String.make", "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" + "name": "make", + "docstrings": [ + "`make(value)` converts the given value to a `string`.\n\n## Examples\n\n```rescript\nString.make(3.5) == \"3.5\"\nString.make([1, 2, 3]) == \"1,2,3\"\n```" + ], + "signature": "let make: 'a => string" }, { - "id": "Core.TypedArray.subarrayToEnd", + "id": "Core.String.fromCharCode", "kind": "value", - "name": "subarrayToEnd", - "docstrings": [], - "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" + "name": "fromCharCode", + "docstrings": [ + "`fromCharCode(n)` creates a `string` containing the character corresponding to\nthat number, `n` ranges from 0 to 65535. If out of range, the lower 16 bits of\nthe value are used. Thus, `fromCharCode(0x1F63A)` gives the same result as\n`fromCharCode(0xF63A)`.\nSee [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) on MDN.\n\n## Examples\n\n```rescript\nString.fromCharCode(65) == \"A\"\nString.fromCharCode(0x3c8) == `ψ`\nString.fromCharCode(0xd55c) == `한`\nString.fromCharCode(-64568) == `ψ`\n```" + ], + "signature": "let fromCharCode: int => string" }, { - "id": "Core.TypedArray.toString", + "id": "Core.String.fromCharCodeMany", "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t<'a> => string" + "name": "fromCharCodeMany", + "docstrings": [ + "`fromCharCodeMany([n1, n2, n3])` creates a `string` from the characters\ncorresponding to the given numbers, using the same rules as `fromCharCode`.\nSee [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) on MDN.\n\n## Examples\n\n```rescript\nString.fromCharCodeMany([189, 43, 190, 61]) == \"½+¾=\"\nString.fromCharCodeMany([65, 66, 67]) == \"ABC\"\n```" + ], + "signature": "let fromCharCodeMany: array => string" }, { - "id": "Core.TypedArray.toLocaleString", + "id": "Core.String.fromCodePoint", "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t<'a> => string" + "name": "fromCodePoint", + "docstrings": [ + "`fromCodePoint(n)` creates a `string` containing the character corresponding to\nthat numeric code point.\nSee [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) on MDN.\n\n## Examples\n\n```rescript\nString.fromCodePoint(65) == \"A\"\nString.fromCodePoint(0x3c8) == `ψ`\nString.fromCodePoint(0xd55c) == `한`\nString.fromCodePoint(0x1f63a) == `😺`\n```\n\n## Exceptions\n\n- `RangeError`: If the number is not a valid code point, like `fromCharCode(-5)`." + ], + "signature": "let fromCodePoint: int => string" }, { - "id": "Core.TypedArray.every", + "id": "Core.String.fromCodePointMany", "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (t<'a>, 'a => bool) => bool" + "name": "fromCodePointMany", + "docstrings": [ + "`fromCodePointMany([n1, n2, n3])` creates a `string` from the characters\ncorresponding to the given code point numbers, using the same rules as\n`fromCodePoint`.\nSee [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) on MDN.\n\n## Examples\n\n```rescript\nString.fromCodePointMany([0xd55c, 0xae00, 0x1f63a]) == `한글😺`\n```\n\n## Exceptions\n\n- `RangeError`: If one of the number is not a valid code point, like\n`fromCharCode([1, -5])`." + ], + "signature": "let fromCodePointMany: array => string" }, { - "id": "Core.TypedArray.everyWithIndex", + "id": "Core.String.equal", "kind": "value", - "name": "everyWithIndex", + "name": "equal", "docstrings": [], - "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" + "signature": "let equal: (string, string) => bool" }, { - "id": "Core.TypedArray.filter", + "id": "Core.String.compare", "kind": "value", - "name": "filter", + "name": "compare", "docstrings": [], - "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + "signature": "let compare: (string, string) => Ordering.t" }, { - "id": "Core.TypedArray.filterWithIndex", + "id": "Core.String.length", "kind": "value", - "name": "filterWithIndex", - "docstrings": [], - "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" + "name": "length", + "docstrings": [ + "`length(str)` returns the length of the given `string`.\nSee [`String.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length) on MDN.\n\n## Examples\n\n```rescript\nString.length(\"abcd\") == 4\n```" + ], + "signature": "let length: string => int" }, { - "id": "Core.TypedArray.find", + "id": "Core.String.get", "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + "name": "get", + "docstrings": [ + "`get(str, index)` returns an `option` at the given `index` number. If\n`index` is out of range, this function returns `None`.\n\n## Examples\n\n```rescript\nString.get(\"ReScript\", 0) == Some(\"R\")\nString.get(\"Hello\", 4) == Some(\"o\")\nString.get(`JS`, 4) == None\n```" + ], + "signature": "let get: (string, int) => option" }, { - "id": "Core.TypedArray.findWithIndex", + "id": "Core.String.getUnsafe", "kind": "value", - "name": "findWithIndex", - "docstrings": [], - "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" + "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.TypedArray.findIndex", + "id": "Core.String.charAt", "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (t<'a>, 'a => bool) => int" + "name": "charAt", + "docstrings": [ + "`charAt(str, index)` gets the character at `index` within string `str`. If\n`index` is negative or greater than the length of `str`, it returns the empty\nstring. If the string contains characters outside the range \\u0000-\\uffff, it\nwill return the first 16-bit value at that position in the string.\nSee [`String.charAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt) on MDN.\n\n## Examples\n\n```rescript\nString.charAt(\"ReScript\", 0) == \"R\"\nString.charAt(\"Hello\", 12) == \"\"\nString.charAt(`JS`, 5) == \"\"\n```" + ], + "signature": "let charAt: (string, int) => string" }, { - "id": "Core.TypedArray.findIndexWithIndex", + "id": "Core.String.charCodeAt", "kind": "value", - "name": "findIndexWithIndex", - "docstrings": [], - "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" + "name": "charCodeAt", + "docstrings": [ + "`charCodeAt(str, index)` returns the character code at position `index` in\nstring `str` the result is in the range 0-65535, unlike `codePointAt`, so it\nwill not work correctly for characters with code points greater than or equal\nto 0x10000. The return type is `float` because this function returns NaN if\n`index` is less than zero or greater than the length of the string.\nSee [`String.charCodeAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt) on MDN.\n\n## Examples\n\n```rescript\nString.charCodeAt(`😺`, 0) == 0xd83d->Int.toFloat\nString.codePointAt(`😺`, 0) == Some(0x1f63a)\n```" + ], + "signature": "let charCodeAt: (string, int) => float" }, { - "id": "Core.TypedArray.forEach", + "id": "Core.String.codePointAt", "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "name": "codePointAt", + "docstrings": [ + "`codePointAt(str, index)` returns the code point at position `index` within\nstring `str` as a `Some(value)`. The return value handles code points greater\nthan or equal to 0x10000. If there is no code point at the given position, the\nfunction returns `None`.\nSee [`String.codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) on MDN.\n\n## Examples\n\n```rescript\nString.codePointAt(`¿😺?`, 1) == Some(0x1f63a)\nString.codePointAt(\"abc\", 5) == None\n```" + ], + "signature": "let codePointAt: (string, int) => option" }, { - "id": "Core.TypedArray.forEachWithIndex", + "id": "Core.String.concat", "kind": "value", - "name": "forEachWithIndex", - "docstrings": [], - "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + "name": "concat", + "docstrings": [ + "`concat(original, append)` returns a new `string` with `append` added after\n`original`.\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) on MDN.\n\n## Examples\n\n```rescript\nString.concat(\"cow\", \"bell\") == \"cowbell\"\nString.concat(\"Re\", \"Script\") == \"ReScript\"\n```" + ], + "signature": "let concat: (string, string) => string" }, { - "id": "Core.TypedArray.map", + "id": "Core.String.concatMany", "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "name": "concatMany", + "docstrings": [ + "`concatMany(original, arr)` returns a new `string` consisting of each item of an\narray of strings added to the `original` string.\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) on MDN.\n\n## Examples\n\n```rescript\nString.concatMany(\"1st\", [\"2nd\", \"3rd\", \"4th\"]) == \"1st2nd3rd4th\"\n```" + ], + "signature": "let concatMany: (string, array) => string" }, { - "id": "Core.TypedArray.mapWithIndex", + "id": "Core.String.endsWith", "kind": "value", - "name": "mapWithIndex", - "docstrings": [], - "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" + "name": "endsWith", + "docstrings": [ + "`endsWith(str, substr)` returns `true` if the `str` ends with `substr`, `false`\notherwise.\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) on MDN.\n\n## Examples\n\n```rescript\nString.endsWith(\"BuckleScript\", \"Script\") == true\nString.endsWith(\"BuckleShoes\", \"Script\") == false\n```" + ], + "signature": "let endsWith: (string, string) => bool" }, { - "id": "Core.TypedArray.reduce", + "id": "Core.String.endsWithFrom", "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + "name": "endsWithFrom", + "docstrings": [ + "`endsWithFrom(str, ending, len)` returns `true` if the first len characters of\n`str` end with `ending`, `false` otherwise. If `len` is greater than or equal\nto the length of `str`, then it works like `endsWith`.\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) on MDN.\n\n## Examples\n\n```rescript\nString.endsWithFrom(\"abcd\", \"cd\", 4) == true\nString.endsWithFrom(\"abcde\", \"cd\", 3) == false\nString.endsWithFrom(\"abcde\", \"cde\", 99) == true\nString.endsWithFrom(\"example.dat\", \"ple\", 7) == true\n```" + ], + "signature": "let endsWithFrom: (string, string, int) => bool" }, { - "id": "Core.TypedArray.reduceWithIndex", + "id": "Core.String.includes", "kind": "value", - "name": "reduceWithIndex", - "docstrings": [], - "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + "name": "includes", + "docstrings": [ + "`includes(str, searchValue)` returns `true` if `searchValue` is found anywhere\nwithin `str`, `false` otherwise.\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) on MDN.\n\n## Examples\n\n```rescript\nString.includes(\"programmer\", \"gram\") == true\nString.includes(\"programmer\", \"er\") == true\nString.includes(\"programmer\", \"pro\") == true\nString.includes(\"programmer.dat\", \"xyz\") == false\n```" + ], + "signature": "let includes: (string, string) => bool" }, { - "id": "Core.TypedArray.reduceRight", + "id": "Core.String.includesFrom", "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + "name": "includesFrom", + "docstrings": [ + "`includesFrom(str, searchValue, start)` returns `true` if `searchValue` is found\nanywhere within `str` starting at character number `start` (where 0 is the\nfirst character), `false` otherwise.\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) on MDN.\n\n## Examples\n\n```rescript\nString.includesFrom(\"programmer\", \"gram\", 1) == true\nString.includesFrom(\"programmer\", \"gram\", 4) == false\nString.includesFrom(`대한민국`, `한`, 1) == true\n```" + ], + "signature": "let includesFrom: (string, string, int) => bool" }, { - "id": "Core.TypedArray.reduceRightWithIndex", + "id": "Core.String.indexOf", "kind": "value", - "name": "reduceRightWithIndex", - "docstrings": [], - "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + "name": "indexOf", + "docstrings": [ + "`indexOf(str, searchValue)` returns the position at which `searchValue` was\nfirst found within `str`, or `-1` if `searchValue` is not in `str`.\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) on MDN.\n\n## Examples\n\n```rescript\nString.indexOf(\"bookseller\", \"ok\") == 2\nString.indexOf(\"bookseller\", \"sell\") == 4\nString.indexOf(\"beekeeper\", \"ee\") == 1\nString.indexOf(\"bookseller\", \"xyz\") == -1\n```" + ], + "signature": "let indexOf: (string, string) => int" }, { - "id": "Core.TypedArray.some", + "id": "Core.String.indexOfOpt", "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (t<'a>, 'a => bool) => bool" + "name": "indexOfOpt", + "docstrings": [ + "`indexOfOpt(str, searchValue)`. Like `indexOf`, but return an `option`.\n\n## Examples\n\n```rescript\nString.indexOfOpt(\"bookseller\", \"ok\") == Some(2)\nString.indexOfOpt(\"bookseller\", \"xyz\") == None\n```" + ], + "signature": "let indexOfOpt: (string, string) => option" }, { - "id": "Core.TypedArray.someWithIndex", + "id": "Core.String.indexOfFrom", "kind": "value", - "name": "someWithIndex", - "docstrings": [], - "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" - } - ] - }, - "core/arraybuffer": { - "id": "Core.ArrayBuffer", - "name": "ArrayBuffer", - "docstrings": [], - "items": [ + "name": "indexOfFrom", + "docstrings": [ + "`indexOfFrom(str, searchValue, start)` returns the position at which\n`searchValue` was found within `str` starting at character position `start`, or\n`-1` if `searchValue` is not found in that portion of `str`. The return value is\nrelative to the beginning of the string, no matter where the search started\nfrom.\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) on MDN.\n\n## Examples\n\n```rescript\nString.indexOfFrom(\"bookseller\", \"ok\", 1) == 2\nString.indexOfFrom(\"bookseller\", \"sell\", 2) == 4\nString.indexOfFrom(\"bookseller\", \"sell\", 5) == -1\n```" + ], + "signature": "let indexOfFrom: (string, string, int) => int" + }, { - "id": "Core.ArrayBuffer.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = Js.TypedArray2.ArrayBuffer.t" + "id": "Core.String.lastIndexOf", + "kind": "value", + "name": "lastIndexOf", + "docstrings": [ + "`lastIndexOf(str, searchValue)` returns the position of the last occurrence of\n`searchValue` within `str`, searching backwards from the end of the string.\nReturns `-1` if `searchValue` is not in `str`. The return value is always\nrelative to the beginning of the string.\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) on MDN.\n\n## Examples\n\n```rescript\nString.lastIndexOf(\"bookseller\", \"ok\") == 2\nString.lastIndexOf(\"beekeeper\", \"ee\") == 4\nString.lastIndexOf(\"abcdefg\", \"xyz\") == -1\n```" + ], + "signature": "let lastIndexOf: (string, string) => int" }, { - "id": "Core.ArrayBuffer.make", + "id": "Core.String.lastIndexOfOpt", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: int => t" + "name": "lastIndexOfOpt", + "docstrings": [ + "`lastIndexOfOpt(str, searchValue)`. Like `lastIndexOfOpt`, but return an\n`option`.\n\n## Examples\n\n```rescript\nString.lastIndexOfOpt(\"bookseller\", \"ok\") == Some(2)\nString.lastIndexOfOpt(\"beekeeper\", \"ee\") == Some(4)\nString.lastIndexOfOpt(\"abcdefg\", \"xyz\") == None\n```" + ], + "signature": "let lastIndexOfOpt: (string, string) => option" }, { - "id": "Core.ArrayBuffer.byteLength", + "id": "Core.String.lastIndexOfFrom", "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" + "name": "lastIndexOfFrom", + "docstrings": [ + "`lastIndexOfFrom(str, searchValue, start)` returns the position of the last\noccurrence of `searchValue` within `str`, searching backwards from the given\nstart position. Returns `-1` if `searchValue` is not in `str`. The return value\nis always relative to the beginning of the string.\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) on MDN.\n\n## Examples\n\n```rescript\nString.lastIndexOfFrom(\"bookseller\", \"ok\", 6) == 2\nString.lastIndexOfFrom(\"beekeeper\", \"ee\", 8) == 4\nString.lastIndexOfFrom(\"beekeeper\", \"ee\", 3) == 1\nString.lastIndexOfFrom(\"abcdefg\", \"xyz\", 4) == -1\n```" + ], + "signature": "let lastIndexOfFrom: (string, string, int) => int" }, { - "id": "Core.ArrayBuffer.slice", + "id": "Core.String.match", "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (t, ~start: int, ~end: int) => t" + "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([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, RegExp.t) => option" }, { - "id": "Core.ArrayBuffer.sliceToEnd", + "id": "Core.String.normalize", "kind": "value", - "name": "sliceToEnd", - "docstrings": [], - "signature": "let sliceToEnd: (t, ~start: int) => t" - } - ] - }, - "core/weakset": { - "id": "Core.WeakSet", - "name": "WeakSet", - "docstrings": [], - "items": [ + "name": "normalize", + "docstrings": [ + "`normalize(str)` returns the normalized Unicode string using Normalization Form\nCanonical (NFC) Composition. Consider the character ã, which can be represented\nas the single codepoint \\u00e3 or the combination of a lower case letter A\n\\u0061 and a combining tilde \\u0303. Normalization ensures that both can be\nstored in an equivalent binary representation.\nSee [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN.\nSee also [Unicode technical report #15](https://unicode.org/reports/tr15/) for details.\n\n## Examples\n\n```rescript\nlet string1 = \"\\u00F1\"\nlet string2 = \"\\u006E\\u0303\"\n\nassert(string1 != string2) // true\nassertEqual(String.normalize(string1), String.normalize(string2))\n```" + ], + "signature": "let normalize: string => string" + }, { - "id": "Core.WeakSet.t", + "id": "Core.String.normalizeForm", "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a> = Js.WeakSet.t<'a>" + "name": "normalizeForm", + "docstrings": [ + "`normalizeByForm(str, form)` returns the normalized Unicode string using the\nspecified form of normalization, which may be one of:\n- \"NFC\" — Normalization Form Canonical Composition.\n- \"NFD\" — Normalization Form Canonical Decomposition.\n- \"NFKC\" — Normalization Form Compatibility Composition.\n- \"NFKD\" — Normalization Form Compatibility Decomposition.\nSee [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN.\nSee also [Unicode technical report #15](https://unicode.org/reports/tr15/) for\ndetails.\n\n## Examples\n\n```rescript\nlet string1 = \"\\uFB00\"\nlet string2 = \"\\u0066\\u0066\"\nConsole.log(string1 == string2) // false\n\nlet normalizeString1 = String.normalizeByForm(string1, #NFKD)\nlet normalizeString2 = String.normalizeByForm(string2, #NFKD)\nConsole.log(normalizeString1 == normalizeString2) // true\n```" + ], + "signature": "type normalizeForm = [#NFC | #NFD | #NFKC | #NFKD]" }, { - "id": "Core.WeakSet.make", + "id": "Core.String.normalizeByForm", "kind": "value", - "name": "make", + "name": "normalizeByForm", "docstrings": [], - "signature": "let make: unit => t<'a>" + "signature": "let normalizeByForm: (string, normalizeForm) => string" }, { - "id": "Core.WeakSet.add", + "id": "Core.String.repeat", "kind": "value", - "name": "add", - "docstrings": [], - "signature": "let add: (t<'a>, 'a) => t<'a>" + "name": "repeat", + "docstrings": [ + "`repeat(str, n)` returns a `string` that consists of `n` repetitions of `str`.\nSee [`String.repeat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) on MDN.\n\n## Examples\n\n```rescript\nString.repeat(\"ha\", 3) == \"hahaha\"\nString.repeat(\"empty\", 0) == \"\"\n```\n\n## Exceptions\n\n- `RangeError`: if `n` is negative." + ], + "signature": "let repeat: (string, int) => string" }, { - "id": "Core.WeakSet.delete", + "id": "Core.String.replace", "kind": "value", - "name": "delete", - "docstrings": [], - "signature": "let delete: (t<'a>, 'a) => bool" + "name": "replace", + "docstrings": [ + "`replace(str, substr, newSubstr)` returns a new `string` which is\nidentical to `str` except with the first matching instance of `substr` replaced\nby `newSubstr`. `substr` is treated as a verbatim string to match, not a\nregular expression.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nString.replace(\"old string\", \"old\", \"new\") == \"new string\"\nString.replace(\"the cat and the dog\", \"the\", \"this\") == \"this cat and the dog\"\n```" + ], + "signature": "let replace: (string, string, string) => string" }, { - "id": "Core.WeakSet.has", + "id": "Core.String.replaceRegExp", "kind": "value", - "name": "has", - "docstrings": [], - "signature": "let has: (t<'a>, 'a) => bool" - } - ] - }, - "core/set": { - "id": "Core.Set", - "name": "Set", - "docstrings": [ - "Bindings to the mutable JavaScript `Set`.\n\nSee [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) on MDN." - ], - "items": [ - { - "id": "Core.Set.t", - "kind": "type", - "name": "t", + "name": "replaceRegExp", "docstrings": [ - "Type representing an instance of `Set`." + "`replaceRegExp(str, regex, replacement)` returns a new `string` where\noccurrences matching regex have been replaced by `replacement`.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nString.replaceRegExp(\"vowels be gone\", %re(\"/[aeiou]/g\"), \"x\") == \"vxwxls bx gxnx\"\nString.replaceRegExp(\"Juan Fulano\", %re(\"/(\\w+) (\\w+)/\"), \"$2, $1\") == \"Fulano, Juan\"\n```" ], - "signature": "type t<'a> = Js.Set.t<'a>" + "signature": "let replaceRegExp: (string, RegExp.t, string) => string" }, { - "id": "Core.Set.make", + "id": "Core.String.replaceAll", "kind": "value", - "name": "make", + "name": "replaceAll", "docstrings": [ - "Creates a new, mutable JavaScript `Set`. A `Set` is a collection of unique values.\n\nSee [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) on MDN.\n\n\n\n## Examples\n```rescript\n// You can annotate the type of your set if you want to\nlet mySet: Set.t = Set.make()\n\n// Or you can let ReScript infer what's in your Set\nlet set = Set.make()\nset->Set.add(\"Fine name\") // Inferred as Set.t\n```\n\n## Alternatives\nA JavaScript `Set` is mutable. If you're looking for an immutable alternative, check out `Belt.Set`." + "`replaceAll(str, substr, newSubstr)` returns a new `string` which is\nidentical to `str` except with all matching instances of `substr` replaced\nby `newSubstr`. `substr` is treated as a verbatim string to match, not a\nregular expression.\nSee [`String.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) on MDN.\n\n## Examples\n\n```rescript\nString.replaceAll(\"old old string\", \"old\", \"new\") == \"new new string\"\nString.replaceAll(\"the cat and the dog\", \"the\", \"this\") == \"this cat and this dog\"\n```" ], - "signature": "let make: unit => t<'a>" + "signature": "let replaceAll: (string, string, string) => string" }, { - "id": "Core.Set.fromArray", + "id": "Core.String.replaceAllRegExp", "kind": "value", - "name": "fromArray", + "name": "replaceAllRegExp", "docstrings": [ - "Turns an array of values into a Set. Meaning only unique values are preserved.\n\n## Examples\n```rescript\ntype languages = ReScript | JavaScript | TypeScript\nlet languageRank = [ReScript, JavaScript, TypeScript]\n\nlet set = Set.fromArray(languageRank) // Set.t\n\nswitch set->Set.has(ReScript) {\n| true => Console.log(\"Yay, ReScript is in there!\")\n| false => Console.log(\"Uh-oh, something is _terribly_ wrong with this program... abort.\")\n}\n```" + "`replaceAllRegExp(str, regex, replacement)` returns a new `string` where\nall occurrences matching regex have been replaced by `replacement`.\nThe pattern must include the global (`g`) flag or a runtime TypeError will be thrown.\nSee [`String.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) on MDN.\n\n## Examples\n\n```rescript\nString.replaceAllRegExp(\"vowels be gone\", %re(\"/[aeiou]/g\"), \"x\") == \"vxwxls bx gxnx\"\nString.replaceAllRegExp(\"aabbcc\", %re(\"/b/g\"), \".\") == \"aa..cc\"\n```" ], - "signature": "let fromArray: array<'a> => t<'a>" + "signature": "let replaceAllRegExp: (string, RegExp.t, string) => string" }, { - "id": "Core.Set.fromIterator", + "id": "Core.String.unsafeReplaceRegExpBy0", "kind": "value", - "name": "fromIterator", + "name": "unsafeReplaceRegExpBy0", "docstrings": [ - "Turns an iterator into a `Set`.\n\n## Examples\n```rescript\n// Let's pretend we have an interator\n@val external someIterator: Iterator.t = \"someIterator\"\n\nlet set = Set.fromIterator(someIterator) // Set.t\n```" + "`unsafeReplaceRegExpBy0(str, regex, f)` returns a new `string` with some or all\nmatches of a pattern with no capturing parentheses replaced by the value\nreturned from the given function. The function receives as its parameters the\nmatched string, the offset at which the match begins, and the whole string being\nmatched.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = %re(\"/[aeiou]/g\")\nlet matchFn = (~match, ~offset as _, ~input as _) => String.toUpperCase(match)\nString.unsafeReplaceRegExpBy0(str, re, matchFn) == \"bEAUtIfUl vOwEls\"\n```" ], - "signature": "let fromIterator: Core__Iterator.t<'a> => t<'a>" + "signature": "let unsafeReplaceRegExpBy0: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string", + "deprecated": "Use `replaceRegExpBy0Unsafe` instead" }, { - "id": "Core.Set.size", + "id": "Core.String.unsafeReplaceRegExpBy1", "kind": "value", - "name": "size", + "name": "unsafeReplaceRegExpBy1", "docstrings": [ - "Returns the size, the number of unique values, of the set.\n\n## Examples\n```rescript\nlet set = Set.make()\n\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue2\")\n\nlet size = set->Set.size // 2\n```" + "`unsafeReplaceRegExpBy1(str, regexp, f)`. Like `unsafeReplaceRegExpBy0`, but `f`\nhas `group1` parameter.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = %re(\"/(Jony is )\\d+/g\")\nlet matchFn = (~match as _, ~group1, ~offset as _, ~input as _) => {\n group1 ++ \"41\"\n}\nString.unsafeReplaceRegExpBy1(str, re, matchFn) == \"Jony is 41\"\n```" ], - "signature": "let size: t<'a> => int" + "signature": "let unsafeReplaceRegExpBy1: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string", + "deprecated": "Use `replaceRegExpBy1Unsafe` instead" }, { - "id": "Core.Set.clear", + "id": "Core.String.unsafeReplaceRegExpBy2", "kind": "value", - "name": "clear", + "name": "unsafeReplaceRegExpBy2", "docstrings": [ - "Clears all entries in the set.\n\n## Examples\n```rescript\nlet set = Set.make()\n\nset->Set.add(\"someKey\")\nset->Set.size // 1\n\nset->Set.clear\nset->Set.size // 0\n```" + "`unsafeReplaceRegExpBy2(str, regexp, f)`. Like `unsafeReplaceRegExpBy1`, but `f`\nhas two group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = %re(\"/(\\d+) times (\\d+)/\")\nlet matchFn = (~match as _, ~group1, ~group2, ~offset as _, ~input as _) => {\n switch (Int.fromString(group1), Int.fromString(group2)) {\n | (Some(x), Some(y)) => Int.toString(x * y)\n | _ => \"???\"\n }\n}\nString.unsafeReplaceRegExpBy2(str, re, matchFn) == \"42\"\n```" ], - "signature": "let clear: t<'a> => unit" + "signature": "let unsafeReplaceRegExpBy2: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string", + "deprecated": "Use `replaceRegExpBy2Unsafe` instead" }, { - "id": "Core.Set.add", + "id": "Core.String.unsafeReplaceRegExpBy3", "kind": "value", - "name": "add", + "name": "unsafeReplaceRegExpBy3", "docstrings": [ - "Adds a new value to the set.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\n```" + "`unsafeReplaceRegExpBy3(str, regexp, f)`. Like `unsafeReplaceRegExpBy2`, but `f`\nhas three group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN." ], - "signature": "let add: (t<'a>, 'a) => unit" + "signature": "let unsafeReplaceRegExpBy3: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~group3: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string", + "deprecated": "Use `replaceRegExpBy3Unsafe` instead" }, { - "id": "Core.Set.delete", + "id": "Core.String.replaceRegExpBy0Unsafe", "kind": "value", - "name": "delete", + "name": "replaceRegExpBy0Unsafe", "docstrings": [ - "Deletes the provided `value` from the set. Returns a `bool` for whether the value existed, and was deleted.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nlet didDeleteValue = set->Set.delete(\"someValue\")\nConsole.log(didDeleteValue) // Logs `true` to the console, becuase the set had the value, so it was successfully deleted\n\nlet didDeleteValue = set->Set.delete(\"someNonExistantKey\")\nConsole.log(didDeleteValue) // Logs `false` to the console, becuase the value did not exist in the set\n```" + "`replaceRegExpBy0Unsafe(str, regex, f)` returns a new `string` with some or all\nmatches of a pattern with no capturing parentheses replaced by the value\nreturned from the given function. The function receives as its parameters the\nmatched string, the offset at which the match begins, and the whole string being\nmatched.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = %re(\"/[aeiou]/g\")\nlet matchFn = (~match, ~offset as _, ~input as _) => String.toUpperCase(match)\nString.replaceRegExpBy0Unsafe(str, re, matchFn) == \"bEAUtIfUl vOwEls\"\n```" ], - "signature": "let delete: (t<'a>, 'a) => bool" + "signature": "let replaceRegExpBy0Unsafe: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" }, { - "id": "Core.Set.has", + "id": "Core.String.replaceRegExpBy1Unsafe", "kind": "value", - "name": "has", + "name": "replaceRegExpBy1Unsafe", "docstrings": [ - "Checks whether the set has a specific value.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\n\nswitch set->Set.has(\"someValue\") {\n| false => Console.log(\"Nope, didn't have it.\")\n| true => Console.log(\"Yay, we have the value!\")\n}\n```" + "`replaceRegExpBy1Unsafe(str, regexp, f)`. Like `replaceRegExpBy0Unsafe`, but `f`\nhas `group1` parameter.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = %re(\"/(Jony is )\\d+/g\")\nlet matchFn = (~match as _, ~group1, ~offset as _, ~input as _) => {\n group1 ++ \"41\"\n}\nString.replaceRegExpBy1Unsafe(str, re, matchFn) == \"Jony is 41\"\n```" ], - "signature": "let has: (t<'a>, 'a) => bool" + "signature": "let replaceRegExpBy1Unsafe: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" }, { - "id": "Core.Set.forEach", + "id": "Core.String.replaceRegExpBy2Unsafe", "kind": "value", - "name": "forEach", + "name": "replaceRegExpBy2Unsafe", "docstrings": [ - "Iterates through all values of the set.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nset->Set.add(\"someValue2\")\n\nset->Set.forEach(value => {\n Console.log(value)\n})\n```" + "`replaceRegExpBy2Unsafe(str, regexp, f)`. Like `replaceRegExpBy1Unsafe`, but `f`\nhas two group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = %re(\"/(\\d+) times (\\d+)/\")\nlet matchFn = (~match as _, ~group1, ~group2, ~offset as _, ~input as _) => {\n switch (Int.fromString(group1), Int.fromString(group2)) {\n | (Some(x), Some(y)) => Int.toString(x * y)\n | _ => \"???\"\n }\n}\nString.replaceRegExpBy2Unsafe(str, re, matchFn) == \"42\"\n```" ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let replaceRegExpBy2Unsafe: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" }, { - "id": "Core.Set.values", + "id": "Core.String.replaceRegExpBy3Unsafe", "kind": "value", - "name": "values", + "name": "replaceRegExpBy3Unsafe", "docstrings": [ - "Returns an iterator that holds all values of the set.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\nset->Set.add(\"anotherValue\")\n\nlet values = set->Set.values\n\n// Logs the first value\nConsole.log(Iterator.next(values).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh values iterator to get an array of all values, since we consumed a value via `next` above already.\nConsole.log(set->Set.values->Iterator.toArray)\n```" + "`replaceRegExpBy3Unsafe(str, regexp, f)`. Like `replaceRegExpBy2Unsafe`, but `f`\nhas three group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN." ], - "signature": "let values: t<'a> => Core__Iterator.t<'a>" - } - ] - }, - "core/weakmap": { - "id": "Core.WeakMap", - "name": "WeakMap", - "docstrings": [], - "items": [ - { - "id": "Core.WeakMap.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'k, 'v> = Js.WeakMap.t<'k, 'v>" + "signature": "let replaceRegExpBy3Unsafe: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~group3: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" }, { - "id": "Core.WeakMap.make", + "id": "Core.String.search", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: unit => t<'k, 'v>" + "name": "search", + "docstrings": [ + "`search(str, regexp)` returns the starting position of the first match of\n`regexp` in the given `str`, or -1 if there is no match.\nSee [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search) on MDN.\n\n## Examples\n\n```rescript\nString.search(\"testing 1 2 3\", %re(\"/\\d+/\")) == 8\nString.search(\"no numbers\", %re(\"/\\d+/\")) == -1\n```" + ], + "signature": "let search: (string, RegExp.t) => int" }, { - "id": "Core.WeakMap.get", + "id": "Core.String.searchOpt", "kind": "value", - "name": "get", - "docstrings": [], - "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + "name": "searchOpt", + "docstrings": [ + "`searchOpt(str, regexp)`. Like `search`, but return an `option`.\n\n## Examples\n\n```rescript\nString.searchOpt(\"testing 1 2 3\", %re(\"/\\d+/\")) == Some(8)\nString.searchOpt(\"no numbers\", %re(\"/\\d+/\")) == None\n```" + ], + "signature": "let searchOpt: (string, RegExp.t) => option" }, { - "id": "Core.WeakMap.has", + "id": "Core.String.slice", "kind": "value", - "name": "has", - "docstrings": [], - "signature": "let has: (t<'k, 'v>, 'k) => bool" + "name": "slice", + "docstrings": [ + "`slice(str, ~start, ~end)` returns the substring of `str` starting at\ncharacter `start` up to but not including `end`.\n- If either `start` or `end` is negative, then it is evaluated as\n`length(str - start)` or `length(str - end)`.\n- If `end` is greater than the length of `str`, then it is treated as\n`length(str)`.\n- If `start` is greater than `end`, slice returns the empty string.\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n## Examples\n\n```rescript\nString.slice(\"abcdefg\", ~start=2, ~end=5) == \"cde\"\nString.slice(\"abcdefg\", ~start=2, ~end=9) == \"cdefg\"\nString.slice(\"abcdefg\", ~start=-4, ~end=-2) == \"de\"\nString.slice(\"abcdefg\", ~start=5, ~end=1) == \"\"\n```" + ], + "signature": "let slice: (string, ~start: int, ~end: int) => string" }, { - "id": "Core.WeakMap.set", + "id": "Core.String.sliceToEnd", "kind": "value", - "name": "set", - "docstrings": [], - "signature": "let set: (t<'k, 'v>, 'k, 'v) => t<'k, 'v>" + "name": "sliceToEnd", + "docstrings": [ + "`sliceToEnd(str, ~start)` returns the substring of `str` starting at character\n`start` to the end of the string.\n- If `start` is negative, then it is evaluated as `length(str - start)`.\n- If `start` is greater than the length of `str`, then sliceToEnd returns the empty string.\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n## Examples\n\n```rescript\nString.sliceToEnd(\"abcdefg\", ~start=4) == \"efg\"\nString.sliceToEnd(\"abcdefg\", ~start=-2) == \"fg\"\nString.sliceToEnd(\"abcdefg\", ~start=7) == \"\"\n```" + ], + "signature": "let sliceToEnd: (string, ~start: int) => string" }, { - "id": "Core.WeakMap.delete", + "id": "Core.String.split", "kind": "value", - "name": "delete", - "docstrings": [], - "signature": "let delete: (t<'k, 'v>, 'k) => bool" - } - ] - }, - "core/map": { - "id": "Core.Map", - "name": "Map", - "docstrings": [ - "Bindings to the mutable JavaScript `Map`.\n\nSee [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) on MDN." - ], - "items": [ + "name": "split", + "docstrings": [ + "`split(str, delimiter)` splits the given `str` at every occurrence of\n`delimiter` and returns an array of the resulting substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.split(\"2018-01-02\", \"-\") == [\"2018\", \"01\", \"02\"]\nString.split(\"a,b,,c\", \",\") == [\"a\", \"b\", \"\", \"c\"]\nString.split(\"good::bad as great::awful\", \"::\") == [\"good\", \"bad as great\", \"awful\"]\nString.split(\"has-no-delimiter\", \";\") == [\"has-no-delimiter\"]\n```" + ], + "signature": "let split: (string, string) => array" + }, { - "id": "Core.Map.t", - "kind": "type", - "name": "t", + "id": "Core.String.splitAtMost", + "kind": "value", + "name": "splitAtMost", "docstrings": [ - "Type representing an instance of `Map`." + "`splitAtMost(str, delimiter, ~limit)` splits the given `str` at every\noccurrence of `delimiter` and returns an array of the first `limit` resulting\nsubstrings. If `limit` is negative or greater than the number of substrings,\nthe array will contain all the substrings.\n\n## Examples\n\n```rescript\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=3) == [\"ant\", \"bee\", \"cat\"]\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=0) == []\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=9) == [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n```" ], - "signature": "type t<'k, 'v> = Js.Map.t<'k, 'v>" + "signature": "let splitAtMost: (string, string, ~limit: int) => array" }, { - "id": "Core.Map.make", + "id": "Core.String.splitByRegExp", "kind": "value", - "name": "make", + "name": "splitByRegExp", "docstrings": [ - "Creates a new, mutable JavaScript `Map`. A `Map` can have any values as both keys and values.\n\nSee [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) on MDN.\n\n\n\n## Examples\n```rescript\n`make()`\n// You can annotate the type of your map if you want to\nlet myMap: Map.t = Map.make()\n\n// Or you can let ReScript infer what's in your map\nlet map = Map.make()\nmap->Map.set(\"lang\", \"ReScript\") // Inferred as Map.t\n```\n\n## Alternatives\nA JavaScript `Map` is mutable. If you're looking for an immutable alternative, check out`Belt.Map`." + "`splitByRegExp(str, regexp)` splits the given `str` at every occurrence of\n`regexp` and returns an array of the resulting substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.splitByRegExp(\"Jan,Feb,Mar\", %re(\"/,/\")) == [Some(\"Jan\"), Some(\"Feb\"), Some(\"Mar\")]\n```" ], - "signature": "let make: unit => t<'k, 'v>" + "signature": "let splitByRegExp: (string, RegExp.t) => array>" }, { - "id": "Core.Map.fromArray", + "id": "Core.String.splitByRegExpAtMost", "kind": "value", - "name": "fromArray", + "name": "splitByRegExpAtMost", "docstrings": [ - "Turns an array of key/value pairs into a Map.\n\n## Examples\n```rescript\ntype languages = ReScript | JavaScript | TypeScript\nlet languageRank = [(ReScript, 1), (JavaScript, 2), (TypeScript, 3)]\n\nlet map = Map.fromArray(languageRank) // Map.t\n\nswitch map->Map.get(ReScript) {\n| Some(1) => Console.log(\"Yay, ReScript is #1!\")\n| _ => Console.log(\"Uh-oh, something is _terribly_ wrong with this program... abort.\")\n}\n```" + "`splitByRegExpAtMost(str, regexp, ~limit)` splits the given `str` at every\noccurrence of `regexp` and returns an array of the first `limit` resulting\nsubstrings. If `limit` is negative or greater than the number of substrings, the\narray will contain all the substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.splitByRegExpAtMost(\"Hello World. How are you doing?\", %re(\"/ /\"), ~limit=3) == [\n Some(\"Hello\"),\n Some(\"World.\"),\n Some(\"How\"),\n]\n```" ], - "signature": "let fromArray: array<('k, 'v)> => t<'k, 'v>" + "signature": "let splitByRegExpAtMost: (\n string,\n RegExp.t,\n ~limit: int,\n) => array>" }, { - "id": "Core.Map.fromIterator", + "id": "Core.String.startsWith", "kind": "value", - "name": "fromIterator", + "name": "startsWith", "docstrings": [ - "Turns an iterator in the shape of `('key, 'value)` into a `Map`.\n\n## Examples\n```rescript\n// Let's pretend we have an interator in the correct shape\n@val external someIterator: Iterator.t<(string, int)> = \"someIterator\"\n\nlet map = Map.fromIterator(someIterator) // Map.t\n```" + "`startsWith(str, substr)` returns `true` if the `str` starts with `substr`,\n`false` otherwise.\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN.\n\n## Examples\n\n```rescript\nString.startsWith(\"BuckleScript\", \"Buckle\") == true\nString.startsWith(\"BuckleScript\", \"\") == true\nString.startsWith(\"JavaScript\", \"Buckle\") == false\n```" ], - "signature": "let fromIterator: Core__Iterator.t<('k, 'v)> => t<'k, 'v>" + "signature": "let startsWith: (string, string) => bool" }, { - "id": "Core.Map.size", + "id": "Core.String.startsWithFrom", "kind": "value", - "name": "size", + "name": "startsWithFrom", "docstrings": [ - "Returns the size, the number of key/value pairs, of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\n\nmap->Map.set(\"someKey\", \"someValue\")\n\nlet size = map->Map.size // 1\n```" + "`startsWithFrom(str, substr, n)` returns `true` if the `str` starts\nwith `substr` starting at position `n`, `false` otherwise. If `n` is negative,\nthe search starts at the beginning of `str`.\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN.\n\n## Examples\n\n```rescript\nString.startsWithFrom(\"BuckleScript\", \"kle\", 3) == true\nString.startsWithFrom(\"BuckleScript\", \"\", 3) == true\nString.startsWithFrom(\"JavaScript\", \"Buckle\", 2) == false\n```" ], - "signature": "let size: t<'k, 'v> => int" + "signature": "let startsWithFrom: (string, string, int) => bool" }, { - "id": "Core.Map.clear", + "id": "Core.String.substring", "kind": "value", - "name": "clear", + "name": "substring", "docstrings": [ - "Clears all entries in the map.\n\n## Examples\n```rescript\nlet map = Map.make()\n\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.size // 1\n\nmap->Map.clear\nmap->Map.size // 0\n```" + "`substring(str, ~start, ~end)` returns characters `start` up to but not\nincluding end from `str`.\n- If `start` is less than zero, it is treated as zero.\n- If `end` is zero or negative, the empty string is returned.\n- If `start` is greater than `end`, the `start` and `end` points are swapped.\nSee [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN.\n\n## Examples\n\n```rescript\nString.substring(\"playground\", ~start=3, ~end=6) == \"ygr\"\nString.substring(\"playground\", ~start=6, ~end=3) == \"ygr\"\nString.substring(\"playground\", ~start=4, ~end=12) == \"ground\"\n```" ], - "signature": "let clear: t<'k, 'v> => unit" + "signature": "let substring: (string, ~start: int, ~end: int) => string" }, { - "id": "Core.Map.forEach", + "id": "Core.String.substringToEnd", "kind": "value", - "name": "forEach", + "name": "substringToEnd", "docstrings": [ - "Iterates through all values of the map.\n\n> Please note that this is *without the keys*, just the values. If you need the key as well, use `Map.forEachWithKey`.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\nmap->Map.forEach(value => {\n Console.log(value)\n})\n```" + "`substringToEnd(str, ~start)` returns the substring of `str` from position\n`start` to the end.\n- If `start` is less than or equal to zero, the entire string is returned.\n- If `start` is greater than or equal to the length of `str`, the empty string\nis returned.\nSee [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN.\n\n## Examples\n\n```rescript\nString.substringToEnd(\"playground\", ~start=4) == \"ground\"\nString.substringToEnd(\"playground\", ~start=-3) == \"playground\"\nString.substringToEnd(\"playground\", ~start=12) == \"\"\n```" ], - "signature": "let forEach: (t<'k, 'v>, 'v => unit) => unit" + "signature": "let substringToEnd: (string, ~start: int) => string" }, { - "id": "Core.Map.forEachWithKey", + "id": "Core.String.toLowerCase", "kind": "value", - "name": "forEachWithKey", + "name": "toLowerCase", "docstrings": [ - "Iterates through all values of the map, including the key for each value.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\nmap->Map.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" + "`toLowerCase(str)` converts `str` to lower case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\ngive different results depending upon context, for example with the Greek\nletter sigma, which has two different lower case forms, one when it is the last\ncharacter in a string and another when it is not.\nSee [`String.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) on MDN.\n\n## Examples\n\n```rescript\nString.toLowerCase(\"ABC\") == \"abc\"\nString.toLowerCase(`ΣΠ`) == `σπ`\nString.toLowerCase(`ΠΣ`) == `πς`\n```" ], - "signature": "let forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" + "signature": "let toLowerCase: string => string" }, { - "id": "Core.Map.get", + "id": "Core.String.toLocaleLowerCase", "kind": "value", - "name": "get", + "name": "toLocaleLowerCase", "docstrings": [ - "Returns the value for a key, if a value exists at that key.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n\nswitch map->Map.get(\"someKey\") {\n| None => Console.log(\"Nope, didn't have it.\")\n| Some(value) => Console.log2(\"Yay, had the value, and it's:\", value)\n}\n```" + "`toLocaleLowerCase(str)` converts `str` to lower case using the current locale.\nSee [`String.toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase) on MDN." ], - "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + "signature": "let toLocaleLowerCase: string => string" }, { - "id": "Core.Map.has", + "id": "Core.String.toUpperCase", "kind": "value", - "name": "has", + "name": "toUpperCase", "docstrings": [ - "Checks whether the map has a specific key.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n\nswitch map->Map.has(\"someKey\") {\n| false => Console.log(\"Nope, didn't have it.\")\n| true => Console.log(\"Yay, we have the value!\")\n}\n```" + "`toUpperCase(str)` converts `str` to upper case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\nexpand the number of letters in the result, for example the German ß\ncapitalizes to two Ses in a row.\nSee [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) on MDN.\n\n## Examples\n\n```rescript\nString.toUpperCase(\"abc\") == \"ABC\"\nString.toUpperCase(`Straße`) == `STRASSE`\nString.toUpperCase(`πς`) == `ΠΣ`\n```" ], - "signature": "let has: (t<'k, 'v>, 'k) => bool" + "signature": "let toUpperCase: string => string" }, { - "id": "Core.Map.set", + "id": "Core.String.toLocaleUpperCase", "kind": "value", - "name": "set", + "name": "toLocaleUpperCase", "docstrings": [ - "Sets the provided `value` to the provided `key`.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n```" + "`toLocaleUpperCase(str)` converts `str` to upper case using the current locale.\nSee [`String.toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase) on MDN." ], - "signature": "let set: (t<'k, 'v>, 'k, 'v) => unit" + "signature": "let toLocaleUpperCase: string => string" }, { - "id": "Core.Map.delete", + "id": "Core.String.trim", "kind": "value", - "name": "delete", + "name": "trim", "docstrings": [ - "Deletes the provided `key` and its value from the map. Returns a `bool` for whether the key existed, and was deleted.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nlet didDeleteKey = map->Map.delete(\"someKey\")\nConsole.log(didDeleteKey) // Logs `true` to the console, becuase the map had the key, so it was successfully deleted\n\nlet didDeleteKey = map->Map.delete(\"someNonExistantKey\")\nConsole.log(didDeleteKey) // Logs `false` to the console, becuase the key did not exist\n```" + "`trim(str)` returns a string that is `str` with whitespace stripped from both\nends. Internal whitespace is not removed.\nSee [`String.trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim) on MDN.\n\n## Examples\n\n```rescript\nString.trim(\" abc def \") == \"abc def\"\nString.trim(\"\\n\\r\\t abc def \\n\\n\\t\\r \") == \"abc def\"\n```" ], - "signature": "let delete: (t<'k, 'v>, 'k) => bool" + "signature": "let trim: string => string" }, { - "id": "Core.Map.keys", + "id": "Core.String.trimStart", "kind": "value", - "name": "keys", + "name": "trimStart", "docstrings": [ - "Returns an iterator that holds all keys of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet keys = map->Map.keys\n\n// Logs the first key\nConsole.log(Iterator.next(keys).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh keys iterator to get an array of all keys, since we consumed a value via `next` above already.\nConsole.log(map->Map.keys->Iterator.toArray)\n```" + "`trimStart(str)` returns a string that is `str` with whitespace stripped from\nthe beginning of a string. Internal whitespace is not removed.\nSee [`String.trimStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart) on MDN.\n\n## Examples\n\n```rescript\nString.trimStart(\" Hello world! \") == \"Hello world! \"\nString.trimStart(\" Hello world! \") == \"Hello world! \"\n```" ], - "signature": "let keys: t<'k, 'v> => Core__Iterator.t<'k>" + "signature": "let trimStart: string => string" }, { - "id": "Core.Map.values", + "id": "Core.String.trimEnd", "kind": "value", - "name": "values", + "name": "trimEnd", "docstrings": [ - "Returns an iterator that holds all values of the map.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet values = map->Map.values\n\n// Logs the first value\nConsole.log(Iterator.next(values).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes values. We'll need a fresh values iterator to get an array of all values, since we consumed a value via `next` above already.\nConsole.log(map->Map.values->Iterator.toArray)\n```" + "`trinEnd(str)` returns a string that is `str` with whitespace stripped from the\nend of a string. Internal whitespace is not removed.\nSee [`String.trimEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd) on MDN.\n\n## Examples\n\n```rescript\nString.trimEnd(\" Hello world! \") == \" Hello world!\"\nString.trimEnd(\" Hello world! \") == \" Hello world!\"\n```" ], - "signature": "let values: t<'k, 'v> => Core__Iterator.t<'v>" + "signature": "let trimEnd: string => string" }, { - "id": "Core.Map.entries", + "id": "Core.String.padStart", "kind": "value", - "name": "entries", + "name": "padStart", "docstrings": [ - "Returns an iterator that holds all entries of the map.\nAn entry is represented as a tuple of `('key, 'value)`,\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"anotherKey\", \"anotherValue\")\n\nlet entries = map->Map.entries\n\n// Logs the first value\nConsole.log(Iterator.next(entries).value)\n\n// You can also turn the iterator into an array.\n// Remember that an iterator consumes entries. We'll need a fresh entries iterator to get an array of all entries, since we consumed a value via `next` above already.\nConsole.log(map->Map.entries->Iterator.toArray)\n```" + "`padStart(str, n, padStr)` returns a string that has been padded with `padStr`\n(multiple times, if needed) until the resulting string reaches the given `n`\nlength. The padding is applied from the start of the current string.\nSee [`String.padStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) on MDN.\n\n## Examples\n\n```rescript\nString.padStart(\"abc\", 5, \" \") == \" abc\"\nString.padStart(\"abc\", 6, \"123465\") == \"123abc\"\n```" ], - "signature": "let entries: t<'k, 'v> => Core__Iterator.t<('k, 'v)>" - } - ] - }, - "core/asynciterator": { - "id": "Core.AsyncIterator", - "name": "AsyncIterator", - "docstrings": [ - "Bindings to async iterators, a way to do async iteration in JavaScript.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN." - ], - "items": [ + "signature": "let padStart: (string, int, string) => string" + }, { - "id": "Core.AsyncIterator.t", - "kind": "type", - "name": "t", + "id": "Core.String.padEnd", + "kind": "value", + "name": "padEnd", "docstrings": [ - "The type representing an async iterator." + "`padEnd(str, n, padStr)` returns a string that has been padded with `padStr`\n(multiple times, if needed) until the resulting string reaches the given `n`\nlength. The padding is applied from the end of the current string.\nSee [`String.padEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) on MDN.\n\n## Examples\n\n```rescript\nString.padEnd(\"Hello\", 10, \".\") == \"Hello.....\"\nString.padEnd(\"abc\", 1, \"\") == \"abc\"\n```" ], - "signature": "type t<'a>" + "signature": "let padEnd: (string, int, string) => string" }, { - "id": "Core.AsyncIterator.value", - "kind": "type", - "name": "value", + "id": "Core.String.getSymbol", + "kind": "value", + "name": "getSymbol", "docstrings": [], - "signature": "type value<'a> = {done: bool, value: option<'a>}" + "signature": "let getSymbol: (string, Symbol.t) => option<'a>" }, { - "id": "Core.AsyncIterator.next", + "id": "Core.String.getSymbolUnsafe", "kind": "value", - "name": "next", - "docstrings": [ - "`next(asyncIterator)`\n\nReturns the next value of the iterator, if any.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN.\n\n## Examples\n- A simple example, getting the next value:\n```rescript\n@val external asyncIterator: AsyncIterator.t = \"someAsyncIterator\"\nlet {AsyncIterator.done, value} = await asyncIterator->AsyncIterator.next\n```\n\n- Complete example, including looping over all values:\n```rescript\n// Let's pretend we get an async iterator returning ints from somewhere.\n@val external asyncIterator: AsyncIterator.t = \"someAsyncIterator\"\n\n\nlet processMyAsyncIterator = async () => {\n // ReScript doesn't have `for ... of` loops, but it's easy to mimic using a while loop.\n let break = ref(false)\n\n while !break.contents {\n // Await the next iterator value\n let {value, done} = await asyncIterator->AsyncIterator.next\n\n // Exit the while loop if the iterator says it's done\n break := done\n\n // This will log the (int) value of the current async iteration, if a value was returned.\n Console.log(value)\n }\n}\n```" - ], - "signature": "let next: t<'a> => promise>" + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: (string, Symbol.t) => 'a" }, { - "id": "Core.AsyncIterator.forEach", + "id": "Core.String.setSymbol", "kind": "value", - "name": "forEach", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: (string, Symbol.t, 'a) => unit" + }, + { + "id": "Core.String.localeCompare", + "kind": "value", + "name": "localeCompare", "docstrings": [ - "`forEach(iterator, fn)` consumes all values in the async iterator and runs the callback `fn` for each value.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\n// Let's pretend we get an async iterator returning ints from somewhere.\n@val external asyncIterator: AsyncIterator.t = \"someAsyncIterator\"\n\nawait asyncIterator->AsyncIterator.forEach(value =>\n switch value {\n | Some(value) if value > 10 => Console.log(\"More than 10!\")\n | _ => ()\n }\n)\n```" + "`localeCompare(referenceStr, compareStr)` returns a float than indicatings\nwhether a reference string comes before or after, or is the same as the given\nstring in sort order. If `referenceStr` occurs before `compareStr` positive if\nthe `referenceStr` occurs after `compareStr`, `0` if they are equivalent.\nDo not rely on exact return values of `-1` or `1`\nSee [`String.localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) on MDN.\n\n## Examples\n\n```rescript\nString.localeCompare(\"a\", \"c\") < 0.0 == true\nString.localeCompare(\"a\", \"a\") == 0.0\n```" ], - "signature": "let forEach: (t<'a>, option<'a> => unit) => promise" + "signature": "let localeCompare: (string, string) => float" } ] }, - "core/iterator": { - "id": "Core.Iterator", - "name": "Iterator", - "docstrings": [ - "Bindings to JavaScript iterators.\n\nSee [`iterator protocols`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN." - ], + "core/result": { + "id": "Core.Result", + "name": "Result", + "docstrings": [], "items": [ { - "id": "Core.Iterator.t", + "id": "Core.Result.t", "kind": "type", "name": "t", "docstrings": [ - "The type representing an iterator." + "Result types are really useful to describe the result of a certain operation\n without relying on exceptions or `option` types.\n\n This module gives you useful utilities to create and combine `Result` data." ], - "signature": "type t<'a>" + "signature": "type t<'res, 'err> = result<'res, 'err> =\n | Ok('res)\n | Error('err)" }, { - "id": "Core.Iterator.value", - "kind": "type", - "name": "value", + "id": "Core.Result.getExn", + "kind": "value", + "name": "getExn", "docstrings": [ - "The current value of an iterator." + "`getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n ```res example\n Result.getExn(Result.Ok(42)) == 42\n\n switch Result.getExn(Error(\"Invalid data\")) {\n | exception Not_found => assert(true)\n | _ => assert(false)\n }\n ```" ], - "signature": "type value<'a> = {done: bool, value: option<'a>}" + "signature": "let getExn: result<'a, 'b> => 'a" }, { - "id": "Core.Iterator.next", + "id": "Core.Result.mapOr", "kind": "value", - "name": "next", + "name": "mapOr", "docstrings": [ - "Returns the next value of the iterator, if any.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\n@val external someIterator: Iterator.t = \"someIterator\"\n\n// Pulls out the next value of the iterator\nlet {Iterator.done, value} = someIterator->Iterator.next\n```" + "`mapOr(res, default, f)`: When res is `Ok(n)`, returns `f(n)`, otherwise `default`.\n\n## Examples\n\n```rescript\nlet ok = Ok(42)\nResult.mapOr(ok, 0, (x) => x / 2) == 21\n\nlet error = Error(\"Invalid data\")\nResult.mapOr(error, 0, (x) => x / 2) == 0\n```" ], - "signature": "let next: t<'a> => value<'a>" + "signature": "let mapOr: (result<'a, 'c>, 'b, 'a => 'b) => 'b" }, { - "id": "Core.Iterator.toArray", + "id": "Core.Result.mapWithDefault", "kind": "value", - "name": "toArray", - "docstrings": [ - "Turns an iterator into an array of the remaining values.\nRemember that each invocation of `next` of an iterator consumes a value. `Iterator.toArray` will consume all remaining values of the iterator and return them in an array to you.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\n// `Map.keys` returns all keys of the map as an iterator.\nlet mapKeysAsArray = map->Map.keys->Iterator.toArray\n\nConsole.log(mapKeysAsArray) // Logs [\"someKey\", \"someKey2\"] to the console.\n```" - ], - "signature": "let toArray: t<'a> => array<'a>" + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (result<'a, 'c>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Core.Iterator.toArrayWithMapper", + "id": "Core.Result.map", "kind": "value", - "name": "toArrayWithMapper", + "name": "map", "docstrings": [ - "`toArray(iterator)` turns `iterator` into an array of its remaining values, applying the provided mapper function on each item.\nRemember that each invocation of `next` of an iterator consumes a value. `Iterator.toArrayWithMapper` will consume all remaining values of the iterator and return them in an array to you.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\nmap->Map.set(\"someKey2\", \"someValue2\")\n\n// `Map.keys` returns all keys of the map as an iterator.\nlet mapKeysAsArray = map\n ->Map.keys\n ->Iterator.toArrayWithMapper(key => key->String.length)\n\nConsole.log(mapKeysAsArray) // Logs [7, 8] to the console.\n```" + "`map(res, f)`: When res is `Ok(n)`, returns `Ok(f(n))`. Otherwise returns res\nunchanged. Function `f` takes a value of the same type as `n` and returns an\nordinary value.\n\n## Examples\n\n```rescript\nlet f = (x) => sqrt(Int.toFloat(x))\n\nResult.map(Ok(64), f) == Ok(8.0)\n\nResult.map(Error(\"Invalid data\"), f) == Error(\"Invalid data\")\n```" ], - "signature": "let toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b>" + "signature": "let map: (result<'a, 'c>, 'a => 'b) => result<'b, 'c>" }, { - "id": "Core.Iterator.forEach", + "id": "Core.Result.flatMap", "kind": "value", - "name": "forEach", - "docstrings": [ - "`forEach(iterator, fn)` consumes all values in the iterator and runs the callback `fn` for each value.\n\nSee [iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) on MDN.\n\n## Examples\n```rescript\n@val external someIterator: Iterator.t = \"someIterator\"\n\nsomeIterator->Iterator.forEach(value =>\n switch value {\n | Some(value) if value > 10 => Console.log(\"More than 10!\")\n | _ => ()\n }\n)\n```" - ], - "signature": "let forEach: (t<'a>, option<'a> => unit) => unit" - } - ] - }, - "core/json": { - "id": "Core.JSON", - "name": "JSON", - "docstrings": [ - "Functions for interacting with JSON." - ], - "items": [ - { - "id": "Core.JSON.t", - "kind": "type", - "name": "t", + "name": "flatMap", "docstrings": [ - "A type representing a JSON object." + "`flatMap(res, f)`: When res is `Ok(n)`, returns `f(n)`. Otherwise, returns res\nunchanged. Function `f` takes a value of the same type as `n` and returns a\n`Result`.\n\n## Examples\n\n```rescript\nlet recip = (x) =>\n if (x !== 0.0) {\n Ok(1.0 /. x)\n } else {\n Error(\"Divide by zero\")\n }\n\nResult.flatMap(Ok(2.0), recip) == Ok(0.5)\n\nResult.flatMap(Ok(0.0), recip) == Error(\"Divide by zero\")\n\nResult.flatMap(Error(\"Already bad\"), recip) == Error(\"Already bad\")\n```" ], - "signature": "type t = Js.Json.t =\n | Boolean(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Core__Dict.t)\n | Array(array)" - }, - { - "id": "Core.JSON.replacer", - "kind": "type", - "name": "replacer", - "docstrings": [], - "signature": "type replacer =\n | Keys(array)\n | Replacer((string, t) => t)" + "signature": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" }, { - "id": "Core.JSON.parseExn", + "id": "Core.Result.getOr", "kind": "value", - "name": "parseExn", + "name": "getOr", "docstrings": [ - "`parseExn(string, ~reviver=?)` \n\nParses a JSON string or throws a JavaScript exception (SyntaxError), if the string isn't valid.\nThe reviver describes how the value should be transformed. It is a function which receives a key and a value.\nIt returns a JSON type.\n\n## Examples\n```rescript\ntry {\n let _ = JSON.parseExn(`{\"foo\":\"bar\",\"hello\":\"world\"}`)\n // { foo: 'bar', hello: 'world' }\n\n let _ = JSON.parseExn(\"\")\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n\nlet reviver = (_, value: JSON.t) =>\n switch value {\n | String(string) => string->String.toUpperCase->JSON.Encode.string\n | Number(number) => (number *. 2.0)->JSON.Encode.float\n | _ => value\n }\n\nlet jsonString = `{\"hello\":\"world\",\"someNumber\":21}`\n\ntry {\n JSON.parseExn(jsonString, ~reviver)->Console.log\n // { hello: 'WORLD', someNumber: 42 }\n\n JSON.parseExn(\"\", ~reviver)->Console.log\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError (Exn.t) if the string isn't valid JSON." + "`getOr(res, defaultValue)`: If `res` is `Ok(n)`, returns `n`, otherwise `default`\n\n## Examples\n\n```rescript\nResult.getOr(Ok(42), 0) == 42\n\nResult.getOr(Error(\"Invalid Data\"), 0) == 0\n```" ], - "signature": "let parseExn: (string, ~reviver: (string, t) => t=?) => t" + "signature": "let getOr: (result<'a, 'b>, 'a) => 'a" }, { - "id": "Core.JSON.parseExnWithReviver", + "id": "Core.Result.getWithDefault", "kind": "value", - "name": "parseExnWithReviver", - "docstrings": [ - "`parseExnWithReviver(string, reviver)` \n\nParses a JSON string or throws a JavaScript exception (SyntaxError), if the string isn't valid.\nThe reviver describes how the value should be transformed. It is a function which receives a key and a value.\nIt returns a JSON type.\n\n## Examples\n```rescript\nlet reviver = (_, value: JSON.t) =>\n switch value {\n | String(string) => string->String.toUpperCase->JSON.Encode.string\n | Number(number) => (number *. 2.0)->JSON.Encode.float\n | _ => value\n }\n\nlet jsonString = `{\"hello\":\"world\",\"someNumber\":21}`\n\ntry {\n JSON.parseExnWithReviver(jsonString, reviver)->Console.log\n // { hello: 'WORLD', someNumber: 42 }\n\n JSON.parseExnWithReviver(\"\", reviver)->Console.log\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError if the string isn't valid JSON." - ], - "signature": "let parseExnWithReviver: (string, (string, t) => t) => t", - "deprecated": "Use `parseExn` with optional parameter instead" + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (result<'a, 'b>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Core.JSON.stringify", + "id": "Core.Result.isOk", "kind": "value", - "name": "stringify", + "name": "isOk", "docstrings": [ - "`stringify(json, ~replacer=?, ~space=?)` \n\nConverts a JSON object to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value,\nor an array of keys which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAny` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringify(json)\n// {\"foo\":\"bar\",\"hello\":\"world\",\"someNumber\":42}\n\nJSON.stringify(json, ~space=2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n\nJSON.stringify(json, ~replacer=Keys([\"foo\", \"someNumber\"]))\n// {\"foo\":\"bar\",\"someNumber\":42}\n\nlet replacer = JSON.Replacer((_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n})\n\nJSON.stringify(json, ~replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n```" + "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." ], - "signature": "let stringify: (t, ~replacer: replacer=?, ~space: int=?) => string" + "signature": "let isOk: result<'a, 'b> => bool" }, { - "id": "Core.JSON.stringifyWithIndent", + "id": "Core.Result.isError", "kind": "value", - "name": "stringifyWithIndent", + "name": "isError", "docstrings": [ - "`stringifyWithIndent(json, indentation)` \n\nConverts a JSON object to a JSON string. The output will be indented.\nIf you want to stringify any type, use `JSON.stringifyAnyWithIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithIndent(json, 2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n```" + "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." ], - "signature": "let stringifyWithIndent: (t, int) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let isError: result<'a, 'b> => bool" }, { - "id": "Core.JSON.stringifyWithReplacer", + "id": "Core.Result.equal", "kind": "value", - "name": "stringifyWithReplacer", + "name": "equal", "docstrings": [ - "`stringifyWithReplacer(json, replacer)` \n\nConverts a JSON object to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nIf you want to stringify any type, use `JSON.stringifyAnyWithReplacer` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyWithReplacer(json, replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n```" + "`equal(res1, res2, f)`: Determine if two `Result` variables are equal with\nrespect to an equality function. If `res1` and `res2` are of the form `Ok(n)`\nand `Ok(m)`, return the result of `f(n, m)`. If one of `res1` and `res2` are of\nthe form `Error(e)`, return false If both `res1` and `res2` are of the form\n`Error(e)`, return true\n\n## Examples\n\n```rescript\nlet good1 = Ok(42)\n\nlet good2 = Ok(32)\n\nlet bad1 = Error(\"invalid\")\n\nlet bad2 = Error(\"really invalid\")\n\nlet mod10equal = (a, b) => mod(a, 10) === mod(b, 10)\n\nResult.equal(good1, good2, mod10equal) == true\n\nResult.equal(good1, bad1, mod10equal) == false\n\nResult.equal(bad2, good2, mod10equal) == false\n\nResult.equal(bad1, bad2, mod10equal) == true\n```" ], - "signature": "let stringifyWithReplacer: (t, (string, t) => t) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" }, { - "id": "Core.JSON.stringifyWithReplacerAndIndent", + "id": "Core.Result.compare", "kind": "value", - "name": "stringifyWithReplacerAndIndent", + "name": "compare", "docstrings": [ - "`stringifyWithReplacerAndIndent(json, replacer, indentation)`\n\nConverts a JSON object to a JSON string. The output will be indented.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nIf you want to stringify any type, use `JSON.stringifyAnyWithReplacerAndIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyWithReplacerAndIndent(json, replacer, 2)\n// {\n// \"foo\": \"BAR\",\n// \"hello\": \"WORLD\",\n// \"someNumber\": 42\n// }\n```" + "`compare(res1, res2, f)`: Compare two `Result` variables with respect to a\ncomparison function. The comparison function returns -1. if the first variable\nis \"less than\" the second, 0. if the two variables are equal, and 1. if the first\nis \"greater than\" the second.\n\nIf `res1` and `res2` are of the form `Ok(n)` and `Ok(m)`, return the result of\n`f(n, m)`. If `res1` is of the form `Error(e)` and `res2` of the form `Ok(n)`,\nreturn -1. (nothing is less than something) If `res1` is of the form `Ok(n)` and\n`res2` of the form `Error(e)`, return 1. (something is greater than nothing) If\nboth `res1` and `res2` are of the form `Error(e)`, return 0. (equal)\n\n## Examples\n\n```rescript\nlet good1 = Ok(59)\n\nlet good2 = Ok(37)\n\nlet bad1 = Error(\"invalid\")\n\nlet bad2 = Error(\"really invalid\")\n\nlet mod10cmp = (a, b) => Int.compare(mod(a, 10), mod(b, 10))\n\nResult.compare(Ok(39), Ok(57), mod10cmp) == 1.\n\nResult.compare(Ok(57), Ok(39), mod10cmp) == (-1.)\n\nResult.compare(Ok(39), Error(\"y\"), mod10cmp) == 1.\n\nResult.compare(Error(\"x\"), Ok(57), mod10cmp) == (-1.)\n\nResult.compare(Error(\"x\"), Error(\"y\"), mod10cmp) == 0.\n```" ], - "signature": "let stringifyWithReplacerAndIndent: (t, (string, t) => t, int) => string", - "deprecated": "Use `stringify` with optional parameters instead" + "signature": "let compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Core.JSON.stringifyWithFilter", + "id": "Core.Result.forEach", "kind": "value", - "name": "stringifyWithFilter", + "name": "forEach", "docstrings": [ - "`stringifyWithFilter(json, filter)` \n\nConverts a JSON object to a JSON string.\nThe filter is an array of keys, which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAnyWithFilter` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithFilter(json, [\"foo\", \"someNumber\"])\n// {\"foo\":\"bar\",\"someNumber\":42}\n```" + "`forEach(res, f)` runs the provided function `f` on the `Ok` value. If `res` is `Error`, nothing happens.\n\n## Examples\n\n```rescript\nResult.forEach(Ok(3), Console.log) // Logs \"3\", returns ()\nResult.forEach(Error(\"x\"), Console.log) // Does nothing, returns ()\n```" ], - "signature": "let stringifyWithFilter: (t, array) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let forEach: (result<'a, 'b>, 'a => unit) => unit" }, { - "id": "Core.JSON.stringifyWithFilterAndIndent", + "id": "Core.Result.mapError", "kind": "value", - "name": "stringifyWithFilterAndIndent", + "name": "mapError", "docstrings": [ - "`stringifyWithFilterAndIndent(json, filter, indentation)` \n\nConverts a JSON object to a JSON string. The output will be indented.\nThe filter is an array of keys, which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAnyWithFilterAndIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithFilterAndIndent(json, [\"foo\", \"someNumber\"], 2)\n// {\n// \"foo\": \"bar\",\n// \"someNumber\": 42\n// }\n```" + "`mapError(r, f)` generates a new `result` by applying the function `f` to the `Error` value. If the source is `Ok`, return it as-is.\n\n## Examples\n\n```rescript\nlet format = n => `Error code: ${n->Int.toString}`\nResult.mapError(Error(14), format) // Error(\"Error code: 14\")\nResult.mapError(Ok(\"abc\"), format) // Ok(\"abc\")\n```" ], - "signature": "let stringifyWithFilterAndIndent: (t, array, int) => string", - "deprecated": "Use `stringify` with optional parameters instead" + "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" }, { - "id": "Core.JSON.stringifyAny", + "id": "Core.Result.all", "kind": "value", - "name": "stringifyAny", + "name": "all", "docstrings": [ - "`stringifyAny(any, ~replacer=?, ~space=?)` \n\nConverts any type to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringify` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nJSON.stringifyAny(dict)\n// {\"foo\":\"bar\",\"hello\":\"world\",\"someNumber\":42}\n\nJSON.stringifyAny(dict, ~space=2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n\nJSON.stringifyAny(dict, ~replacer=Keys([\"foo\", \"someNumber\"]))\n// {\"foo\":\"bar\",\"someNumber\":42}\n\nlet replacer = JSON.Replacer((_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n})\n\nJSON.stringifyAny(dict, ~replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all(results)` returns a result of array if all options are Ok, otherwise returns Error.\n## Examples\n```rescript\nResult.all([Ok(1), Ok(2), Ok(3)]) // Ok([1, 2, 3])\nResult.all([Ok(1), Error(1)]) // Error(1)\n```" ], - "signature": "let stringifyAny: ('a, ~replacer: replacer=?, ~space: int=?) => option" + "signature": "let all: array> => result, 'b>" }, { - "id": "Core.JSON.stringifyAnyWithIndent", + "id": "Core.Result.all2", "kind": "value", - "name": "stringifyAnyWithIndent", + "name": "all2", "docstrings": [ - "`stringifyAnyWithIndent(any, indentation)` \n\nConverts any type to a JSON string. The output will be indented.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithIndent` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nJSON.stringifyAnyWithIndent(dict, 2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all2((r1, r2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithIndent: ('a, int) => option", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "signature": "let all2: (\n (result<'r1, 'e>, result<'r2, 'e>),\n) => result<('r1, 'r2), 'e>" }, { - "id": "Core.JSON.stringifyAnyWithReplacer", + "id": "Core.Result.all3", "kind": "value", - "name": "stringifyAnyWithReplacer", + "name": "all3", "docstrings": [ - "`stringifyAnyWithReplacer(json, replacer)`\n\nConverts any type to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithReplacer` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyAnyWithReplacer(dict, replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all3((r1, r2, r3))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithReplacer: ('a, (string, t) => t) => option", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "signature": "let all3: (\n (result<'r1, 'e>, result<'r2, 'e>, result<'r3, 'e>),\n) => result<('r1, 'r2, 'r3), 'e>" }, { - "id": "Core.JSON.stringifyAnyWithReplacerAndIndent", + "id": "Core.Result.all4", "kind": "value", - "name": "stringifyAnyWithReplacerAndIndent", + "name": "all4", "docstrings": [ - "`stringifyAnyWithReplacerAndIndent(json, replacer, indentation)` \n\nConverts any type to a JSON string. The output will be indented.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithReplacerAndIndent` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyAnyWithReplacerAndIndent(dict, replacer, 2)\n// {\n// \"foo\": \"BAR\",\n// \"hello\": \"WORLD\",\n// \"someNumber\": 42\n// }\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all4((r1, r2, r3, r4))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithReplacerAndIndent: ('a, (string, t) => t, int) => option", - "deprecated": "Use `stringifyAny` with optional parameters instead" + "signature": "let all4: (\n (\n result<'r1, 'e>,\n result<'r2, 'e>,\n result<'r3, 'e>,\n result<'r4, 'e>,\n ),\n) => result<('r1, 'r2, 'r3, 'r4), 'e>" }, { - "id": "Core.JSON.stringifyAnyWithFilter", + "id": "Core.Result.all5", "kind": "value", - "name": "stringifyAnyWithFilter", + "name": "all5", "docstrings": [ - "`stringifyAnyWithFilter(json, filter)` \n\nConverts any type to a JSON string.\nThe filter is an array of keys, which should be included in the output.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithFilter` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nJSON.stringifyAnyWithFilter(dict, [\"foo\", \"someNumber\"])\n// {\"foo\": \"bar\",\"someNumber\": 42}\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all5((r1, r2, r3, r4, r5))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithFilter: ('a, array) => string", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "signature": "let all5: (\n (\n result<'r1, 'e>,\n result<'r2, 'e>,\n result<'r3, 'e>,\n result<'r4, 'e>,\n result<'r5, 'e>,\n ),\n) => result<('r1, 'r2, 'r3, 'r4, 'r5), 'e>" }, { - "id": "Core.JSON.stringifyAnyWithFilterAndIndent", + "id": "Core.Result.all6", "kind": "value", - "name": "stringifyAnyWithFilterAndIndent", + "name": "all6", "docstrings": [ - "`stringifyAnyWithFilterAndIndent(json, filter, indentation)` \n\nConverts any type to a JSON string. The output will be indented.\nThe filter is an array of keys, which should be included in the output.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithFilterAndIndent` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nJSON.stringifyAnyWithFilterAndIndent(dict, [\"foo\", \"someNumber\"], 2)\n// {\n// \"foo\": \"bar\",\n// \"someNumber\": 42\n// }\n\nJSON.stringifyAny(() => \"hello world\")\n// None\n\nBigInt.fromInt(0)->JSON.stringifyAny\n// exception\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + "`all6((r1, r2, r3, r4, r5, r6))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithFilterAndIndent: ('a, array, int) => string", - "deprecated": "Use `stringifyAny` with optional parameters instead" + "signature": "let all6: (\n (\n result<'r1, 'e>,\n result<'r2, 'e>,\n result<'r3, 'e>,\n result<'r4, 'e>,\n result<'r5, 'e>,\n result<'r6, 'e>,\n ),\n) => result<('r1, 'r2, 'r3, 'r4, 'r5, 'r6), 'e>" } ] }, - "core/type": { - "id": "Core.Type", - "name": "Type", + "core/regexp": { + "id": "Core.RegExp", + "name": "RegExp", "docstrings": [ - "Utilities for classifying the type of JavaScript values at runtime." + "Functions for handling RegExp's in ReScript.\n\nSee [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) on MDN." ], "items": [ { - "id": "Core.Type.t", + "id": "Core.RegExp.t", "kind": "type", "name": "t", "docstrings": [ - "The possible types of JavaScript values." + "Type representing an instantiated `RegExp`." ], - "signature": "type t = [\n | #bigint\n | #boolean\n | #function\n | #number\n | #object\n | #string\n | #symbol\n | #undefined\n]" + "signature": "type t" }, { - "id": "Core.Type.typeof", + "id": "Core.RegExp.fromString", "kind": "value", - "name": "typeof", + "name": "fromString", "docstrings": [ - "`typeof(someValue)`\n\nReturns the underlying JavaScript type of any runtime value.\n\nSee [`typeof`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof) on MDN.\n\n## Examples\n```rescript\nConsole.log(Type.typeof(\"Hello\")) // Logs \"string\" to the console.\n\nlet someVariable = true\n\nswitch someVariable->Type.typeof {\n| #boolean => Console.log(\"This is a bool, yay!\")\n| _ => Console.log(\"Oh, not a bool sadly...\")\n}\n```" + "`fromString(string)` creates a `RegExp.t` from the provided string. This can then be used to match on strings using `RegExp.exec`.\n\nSee [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" ], - "signature": "let typeof: 'a => t" - } - ] - }, - "core/symbol": { - "id": "Core.Symbol", - "name": "Symbol", - "docstrings": [], - "items": [ - { - "id": "Core.Symbol.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = Js.Types.symbol" - }, - { - "id": "Core.Symbol.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: string => t" - }, - { - "id": "Core.Symbol.getFor", - "kind": "value", - "name": "getFor", - "docstrings": [], - "signature": "let getFor: string => t" - }, - { - "id": "Core.Symbol.keyFor", - "kind": "value", - "name": "keyFor", - "docstrings": [], - "signature": "let keyFor: t => option" - }, - { - "id": "Core.Symbol.asyncIterator", - "kind": "value", - "name": "asyncIterator", - "docstrings": [], - "signature": "let asyncIterator: t" - }, - { - "id": "Core.Symbol.hasInstance", - "kind": "value", - "name": "hasInstance", - "docstrings": [], - "signature": "let hasInstance: t" + "signature": "let fromString: string => t" }, { - "id": "Core.Symbol.isConcatSpreadable", + "id": "Core.RegExp.fromStringWithFlags", "kind": "value", - "name": "isConcatSpreadable", - "docstrings": [], - "signature": "let isConcatSpreadable: t" + "name": "fromStringWithFlags", + "docstrings": [ + "`fromStringWithFlags(string)` creates a `RegExp.t` from the provided string, using the provided `flags`. This can then be used to match on strings using `RegExp.exec`.\n\nSee [`RegExp parameters`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp#parameters) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" + ], + "signature": "let fromStringWithFlags: (string, ~flags: string) => t" }, { - "id": "Core.Symbol.iterator", + "id": "Core.RegExp.test", "kind": "value", - "name": "iterator", - "docstrings": [], - "signature": "let iterator: t" + "name": "test", + "docstrings": [ + "`test(regexp, string)` tests whether the provided `regexp` matches on the provided string.\n\nSee [`RegExp.test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nif regexp->RegExp.test(\"ReScript is cool!\") {\n Console.log(\"Yay, there's a word in there.\")\n}\n```" + ], + "signature": "let test: (t, string) => bool" }, { - "id": "Core.Symbol.match", + "id": "Core.RegExp.exec", "kind": "value", - "name": "match", - "docstrings": [], - "signature": "let match: t" + "name": "exec", + "docstrings": [ + "`exec(regexp, string)` executes the provided regexp on the provided string, optionally returning a `RegExp.Result.t` if the regexp matches on the string.\n\nSee [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" + ], + "signature": "let exec: (t, string) => option" }, { - "id": "Core.Symbol.matchAll", + "id": "Core.RegExp.lastIndex", "kind": "value", - "name": "matchAll", - "docstrings": [], - "signature": "let matchAll: t" + "name": "lastIndex", + "docstrings": [ + "`lastIndex(regexp)` returns 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\nConsole.log(regexp->RegExp.lastIndex) // Logs `0` to the console\n\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `4` to the console\n```" + ], + "signature": "let lastIndex: t => int" }, { - "id": "Core.Symbol.replace", + "id": "Core.RegExp.setLastIndex", "kind": "value", - "name": "replace", - "docstrings": [], - "signature": "let replace: t" + "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.Symbol.search", + "id": "Core.RegExp.ignoreCase", "kind": "value", - "name": "search", - "docstrings": [], - "signature": "let search: t" + "name": "ignoreCase", + "docstrings": [ + "`ignoreCase(regexp)` returns whether the ignore case (`i`) flag is set on this `RegExp`.\n\nSee [`RegExp.ignoreCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/ignoreCase) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.ignoreCase) // Logs `false`, since `i` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"i\")\nConsole.log(regexp2->RegExp.ignoreCase) // Logs `true`, since `i` is set\n```" + ], + "signature": "let ignoreCase: t => bool" }, { - "id": "Core.Symbol.species", + "id": "Core.RegExp.global", "kind": "value", - "name": "species", - "docstrings": [], - "signature": "let species: t" + "name": "global", + "docstrings": [ + "`global(regexp)` returns whether the global (`g`) flag is set on this `RegExp`.\n\nSee [`RegExp.global`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.global) // Logs `true`, since `g` is set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"i\")\nConsole.log(regexp2->RegExp.global) // Logs `false`, since `g` is not set\n```" + ], + "signature": "let global: t => bool" }, { - "id": "Core.Symbol.split", + "id": "Core.RegExp.multiline", "kind": "value", - "name": "split", - "docstrings": [], - "signature": "let split: t" + "name": "multiline", + "docstrings": [ + "`multiline(regexp)` returns whether the multiline (`m`) flag is set on this `RegExp`.\n\nSee [`RegExp.multiline`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.multiline) // Logs `false`, since `m` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"mi\")\nConsole.log(regexp2->RegExp.multiline) // Logs `true`, since `m` is set\n```" + ], + "signature": "let multiline: t => bool" }, { - "id": "Core.Symbol.toPrimitive", + "id": "Core.RegExp.source", "kind": "value", - "name": "toPrimitive", - "docstrings": [], - "signature": "let toPrimitive: t" + "name": "source", + "docstrings": [ + "`source(regexp)` returns the source text for this `RegExp`, without the two forward slashes (if present), and without any set flags.\n\nSee [`RegExp.source`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source) on MDN.\n\n## Examples\n```rescript\nlet regexp = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp->RegExp.source) // Logs `\\w+`, the source text of the `RegExp`\n```" + ], + "signature": "let source: t => string" }, { - "id": "Core.Symbol.toStringTag", + "id": "Core.RegExp.sticky", "kind": "value", - "name": "toStringTag", - "docstrings": [], - "signature": "let toStringTag: t" + "name": "sticky", + "docstrings": [ + "`sticky(regexp)` returns whether the sticky (`y`) flag is set on this `RegExp`.\n\nSee [`RegExp.sticky`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.unicode) // Logs `false`, since `y` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"my\")\nConsole.log(regexp2->RegExp.unicode) // Logs `true`, since `y` is set\n```" + ], + "signature": "let sticky: t => bool" }, { - "id": "Core.Symbol.unscopables", + "id": "Core.RegExp.unicode", "kind": "value", - "name": "unscopables", - "docstrings": [], - "signature": "let unscopables: t" + "name": "unicode", + "docstrings": [ + "`unicode(regexp)` returns whether the unicode (`y`) flag is set on this `RegExp`.\n\nSee [`RegExp.unicode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.unicode) // Logs `false`, since `u` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"mu\")\nConsole.log(regexp2->RegExp.unicode) // Logs `true`, since `u` is set\n```" + ], + "signature": "let unicode: t => bool" } ] }, - "core/string": { - "id": "Core.String", - "name": "String", + "core/promise": { + "id": "Core.Promise", + "name": "Promise", "docstrings": [ - "Functions for interacting with JavaScript strings.\nSee: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)." + "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." ], "items": [ { - "id": "Core.String.make", - "kind": "value", - "name": "make", - "docstrings": [ - "`make(value)` converts the given value to a `string`.\n\n## Examples\n\n```rescript\nString.make(3.5) == \"3.5\"\nString.make([1, 2, 3]) == \"1,2,3\"\n```" - ], - "signature": "let make: 'a => string" - }, - { - "id": "Core.String.fromCharCode", - "kind": "value", - "name": "fromCharCode", - "docstrings": [ - "`fromCharCode(n)` creates a `string` containing the character corresponding to\nthat number, `n` ranges from 0 to 65535. If out of range, the lower 16 bits of\nthe value are used. Thus, `fromCharCode(0x1F63A)` gives the same result as\n`fromCharCode(0xF63A)`.\nSee [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) on MDN.\n\n## Examples\n\n```rescript\nString.fromCharCode(65) == \"A\"\nString.fromCharCode(0x3c8) == `ψ`\nString.fromCharCode(0xd55c) == `한`\nString.fromCharCode(-64568) == `ψ`\n```" - ], - "signature": "let fromCharCode: int => string" + "id": "Core.Promise.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a> = promise<'a>" }, { - "id": "Core.String.fromCharCodeMany", + "id": "Core.Promise.resolve", "kind": "value", - "name": "fromCharCodeMany", + "name": "resolve", "docstrings": [ - "`fromCharCodeMany([n1, n2, n3])` creates a `string` from the characters\ncorresponding to the given numbers, using the same rules as `fromCharCode`.\nSee [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) on MDN.\n\n## Examples\n\n```rescript\nString.fromCharCodeMany([189, 43, 190, 61]) == \"½+¾=\"\nString.fromCharCodeMany([65, 66, 67]) == \"ABC\"\n```" + "`resolve(value)` creates a resolved Promise with a given `value`.\nSee [`Promise.resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve) on MDN.\n\n## Examples\n\n```rescript\nlet p = Promise.resolve(5) // promise\n```" ], - "signature": "let fromCharCodeMany: array => string" + "signature": "let resolve: 'a => t<'a>" }, { - "id": "Core.String.fromCodePoint", + "id": "Core.Promise.reject", "kind": "value", - "name": "fromCodePoint", + "name": "reject", "docstrings": [ - "`fromCodePoint(n)` creates a `string` containing the character corresponding to\nthat numeric code point.\nSee [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) on MDN.\n\n## Examples\n\n```rescript\nString.fromCodePoint(65) == \"A\"\nString.fromCodePoint(0x3c8) == `ψ`\nString.fromCodePoint(0xd55c) == `한`\nString.fromCodePoint(0x1f63a) == `😺`\n```\n\n## Exceptions\n\n- `RangeError`: If the number is not a valid code point, like `fromCharCode(-5)`." + "`reject(exn)` reject a Promise.\nSee [`Promise.reject`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject) on MDN.\n\n## Examples\n\n```rescript\nexception TestError(string)\n\nTestError(\"some rejected value\")\n->Promise.reject\n->Promise.catch(v => {\n switch v {\n | TestError(msg) => assertEqual(msg, \"some rejected value\")\n | _ => assert(false)\n }\n Promise.resolve()\n})\n->ignore\n```" ], - "signature": "let fromCodePoint: int => string" + "signature": "let reject: exn => t<'a>" }, { - "id": "Core.String.fromCodePointMany", + "id": "Core.Promise.make", "kind": "value", - "name": "fromCodePointMany", + "name": "make", "docstrings": [ - "`fromCodePointMany([n1, n2, n3])` creates a `string` from the characters\ncorresponding to the given code point numbers, using the same rules as\n`fromCodePoint`.\nSee [`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint) on MDN.\n\n## Examples\n\n```rescript\nString.fromCodePointMany([0xd55c, 0xae00, 0x1f63a]) == `한글😺`\n```\n\n## Exceptions\n\n- `RangeError`: If one of the number is not a valid code point, like\n`fromCharCode([1, -5])`." + "`make(callback)` creates a new Promise based on a `callback` that receives two\nuncurried functions `resolve` and `reject` for defining the Promise's result.\n\n## Examples\n\n```rescript\nopen Promise\n\nlet n = 4\nPromise.make((resolve, reject) => {\n if(n < 5) {\n resolve(. \"success\")\n }\n else {\n reject(. \"failed\")\n }\n})\n->then(str => {\n Console.log(str)->resolve\n})\n->catch(_ => {\n Console.log(\"Error occurred\")\n resolve()\n})\n->ignore\n```" ], - "signature": "let fromCodePointMany: array => string" - }, - { - "id": "Core.String.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (string, string) => bool" + "signature": "let make: (('a => unit, 'e => unit) => unit) => t<'a>" }, { - "id": "Core.String.compare", - "kind": "value", - "name": "compare", + "id": "Core.Promise.promiseAndResolvers", + "kind": "type", + "name": "promiseAndResolvers", "docstrings": [], - "signature": "let compare: (string, string) => Core__Ordering.t" + "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" }, { - "id": "Core.String.length", + "id": "Core.Promise.withResolvers", "kind": "value", - "name": "length", + "name": "withResolvers", "docstrings": [ - "`length(str)` returns the length of the given `string`.\nSee [`String.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length) on MDN.\n\n## Examples\n\n```rescript\nString.length(\"abcd\") == 4\n```" + "`withResolvers()` returns a object containing a new promise with functions to resolve or reject it. See [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\n\nlet {promise, resolve, _} = Promise.withResolvers()\n\nsetTimeout(() => {\n resolve(. \"success\")\n}, 1000)->ignore\n\npromise\n->thenResolve(str => {\n Console.log(str)\n})\n->ignore\n```" ], - "signature": "let length: string => int" + "signature": "let withResolvers: unit => promiseAndResolvers<'a>" }, { - "id": "Core.String.get", + "id": "Core.Promise.catch", "kind": "value", - "name": "get", + "name": "catch", "docstrings": [ - "`get(str, index)` returns an `option` at the given `index` number. If\n`index` is out of range, this function returns `None`.\n\n## Examples\n\n```rescript\nString.get(\"ReScript\", 0) == Some(\"R\")\nString.get(\"Hello\", 4) == Some(\"o\")\nString.get(`JS`, 4) == None\n```" + "`catch(promise, errorCallback)` registers an exception handler in a promise chain.\nThe `errorCallback` receives an `exn` value that can later be refined into a JS\nerror or ReScript error. The `errorCallback` needs to return a promise with the\nsame type as the consumed promise. See [`Promise.catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\n\nexception SomeError(string)\n\nreject(SomeError(\"this is an error\"))\n->then(_ => {\n Ok(\"This result will never be returned\")->resolve\n})\n->catch(e => {\n let msg = switch(e) {\n | SomeError(msg) => \"ReScript error occurred: \" ++ msg\n | Exn.Error(obj) =>\n switch Exn.message(obj) {\n | Some(msg) => \"JS exception occurred: \" ++ msg\n | None => \"Some other JS value has been thrown\"\n }\n | _ => \"Unexpected error occurred\"\n }\n\n Error(msg)->resolve\n})\n->then(result => {\n switch result {\n | Ok(r) => Console.log2(\"Operation successful: \", r)\n | Error(msg) => Console.log2(\"Operation failed: \", msg)\n }->resolve\n})\n->ignore // Ignore needed for side-effects\n```\n\nIn case you want to return another promise in your `callback`, consider using\n`then` instead." ], - "signature": "let get: (string, int) => option" + "signature": "let catch: (t<'a>, exn => t<'a>) => t<'a>" }, { - "id": "Core.String.getUnsafe", + "id": "Core.Promise.then", "kind": "value", - "name": "getUnsafe", + "name": "then", "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```" + "`then(promise, callback)` returns a new promise based on the result of `promise`'s \nvalue. The `callback` needs to explicitly return a new promise via `resolve`.\nIt is **not allowed** to resolve a nested promise (like `resolve(resolve(1))`).\nSee [`Promise.then`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) on MDN.\n## Examples\n\n```rescript\nopen Promise\nresolve(5)\n->then(num => {\n resolve(num + 5)\n})\n->then(num => {\n Console.log2(\"Your lucky number is: \", num)\n resolve()\n})\n->ignore\n```" ], - "signature": "let getUnsafe: (string, int) => string" + "signature": "let then: (t<'a>, 'a => t<'b>) => t<'b>" }, { - "id": "Core.String.charAt", + "id": "Core.Promise.thenResolve", "kind": "value", - "name": "charAt", + "name": "thenResolve", "docstrings": [ - "`charAt(str, index)` gets the character at `index` within string `str`. If\n`index` is negative or greater than the length of `str`, it returns the empty\nstring. If the string contains characters outside the range \\u0000-\\uffff, it\nwill return the first 16-bit value at that position in the string.\nSee [`String.charAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt) on MDN.\n\n## Examples\n\n```rescript\nString.charAt(\"ReScript\", 0) == \"R\"\nString.charAt(\"Hello\", 12) == \"\"\nString.charAt(`JS`, 5) == \"\"\n```" + "`thenResolve(promise, callback)` converts an encapsulated value of a promise\ninto another promise wrapped value. It is **not allowed** to return a promise\nwithin the provided callback (e.g. `thenResolve(value => resolve(value))`).\n\n## Examples\n\n```rescript\nopen Promise\nresolve(\"Anna\")\n->thenResolve(str => {\n \"Hello \" ++ str\n})\n->thenResolve(str => {\n Console.log(str)\n})\n->ignore // Ignore needed for side-effects\n```\n\nIn case you want to return another promise in your `callback`, consider using\n`then` instead." ], - "signature": "let charAt: (string, int) => string" + "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Core.String.charCodeAt", + "id": "Core.Promise.finally", "kind": "value", - "name": "charCodeAt", + "name": "finally", "docstrings": [ - "`charCodeAt(str, index)` returns the character code at position `index` in\nstring `str` the result is in the range 0-65535, unlike `codePointAt`, so it\nwill not work correctly for characters with code points greater than or equal\nto 0x10000. The return type is `float` because this function returns NaN if\n`index` is less than zero or greater than the length of the string.\nSee [`String.charCodeAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt) on MDN.\n\n## Examples\n\n```rescript\nString.charCodeAt(`😺`, 0) == 0xd83d->Int.toFloat\nString.codePointAt(`😺`, 0) == Some(0x1f63a)\n```" + "`finally(promise, callback)` is used to execute a function that is called no\nmatter if a promise was resolved or rejected. It will return the same `promise`\nit originally received. See [`Promise.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nexception SomeError(string)\nlet isDone = ref(false)\n\nresolve(5)\n->then(_ => {\n reject(SomeError(\"test\"))\n})\n->then(v => {\n Console.log2(\"final result\", v)\n resolve()\n})\n->catch(_ => {\n Console.log(\"Error handled\")\n resolve()\n})\n->finally(() => {\n Console.log(\"finally\")\n isDone := true\n})\n->then(() => {\n Console.log2(\"isDone:\", isDone.contents)\n resolve()\n})\n->ignore\n```" ], - "signature": "let charCodeAt: (string, int) => float" + "signature": "let finally: (t<'a>, unit => unit) => t<'a>" }, { - "id": "Core.String.codePointAt", + "id": "Core.Promise.race", "kind": "value", - "name": "codePointAt", + "name": "race", "docstrings": [ - "`codePointAt(str, index)` returns the code point at position `index` within\nstring `str` as a `Some(value)`. The return value handles code points greater\nthan or equal to 0x10000. If there is no code point at the given position, the\nfunction returns `None`.\nSee [`String.codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) on MDN.\n\n## Examples\n\n```rescript\nString.codePointAt(`¿😺?`, 1) == Some(0x1f63a)\nString.codePointAt(\"abc\", 5) == None\n```" + "`race(arr)` runs all promises concurrently and returns promise settles with the eventual state of the first promise that settles. See [`Promise.race`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nlet racer = (ms, name) => {\n Promise.make((resolve, _) => {\n setTimeout(() => {\n resolve(name)\n }, ms)->ignore\n })\n}\n\nlet promises = [racer(1000, \"Turtle\"), racer(500, \"Hare\"), racer(100, \"Eagle\")]\n\nrace(promises)->then(winner => {\n Console.log(\"The winner is \" ++ winner)\n resolve()\n})\n```" ], - "signature": "let codePointAt: (string, int) => option" + "signature": "let race: array> => t<'a>" }, { - "id": "Core.String.concat", + "id": "Core.Promise.any", "kind": "value", - "name": "concat", + "name": "any", "docstrings": [ - "`concat(original, append)` returns a new `string` with `append` added after\n`original`.\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) on MDN.\n\n## Examples\n\n```rescript\nString.concat(\"cow\", \"bell\") == \"cowbell\"\nString.concat(\"Re\", \"Script\") == \"ReScript\"\n```" + "`any(arr)` runs all promises concurrently and returns promise fulfills when any of the input's promises fulfills, with this first fulfillment value. See [`Promise.any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nlet racer = (ms, name) => {\n Promise.make((resolve, _) => {\n setTimeout(() => {\n resolve(name)\n }, ms)->ignore\n })\n}\n\nlet promises = [racer(1000, \"Turtle\"), racer(500, \"Hare\"), racer(100, \"Eagle\")]\n\nany(promises)->then(winner => {\n Console.log(\"The winner is \" ++ winner)\n resolve()\n})\n```" ], - "signature": "let concat: (string, string) => string" + "signature": "let any: array> => t<'a>" }, { - "id": "Core.String.concatMany", + "id": "Core.Promise.all", "kind": "value", - "name": "concatMany", + "name": "all", "docstrings": [ - "`concatMany(original, arr)` returns a new `string` consisting of each item of an\narray of strings added to the `original` string.\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat) on MDN.\n\n## Examples\n\n```rescript\nString.concatMany(\"1st\", [\"2nd\", \"3rd\", \"4th\"]) == \"1st2nd3rd4th\"\n```" + "`all(promises)` runs all promises concurrently and returns a promise fulfills when all of the input's promises fulfill, with an array of the fulfillment values. See [`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) on MDN.\n\n```rescript\nopen Promise\nlet promises = [resolve(1), resolve(2), resolve(3)]\n\nall(promises)\n->then((results) => {\n results->Array.forEach(num => {\n Console.log2(\"Number: \", num)\n })\n\n resolve()\n})\n->ignore\n```" ], - "signature": "let concatMany: (string, array) => string" + "signature": "let all: array> => t>" }, { - "id": "Core.String.endsWith", + "id": "Core.Promise.all2", "kind": "value", - "name": "endsWith", + "name": "all2", "docstrings": [ - "`endsWith(str, substr)` returns `true` if the `str` ends with `substr`, `false`\notherwise.\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) on MDN.\n\n## Examples\n\n```rescript\nString.endsWith(\"BuckleScript\", \"Script\") == true\nString.endsWith(\"BuckleShoes\", \"Script\") == false\n```" + "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let endsWith: (string, string) => bool" + "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" }, { - "id": "Core.String.endsWithFrom", + "id": "Core.Promise.all3", "kind": "value", - "name": "endsWithFrom", + "name": "all3", "docstrings": [ - "`endsWithFrom(str, ending, len)` returns `true` if the first len characters of\n`str` end with `ending`, `false` otherwise. If `len` is greater than or equal\nto the length of `str`, then it works like `endsWith`.\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith) on MDN.\n\n## Examples\n\n```rescript\nString.endsWithFrom(\"abcd\", \"cd\", 4) == true\nString.endsWithFrom(\"abcde\", \"cd\", 3) == false\nString.endsWithFrom(\"abcde\", \"cde\", 99) == true\nString.endsWithFrom(\"example.dat\", \"ple\", 7) == true\n```" + "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" ], - "signature": "let endsWithFrom: (string, string, int) => bool" + "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" }, { - "id": "Core.String.includes", + "id": "Core.Promise.all4", "kind": "value", - "name": "includes", + "name": "all4", "docstrings": [ - "`includes(str, searchValue)` returns `true` if `searchValue` is found anywhere\nwithin `str`, `false` otherwise.\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) on MDN.\n\n## Examples\n\n```rescript\nString.includes(\"programmer\", \"gram\") == true\nString.includes(\"programmer\", \"er\") == true\nString.includes(\"programmer\", \"pro\") == true\nString.includes(\"programmer.dat\", \"xyz\") == false\n```" + "`all4((p1, p2, p3, p4))`. Like `all()`, but with a fixed size tuple of 4" ], - "signature": "let includes: (string, string) => bool" + "signature": "let all4: ((t<'a>, t<'b>, t<'c>, t<'d>)) => t<('a, 'b, 'c, 'd)>" }, { - "id": "Core.String.includesFrom", + "id": "Core.Promise.all5", "kind": "value", - "name": "includesFrom", + "name": "all5", "docstrings": [ - "`includesFrom(str, searchValue, start)` returns `true` if `searchValue` is found\nanywhere within `str` starting at character number `start` (where 0 is the\nfirst character), `false` otherwise.\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) on MDN.\n\n## Examples\n\n```rescript\nString.includesFrom(\"programmer\", \"gram\", 1) == true\nString.includesFrom(\"programmer\", \"gram\", 4) == false\nString.includesFrom(`대한민국`, `한`, 1) == true\n```" + "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" ], - "signature": "let includesFrom: (string, string, int) => bool" + "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" }, { - "id": "Core.String.indexOf", + "id": "Core.Promise.all6", "kind": "value", - "name": "indexOf", + "name": "all6", "docstrings": [ - "`indexOf(str, searchValue)` returns the position at which `searchValue` was\nfirst found within `str`, or `-1` if `searchValue` is not in `str`.\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) on MDN.\n\n## Examples\n\n```rescript\nString.indexOf(\"bookseller\", \"ok\") == 2\nString.indexOf(\"bookseller\", \"sell\") == 4\nString.indexOf(\"beekeeper\", \"ee\") == 1\nString.indexOf(\"bookseller\", \"xyz\") == -1\n```" + "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\n\")" ], - "signature": "let indexOf: (string, string) => int" + "signature": "let all6: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>),\n) => t<('a, 'b, 'c, 'd, 'e, 'f)>" }, { - "id": "Core.String.indexOfOpt", + "id": "Core.Promise.settledResult", + "kind": "type", + "name": "settledResult", + "docstrings": [], + "signature": "type settledResult<'a> =\n | Fulfilled({value: 'a})\n | Rejected({reason: exn})" + }, + { + "id": "Core.Promise.allSettled", "kind": "value", - "name": "indexOfOpt", + "name": "allSettled", "docstrings": [ - "`indexOfOpt(str, searchValue)`. Like `indexOf`, but return an `option`.\n\n## Examples\n\n```rescript\nString.indexOfOpt(\"bookseller\", \"ok\") == Some(2)\nString.indexOfOpt(\"bookseller\", \"xyz\") == None\n```" + "`allSettled(promises)` runs all promises concurrently and returns promise fulfills when all of the input's promises settle with an array of objects that describe the outcome of each promise. See [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) on MDN.\n\n```rescript\nopen Promise\n\nexception TestError(string)\n\nlet promises = [resolve(1), resolve(2), reject(TestError(\"some rejected promise\"))]\n\nallSettled(promises)\n->then((results) => {\n results->Array.forEach((result) => {\n switch result {\n | Fulfilled({value: num}) => \n Console.log2(\"Number: \", num)\n | Rejected({reason}) =>\n Console.log(reason)\n }\n })\n\n resolve()\n})\n->ignore\n```" ], - "signature": "let indexOfOpt: (string, string) => option" + "signature": "let allSettled: array> => t>>" }, { - "id": "Core.String.indexOfFrom", + "id": "Core.Promise.allSettled2", "kind": "value", - "name": "indexOfFrom", + "name": "allSettled2", "docstrings": [ - "`indexOfFrom(str, searchValue, start)` returns the position at which\n`searchValue` was found within `str` starting at character position `start`, or\n`-1` if `searchValue` is not found in that portion of `str`. The return value is\nrelative to the beginning of the string, no matter where the search started\nfrom.\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) on MDN.\n\n## Examples\n\n```rescript\nString.indexOfFrom(\"bookseller\", \"ok\", 1) == 2\nString.indexOfFrom(\"bookseller\", \"sell\", 2) == 4\nString.indexOfFrom(\"bookseller\", \"sell\", 5) == -1\n```" + "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" ], - "signature": "let indexOfFrom: (string, string, int) => int" + "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" }, { - "id": "Core.String.lastIndexOf", + "id": "Core.Promise.allSettled3", "kind": "value", - "name": "lastIndexOf", + "name": "allSettled3", "docstrings": [ - "`lastIndexOf(str, searchValue)` returns the position of the last occurrence of\n`searchValue` within `str`, searching backwards from the end of the string.\nReturns `-1` if `searchValue` is not in `str`. The return value is always\nrelative to the beginning of the string.\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) on MDN.\n\n## Examples\n\n```rescript\nString.lastIndexOf(\"bookseller\", \"ok\") == 2\nString.lastIndexOf(\"beekeeper\", \"ee\") == 4\nString.lastIndexOf(\"abcdefg\", \"xyz\") == -1\n```" + "`allSettled3((p1, p2, p3))`. Like `allSettled()`, but with a fixed size tuple of 3" ], - "signature": "let lastIndexOf: (string, string) => int" + "signature": "let allSettled3: (\n (t<'a>, t<'b>, t<'c>),\n) => t<\n (settledResult<'a>, settledResult<'b>, settledResult<'c>),\n>" }, { - "id": "Core.String.lastIndexOfOpt", + "id": "Core.Promise.allSettled4", "kind": "value", - "name": "lastIndexOfOpt", + "name": "allSettled4", "docstrings": [ - "`lastIndexOfOpt(str, searchValue)`. Like `lastIndexOfOpt`, but return an\n`option`.\n\n## Examples\n\n```rescript\nString.lastIndexOfOpt(\"bookseller\", \"ok\") == Some(2)\nString.lastIndexOfOpt(\"beekeeper\", \"ee\") == Some(4)\nString.lastIndexOfOpt(\"abcdefg\", \"xyz\") == None\n```" + "`allSettled4((p1, p2, p3, p4))`. Like `allSettled()`, but with a fixed size tuple of 4" ], - "signature": "let lastIndexOfOpt: (string, string) => option" + "signature": "let allSettled4: (\n (t<'a>, t<'b>, t<'c>, t<'d>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n ),\n>" }, { - "id": "Core.String.lastIndexOfFrom", + "id": "Core.Promise.allSettled5", "kind": "value", - "name": "lastIndexOfFrom", + "name": "allSettled5", "docstrings": [ - "`lastIndexOfFrom(str, searchValue, start)` returns the position of the last\noccurrence of `searchValue` within `str`, searching backwards from the given\nstart position. Returns `-1` if `searchValue` is not in `str`. The return value\nis always relative to the beginning of the string.\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf) on MDN.\n\n## Examples\n\n```rescript\nString.lastIndexOfFrom(\"bookseller\", \"ok\", 6) == 2\nString.lastIndexOfFrom(\"beekeeper\", \"ee\", 8) == 4\nString.lastIndexOfFrom(\"beekeeper\", \"ee\", 3) == 1\nString.lastIndexOfFrom(\"abcdefg\", \"xyz\", 4) == -1\n```" + "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" ], - "signature": "let lastIndexOfFrom: (string, string, int) => int" + "signature": "let allSettled5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n settledResult<'e>,\n ),\n>" }, { - "id": "Core.String.match", + "id": "Core.Promise.allSettled6", "kind": "value", - "name": "match", + "name": "allSettled6", "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([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```" + "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\n\")" ], - "signature": "let match: (string, Core__RegExp.t) => option" + "signature": "let allSettled6: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n settledResult<'e>,\n settledResult<'f>,\n ),\n>" }, { - "id": "Core.String.normalize", + "id": "Core.Promise.done", "kind": "value", - "name": "normalize", + "name": "done", "docstrings": [ - "`normalize(str)` returns the normalized Unicode string using Normalization Form\nCanonical (NFC) Composition. Consider the character ã, which can be represented\nas the single codepoint \\u00e3 or the combination of a lower case letter A\n\\u0061 and a combining tilde \\u0303. Normalization ensures that both can be\nstored in an equivalent binary representation.\nSee [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN.\nSee also [Unicode technical report #15](https://unicode.org/reports/tr15/) for details.\n\n## Examples\n\n```rescript\nlet string1 = \"\\uFB00\"\nlet string2 = \"\\u0066\\u0066\"\nConsole.log(string1 === string2) // false\n\nlet normalizeString1 = String.normalize(string1)\nlet normalizeString2 = String.normalize(string2)\nassert(normalizeString1 === normalizeString2)\n```" + "`done(p)` is a safe way to ignore a promise. If a value is anything else than a\npromise, it will raise a type error." ], - "signature": "let normalize: string => string" - }, + "signature": "let done: promise<'a> => unit" + } + ] + }, + "core/ordering": { + "id": "Core.Ordering", + "name": "Ordering", + "docstrings": [], + "items": [ { - "id": "Core.String.normalizeForm", + "id": "Core.Ordering.t", "kind": "type", - "name": "normalizeForm", - "docstrings": [ - "`normalizeByForm(str, form)` returns the normalized Unicode string using the\nspecified form of normalization, which may be one of:\n- \"NFC\" — Normalization Form Canonical Composition.\n- \"NFD\" — Normalization Form Canonical Decomposition.\n- \"NFKC\" — Normalization Form Compatibility Composition.\n- \"NFKD\" — Normalization Form Compatibility Decomposition.\nSee [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN.\nSee also [Unicode technical report #15](https://unicode.org/reports/tr15/) for\ndetails.\n\n## Examples\n\n```rescript\nlet string1 = \"\\uFB00\"\nlet string2 = \"\\u0066\\u0066\"\nConsole.log(string1 == string2) // false\n\nlet normalizeString1 = String.normalizeByForm(string1, #NFKD)\nlet normalizeString2 = String.normalizeByForm(string2, #NFKD)\nConsole.log(normalizeString1 == normalizeString2) // true\n```" - ], - "signature": "type normalizeForm = [#NFC | #NFD | #NFKC | #NFKD]" + "name": "t", + "docstrings": [], + "signature": "type t = float" }, { - "id": "Core.String.normalizeByForm", + "id": "Core.Ordering.less", "kind": "value", - "name": "normalizeByForm", + "name": "less", "docstrings": [], - "signature": "let normalizeByForm: (string, normalizeForm) => string" + "signature": "let less: float" }, { - "id": "Core.String.repeat", + "id": "Core.Ordering.equal", "kind": "value", - "name": "repeat", - "docstrings": [ - "`repeat(str, n)` returns a `string` that consists of `n` repetitions of `str`.\nSee [`String.repeat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) on MDN.\n\n## Examples\n\n```rescript\nString.repeat(\"ha\", 3) == \"hahaha\"\nString.repeat(\"empty\", 0) == \"\"\n```\n\n## Exceptions\n\n- `RangeError`: if `n` is negative." - ], - "signature": "let repeat: (string, int) => string" + "name": "equal", + "docstrings": [], + "signature": "let equal: float" }, { - "id": "Core.String.replace", + "id": "Core.Ordering.greater", "kind": "value", - "name": "replace", - "docstrings": [ - "`replace(str, substr, newSubstr)` returns a new `string` which is\nidentical to `str` except with the first matching instance of `substr` replaced\nby `newSubstr`. `substr` is treated as a verbatim string to match, not a\nregular expression.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nString.replace(\"old string\", \"old\", \"new\") == \"new string\"\nString.replace(\"the cat and the dog\", \"the\", \"this\") == \"this cat and the dog\"\n```" - ], - "signature": "let replace: (string, string, string) => string" + "name": "greater", + "docstrings": [], + "signature": "let greater: float" }, { - "id": "Core.String.replaceRegExp", + "id": "Core.Ordering.isLess", "kind": "value", - "name": "replaceRegExp", - "docstrings": [ - "`replaceRegExp(str, regex, replacement)` returns a new `string` where\noccurrences matching regex have been replaced by `replacement`.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nString.replaceRegExp(\"vowels be gone\", %re(\"/[aeiou]/g\"), \"x\") == \"vxwxls bx gxnx\"\nString.replaceRegExp(\"Juan Fulano\", %re(\"/(\\w+) (\\w+)/\"), \"$2, $1\") == \"Fulano, Juan\"\n```" - ], - "signature": "let replaceRegExp: (string, Core__RegExp.t, string) => string" + "name": "isLess", + "docstrings": [], + "signature": "let isLess: float => bool" }, { - "id": "Core.String.replaceAll", + "id": "Core.Ordering.isEqual", "kind": "value", - "name": "replaceAll", - "docstrings": [ - "`replaceAll(str, substr, newSubstr)` returns a new `string` which is\nidentical to `str` except with all matching instances of `substr` replaced\nby `newSubstr`. `substr` is treated as a verbatim string to match, not a\nregular expression.\nSee [`String.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) on MDN.\n\n## Examples\n\n```rescript\nString.replaceAll(\"old old string\", \"old\", \"new\") == \"new new string\"\nString.replaceAll(\"the cat and the dog\", \"the\", \"this\") == \"this cat and this dog\"\n```" - ], - "signature": "let replaceAll: (string, string, string) => string" + "name": "isEqual", + "docstrings": [], + "signature": "let isEqual: float => bool" }, { - "id": "Core.String.replaceAllRegExp", + "id": "Core.Ordering.isGreater", "kind": "value", - "name": "replaceAllRegExp", - "docstrings": [ - "`replaceAllRegExp(str, regex, replacement)` returns a new `string` where\nall occurrences matching regex have been replaced by `replacement`.\nThe pattern must include the global (`g`) flag or a runtime TypeError will be thrown.\nSee [`String.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) on MDN.\n\n## Examples\n\n```rescript\nString.replaceAllRegExp(\"vowels be gone\", %re(\"/[aeiou]/g\"), \"x\") == \"vxwxls bx gxnx\"\nString.replaceAllRegExp(\"aabbcc\", %re(\"/b/g\"), \".\") == \"aa..cc\"\n```" - ], - "signature": "let replaceAllRegExp: (string, Core__RegExp.t, string) => string" + "name": "isGreater", + "docstrings": [], + "signature": "let isGreater: float => bool" }, { - "id": "Core.String.unsafeReplaceRegExpBy0", - "kind": "value", - "name": "unsafeReplaceRegExpBy0", + "id": "Core.Ordering.invert", + "kind": "value", + "name": "invert", + "docstrings": [], + "signature": "let invert: float => float" + }, + { + "id": "Core.Ordering.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [], + "signature": "let fromInt: int => float" + } + ] + }, + "core/option": { + "id": "Core.Option", + "name": "Option", + "docstrings": [ + "We represent the existence and nonexistence of a value by wrapping it with\nthe `option` type. In order to make it a bit more convenient to work with\noption-types, we provide utility-functions for it.\n\nThe `option` type is a part of the ReScript standard library which is defined\nlike this:\n\n```rescript\ntype option<'a> = None | Some('a)\n```\n\n```rescript\nlet someString: option = Some(\"hello\")\n```" + ], + "items": [ + { + "id": "Core.Option.t", + "kind": "type", + "name": "t", "docstrings": [ - "`unsafeReplaceRegExpBy0(str, regex, f)` returns a new `string` with some or all\nmatches of a pattern with no capturing parentheses replaced by the value\nreturned from the given function. The function receives as its parameters the\nmatched string, the offset at which the match begins, and the whole string being\nmatched.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = %re(\"/[aeiou]/g\")\nlet matchFn = (~match, ~offset as _, ~input as _) => String.toUpperCase(match)\nString.unsafeReplaceRegExpBy0(str, re, matchFn) == \"bEAUtIfUl vOwEls\"\n```" + "Type representing an option of type 'a." ], - "signature": "let unsafeReplaceRegExpBy0: (\n string,\n Core__RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" + "signature": "type t<'a> = option<'a> = None | Some('a)" }, { - "id": "Core.String.unsafeReplaceRegExpBy1", + "id": "Core.Option.filter", "kind": "value", - "name": "unsafeReplaceRegExpBy1", + "name": "filter", "docstrings": [ - "`unsafeReplaceRegExpBy1(str, regexp, f)`. Like `unsafeReplaceRegExpBy0`, but `f`\nhas `group1` parameter.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = %re(\"/(Jony is )\\d+/g\")\nlet matchFn = (~match as _, ~group1, ~offset as _, ~input as _) => {\n group1 ++ \"41\"\n}\nString.unsafeReplaceRegExpBy1(str, re, matchFn) == \"Jony is 41\"\n```" + "`filter(opt, f)` applies `f` to `opt`, if `f` returns `true`, then it returns `Some(value)`, otherwise returns `None`.\n\n## Examples\n\n```rescript\nOption.filter(Some(10), x => x > 5) // Some(10)\nOption.filter(Some(4), x => x > 5) // None\nOption.filter(None, x => x > 5) // None\n```" ], - "signature": "let unsafeReplaceRegExpBy1: (\n string,\n Core__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" }, { - "id": "Core.String.unsafeReplaceRegExpBy2", + "id": "Core.Option.forEach", "kind": "value", - "name": "unsafeReplaceRegExpBy2", + "name": "forEach", "docstrings": [ - "`unsafeReplaceRegExpBy2(str, regexp, f)`. Like `unsafeReplaceRegExpBy1`, but `f`\nhas two group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = %re(\"/(\\d+) times (\\d+)/\")\nlet matchFn = (~match as _, ~group1, ~group2, ~offset as _, ~input as _) => {\n switch (Int.fromString(group1), Int.fromString(group2)) {\n | (Some(x), Some(y)) => Int.toString(x * y)\n | _ => \"???\"\n }\n}\nString.unsafeReplaceRegExpBy2(str, re, matchFn) == \"42\"\n```" + "`forEach(opt, f)` call `f` on `opt`. if `opt` is `Some(value)`, then if calls\n`f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nOption.forEach(Some(\"thing\"), x => Console.log(x)) // logs \"thing\"\nOption.forEach(None, x => Console.log(x)) // returns ()\n```" ], - "signature": "let unsafeReplaceRegExpBy2: (\n string,\n Core__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + "signature": "let forEach: (option<'a>, 'a => unit) => unit" }, { - "id": "Core.String.unsafeReplaceRegExpBy3", + "id": "Core.Option.getExn", "kind": "value", - "name": "unsafeReplaceRegExpBy3", + "name": "getExn", "docstrings": [ - "`unsafeReplaceRegExpBy3(str, regexp, f)`. Like `unsafeReplaceRegExpBy1`, but `f`\nhas three group parameters.\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) on MDN." + "`getExn(opt, ~message=?)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception with the message provided, or a generic message if no message was provided.\n\n```rescript\nOption.getExn(Some(3))->assertEqual(3)\n\nswitch Option.getExn(None) {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n\nswitch Option.getExn(None, ~message=\"was None!\") {\n| exception _ => assert(true) // Raises an Error with the message \"was None!\"\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an error if `opt` is `None`" ], - "signature": "let unsafeReplaceRegExpBy3: (\n string,\n Core__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~group3: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" }, { - "id": "Core.String.search", + "id": "Core.Option.getUnsafe", "kind": "value", - "name": "search", + "name": "getUnsafe", "docstrings": [ - "`search(str, regexp)` returns the starting position of the first match of\n`regexp` in the given `str`, or -1 if there is no match.\nSee [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search) on MDN.\n\n## Examples\n\n```rescript\nString.search(\"testing 1 2 3\", %re(\"/\\d+/\")) == 8\nString.search(\"no numbers\", %re(\"/\\d+/\")) == -1\n```" + "`getUnsafe(opt)` returns `value` if `opt` is `Some(value)`, otherwise `undefined`.\n\n## Examples\n\n```rescript\nOption.getUnsafe(Some(3)) == 3\nOption.getUnsafe(None: option) // Returns `undefined`, which is not a valid `int`\n```\n\n## Notes\n\n- This is an unsafe operation. It assumes `value` is not `None`, and may cause undefined behaviour if it is." ], - "signature": "let search: (string, Core__RegExp.t) => int" + "signature": "let getUnsafe: option<'a> => 'a" }, { - "id": "Core.String.searchOpt", + "id": "Core.Option.mapOr", "kind": "value", - "name": "searchOpt", + "name": "mapOr", "docstrings": [ - "`searchOpt(str, regexp)`. Like `search`, but return an `option`.\n\n## Examples\n\n```rescript\nString.searchOpt(\"testing 1 2 3\", %re(\"/\\d+/\")) == Some(8)\nString.searchOpt(\"no numbers\", %re(\"/\\d+/\")) == None\n```" + "`mapOr(opt, default, f)` returns `f(value)` if `opt` is `Some(value)`, otherwise `default`.\n\n## Examples\n\n```rescript\nlet someValue = Some(3)\nsomeValue->Option.mapOr(0, x => x + 5) // 8\n\nlet noneValue = None\nnoneValue->Option.mapOr(0, x => x + 5) // 0\n```" ], - "signature": "let searchOpt: (string, Core__RegExp.t) => option" + "signature": "let mapOr: (option<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Core.String.slice", + "id": "Core.Option.mapWithDefault", "kind": "value", - "name": "slice", - "docstrings": [ - "`slice(str, ~start, ~end)` returns the substring of `str` starting at\ncharacter `start` up to but not including `end`.\n- If either `start` or `end` is negative, then it is evaluated as\n`length(str - start)` or `length(str - end)`.\n- If `end` is greater than the length of `str`, then it is treated as\n`length(str)`.\n- If `start` is greater than `end`, slice returns the empty string.\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n## Examples\n\n```rescript\nString.slice(\"abcdefg\", ~start=2, ~end=5) == \"cde\"\nString.slice(\"abcdefg\", ~start=2, ~end=9) == \"cdefg\"\nString.slice(\"abcdefg\", ~start=-4, ~end=-2) == \"de\"\nString.slice(\"abcdefg\", ~start=5, ~end=1) == \"\"\n```" - ], - "signature": "let slice: (string, ~start: int, ~end: int) => string" + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Core.String.sliceToEnd", + "id": "Core.Option.map", "kind": "value", - "name": "sliceToEnd", + "name": "map", "docstrings": [ - "`sliceToEnd(str, ~start)` returns the substring of `str` starting at character\n`start` to the end of the string.\n- If `start` is negative, then it is evaluated as `length(str - start)`.\n- If `start` is greater than the length of `str`, then sliceToEnd returns the empty string.\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n## Examples\n\n```rescript\nString.sliceToEnd(\"abcdefg\", ~start=4) == \"efg\"\nString.sliceToEnd(\"abcdefg\", ~start=-2) == \"fg\"\nString.sliceToEnd(\"abcdefg\", ~start=7) == \"\"\n```" + "`map(opt, f)` returns `Some(f(value))` if `opt` is `Some(value)`, otherwise `None`.\n\n## Examples\n\n```rescript\nOption.map(Some(3), x => x * x) // Some(9)\nOption.map(None, x => x * x) // None\n```" ], - "signature": "let sliceToEnd: (string, ~start: int) => string" + "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" }, { - "id": "Core.String.split", + "id": "Core.Option.flatMap", "kind": "value", - "name": "split", + "name": "flatMap", "docstrings": [ - "`split(str, delimiter)` splits the given `str` at every occurrence of\n`delimiter` and returns an array of the resulting substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.split(\"2018-01-02\", \"-\") == [\"2018\", \"01\", \"02\"]\nString.split(\"a,b,,c\", \",\") == [\"a\", \"b\", \"\", \"c\"]\nString.split(\"good::bad as great::awful\", \"::\") == [\"good\", \"bad as great\", \"awful\"]\nString.split(\"has-no-delimiter\", \";\") == [\"has-no-delimiter\"]\n```" + "`flatMap(opt, f)` returns `f(value)` if `opt` is `Some(value)`, otherwise `None`.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Some(value + 1)\n } else {\n None\n }\n\nOption.flatMap(Some(2), addIfAboveOne) // Some(3)\nOption.flatMap(Some(-4), addIfAboveOne) // None\nOption.flatMap(None, addIfAboveOne) // None\n```" ], - "signature": "let split: (string, string) => array" + "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" }, { - "id": "Core.String.splitAtMost", + "id": "Core.Option.getOr", "kind": "value", - "name": "splitAtMost", + "name": "getOr", "docstrings": [ - "`splitAtMost(str, delimiter, ~limit)` splits the given `str` at every\noccurrence of `delimiter` and returns an array of the first `limit` resulting\nsubstrings. If `limit` is negative or greater than the number of substrings,\nthe array will contain all the substrings.\n\n## Examples\n\n```rescript\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=3) == [\"ant\", \"bee\", \"cat\"]\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=0) == []\nString.splitAtMost(\"ant/bee/cat/dog/elk\", \"/\", ~limit=9) == [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n```" + "`getOr(opt, default)` returns `value` if `opt` is `Some(value)`, otherwise `default`.\n\n## Examples\n\n```rescript\nOption.getOr(None, \"Banana\") // Banana\nOption.getOr(Some(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nSome(\"Jane\")->greet // \"Greetings Jane\"\nNone->greet // \"Greetings Anonymous\"\n```" ], - "signature": "let splitAtMost: (string, string, ~limit: int) => array" + "signature": "let getOr: (option<'a>, 'a) => 'a" }, { - "id": "Core.String.splitByRegExp", + "id": "Core.Option.getWithDefault", "kind": "value", - "name": "splitByRegExp", - "docstrings": [ - "`splitByRegExp(str, regexp)` splits the given `str` at every occurrence of\n`regexp` and returns an array of the resulting substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.splitByRegExp(\"Jan,Feb,Mar\", %re(\"/,/\")) == [Some(\"Jan\"), Some(\"Feb\"), Some(\"Mar\")]\n```" - ], - "signature": "let splitByRegExp: (string, Core__RegExp.t) => array>" + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (option<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Core.String.splitByRegExpAtMost", + "id": "Core.Option.orElse", "kind": "value", - "name": "splitByRegExpAtMost", + "name": "orElse", "docstrings": [ - "`splitByRegExpAtMost(str, regexp, ~limit)` splits the given `str` at every\noccurrence of `regexp` and returns an array of the first `limit` resulting\nsubstrings. If `limit` is negative or greater than the number of substrings, the\narray will contain all the substrings.\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on MDN.\n\n## Examples\n\n```rescript\nString.splitByRegExpAtMost(\"Hello World. How are you doing?\", %re(\"/ /\"), ~limit=3) == [\n Some(\"Hello\"),\n Some(\"World.\"),\n Some(\"How\"),\n]\n```" + "`orElse(opt1, opt2)` returns `opt2` if `opt1` is `None`, otherwise `opt1`.\n\n## Examples\n\n```rescript\nOption.orElse(Some(1812), Some(1066)) == Some(1812)\nOption.orElse(None, Some(1066)) == Some(1066)\nOption.orElse(None, None) == None\n```" ], - "signature": "let splitByRegExpAtMost: (\n string,\n Core__RegExp.t,\n ~limit: int,\n) => array>" + "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" }, { - "id": "Core.String.startsWith", + "id": "Core.Option.isSome", "kind": "value", - "name": "startsWith", + "name": "isSome", "docstrings": [ - "`startsWith(str, substr)` returns `true` if the `str` starts with `substr`,\n`false` otherwise.\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN.\n\n## Examples\n\n```rescript\nString.startsWith(\"BuckleScript\", \"Buckle\") == true\nString.startsWith(\"BuckleScript\", \"\") == true\nString.startsWith(\"JavaScript\", \"Buckle\") == false\n```" + "`isSome(opt)` returns `true` if `opt` is `Some(value)`, otherwise returns `false`.\n\n## Examples\n\n```rescript\nOption.isSome(None) // false\nOption.isSome(Some(1)) // true\n```" ], - "signature": "let startsWith: (string, string) => bool" + "signature": "let isSome: option<'a> => bool" }, { - "id": "Core.String.startsWithFrom", + "id": "Core.Option.isNone", "kind": "value", - "name": "startsWithFrom", + "name": "isNone", "docstrings": [ - "`startsWithFrom(str, substr, n)` returns `true` if the `str` starts\nwith `substr` starting at position `n`, `false` otherwise. If `n` is negative,\nthe search starts at the beginning of `str`.\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN.\n\n## Examples\n\n```rescript\nString.startsWithFrom(\"BuckleScript\", \"kle\", 3) == true\nString.startsWithFrom(\"BuckleScript\", \"\", 3) == true\nString.startsWithFrom(\"JavaScript\", \"Buckle\", 2) == false\n```" + "`isNone(opt)` returns `true` if `opt` is `None`, false otherwise.\n\n## Examples\n\n```rescript\nOption.isNone(None) // true\nOption.isNone(Some(1)) // false\n```" ], - "signature": "let startsWithFrom: (string, string, int) => bool" + "signature": "let isNone: option<'a> => bool" }, { - "id": "Core.String.substring", + "id": "Core.Option.equal", "kind": "value", - "name": "substring", + "name": "equal", "docstrings": [ - "`substring(str, ~start, ~end)` returns characters `start` up to but not\nincluding end from `str`.\n- If `start` is less than zero, it is treated as zero.\n- If `end` is zero or negative, the empty string is returned.\n- If `start` is greater than `end`, the `start` and `end` points are swapped.\nSee [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN.\n\n## Examples\n\n```rescript\nString.substring(\"playground\", ~start=3, ~end=6) == \"ygr\"\nString.substring(\"playground\", ~start=6, ~end=3) == \"ygr\"\nString.substring(\"playground\", ~start=4, ~end=12) == \"ground\"\n```" + "`equal(opt1, opt2, f)` evaluates two optional values for equality with respect to a predicate function `f`. If both `opt1` and `opt2` are `None`, returns `true`.\nIf one of the arguments is `Some(value)` and the other is `None`, returns\n`false`.\nIf arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`f(value1, value2)`, the predicate function `f` must return a bool.\n\n## Examples\n\n```rescript\nlet clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\nopen Option\n\nequal(Some(3), Some(15), clockEqual) // true\nequal(Some(3), None, clockEqual) // false\nequal(None, Some(3), clockEqual) // false\nequal(None, None, clockEqual) // true\n```" ], - "signature": "let substring: (string, ~start: int, ~end: int) => string" + "signature": "let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Core.String.substringToEnd", + "id": "Core.Option.compare", "kind": "value", - "name": "substringToEnd", + "name": "compare", "docstrings": [ - "`substringToEnd(str, ~start)` returns the substring of `str` from position\n`start` to the end.\n- If `start` is less than or equal to zero, the entire string is returned.\n- If `start` is greater than or equal to the length of `str`, the empty string\nis returned.\nSee [`String.substring`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) on MDN.\n\n## Examples\n\n```rescript\nString.substringToEnd(\"playground\", ~start=4) == \"ground\"\nString.substringToEnd(\"playground\", ~start=-3) == \"playground\"\nString.substringToEnd(\"playground\", ~start=12) == \"\"\n```" + "`compare(opt1, opt2, f)` compares two optional values with respect to given `f`.\n\nIf both `opt1` and `opt2` are `None`, it returns `0.`. If the first argument is `Some(value1)` and the second is `None`, returns `1.` (something is greater than nothing).\n\nIf the first argument is `None` and the second is `Some(value2)`, returns `-1.`\n(nothing is less than something).\n\nIf the arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`f(value1, value2)`, `f` takes two arguments and returns `-1.` if the first\nargument is less than the second, `0.` if the arguments are equal, and `1.` if\nthe first argument is greater than the second.\n\n## Examples\n\n```rescript\nlet clockCompare = (a, b) => Int.compare(mod(a, 12), mod(b, 12))\n\nOption.compare(Some(3), Some(15), clockCompare) // 0.\nOption.compare(Some(3), Some(14), clockCompare) // 1.\nOption.compare(Some(2), Some(15), clockCompare) // (-1.)\nOption.compare(None, Some(15), clockCompare) // (-1.)\nOption.compare(Some(14), None, clockCompare) // 1.\nOption.compare(None, None, clockCompare) // 0.\n```" ], - "signature": "let substringToEnd: (string, ~start: int) => string" + "signature": "let compare: (\n option<'a>,\n option<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Core.String.toLowerCase", + "id": "Core.Option.all", "kind": "value", - "name": "toLowerCase", + "name": "all", "docstrings": [ - "`toLowerCase(str)` converts `str` to lower case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\ngive different results depending upon context, for example with the Greek\nletter sigma, which has two different lower case forms, one when it is the last\ncharacter in a string and another when it is not.\nSee [`String.toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) on MDN.\n\n## Examples\n\n```rescript\nString.toLowerCase(\"ABC\") == \"abc\"\nString.toLowerCase(`ΣΠ`) == `σπ`\nString.toLowerCase(`ΠΣ`) == `πς`\n```" + "`all(options)` returns an option of array if all options are Some, otherwise returns None.\n\n## Examples\n\n```rescript\nOption.all([Some(1), Some(2), Some(3)]) // Some([1, 2, 3])\nOption.all([Some(1), None]) // None\n```" ], - "signature": "let toLowerCase: string => string" + "signature": "let all: array> => option>" }, { - "id": "Core.String.toLocaleLowerCase", + "id": "Core.Option.all2", "kind": "value", - "name": "toLocaleLowerCase", + "name": "all2", "docstrings": [ - "`toLocaleLowerCase(str)` converts `str` to lower case using the current locale.\nSee [`String.toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase) on MDN." + "`all2((o1, o2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let toLocaleLowerCase: string => string" + "signature": "let all2: ((option<'a>, option<'b>)) => option<('a, 'b)>" }, { - "id": "Core.String.toUpperCase", + "id": "Core.Option.all3", "kind": "value", - "name": "toUpperCase", + "name": "all3", "docstrings": [ - "`toUpperCase(str)` converts `str` to upper case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\nexpand the number of letters in the result, for example the German ß\ncapitalizes to two Ses in a row.\nSee [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) on MDN.\n\n## Examples\n\n```rescript\nString.toUpperCase(\"abc\") == \"ABC\"\nString.toUpperCase(`Straße`) == `STRASSE`\nString.toUpperCase(`πς`) == `ΠΣ`\n```" + "`all3((o1, o2, o3))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let toUpperCase: string => string" + "signature": "let all3: (\n (option<'a>, option<'b>, option<'c>),\n) => option<('a, 'b, 'c)>" }, { - "id": "Core.String.toLocaleUpperCase", + "id": "Core.Option.all4", "kind": "value", - "name": "toLocaleUpperCase", + "name": "all4", "docstrings": [ - "`toLocaleUpperCase(str)` converts `str` to upper case using the current locale.\nSee [`String.toLocaleUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase) on MDN." + "`all4((o1, o2, o3, o4))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let toLocaleUpperCase: string => string" + "signature": "let all4: (\n (option<'a>, option<'b>, option<'c>, option<'d>),\n) => option<('a, 'b, 'c, 'd)>" }, { - "id": "Core.String.trim", + "id": "Core.Option.all5", "kind": "value", - "name": "trim", + "name": "all5", "docstrings": [ - "`trim(str)` returns a string that is `str` with whitespace stripped from both\nends. Internal whitespace is not removed.\nSee [`String.trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim) on MDN.\n\n## Examples\n\n```rescript\nString.trim(\" abc def \") == \"abc def\"\nString.trim(\"\\n\\r\\t abc def \\n\\n\\t\\r \") == \"abc def\"\n```" + "`all5((o1, o2, o3, o4, o5))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let trim: string => string" + "signature": "let all5: (\n (\n option<'a>,\n option<'b>,\n option<'c>,\n option<'d>,\n option<'e>,\n ),\n) => option<('a, 'b, 'c, 'd, 'e)>" }, { - "id": "Core.String.trimStart", + "id": "Core.Option.all6", "kind": "value", - "name": "trimStart", + "name": "all6", "docstrings": [ - "`trimStart(str)` returns a string that is `str` with whitespace stripped from\nthe beginning of a string. Internal whitespace is not removed.\nSee [`String.trimStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart) on MDN.\n\n## Examples\n\n```rescript\nString.trimStart(\" Hello world! \") == \"Hello world! \"\nString.trimStart(\" Hello world! \") == \"Hello world! \"\n```" + "`all6((o1, o2, o3, o4, o5, o6))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let trimStart: string => string" - }, + "signature": "let all6: (\n (\n option<'a>,\n option<'b>,\n option<'c>,\n option<'d>,\n option<'e>,\n option<'f>,\n ),\n) => option<('a, 'b, 'c, 'd, 'e, 'f)>" + } + ] + }, + "core/object": { + "id": "Core.Object", + "name": "Object", + "docstrings": [], + "items": [ { - "id": "Core.String.trimEnd", + "id": "Core.Object.make", "kind": "value", - "name": "trimEnd", + "name": "make", "docstrings": [ - "`trinEnd(str)` returns a string that is `str` with whitespace stripped from the\nend of a string. Internal whitespace is not removed.\nSee [`String.trimEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd) on MDN.\n\n## Examples\n\n```rescript\nString.trimEnd(\" Hello world! \") == \" Hello world!\"\nString.trimEnd(\" Hello world! \") == \" Hello world!\"\n```" + "`make` create a new object that inherits the properties and methods from the standard built-in Object, such as `toString`. See [Object on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n## Examples\n\n```rescript\nlet x = Object.make()\nx->Object.keysToArray->Array.length // 0\nx->Object.get(\"toString\")->Option.isSome // true\n```" ], - "signature": "let trimEnd: string => string" + "signature": "let make: unit => {..}" }, { - "id": "Core.String.padStart", + "id": "Core.Object.is", "kind": "value", - "name": "padStart", + "name": "is", "docstrings": [ - "`padStart(str, n, padStr)` returns a string that has been padded with `padStr`\n(multiple times, if needed) until the resulting string reaches the given `n`\nlength. The padding is applied from the start of the current string.\nSee [`String.padStart`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart) on MDN.\n\n## Examples\n\n```rescript\nString.padStart(\"abc\", 5, \" \") == \" abc\"\nString.padStart(\"abc\", 6, \"123465\") == \"123abc\"\n```" + "`is` determines if two objects are identical in all contexts. Objects, arrays, records, and other non-primitives are only identical if they reference the **exact** same object in memory. Primitives like ints, floats, and strings are identical if they have the same value. `+0` and `-0` are distinct. NaN is equal to itself. See [Object.is on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)\n\nIn most scenarios use `==` or `===` or the custom `equals` function (if provided) for the type.\n\n## Examples\n\n```rescript\nObject.is(25, 13) // false\nObject.is(\"abc\", \"abc\") // true\nObject.is(undefined, undefined) // true\nObject.is(undefined, null) // false\nObject.is(-0.0, 0.0) // false\nObject.is(list{1, 2}, list{1, 2}) // false\n\nObject.is([1, 2, 3], [1, 2, 3]) // false\n[1, 2, 3] == [1, 2, 3] // true\n[1, 2, 3] === [1, 2, 3] // false\n\nlet fruit = {\"name\": \"Apple\" }\nObject.is(fruit, fruit) // true\nObject.is(fruit, {\"name\": \"Apple\" }) // false\nfruit == {\"name\": \"Apple\" } // true\nfruit === {\"name\": \"Apple\" } // false\n```" ], - "signature": "let padStart: (string, int, string) => string" + "signature": "let is: ('a, 'a) => bool" }, { - "id": "Core.String.padEnd", + "id": "Core.Object.create", "kind": "value", - "name": "padEnd", + "name": "create", "docstrings": [ - "`padEnd(str, n, padStr)` returns a string that has been padded with `padStr`\n(multiple times, if needed) until the resulting string reaches the given `n`\nlength. The padding is applied from the end of the current string.\nSee [`String.padEnd`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd) on MDN.\n\n## Examples\n\n```rescript\nString.padEnd(\"Hello\", 10, \".\") == \"Hello.....\"\nString.padEnd(\"abc\", 1, \"\") == \"abc\"\n```" + "`create` creates a new object, using an existing object as the prototype of the new object. See [Object.create on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\n\n**Note:** ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object) and [records](https://rescript-lang.org/docs/manual/latest/record). This is often safer and more convenient than using `create` and other functions in this module.\n\n## Examples\n\n```rescript\nlet x = {\"fruit\": \"banana\"}\nlet y = Object.create(x)\ny->Object.get(\"fruit\") // Some(\"banana\")\n```" ], - "signature": "let padEnd: (string, int, string) => string" + "signature": "let create: {..} => {..}" }, { - "id": "Core.String.getSymbol", + "id": "Core.Object.createWithProperties", "kind": "value", - "name": "getSymbol", + "name": "createWithProperties", "docstrings": [], - "signature": "let getSymbol: (string, Core__Symbol.t) => option<'a>" + "signature": "let createWithProperties: ({..}, {..}) => {..}" }, { - "id": "Core.String.getSymbolUnsafe", + "id": "Core.Object.createWithNull", "kind": "value", - "name": "getSymbolUnsafe", + "name": "createWithNull", "docstrings": [], - "signature": "let getSymbolUnsafe: (string, Core__Symbol.t) => 'a" + "signature": "let createWithNull: unit => {..}" }, { - "id": "Core.String.setSymbol", + "id": "Core.Object.createWithNullAndProperties", "kind": "value", - "name": "setSymbol", + "name": "createWithNullAndProperties", "docstrings": [], - "signature": "let setSymbol: (string, Core__Symbol.t, 'a) => unit" + "signature": "let createWithNullAndProperties: {..} => {..}" }, { - "id": "Core.String.localeCompare", + "id": "Core.Object.assign", "kind": "value", - "name": "localeCompare", + "name": "assign", "docstrings": [ - "`localeCompare(referenceStr, compareStr)` returns a float than indicatings\nwhether a reference string comes before or after, or is the same as the given\nstring in sort order. If `referenceStr` occurs before `compareStr` positive if\nthe `referenceStr` occurs after `compareStr`, `0` if they are equivalent.\nDo not rely on exact return values of `-1` or `1`\nSee [`String.localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare) on MDN.\n\n## Examples\n\n```rescript\nString.localeCompare(\"a\", \"c\") < 0.0 == true\nString.localeCompare(\"a\", \"a\") == 0.0\n```" + "`assign(target, source)` copies enumerable own properties from the source to the target, overwriting properties with the same name. It returns the modified target object. A deep clone is not created; properties are copied by reference.\n\n**Warning:** ReScript provides compile-time support for type-safe access to JavaScript objects. This eliminates common errors such as accessing properties that do not exist, or using a property of type x as if it were a y. Using `assign` can bypass these safety checks and lead to run-time errors (if you are not careful). ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object) and [records](https://rescript-lang.org/docs/manual/latest/record). This is often safer and more convenient than using `assign` and other functions in this module.\n\nSee [Object.assign on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) or [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign).\n\n## Examples\n\n```rescript\nObject.assign({\"a\": 1}, {\"a\": 2}) // {\"a\": 2}\nObject.assign({\"a\": 1, \"b\": 2}, {\"a\": 0}) // {\"a\": 0, \"b\": 2}\nObject.assign({\"a\": 1}, {\"a\": null}) // {\"a\": null}\n```" ], - "signature": "let localeCompare: (string, string) => float" - } - ] - }, - "core/regexp": { - "id": "Core.RegExp", - "name": "RegExp", - "docstrings": [ - "Functions for handling RegExp's in ReScript.\n\nSee [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) on MDN." - ], - "items": [ + "signature": "let assign: ({..}, {..}) => {..}" + }, { - "id": "Core.RegExp.t", - "kind": "type", - "name": "t", + "id": "Core.Object.assignMany", + "kind": "value", + "name": "assignMany", "docstrings": [ - "Type representing an instantiated `RegExp`." + "`assignMany(target, sources)` copies enumerable own properties from each source to the target, overwriting properties with the same name. Later sources' properties overwrite earlier ones. It returns the modified target object. A deep clone is not created; properties are copied by reference.\n\n**Note:** ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object), including spreading one object into another. This is often more convenient than using `assign` or `assignMany`. \n\nSee [Object.assign on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) or [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign)." ], - "signature": "type t = Js.Re.t" + "signature": "let assignMany: ({..}, array<{..}>) => {..}" }, { - "id": "Core.RegExp.fromString", + "id": "Core.Object.copy", "kind": "value", - "name": "fromString", + "name": "copy", + "docstrings": [], + "signature": "let copy: ({..} as 'a) => 'a" + }, + { + "id": "Core.Object.get", + "kind": "value", + "name": "get", "docstrings": [ - "`fromString(string)` creates a `RegExp.t` from the provided string. This can then be used to match on strings using `RegExp.exec`.\n\nSee [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" + "`get` gets the value of a property by name. Returns `None` if the property does not exist or has the value `undefined`. Otherwise returns `Some`, including if the value is `null`.\n\n## Examples\n\n```rescript\n{\"a\": 1}->Object.get(\"a\") // Some(1)\n{\"a\": 1}->Object.get(\"b\") // None\n{\"a\": undefined}->Object.get(\"a\") // None\n{\"a\": null}->Object.get(\"a\") // Some(null)\n{\"a\": 1}->Object.get(\"toString\")->Option.isSome // true\n```" ], - "signature": "let fromString: string => t" + "signature": "let get: ({..}, string) => option<'a>" }, { - "id": "Core.RegExp.fromStringWithFlags", + "id": "Core.Object.getSymbol", "kind": "value", - "name": "fromStringWithFlags", + "name": "getSymbol", "docstrings": [ - "`fromStringWithFlags(string)` creates a `RegExp.t` from the provided string, using the provided `flags`. This can then be used to match on strings using `RegExp.exec`.\n\nSee [`RegExp parameters`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp#parameters) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" + "`getSymbol` gets the value of a property by symbol. Returns `None` if the property does not exist or has the value `undefined`. Otherwise returns `Some`, including if the value is `null`.\n\n## Examples\n\n```rescript\nlet fruit = Symbol.make(\"fruit\")\nlet x = Object.make()\nx->Object.setSymbol(fruit, \"banana\")\nx->Object.getSymbol(fruit) // Some(\"banana\")\n```" ], - "signature": "let fromStringWithFlags: (string, ~flags: string) => t" + "signature": "let getSymbol: ({..}, Symbol.t) => option<'a>" }, { - "id": "Core.RegExp.test", + "id": "Core.Object.getSymbolUnsafe", "kind": "value", - "name": "test", - "docstrings": [ - "`test(regexp, string)` tests whether the provided `regexp` matches on the provided string.\n\nSee [`RegExp.test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nif regexp->RegExp.test(\"ReScript is cool!\") {\n Console.log(\"Yay, there's a word in there.\")\n}\n```" - ], - "signature": "let test: (t, string) => bool" + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: ({..}, Symbol.t) => 'a" }, { - "id": "Core.RegExp.exec", + "id": "Core.Object.set", "kind": "value", - "name": "exec", + "name": "set", "docstrings": [ - "`exec(regexp, string)` executes the provided regexp on the provided string, optionally returning a `RegExp.Result.t` if the regexp matches on the string.\n\nSee [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\n\nswitch regexp->RegExp.exec(\"ReScript is pretty cool, right?\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"ReScript\"\n}\n```" + "`set(name, value)` assigns a value to the named object property, overwriting the previous value if any. See [Working with Objects on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#objects_and_properties)\n\n## Examples\n\n```rescript\n{\"a\": 1}->Object.set(\"a\", 2) // {\"a\": 2}\n{\"a\": 1}->Object.set(\"a\", None) // {\"a\": None}\n{\"a\": 1}->Object.set(\"b\", 2) // {\"a\": 1, \"b\": 2}\n```" ], - "signature": "let exec: (t, string) => option" + "signature": "let set: ({..}, string, 'a) => unit" }, { - "id": "Core.RegExp.lastIndex", + "id": "Core.Object.setSymbol", "kind": "value", - "name": "lastIndex", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: ({..}, Symbol.t, 'a) => unit" + }, + { + "id": "Core.Object.keysToArray", + "kind": "value", + "name": "keysToArray", "docstrings": [ - "`lastIndex(regexp)` returns 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\nConsole.log(regexp->RegExp.lastIndex) // Logs `0` to the console\n\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `4` to the console\n```" + "`keysToArray` returns an array of an object's own enumerable string-keyed property names. See [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.keys) \nor [Object.keys on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys).\n\n## Examples\n\n```rescript\n{\"a\": 1, \"b\": 2}->Object.keysToArray // [\"a\", \"b\"]\n{\"a\": None}->Object.keysToArray // [\"a\"]\nObject.make()->Object.keysToArray // []\n```" ], - "signature": "let lastIndex: t => int" + "signature": "let keysToArray: {..} => array" }, { - "id": "Core.RegExp.setLastIndex", + "id": "Core.Object.hasOwnProperty", "kind": "value", - "name": "setLastIndex", + "name": "hasOwnProperty", "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```" + "`hasOwnProperty` determines whether the object has the specified property as its **own** property, as opposed to inheriting it. See [hasOwnProperty on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 2}\n{\"a\": 1}->Object.hasOwnProperty(\"a\") // true\n{\"a\": 1}->Object.hasOwnProperty(\"b\") // false\n{\"a\": 1}->Object.hasOwnProperty(\"toString\") // false\n```" ], - "signature": "let setLastIndex: (t, int) => unit" + "signature": "let hasOwnProperty: ({..}, string) => bool" }, { - "id": "Core.RegExp.ignoreCase", + "id": "Core.Object.seal", "kind": "value", - "name": "ignoreCase", + "name": "seal", "docstrings": [ - "`ignoreCase(regexp)` returns whether the ignore case (`i`) flag is set on this `RegExp`.\n\nSee [`RegExp.ignoreCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/ignoreCase) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.ignoreCase) // Logs `false`, since `i` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"i\")\nConsole.log(regexp2->RegExp.ignoreCase) // Logs `true`, since `i` is set\n```" + "`seal` seals an object. Sealing an object prevents extensions and makes existing properties non-configurable. A sealed object has a fixed set of properties. Unlike `freeze`, values of existing properties can still be changed as long as they are writable. \n\n**Note:** `seal` returns the same object that was passed in; it does not create a copy. Any attempt to delete or add properties to a sealed object will fail, either silently or by throwing an error. \n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.seal) and [Object.seal on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 2}\npoint->Object.set(\"x\", -7) // succeeds\npoint->Object.seal->ignore\n\ntry {\n point->Object.set(\"z\", 9) // fails\n} catch {\n| Exn.Error(_) => assert(true)\n| _ => assert(false)\n}\n\npoint->Object.set(\"x\", 13) // succeeds\n```" ], - "signature": "let ignoreCase: t => bool" + "signature": "let seal: ({..} as 'a) => 'a" }, { - "id": "Core.RegExp.global", + "id": "Core.Object.preventExtensions", "kind": "value", - "name": "global", + "name": "preventExtensions", "docstrings": [ - "`global(regexp)` returns whether the global (`g`) flag is set on this `RegExp`.\n\nSee [`RegExp.global`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.global) // Logs `true`, since `g` is set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"i\")\nConsole.log(regexp2->RegExp.global) // Logs `false`, since `g` is not set\n```" + "`preventExtensions` prevents new properties from being added to the object. It modifies the object (rather than creating a copy) and returns it.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.preventextensions) and [Object.preventExtensions on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions)\n\n## Examples\n\n```rescript\nlet obj = {\"a\": 1}\nobj->Object.set(\"b\", 2) // succeeds\nobj->Object.preventExtensions->ignore\ntry {\n obj->Object.set(\"c\", 3) // fails\n} catch {\n| Exn.Error(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let global: t => bool" + "signature": "let preventExtensions: ({..} as 'a) => 'a" }, { - "id": "Core.RegExp.multiline", + "id": "Core.Object.freeze", "kind": "value", - "name": "multiline", + "name": "freeze", "docstrings": [ - "`multiline(regexp)` returns whether the multiline (`m`) flag is set on this `RegExp`.\n\nSee [`RegExp.multiline`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.multiline) // Logs `false`, since `m` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"mi\")\nConsole.log(regexp2->RegExp.multiline) // Logs `true`, since `m` is set\n```" + "`freeze` freezes an object. Freezing an object makes existing properties non-writable and prevents extensions. Once an object is frozen, new properties cannot be be added, existing properties cannot be removed, and their values cannot be changed.\n\n**Note:** `freeze` returns the same object that was passed in; it does not create a frozen copy. Any attempt to change a frozen object will fail, either silently or by throwing an exception.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).\n\n## Examples\n\n```rescript\nlet obj = {\"a\": 1}\nobj->Object.set(\"a\", 2) // succeeds\nobj->Object.freeze->ignore\n\ntry {\n obj->Object.set(\"a\", 3) // fails\n} catch {\n| Exn.Error(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let multiline: t => bool" + "signature": "let freeze: ({..} as 'a) => 'a" }, { - "id": "Core.RegExp.source", + "id": "Core.Object.isSealed", "kind": "value", - "name": "source", + "name": "isSealed", "docstrings": [ - "`source(regexp)` returns the source text for this `RegExp`, without the two forward slashes (if present), and without any set flags.\n\nSee [`RegExp.source`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source) on MDN.\n\n## Examples\n```rescript\nlet regexp = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp->RegExp.source) // Logs `\\w+`, the source text of the `RegExp`\n```" + "`isSealed` determines if an object is sealed. A sealed object has a fixed set of properties.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.issealed) and [Object.isSealed on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 3}->Object.seal\nlet pointIsSealed = point->Object.isSealed // true\nlet fruit = {\"name\": \"Apple\" }\nlet fruitIsSealed = fruit->Object.isSealed // false\n ```" ], - "signature": "let source: t => string" + "signature": "let isSealed: 'a => bool" }, { - "id": "Core.RegExp.sticky", + "id": "Core.Object.isFrozen", "kind": "value", - "name": "sticky", + "name": "isFrozen", "docstrings": [ - "`sticky(regexp)` returns whether the sticky (`y`) flag is set on this `RegExp`.\n\nSee [`RegExp.sticky`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.unicode) // Logs `false`, since `y` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"my\")\nConsole.log(regexp2->RegExp.unicode) // Logs `true`, since `y` is set\n```" + "`isFrozen` determines if an object is frozen. An object is frozen if an only if it is not extensible, all its properties are non-configurable, and all its data properties are non-writable.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 3}->Object.freeze\nlet pointIsFrozen = point->Object.isFrozen // true\nlet fruit = {\"name\": \"Apple\" }\nlet fruitIsFrozen = fruit->Object.isFrozen // false\n ```" ], - "signature": "let sticky: t => bool" + "signature": "let isFrozen: 'a => bool" }, { - "id": "Core.RegExp.unicode", + "id": "Core.Object.isExtensible", "kind": "value", - "name": "unicode", + "name": "isExtensible", "docstrings": [ - "`unicode(regexp)` returns whether the unicode (`y`) flag is set on this `RegExp`.\n\nSee [`RegExp.unicode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode) on MDN.\n\n## Examples\n```rescript\nlet regexp1 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"g\")\nConsole.log(regexp1->RegExp.unicode) // Logs `false`, since `u` is not set\n\nlet regexp2 = RegExp.fromStringWithFlags(\"\\\\w+\", ~flags=\"mu\")\nConsole.log(regexp2->RegExp.unicode) // Logs `true`, since `u` is set\n```" + "`isExtensible` determines if an object is extensible (whether it can have new properties added to it).\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isextensible) and [Object.isExtensible on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible)\n\n## Examples\n\n```rescript\nlet obj = {\"a\": 1}\nobj->Object.isExtensible // true\nobj->Object.preventExtensions->ignore\nobj->Object.isExtensible // false\n```" ], - "signature": "let unicode: t => bool" + "signature": "let isExtensible: 'a => bool" } ] }, - "core/promise": { - "id": "Core.Promise", - "name": "Promise", + "core/nullable": { + "id": "Core.Nullable", + "name": "Nullable", "docstrings": [ - "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." + "Functions for handling nullable values.\n\nPrimarily useful when interoping with JavaScript when you don't know whether you'll get a value, `null` or `undefined`." ], "items": [ { - "id": "Core.Promise.t", + "id": "Core.Nullable.t", "kind": "type", "name": "t", - "docstrings": [], - "signature": "type t<'a> = promise<'a>" + "docstrings": [ + "Type representing a nullable value.\nA nullable value can be the value `'a`, `null` or `undefined`." + ], + "signature": "@unboxed\ntype t<'a> = nullable<'a> =\n | Value('a)\n | @as(null) Null\n | @as(undefined) Undefined" }, { - "id": "Core.Promise.resolve", + "id": "Core.Nullable.null", "kind": "value", - "name": "resolve", + "name": "null", "docstrings": [ - "`resolve(value)` creates a resolved Promise with a given `value`.\nSee [`Promise.resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve) on MDN.\n\n## Examples\n\n```rescript\nlet p = Promise.resolve(5) // promise\n```" + "The value `null`.\n\nSee [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) on MDN.\n\n## Examples\n```rescript\nConsole.log(Nullable.null) // Logs `null` to the console.\n```" ], - "signature": "let resolve: 'a => t<'a>" + "signature": "let null: t<'a>" }, { - "id": "Core.Promise.reject", + "id": "Core.Nullable.undefined", "kind": "value", - "name": "reject", + "name": "undefined", "docstrings": [ - "`reject(exn)` reject a Promise.\nSee [`Promise.reject`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject) on MDN.\n\n## Examples\n\n```rescript\nexception TestError(string)\n\nlet p = Promise.reject(TestError(\"some rejected value\"))\n```" + "The value `undefined`.\n\nSee [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/undefined) on MDN.\n\n## Examples\n```rescript\nConsole.log(undefined) // Logs `undefined` to the console.\n```" ], - "signature": "let reject: exn => t<'a>" + "signature": "let undefined: t<'a>" }, { - "id": "Core.Promise.make", + "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", "name": "make", "docstrings": [ - "`make(callback)` creates a new Promise based on a `callback` that receives two\nuncurried functions `resolve` and `reject` for defining the Promise's result.\n\n## Examples\n\n```rescript\nopen Promise\n\nlet n = 4\nPromise.make((resolve, reject) => {\n if(n < 5) {\n resolve(. \"success\")\n }\n else {\n reject(. \"failed\")\n }\n})\n->then(str => {\n Console.log(str)->resolve\n})\n->catch(_ => {\n Console.log(\"Error occurred\")\n resolve()\n})\n->ignore\n```" + "Creates a new nullable value from the provided value.\nThis means the compiler will enforce null checks for the new value.\n\n## Examples\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// Need to do this\nswitch asNullable->Nullable.toOption {\n| Some(value) if value == myStr => Console.log(\"Yay, values matched!\")\n| _ => Console.log(\"Values did not match.\")\n}\n```" ], - "signature": "let make: (('a => unit, 'e => unit) => unit) => t<'a>" + "signature": "let make: 'a => t<'a>" }, { - "id": "Core.Promise.promiseAndResolvers", - "kind": "type", - "name": "promiseAndResolvers", + "id": "Core.Nullable.equal", + "kind": "value", + "name": "equal", "docstrings": [], - "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Core.Promise.withResolvers", + "id": "Core.Nullable.compare", "kind": "value", - "name": "withResolvers", - "docstrings": [ - "`withResolvers()` returns a object containing a new promise with functions to resolve or reject it. See [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\n\nlet {promise, resolve, _} = Promise.withResolvers()\n\nsetTimeout(() => {\n resolve(. \"success\")\n}, 1000)->ignore\n\npromise\n->thenResolve(str => {\n Console.log(str)\n})\n->ignore\n```" - ], - "signature": "let withResolvers: unit => promiseAndResolvers<'a>" + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Core.Promise.catch", + "id": "Core.Nullable.toOption", "kind": "value", - "name": "catch", + "name": "toOption", "docstrings": [ - "`catch(promise, errorCallback)` registers an exception handler in a promise chain.\nThe `errorCallback` receives an `exn` value that can later be refined into a JS\nerror or ReScript error. The `errorCallback` needs to return a promise with the\nsame type as the consumed promise. See [`Promise.catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\n\nexception SomeError(string)\n\nreject(SomeError(\"this is an error\"))\n->then(_ => {\n Ok(\"This result will never be returned\")->resolve\n})\n->catch(e => {\n let msg = switch(e) {\n | SomeError(msg) => \"ReScript error occurred: \" ++ msg\n | Exn.Error(obj) =>\n switch Exn.message(obj) {\n | Some(msg) => \"JS exception occurred: \" ++ msg\n | None => \"Some other JS value has been thrown\"\n }\n | _ => \"Unexpected error occurred\"\n }\n\n Error(msg)->resolve\n})\n->then(result => {\n switch result {\n | Ok(r) => Console.log2(\"Operation successful: \", r)\n | Error(msg) => Console.log2(\"Operation failed: \", msg)\n }->resolve\n})\n->ignore // Ignore needed for side-effects\n```\n\nIn case you want to return another promise in your `callback`, consider using\n`then` instead." + "Converts a nullable value into an option, so it can be pattern matched on.\nWill convert both `null` and `undefined` to `None`, and a present value to `Some(value)`.\n\n## Examples\n```rescript\nlet nullableString = Nullable.make(\"Hello\")\n\nswitch nullableString->Nullable.toOption {\n| Some(str) => Console.log2(\"Got string:\", str)\n| None => Console.log(\"Didn't have a value.\")\n}\n```" ], - "signature": "let catch: (t<'a>, exn => t<'a>) => t<'a>" + "signature": "let toOption: t<'a> => option<'a>" }, { - "id": "Core.Promise.then", + "id": "Core.Nullable.fromOption", "kind": "value", - "name": "then", + "name": "fromOption", "docstrings": [ - "`then(promise, callback)` returns a new promise based on the result of `promise`'s \nvalue. The `callback` needs to explicitly return a new promise via `resolve`.\nIt is **not allowed** to resolve a nested promise (like `resolve(resolve(1))`).\nSee [`Promise.then`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) on MDN.\n## Examples\n\n```rescript\nopen Promise\nresolve(5)\n->then(num => {\n resolve(num + 5)\n})\n->then(num => {\n Console.log2(\"Your lucky number is: \", num)\n resolve()\n})\n->ignore\n```" + "Turns an `option` into a `Nullable.t`.\n\n## Examples\n```rescript\nlet optString = Some(\"Hello\")\nlet asNullable = optString->Nullable.fromOption // Nullable.t\n```" ], - "signature": "let then: (t<'a>, 'a => t<'b>) => t<'b>" + "signature": "let fromOption: option<'a> => t<'a>" }, { - "id": "Core.Promise.thenResolve", + "id": "Core.Nullable.getOr", "kind": "value", - "name": "thenResolve", + "name": "getOr", "docstrings": [ - "`thenResolve(promise, callback)` converts an encapsulated value of a promise\ninto another promise wrapped value. It is **not allowed** to return a promise\nwithin the provided callback (e.g. `thenResolve(value => resolve(value))`).\n\n## Examples\n\n```rescript\nopen Promise\nresolve(\"Anna\")\n->thenResolve(str => {\n \"Hello \" ++ str\n})\n->thenResolve(str => {\n Console.log(str)\n})\n->ignore // Ignore needed for side-effects\n```\n\nIn case you want to return another promise in your `callback`, consider using\n`then` instead." + "`getOr(value, default)` returns `value` if not `null` or `undefined`,\notherwise return `default`.\n\n## Examples\n\n```rescript\nNullable.getOr(Nullable.null, \"Banana\") // Banana\nNullable.getOr(Nullable.make(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nNullable.make(\"Jane\")->Nullable.toOption->greet // \"Greetings Jane\"\nNullable.null->Nullable.toOption->greet // \"Greetings Anonymous\"\n```" ], - "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let getOr: (t<'a>, 'a) => 'a" }, { - "id": "Core.Promise.finally", + "id": "Core.Nullable.getWithDefault", "kind": "value", - "name": "finally", - "docstrings": [ - "`finally(promise, callback)` is used to execute a function that is called no\nmatter if a promise was resolved or rejected. It will return the same `promise`\nit originally received. See [`Promise.finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nexception SomeError(string)\nlet isDone = ref(false)\n\nresolve(5)\n->then(_ => {\n reject(SomeError(\"test\"))\n})\n->then(v => {\n Console.log2(\"final result\", v)\n resolve()\n})\n->catch(_ => {\n Console.log(\"Error handled\")\n resolve()\n})\n->finally(() => {\n Console.log(\"finally\")\n isDone := true\n})\n->then(() => {\n Console.log2(\"isDone:\", isDone.contents)\n resolve()\n})\n->ignore\n```" - ], - "signature": "let finally: (t<'a>, unit => unit) => t<'a>" + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Core.Promise.race", + "id": "Core.Nullable.getExn", "kind": "value", - "name": "race", + "name": "getExn", "docstrings": [ - "`race(arr)` runs all promises concurrently and returns promise settles with the eventual state of the first promise that settles. See [`Promise.race`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nlet racer = (ms, name) => {\n Promise.make((resolve, _) => {\n setTimeout(() => {\n resolve(name)\n }, ms)->ignore\n })\n}\n\nlet promises = [racer(1000, \"Turtle\"), racer(500, \"Hare\"), racer(100, \"Eagle\")]\n\nrace(promises)->then(winner => {\n Console.log(\"The winner is \" ++ winner)\n resolve()\n})\n```" + "`getExn(value)` raises an exception if `null` or `undefined`, otherwise returns the value.\n\n```rescript\nswitch Nullable.getExn(%raw(\"'Hello'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"Hello\")\n}\n\nswitch Nullable.getExn(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n\nswitch Nullable.getExn(%raw(\"undefined\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null` or `undefined`" ], - "signature": "let race: array> => t<'a>" + "signature": "let getExn: t<'a> => 'a" }, { - "id": "Core.Promise.any", + "id": "Core.Nullable.getUnsafe", "kind": "value", - "name": "any", + "name": "getUnsafe", "docstrings": [ - "`any(arr)` runs all promises concurrently and returns promise fulfills when any of the input's promises fulfills, with this first fulfillment value. See [`Promise.any`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any) on MDN.\n\n## Examples\n\n```rescript\nopen Promise\nlet racer = (ms, name) => {\n Promise.make((resolve, _) => {\n setTimeout(() => {\n resolve(name)\n }, ms)->ignore\n })\n}\n\nlet promises = [racer(1000, \"Turtle\"), racer(500, \"Hare\"), racer(100, \"Eagle\")]\n\nany(promises)->then(winner => {\n Console.log(\"The winner is \" ++ winner)\n resolve()\n})\n```" + "`getUnsafe(value)` returns `value`.\n\n## Examples\n\n```rescript\nNullable.getUnsafe(Nullable.make(3)) == 3\nNullable.getUnsafe(Nullable.null) // Raises an error\n```\n\n## Important\n\n- This is an unsafe operation, it assumes `value` is not `null` or `undefined`." ], - "signature": "let any: array> => t<'a>" + "signature": "let getUnsafe: t<'a> => 'a" }, { - "id": "Core.Promise.all", + "id": "Core.Nullable.forEach", "kind": "value", - "name": "all", + "name": "forEach", "docstrings": [ - "`all(promises)` runs all promises concurrently and returns a promise fulfills when all of the input's promises fulfill, with an array of the fulfillment values. See [`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) on MDN.\n\n```rescript\nopen Promise\nlet promises = [resolve(1), resolve(2), resolve(3)]\n\nall(promises)\n->then((results) => {\n results->Array.forEach(num => {\n Console.log2(\"Number: \", num)\n })\n\n resolve()\n})\n->ignore\n```" + "`forEach(value, f)` call `f` on `value`. if `value` is not `null` or `undefined`, \nthen if calls `f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nNullable.forEach(Nullable.make(\"thing\"), x => Console.log(x)) // logs \"thing\"\nNullable.forEach(Nullable.null, x => Console.log(x)) // returns ()\nNullable.forEach(undefined, x => Console.log(x)) // returns ()\n```" ], - "signature": "let all: array> => t>" + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Core.Promise.all2", + "id": "Core.Nullable.map", "kind": "value", - "name": "all2", + "name": "map", "docstrings": [ - "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" + "`map(value, f)` returns `f(value)` if `value` is not `null` or `undefined`,\notherwise returns `value` unchanged.\n\n## Examples\n\n```rescript\nNullable.map(Nullable.make(3), x => x * x) // Nullable.make(9)\nNullable.map(undefined, x => x * x) // undefined\n```" ], - "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Core.Promise.all3", + "id": "Core.Nullable.mapOr", "kind": "value", - "name": "all3", + "name": "mapOr", "docstrings": [ - "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" + "`mapOr(value, default, f)` returns `f(value)` if `value` is not `null`\nor `undefined`, otherwise returns `default`.\n\n## Examples\n\n```rescript\nlet someValue = Nullable.make(3)\nsomeValue->Nullable.mapOr(0, x => x + 5) // 8\n\nlet noneValue = Nullable.null\nnoneValue->Nullable.mapOr(0, x => x + 5) // 0\n```" ], - "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" + "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Core.Promise.all4", + "id": "Core.Nullable.mapWithDefault", "kind": "value", - "name": "all4", - "docstrings": [ - "`all4((p1, p2, p3, p4))`. Like `all()`, but with a fixed size tuple of 4" - ], - "signature": "let all4: ((t<'a>, t<'b>, t<'c>, t<'d>)) => t<('a, 'b, 'c, 'd)>" + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Core.Promise.all5", + "id": "Core.Nullable.flatMap", "kind": "value", - "name": "all5", + "name": "flatMap", "docstrings": [ - "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" + "`flatMap(value, f)` returns `f(value)` if `value` is not `null` or `undefined`,\notherwise returns `value` unchanged.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Nullable.make(value + 1)\n } else {\n Nullable.null\n }\n\nNullable.flatMap(Nullable.make(2), addIfAboveOne) // Nullable.make(3)\nNullable.flatMap(Nullable.make(-4), addIfAboveOne) // undefined\nNullable.flatMap(Nullable.null, addIfAboveOne) // undefined\n```" + ], + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" + } + ] + }, + "core/null": { + "id": "Core.Null", + "name": "Null", + "docstrings": [ + "Functions for handling values that could be `null`.\n\nIf you also need to cover `undefined`, check out `Nullable` instead." + ], + "items": [ + { + "id": "Core.Null.t", + "kind": "type", + "name": "t", + "docstrings": [ + "A type representing a value that can be either `'a` or `null`." ], - "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" + "signature": "@unboxed\ntype t<'a> = null<'a> =\n | Value('a)\n | @as(null) Null" }, { - "id": "Core.Promise.all6", + "id": "Core.Null.asNullable", "kind": "value", - "name": "all6", + "name": "asNullable", "docstrings": [ - "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\n\")" + "Converts a `Null.t` into a `Nullable.t`.\n\n## Examples\n```rescript\nlet nullValue = Null.make(\"Hello\")\nlet asNullable = nullValue->Null.asNullable // Nullable.t\n```" ], - "signature": "let all6: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>),\n) => t<('a, 'b, 'c, 'd, 'e, 'f)>" + "signature": "let asNullable: t<'a> => Nullable.t<'a>" }, { - "id": "Core.Promise.settledResult", - "kind": "type", - "name": "settledResult", - "docstrings": [], - "signature": "type settledResult<'a> =\n | Fulfilled({value: 'a})\n | Rejected({reason: exn})" - }, - { - "id": "Core.Promise.allSettled", + "id": "Core.Null.null", "kind": "value", - "name": "allSettled", + "name": "null", "docstrings": [ - "`allSettled(promises)` runs all promises concurrently and returns promise fulfills when all of the input's promises settle with an array of objects that describe the outcome of each promise. See [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) on MDN.\n\n```rescript\nopen Promise\n\nexception TestError(string)\n\nlet promises = [resolve(1), resolve(2), reject(TestError(\"some rejected promise\"))]\n\nallSettled(promises)\n->then((results) => {\n results->Array.forEach((result) => {\n switch result {\n | Fulfilled({value: num}) => \n Console.log2(\"Number: \", num)\n | Rejected({reason}) =>\n Console.log(reason)\n }\n })\n\n resolve()\n})\n->ignore\n```" + "The value `null`.\n\nSee [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) on MDN.\n\n## Examples\n```rescript\nConsole.log(null) // Logs `null` to the console.\n```" ], - "signature": "let allSettled: array> => t>>" + "signature": "let null: t<'a>" }, { - "id": "Core.Promise.allSettled2", + "id": "Core.Null.make", "kind": "value", - "name": "allSettled2", + "name": "make", "docstrings": [ - "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" + "Creates a new `Null.t` from the provided value.\nThis means the compiler will enforce null checks for the new value.\n\n## Examples\n```rescript\nlet myStr = \"Hello\"\nlet asNullValue = myStr->Null.make // The compiler now thinks this can be `string` or `null`.\n```" ], - "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" + "signature": "let make: 'a => t<'a>" }, { - "id": "Core.Promise.allSettled3", + "id": "Core.Null.equal", "kind": "value", - "name": "allSettled3", - "docstrings": [ - "`allSettled3((p1, p2, p3))`. Like `allSettled()`, but with a fixed size tuple of 3" - ], - "signature": "let allSettled3: (\n (t<'a>, t<'b>, t<'c>),\n) => t<\n (settledResult<'a>, settledResult<'b>, settledResult<'c>),\n>" + "name": "equal", + "docstrings": [], + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Core.Promise.allSettled4", + "id": "Core.Null.compare", "kind": "value", - "name": "allSettled4", - "docstrings": [ - "`allSettled4((p1, p2, p3, p4))`. Like `allSettled()`, but with a fixed size tuple of 4" - ], - "signature": "let allSettled4: (\n (t<'a>, t<'b>, t<'c>, t<'d>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n ),\n>" + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Core.Promise.allSettled5", + "id": "Core.Null.toOption", "kind": "value", - "name": "allSettled5", + "name": "toOption", "docstrings": [ - "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" + "Converts a nullable value into an option, so it can be pattern matched on.\nWill convert `null` to `None`, and a present value to `Some(value)`.\n\n## Examples\n```rescript\nlet nullStr = Null.make(\"Hello\")\n\nswitch nullStr->Null.toOption {\n| Some(str) => Console.log2(\"Got string:\", str)\n| None => Console.log(\"Didn't have a value.\")\n}\n```" ], - "signature": "let allSettled5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n settledResult<'e>,\n ),\n>" + "signature": "let toOption: t<'a> => option<'a>" }, { - "id": "Core.Promise.allSettled6", + "id": "Core.Null.fromOption", "kind": "value", - "name": "allSettled6", + "name": "fromOption", "docstrings": [ - "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\n\")" + "Turns an `option` into a `Null.t`. `None` will be converted to `null`.\n\n## Examples\n```rescript\nlet optString: option = None\nlet asNull = optString->Null.fromOption // Null.t\nConsole.log(asNull == Null.null) // Logs `true` to the console.\n```" ], - "signature": "let allSettled6: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>, t<'f>),\n) => t<\n (\n settledResult<'a>,\n settledResult<'b>,\n settledResult<'c>,\n settledResult<'d>,\n settledResult<'e>,\n settledResult<'f>,\n ),\n>" + "signature": "let fromOption: option<'a> => t<'a>" }, { - "id": "Core.Promise.done", + "id": "Core.Null.getOr", "kind": "value", - "name": "done", + "name": "getOr", "docstrings": [ - "`done(p)` is a safe way to ignore a promise. If a value is anything else than a\npromise, it will raise a type error." + "`getOr(value, default)` returns `value` if not `null`, otherwise return\n`default`.\n\n## Examples\n\n```rescript\nNull.getOr(Null.null, \"Banana\") // Banana\nNull.getOr(Null.make(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nNull.make(\"Jane\")->Null.toOption->greet // \"Greetings Jane\"\nNull.null->Null.toOption->greet // \"Greetings Anonymous\"\n```" ], - "signature": "let done: promise<'a> => unit" - } - ] - }, - "core/ordering": { - "id": "Core.Ordering", - "name": "Ordering", - "docstrings": [], - "items": [ - { - "id": "Core.Ordering.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = float" + "signature": "let getOr: (t<'a>, 'a) => 'a" }, { - "id": "Core.Ordering.less", + "id": "Core.Null.getWithDefault", "kind": "value", - "name": "less", + "name": "getWithDefault", "docstrings": [], - "signature": "let less: float" + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Core.Ordering.equal", + "id": "Core.Null.getExn", "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: float" + "name": "getExn", + "docstrings": [ + "`getExn(value)` raises an exception if `null`, otherwise returns the value.\n\n```rescript\nNull.getExn(Null.make(3))->assertEqual(3)\n\nswitch Null.getExn(%raw(\"'ReScript'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"ReScript\")\n}\n\nswitch Null.getExn(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null`," + ], + "signature": "let getExn: t<'a> => 'a" }, { - "id": "Core.Ordering.greater", + "id": "Core.Null.getUnsafe", "kind": "value", - "name": "greater", - "docstrings": [], - "signature": "let greater: float" + "name": "getUnsafe", + "docstrings": [ + "`getUnsafe(value)` returns `value`.\n\n## Examples\n\n```rescript\nNull.getUnsafe(Null.make(3)) == 3\nNull.getUnsafe(Null.null) // Raises an error\n```\n\n## Important\n\n- This is an unsafe operation, it assumes `value` is not `null`." + ], + "signature": "let getUnsafe: t<'a> => 'a" }, { - "id": "Core.Ordering.isLess", + "id": "Core.Null.forEach", "kind": "value", - "name": "isLess", - "docstrings": [], - "signature": "let isLess: float => bool" + "name": "forEach", + "docstrings": [ + "`forEach(value, f)` call `f` on `value`. if `value` is not `null`, then if calls\n`f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nNull.forEach(Null.make(\"thing\"), x => Console.log(x)) // logs \"thing\"\nNull.forEach(Null.null, x => Console.log(x)) // logs nothing\n```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Core.Ordering.isEqual", + "id": "Core.Null.map", "kind": "value", - "name": "isEqual", - "docstrings": [], - "signature": "let isEqual: float => bool" + "name": "map", + "docstrings": [ + "`map(value, f)` returns `f(value)` if `value` is not `null`, otherwise returns\n`value` unchanged.\n\n## Examples\n\n```rescript\nNull.map(Null.make(3), x => x * x) // Null.make(9)\nNull.map(Null.null, x => x * x) // null\n```" + ], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Core.Ordering.isGreater", + "id": "Core.Null.mapOr", "kind": "value", - "name": "isGreater", - "docstrings": [], - "signature": "let isGreater: float => bool" + "name": "mapOr", + "docstrings": [ + "`mapOr(value, default, f)` returns `f(value)` if `value` is not `null`,\notherwise returns `default`.\n\n## Examples\n\n```rescript\nlet someValue = Null.make(3)\nsomeValue->Null.mapOr(0, x => x + 5) // 8\n\nlet noneValue = Null.null\nnoneValue->Null.mapOr(0, x => x + 5) // 0\n```" + ], + "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Core.Ordering.invert", + "id": "Core.Null.mapWithDefault", "kind": "value", - "name": "invert", + "name": "mapWithDefault", "docstrings": [], - "signature": "let invert: float => float" + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Core.Ordering.fromInt", + "id": "Core.Null.flatMap", "kind": "value", - "name": "fromInt", - "docstrings": [], - "signature": "let fromInt: int => float" + "name": "flatMap", + "docstrings": [ + "`flatMap(value, f)` returns `f(value)` if `value` is not `null`, otherwise\nreturns `value` unchanged.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Null.make(value + 1)\n } else {\n Null.null\n }\n\nNull.flatMap(Null.make(2), addIfAboveOne) // Null.make(3)\nNull.flatMap(Null.make(-4), addIfAboveOne) // null\nNull.flatMap(Null.null, addIfAboveOne) // null\n```" + ], + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" } ] }, - "core/object": { - "id": "Core.Object", - "name": "Object", - "docstrings": [], + "core/math": { + "id": "Core.Math", + "name": "Math", + "docstrings": [ + "Functions for interacting with JavaScript Math.\nSee: [`Math`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)." + ], "items": [ { - "id": "Core.Object.make", + "id": "Core.Math.abs", "kind": "value", - "name": "make", + "name": "abs", "docstrings": [ - "`make` create a new object that inherits the properties and methods from the standard built-in Object, such as `toString`. See [Object on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n## Examples\n\n```rescript\nlet x = Object.make()\nx->Object.keysToArray->Array.length // 0\nx->Object.get(\"toString\")->Option.isSome // true\n```" + "`abs(v)` returns absolute value of `v`.\nSee [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n## Examples\n\n```rescript\nMath.abs(-2.0) // 2.0\nMath.abs(3.0) // 3.0\n```" ], - "signature": "let make: unit => {..}" + "signature": "let abs: float => float" }, { - "id": "Core.Object.is", + "id": "Core.Math.acos", "kind": "value", - "name": "is", + "name": "acos", "docstrings": [ - "`is` determines if two objects are identical in all contexts. Objects, arrays, records, and other non-primitives are only identical if they reference the **exact** same object in memory. Primitives like ints, floats, and strings are identical if they have the same value. `+0` and `-0` are distinct. NaN is equal to itself. See [Object.is on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)\n\nIn most scenarios use `==` or `===` or the custom `equals` function (if provided) for the type.\n\n## Examples\n\n```rescript\nObject.is(25, 13) // false\nObject.is(\"abc\", \"abc\") // true\nObject.is(undefined, undefined) // true\nObject.is(undefined, null) // false\nObject.is(-0.0, 0.0) // false\nObject.is(list{1, 2}, list{1, 2}) // false\n\nObject.is([1, 2, 3], [1, 2, 3]) // false\n[1, 2, 3] == [1, 2, 3] // true\n[1, 2, 3] === [1, 2, 3] // false\n\nlet fruit = {\"name\": \"Apple\" }\nObject.is(fruit, fruit) // true\nObject.is(fruit, {\"name\": \"Apple\" }) // false\nfruit == {\"name\": \"Apple\" } // true\nfruit === {\"name\": \"Apple\" } // false\n```" + "`acos(v)` returns arccosine (in radians) of argument `v`, returns `NaN` if the\nargument is outside the range [-1.0, 1.0].\nSee [`Math.acos`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos) on MDN.\n\n## Examples\n\n```rescript\nMath.acos(-1.0) // 3.141592653589793\nMath.acos(-3.0)->Float.isNaN // true\n```" ], - "signature": "let is: ('a, 'a) => bool" + "signature": "let acos: float => float" }, { - "id": "Core.Object.create", + "id": "Core.Math.acosh", "kind": "value", - "name": "create", + "name": "acosh", "docstrings": [ - "`create` creates a new object, using an existing object as the prototype of the new object. See [Object.create on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\n\n**Note:** ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object) and [records](https://rescript-lang.org/docs/manual/latest/record). This is often safer and more convenient than using `create` and other functions in this module.\n\n## Examples\n\n```rescript\nlet x = {\"fruit\": \"banana\"}\nlet y = Object.create(x)\ny->Object.get(\"fruit\") // Some(\"banana\")\n```" + "`acosh(v)` returns the inverse hyperbolic arccosine (in radians) of argument `v`,\nreturns `NaN` if the argument is less than `1.0`.\nSee [`Math.acosh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh) on MDN.\n\n## Examples\n\n```rescript\nMath.acosh(1.0) // 0.0\nMath.acosh(0.5)->Float.isNaN // true\n```" ], - "signature": "let create: {..} => {..}" - }, - { - "id": "Core.Object.createWithProperties", - "kind": "value", - "name": "createWithProperties", - "docstrings": [], - "signature": "let createWithProperties: ({..}, {..}) => {..}" - }, - { - "id": "Core.Object.createWithNull", - "kind": "value", - "name": "createWithNull", - "docstrings": [], - "signature": "let createWithNull: unit => {..}" - }, - { - "id": "Core.Object.createWithNullAndProperties", - "kind": "value", - "name": "createWithNullAndProperties", - "docstrings": [], - "signature": "let createWithNullAndProperties: {..} => {..}" + "signature": "let acosh: float => float" }, { - "id": "Core.Object.assign", + "id": "Core.Math.asin", "kind": "value", - "name": "assign", + "name": "asin", "docstrings": [ - "`assign(target, source)` copies enumerable own properties from the source to the target, overwriting properties with the same name. It returns the modified target object. A deep clone is not created; properties are copied by reference.\n\n**Warning:** ReScript provides compile-time support for type-safe access to JavaScript objects. This eliminates common errors such as accessing properties that do not exist, or using a property of type x as if it were a y. Using `assign` can bypass these safety checks and lead to run-time errors (if you are not careful). ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object) and [records](https://rescript-lang.org/docs/manual/latest/record). This is often safer and more convenient than using `assign` and other functions in this module.\n\nSee [Object.assign on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) or [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign).\n\n## Examples\n\n```rescript\nObject.assign({\"a\": 1}, {\"a\": 2}) // {\"a\": 2}\nObject.assign({\"a\": 1, \"b\": 2}, {\"a\": 0}) // {\"a\": 0, \"b\": 2}\nObject.assign({\"a\": 1}, {\"a\": null}) // {\"a\": null}\n```" + "`asin(v)` returns the inverse sine (in radians) of argument `v`, returns `NaN`\nif the argument `v` is outside the range [-1.0, 1.0].\nSee [`Math.asin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin) on MDN.\n\n## Examples\n\n```rescript\nMath.asin(-1.0) // -1.5707963267948966\nMath.asin(-2.0)->Float.isNaN // true\n```" ], - "signature": "let assign: ({..}, {..}) => {..}" + "signature": "let asin: float => float" }, { - "id": "Core.Object.assignMany", + "id": "Core.Math.asinh", "kind": "value", - "name": "assignMany", + "name": "asinh", "docstrings": [ - "`assignMany(target, sources)` copies enumerable own properties from each source to the target, overwriting properties with the same name. Later sources' properties overwrite earlier ones. It returns the modified target object. A deep clone is not created; properties are copied by reference.\n\n**Note:** ReScript provides [first-class support for immutable objects](https://rescript-lang.org/docs/manual/latest/object), including spreading one object into another. This is often more convenient than using `assign` or `assignMany`. \n\nSee [Object.assign on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) or [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign)." + "`asinh(v)` returns the inverse hyperbolic sine of argument `v`.\nSee [`Math.asinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh) on MDN.\n\n## Examples\n\n```rescript\nMath.asinh(-1.0) // -0.881373587019543\nMath.asinh(-0.0) // -0.0\n```" ], - "signature": "let assignMany: ({..}, array<{..}>) => {..}" - }, - { - "id": "Core.Object.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: ({..} as 'a) => 'a" + "signature": "let asinh: float => float" }, { - "id": "Core.Object.get", + "id": "Core.Math.atan", "kind": "value", - "name": "get", + "name": "atan", "docstrings": [ - "`get` gets the value of a property by name. Returns `None` if the property does not exist or has the value `undefined`. Otherwise returns `Some`, including if the value is `null`.\n\n## Examples\n\n```rescript\n{\"a\": 1}->Object.get(\"a\") // Some(1)\n{\"a\": 1}->Object.get(\"b\") // None\n{\"a\": undefined}->Object.get(\"a\") // None\n{\"a\": null}->Object.get(\"a\") // Some(null)\n{\"a\": 1}->Object.get(\"toString\")->Option.isSome // true\n```" + "`atan(v)` returns the inverse tangent (in radians) of argument `v`.\nSee [`Math.atan`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan) on MDN.\n\n## Examples\n\n```rescript\nMath.atan(-0.0) // -0.0\nMath.atan(0.0) // 0.0\nMath.atan(1.0) // 0.7853981633974483\n```" ], - "signature": "let get: ({..}, string) => option<'a>" + "signature": "let atan: float => float" }, { - "id": "Core.Object.getSymbol", + "id": "Core.Math.atanh", "kind": "value", - "name": "getSymbol", + "name": "atanh", "docstrings": [ - "`getSymbol` gets the value of a property by symbol. Returns `None` if the property does not exist or has the value `undefined`. Otherwise returns `Some`, including if the value is `null`.\n\n## Examples\n\n```rescript\nlet fruit = Symbol.make(\"fruit\")\nlet x = Object.make()\nx->Object.setSymbol(fruit, \"banana\")\nx->Object.getSymbol(fruit) // Some(\"banana\")\n```" + "`atanh(v)` returns the invert hyperbolic tangent of argument `v`. Returns `NaN`\nif the argument `v` is is outside the range [-1.0, 1.0] and `Infinity` if `v`\nis `-1.0` or `1.0`.\nSee [`Math.atanh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh) on MDN.\n\n## Examples\n\n```rescript\nMath.atanh(-2.0)->Float.isNaN // true\nMath.atanh(-1.0)->Float.isFinite // false\nMath.atanh(-0.0) // -0.0\nMath.atanh(0.0) // 0.0\nMath.atanh(0.5) // 0.5493061443340548\n```" ], - "signature": "let getSymbol: ({..}, Core__Symbol.t) => option<'a>" + "signature": "let atanh: float => float" }, { - "id": "Core.Object.getSymbolUnsafe", + "id": "Core.Math.atan2", "kind": "value", - "name": "getSymbolUnsafe", - "docstrings": [], - "signature": "let getSymbolUnsafe: ({..}, Core__Symbol.t) => 'a" + "name": "atan2", + "docstrings": [ + "`atan2(~y, ~x)` returns the angle (in radians) of the quotient `y /. x`. It is\nalso the angle between the *x*-axis and point (*x*, *y*).\nSee [`Math.atan2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2) on MDN.\n\n## Examples\n\n```rescript\nMath.atan2(~y=0.0, ~x=10.0) == 0.0\nMath.atan2(~x=5.0, ~y=5.0) == Math.Constants.pi /. 4.0\nMath.atan2(~x=90.0, ~y=15.0) // 1.4056476493802699\nMath.atan2(~x=15.0, ~y=90.0) // 0.16514867741462683\n```" + ], + "signature": "let atan2: (~y: float, ~x: float) => float" }, { - "id": "Core.Object.set", + "id": "Core.Math.cbrt", "kind": "value", - "name": "set", + "name": "cbrt", "docstrings": [ - "`set(name, value)` assigns a value to the named object property, overwriting the previous value if any. See [Working with Objects on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#objects_and_properties)\n\n## Examples\n\n```rescript\n{\"a\": 1}->Object.set(\"a\", 2) // {\"a\": 2}\n{\"a\": 1}->Object.set(\"a\", None) // {\"a\": None}\n{\"a\": 1}->Object.set(\"b\", 2) // {\"a\": 1, \"b\": 2}\n```" + "`cbrt(v)` returns the cube root of argument `v`.\nSee [`Math.cbrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt) on MDN.\n\n## Examples\n\n```rescript\nMath.cbrt(-1.0) // -1.0\nMath.cbrt(-0.0) // -0.0\nMath.cbrt(0.0) // 0.0\n```" ], - "signature": "let set: ({..}, string, 'a) => unit" + "signature": "let cbrt: float => float" }, { - "id": "Core.Object.setSymbol", + "id": "Core.Math.ceil", "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: ({..}, Core__Symbol.t, 'a) => unit" + "name": "ceil", + "docstrings": [ + "`ceil(v)` returns the smallest integral value greater than or equal to the\nargument `v`. The result is a `float` and is not restricted to the `int` data\ntype range.\nSee [`Math.ceil`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil) on MDN.\n\n## Examples\n\n```rescript\nMath.ceil(3.1) == 4.0\nMath.ceil(3.0) == 3.0\nMath.ceil(-3.1) == -3.0\nMath.ceil(2_150_000_000.3) == 2_150_000_001.0\n```" + ], + "signature": "let ceil: float => float" }, { - "id": "Core.Object.keysToArray", + "id": "Core.Math.cos", "kind": "value", - "name": "keysToArray", + "name": "cos", "docstrings": [ - "`keysToArray` returns an array of an object's own enumerable string-keyed property names. See [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.keys) \nor [Object.keys on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys).\n\n## Examples\n\n```rescript\n{\"a\": 1, \"b\": 2}->Object.keysToArray // [\"a\", \"b\"]\n{\"a\": None}->Object.keysToArray // [\"a\"]\nObject.make()->Object.keysToArray // []\n```" + "`cos(v)` returns the cosine of argument `v`, which must be specified in radians.\nSee [`Math.cos`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos) on MDN.\n\n## Examples\n\n```rescript\nMath.cos(-0.0) // 1.0\nMath.cos(0.0) // 1.0\nMath.cos(1.0) // 0.5403023058681398\n```" ], - "signature": "let keysToArray: {..} => array" + "signature": "let cos: float => float" }, { - "id": "Core.Object.hasOwnProperty", + "id": "Core.Math.cosh", "kind": "value", - "name": "hasOwnProperty", + "name": "cosh", "docstrings": [ - "`hasOwnProperty` determines whether the object has the specified property as its **own** property, as opposed to inheriting it. See [hasOwnProperty on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 2}\n{\"a\": 1}->Object.hasOwnProperty(\"a\") // true\n{\"a\": 1}->Object.hasOwnProperty(\"b\") // false\n{\"a\": 1}->Object.hasOwnProperty(\"toString\") // false\n```" + "`cosh(v)` returns the hyperbolic cosine of argument `v`, which must be specified\nin radians.\nSee [`Math.cosh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh) on MDN.\n\n## Examples\n\n```rescript\nMath.cosh(-1.0) // 1.5430806348152437\nMath.cosh(-0.0) // 1.0\nMath.cosh(0.0) // 1.0\n```" ], - "signature": "let hasOwnProperty: ({..}, string) => bool" + "signature": "let cosh: float => float" }, { - "id": "Core.Object.seal", + "id": "Core.Math.exp", "kind": "value", - "name": "seal", + "name": "exp", "docstrings": [ - "`seal` seals an object. Sealing an object prevents extensions and makes existing properties non-configurable. A sealed object has a fixed set of properties. Unlike `freeze`, values of existing properties can still be changed as long as they are writable. \n\n**Note:** `seal` returns the same object that was passed in; it does not create a copy. Any attempt to delete or add properties to a sealed object will fail, either silently or by throwing an error. \n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.seal) and [Object.seal on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 2}\npoint->Object.set(\"x\", -7) // succeeds\npoint->Object.seal->ignore\npoint->Object.set(\"z\", 9) // fails\npoint->Object.set(\"x\", 13) // succeeds\n```" + "`exp(v)` returns natural exponentional, returns *e* (the base of natural logarithms)\nto the power of the given argument `v`.\nSee [`Math.exp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp) on MDN.\n\n## Examples\n\n```rescript\nMath.exp(-1.0) // 0.36787944117144233\nMath.exp(0.0) // 1.0\n```" ], - "signature": "let seal: ({..} as 'a) => 'a" + "signature": "let exp: float => float" }, { - "id": "Core.Object.preventExtensions", + "id": "Core.Math.expm1", "kind": "value", - "name": "preventExtensions", + "name": "expm1", "docstrings": [ - "`preventExtensions` prevents new properties from being added to the object. It modifies the object (rather than creating a copy) and returns it.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.preventextensions) and [Object.preventExtensions on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions)\n\n## Examples\n\n```rescript\nlet obj = {\"a\": 1}\nobj->Object.set(\"b\", 2) // succeeds\nobj->Object.preventExtensions->ignore\nobj->Object.set(\"c\", 3) // fails\n```" + "`expm1(v)` returns *e* (the base of natural logarithms) to the power of the given\nargument `v` minus 1.\nSee [`Math.expm1`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1) on MDN.\n\n## Examples\n\n```rescript\nMath.expm1(-1.0) // -0.6321205588285577\nMath.expm1(-0.0) // -0\n```" ], - "signature": "let preventExtensions: ({..} as 'a) => 'a" + "signature": "let expm1: float => float" }, { - "id": "Core.Object.freeze", + "id": "Core.Math.floor", "kind": "value", - "name": "freeze", + "name": "floor", "docstrings": [ - "`freeze` freezes an object. Freezing an object makes existing properties non-writable and prevents extensions. Once an object is frozen, new properties cannot be be added, existing properties cannot be removed, and their values cannot be changed.\n\n**Note:** `freeze` returns the same object that was passed in; it does not create a frozen copy. Any attempt to change a frozen object will fail, either silently or by throwing an exception.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).\n\n## Examples\n\n ```rescript\nlet obj = {\"a\": 1}\nobj->Object.set(\"a\", 2) // succeeds\nobj->Object.freeze->ignore\nobj->Object.set(\"a\", 3) // fails\n```" + "`floor(v)` returns the largest integral value less than or equal to the argument\n`v`. The result is a `float` and is not restricted to the `int` data type range.\nSee [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) on MDN.\n\n## Examples\n\n```rescript\nMath.floor(-45.95) // -46.0\nMath.floor(-45.05) // -46.0\nMath.floor(-0.0) // -0.0\n```" ], - "signature": "let freeze: ({..} as 'a) => 'a" + "signature": "let floor: float => float" }, { - "id": "Core.Object.isSealed", + "id": "Core.Math.fround", "kind": "value", - "name": "isSealed", + "name": "fround", "docstrings": [ - "`isSealed` determines if an object is sealed. A sealed object has a fixed set of properties.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.issealed) and [Object.isSealed on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed)\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 3}->Object.seal\nlet pointIsSealed = point->Object.isSealed // true\nlet fruit = {\"name\": \"Apple\" }\nlet fruitIsSealed = fruit->Object.isSealed // false\n ```" + "`fround(v)` returns the nearest single precision float.\nSee [`Math.fround`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround) on MDN.\n\n## Examples\n\n```rescript\nMath.fround(5.5) == 5.5\nMath.fround(5.05) == 5.050000190734863\n```" ], - "signature": "let isSealed: 'a => bool" + "signature": "let fround: float => float" }, { - "id": "Core.Object.isFrozen", + "id": "Core.Math.hypot", "kind": "value", - "name": "isFrozen", + "name": "hypot", "docstrings": [ - "`isFrozen` determines if an object is frozen. An object is frozen if an only if it is not extensible, all its properties are non-configurable, and all its data properties are non-writable.\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isfrozen) and [Object.isFrozen on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen).\n\n## Examples\n\n```rescript\nlet point = {\"x\": 1, \"y\": 3}->Object.freeze\nlet pointIsFrozen = point->Object.isFrozen // true\nlet fruit = {\"name\": \"Apple\" }\nlet fruitIsFrozen = fruit->Object.isFrozen // false\n ```" + "`hypot(a, b)` returns the square root of the sum of squares of its two arguments\n(the Pythagorean formula).\nSee [`Math.hypot`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot) on MDN.\n\n## Examples\n\n```rescript\nMath.hypot(3.0, 4.0) // 5.0\nMath.hypot(3.0, 5.0) // 5.8309518948453\n```" ], - "signature": "let isFrozen: 'a => bool" + "signature": "let hypot: (float, float) => float" }, { - "id": "Core.Object.isExtensible", + "id": "Core.Math.hypotMany", "kind": "value", - "name": "isExtensible", + "name": "hypotMany", "docstrings": [ - "`isExtensible` determines if an object is extensible (whether it can have new properties added to it).\n\nSee [ECMAScript Language Specification](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.isextensible) and [Object.isExtensible on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible)\n\n## Examples\n\n```rescript\nlet obj = {\"a\": 1}\nobj->Object.isExtensible // true\nobj->Object.preventExtensions->ignore\nobj->Object.isExtensible // false\n```" + "`hypotMany(arr)` returns the square root of the sum of squares of the numbers in\nthe array argument (generalized Pythagorean equation). Using an array allows you\nto have more than two items. If `arr` is an empty array then returns `0.0`.\nSee [`Math.hypot`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot) on MDN.\n\n## Examples\n\n```rescript\nMath.hypotMany([3.0, 4.0, 5.0]) // 7.0710678118654755\nMath.hypotMany([]) // 0.0\n```" ], - "signature": "let isExtensible: 'a => bool" - } - ] - }, - "core/nullable": { - "id": "Core.Nullable", - "name": "Nullable", - "docstrings": [ - "Functions for handling nullable values.\n\nPrimarily useful when interoping with JavaScript when you don't know whether you'll get a value, `null` or `undefined`." - ], - "items": [ + "signature": "let hypotMany: array => float" + }, { - "id": "Core.Nullable.t", - "kind": "type", - "name": "t", + "id": "Core.Math.log", + "kind": "value", + "name": "log", "docstrings": [ - "Type representing a nullable value.\nA nullable value can be the value `'a`, `null` or `undefined`." + "`log(v)` returns the natural logarithm of argument `v`, this is the number *x*\nsuch that `e^x` equals the argument. Returns `NaN` for negative arguments and\n`Infinity` for `0.0` or `-0.0`.\nSee [`Math.log`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log) on MDN.\n\n## Examples\n\n```rescript\nMath.log(-1.0)->Float.isNaN // true\nMath.log(-0.0)->Float.isFinite // false\nMath.log(0.0)->Float.isFinite // false\nMath.log(1.0) // 0\n```" ], - "signature": "type t<'a> = Js.Nullable.t<'a> =\n | Value('a)\n | Null\n | Undefined" + "signature": "let log: float => float" }, { - "id": "Core.Nullable.null", + "id": "Core.Math.log1p", "kind": "value", - "name": "null", + "name": "log1p", "docstrings": [ - "The value `null`.\n\nSee [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) on MDN.\n\n## Examples\n```rescript\nConsole.log(Nullable.null) // Logs `null` to the console.\n```" + "`log1p(v)` returns the natural logarithm of one plus the argument `v`.\nReturns `NaN` for arguments less than `-1` and `Infinity` if `v` is `-1.0`.\nSee [`Math.log1p`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p) on MDN.\n\n## Examples\n\n```rescript\nMath.log1p(-2.0)->Float.isNaN // true\nMath.log1p(-1.0)->Float.isFinite // false\nMath.log1p(-0.0) // -0\n```" ], - "signature": "let null: t<'a>" + "signature": "let log1p: float => float" }, { - "id": "Core.Nullable.undefined", + "id": "Core.Math.log10", "kind": "value", - "name": "undefined", + "name": "log10", "docstrings": [ - "The value `undefined`.\n\nSee [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/undefined) on MDN.\n\n## Examples\n```rescript\nConsole.log(undefined) // Logs `undefined` to the console.\n```" + "`log10(v)` returns the base 10 logarithm of argument `v`. Returns `NaN` for\nnegative `v`. If `v` is `-0.0` or `0.0` returns `Infinity`.\nSee [`Math.log10`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10) on MDN.\n\n## Examples\n\n```rescript\nMath.log10(-2.0)->Float.isNaN // true\nMath.log10(-0.0)->Float.isFinite // false\nMath.log10(0.0)->Float.isFinite // false\nMath.log10(1.0) // 0\n```" ], - "signature": "let undefined: t<'a>" + "signature": "let log10: float => float" }, { - "id": "Core.Nullable.isNullable", + "id": "Core.Math.log2", "kind": "value", - "name": "isNullable", + "name": "log2", "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```" + "`log2(v)` returns the base 2 logarithm of argument `v`. Returns `NaN` for\nnegative `v` and `Infinity` if `v` is `-0.0` or `0.0`.\nSee [`Math.log2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2) on MDN.\n\n## Examples\n\n```rescript\nMath.log2(-2.0)->Float.isNaN // true\nMath.log2(-0.0)->Float.isFinite // false\nMath.log2(0.0)->Float.isFinite // false\nMath.log2(1.0) // 0.0\n```" ], - "signature": "let isNullable: t<'a> => bool" + "signature": "let log2: float => float" }, { - "id": "Core.Nullable.make", + "id": "Core.Math.min", "kind": "value", - "name": "make", + "name": "min", "docstrings": [ - "Creates a new nullable value from the provided value.\nThis means the compiler will enforce null checks for the new value.\n\n## Examples\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// Need to do this\nswitch asNullable->Nullable.toOption {\n| Some(value) if value == myStr => Console.log(\"Yay, values matched!\")\n| _ => Console.log(\"Values did not match.\")\n}\n```" + "`min(a, b)` returns the minimum of its two float arguments.\nSee [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n## Examples\n\n```rescript\nMath.min(1.0, 2.0) // 1.0\nMath.min(-1.0, -2.0) // -2.0\n```" ], - "signature": "let make: 'a => t<'a>" + "signature": "let min: (float, float) => float" }, { - "id": "Core.Nullable.equal", + "id": "Core.Math.minMany", "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "name": "minMany", + "docstrings": [ + "`minMany(arr)` returns the minimum of the float in the given array `arr`.\nReturns `Infinity` if `arr` is empty.\nSee [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n## Examples\n\n```rescript\nMath.minMany([1.0, 2.0]) // 1.0\nMath.minMany([-1.0, -2.0]) // -2.0\nMath.minMany([])->Float.isFinite // false\n```" + ], + "signature": "let minMany: array => float" }, { - "id": "Core.Nullable.compare", + "id": "Core.Math.max", "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Core__Ordering.t,\n) => Core__Ordering.t" + "name": "max", + "docstrings": [ + "`max(a, b)` returns the maximum of its two float arguments.\nSee [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n## Examples\n\n```rescript\nMath.max(1.0, 2.0) // 2.0\nMath.max(-1.0, -2.0) // -1.0\n```" + ], + "signature": "let max: (float, float) => float" }, { - "id": "Core.Nullable.toOption", + "id": "Core.Math.maxMany", "kind": "value", - "name": "toOption", + "name": "maxMany", "docstrings": [ - "Converts a nullable value into an option, so it can be pattern matched on.\nWill convert both `null` and `undefined` to `None`, and a present value to `Some(value)`.\n\n## Examples\n```rescript\nlet nullableString = Nullable.make(\"Hello\")\n\nswitch nullableString->Nullable.toOption {\n| Some(str) => Console.log2(\"Got string:\", str)\n| None => Console.log(\"Didn't have a value.\")\n}\n```" + "`maxMany(arr)` returns the maximum of the float in the given array `arr`.\nReturns `Infinity` if `arr` is empty.\nSee [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n## Examples\n\n```rescript\nMath.maxMany([1.0, 2.0]) // 2.0\nMath.maxMany([-1.0, -2.0]) // -1.0\nMath.maxMany([])->Float.isFinite // false\n```" ], - "signature": "let toOption: t<'a> => option<'a>" + "signature": "let maxMany: array => float" }, { - "id": "Core.Nullable.fromOption", + "id": "Core.Math.pow", "kind": "value", - "name": "fromOption", + "name": "pow", "docstrings": [ - "Turns an `option` into a `Nullable.t`.\n\n## Examples\n```rescript\nlet optString = Some(\"Hello\")\nlet asNullable = optString->Nullable.fromOption // Nullable.t\n```" + "`pow(a, ~exp)` raises the given base `a` to the given exponent `exp`.\nSee [`Math.pow`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) on MDN.\n\n## Examples\n\n```rescript\nMath.pow(2.0, ~exp=4.0) // 16.0\nMath.pow(3.0, ~exp=4.0) // 81.0\n```" ], - "signature": "let fromOption: option<'a> => t<'a>" + "signature": "let pow: (float, ~exp: float) => float" }, { - "id": "Core.Nullable.getOr", + "id": "Core.Math.random", "kind": "value", - "name": "getOr", + "name": "random", "docstrings": [ - "`getOr(value, default)` returns `value` if not `null` or `undefined`,\notherwise return `default`.\n\n## Examples\n\n```rescript\nNullable.getOr(Nullable.null, \"Banana\") // Banana\nNullable.getOr(Nullable.make(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nNullable.make(\"Jane\")->Nullable.toOption->greet // \"Greetings Jane\"\nNullable.null->Nullable.toOption->greet // \"Greetings Anonymous\"\n```" + "`random()` returns a random number in the half-closed interval [0,1].\nSee [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) on MDN.\n\n## Examples\n\n```rescript\nMath.random()\n```" ], - "signature": "let getOr: (t<'a>, 'a) => 'a" + "signature": "let random: unit => float" }, { - "id": "Core.Nullable.getWithDefault", + "id": "Core.Math.round", "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (t<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" + "name": "round", + "docstrings": [ + "`round(v)` returns then value of `v` rounded to nearest integral value\n(expressed as a float). If the fractional portion of the argument `v` is greater\nthan `0.5`, the argument `v` is rounded to the float with the next higher\nabsolute value.\nSee [`Math.round`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round) on MDN.\n\n## Examples\n\n```rescript\nMath.round(-20.5) // -20.0\nMath.round(-0.1) // -0.0\nMath.round(0.0) // 0.0\nMath.round(-0.0) // -0.0\n```" + ], + "signature": "let round: float => float" }, { - "id": "Core.Nullable.getExn", + "id": "Core.Math.sign", "kind": "value", - "name": "getExn", + "name": "sign", "docstrings": [ - "`getExn(value)` raises an exception if `null` or `undefined`, otherwise returns the value.\n\n```rescript\nNullable.getExn(Nullable.make(3)) // 3\nNullable.getExn(Nullable.null) /* Raises an Error */\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null` or `undefined`" + "`sign(v)` returns the sign of its foat argument: `-1` if negative, `0` if\nzero, `1` if positive.\nSee [`Math.sign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign) on MDN.\n\n## Examples\n\n```rescript\nMath.sign(3.0) // 1.0\nMath.sign(-3.0) // 1.0\nMath.sign(0.0) // 0.0\n```" ], - "signature": "let getExn: t<'a> => 'a" + "signature": "let sign: float => float" }, { - "id": "Core.Nullable.getUnsafe", + "id": "Core.Math.sin", "kind": "value", - "name": "getUnsafe", + "name": "sin", "docstrings": [ - "`getUnsafe(value)` returns `value`.\n\n## Examples\n\n```rescript\nNullable.getUnsafe(Nullable.make(3)) == 3\nNullable.getUnsafe(Nullable.null) // Raises an error\n```\n\n## Important\n\n- This is an unsafe operation, it assumes `value` is not `null` or `undefined`." + "`sin(v)` returns the sine of argument `v`, which must be specified in radians.\nSee [`Math.sin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin) on MDN.\n\n## Examples\n\n```rescript\nMath.sin(-0.0) // -0.0\nMath.sin(0.0) // 0.0\nMath.sin(1.0) // 0.8414709848078965\n```" ], - "signature": "let getUnsafe: t<'a> => 'a" + "signature": "let sin: float => float" }, { - "id": "Core.Nullable.forEach", + "id": "Core.Math.sinh", "kind": "value", - "name": "forEach", + "name": "sinh", "docstrings": [ - "`forEach(value, f)` call `f` on `value`. if `value` is not `null` or `undefined`, \nthen if calls `f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nNullable.forEach(Nullable.make(\"thing\"), x => Console.log(x)) // logs \"thing\"\nNullable.forEach(Nullable.null, x => Console.log(x)) // returns ()\nNullable.forEach(undefined, x => Console.log(x)) // returns ()\n```" + "`sinh(v)` returns then hyperbolic sine of argument `v`, which must be specified\nin radians.\nSee [`Math.sinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh) on MDN.\n\n## Examples\n\n```rescript\nMath.sinh(-0.0) // -0.0\nMath.sinh(0.0) // 0.0\nMath.sinh(1.0) // 1.1752011936438014\n```" ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let sinh: float => float" }, { - "id": "Core.Nullable.map", + "id": "Core.Math.sqrt", "kind": "value", - "name": "map", + "name": "sqrt", "docstrings": [ - "`map(value, f)` returns `f(value)` if `value` is not `null` or `undefined`,\notherwise returns `value` unchanged.\n\n## Examples\n\n```rescript\nNullable.map(Nullable.make(3), x => x * x) // Nullable.make(9)\nNullable.map(undefined, x => x * x) // undefined\n```" + "`sqrt(v)` returns the square root of `v`. If `v` is negative returns `NaN`.\nSee [`Math.sqrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) on MDN.\n\n## Examples\n\n```rescript\nMath.sqrt(-1.0)->Float.isNaN // true\nMath.sqrt(-0.0) // -0.0\nMath.sqrt(0.0) // 0.0\nMath.sqrt(1.0) // 1.0\nMath.sqrt(9.0) // 3.0\n```" ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let sqrt: float => float" }, { - "id": "Core.Nullable.mapOr", + "id": "Core.Math.tan", "kind": "value", - "name": "mapOr", + "name": "tan", "docstrings": [ - "`mapOr(value, default, f)` returns `f(value)` if `value` is not `null`\nor `undefined`, otherwise returns `default`.\n\n## Examples\n\n```rescript\nlet someValue = Nullable.make(3)\nsomeValue->Nullable.mapOr(0, x => x + 5) // 8\n\nlet noneValue = Nullable.null\nnoneValue->Nullable.mapOr(0, x => x + 5) // 0\n```" + "`tan(v)` returns the tangent of argument `v`, which must be specified in\nradians. Returns `NaN` if `v` is positive `Infinity` or negative `Infinity`.\nSee [`Math.tan`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan) on MDN.\n\n## Examples\n\n```rescript\nMath.tan(-0.0) // -0.0\nMath.tan(0.0) // 0.0\nMath.tan(1.0) // 1.5574077246549023\n```" ], - "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" + "signature": "let tan: float => float" }, { - "id": "Core.Nullable.mapWithDefault", + "id": "Core.Math.tanh", "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "name": "tanh", + "docstrings": [ + "`tanh(v)` returns the hyperbolic tangent of argument `v`, which must be\nspecified in radians.\nSee [`Math.tanh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh) on MDN.\n\n## Examples\n\n```rescript\nMath.tanh(-0.0) // -0.0\nMath.tanh(0.0) // 0.0\nMath.tanh(1.0) // 0.7615941559557649\n```" + ], + "signature": "let tanh: float => float" }, { - "id": "Core.Nullable.flatMap", + "id": "Core.Math.trunc", "kind": "value", - "name": "flatMap", + "name": "trunc", "docstrings": [ - "`flatMap(value, f)` returns `f(value)` if `value` is not `null` or `undefined`,\notherwise returns `value` unchanged.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Nullable.make(value + 1)\n } else {\n Nullable.null\n }\n\nNullable.flatMap(Nullable.make(2), addIfAboveOne) // Nullable.make(3)\nNullable.flatMap(Nullable.make(-4), addIfAboveOne) // undefined\nNullable.flatMap(Nullable.null, addIfAboveOne) // undefined\n```" + "`trunc(v)` truncates the argument `v`, i.e., removes fractional digits.\nSee [`Math.trunc`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) on MDN.\n\n## Examples\n\n```rescript\nMath.trunc(0.123) // 0.0\nMath.trunc(1.999) // 1.0\nMath.trunc(13.37) // 13.0\nMath.trunc(42.84) // 42.0\n```" ], - "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" + "signature": "let trunc: float => float" } ] }, - "core/null": { - "id": "Core.Null", - "name": "Null", - "docstrings": [ - "Functions for handling values that could be `null`.\n\nIf you also need to cover `undefined`, check out `Nullable` instead." - ], + "core/list": { + "id": "Core.List", + "name": "List", + "docstrings": [], "items": [ { - "id": "Core.Null.t", + "id": "Core.List.t", "kind": "type", "name": "t", "docstrings": [ - "A type representing a value that can be either `'a` or `null`." + "Collection functions for manipulating the `list` data structures, a singly-linked list.\n\n**Prefer Array** if you need any of the following:\n\n- Random access of element\n- Better interop with JavaScript\n- Better memory usage & performance." ], - "signature": "type t<'a> = Js.Null.t<'a> = Value('a) | Null" + "signature": "type t<'a> = list<'a>" }, { - "id": "Core.Null.asNullable", + "id": "Core.List.length", "kind": "value", - "name": "asNullable", + "name": "length", "docstrings": [ - "Converts a `Null.t` into a `Nullable.t`.\n\n## Examples\n```rescript\nlet nullValue = Null.make(\"Hello\")\nlet asNullable = nullValue->Null.asNullable // Nullable.t\n```" + "`length(list)` returns the length of `list`.\n\n## Examples\n\n```rescript\nList.length(list{1, 2, 3}) // 3\n```" ], - "signature": "let asNullable: t<'a> => Core__Nullable.t<'a>" + "signature": "let length: list<'a> => int" }, { - "id": "Core.Null.null", + "id": "Core.List.size", "kind": "value", - "name": "null", + "name": "size", "docstrings": [ - "The value `null`.\n\nSee [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) on MDN.\n\n## Examples\n```rescript\nConsole.log(null) // Logs `null` to the console.\n```" + "`size(list)`. See [`length`](#length)\n\n## Examples\n\n```rescript\nList.size(list{1, 2, 3}) // 3\n```" ], - "signature": "let null: t<'a>" + "signature": "let size: list<'a> => int" }, { - "id": "Core.Null.make", + "id": "Core.List.head", "kind": "value", - "name": "make", + "name": "head", "docstrings": [ - "Creates a new `Null.t` from the provided value.\nThis means the compiler will enforce null checks for the new value.\n\n## Examples\n```rescript\nlet myStr = \"Hello\"\nlet asNullValue = myStr->Null.make // The compiler now thinks this can be `string` or `null`.\n```" + "`head(list)` returns `Some(value)` where `value` is the first element in the\nlist, or `None` if `list` is an empty list.\n\n## Examples\n\n```rescript\nList.head(list{}) // None\nList.head(list{1, 2, 3}) // Some(1)\n```" ], - "signature": "let make: 'a => t<'a>" - }, - { - "id": "Core.Null.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.Null.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Core__Ordering.t,\n) => Core__Ordering.t" + "signature": "let head: list<'a> => option<'a>" }, { - "id": "Core.Null.toOption", + "id": "Core.List.headExn", "kind": "value", - "name": "toOption", + "name": "headExn", "docstrings": [ - "Converts a nullable value into an option, so it can be pattern matched on.\nWill convert `null` to `None`, and a present value to `Some(value)`.\n\n## Examples\n```rescript\nlet nullStr = Null.make(\"Hello\")\n\nswitch nullStr->Null.toOption {\n| Some(str) => Console.log2(\"Got string:\", str)\n| None => Console.log(\"Didn't have a value.\")\n}\n```" + "`headExn(list)` same as [`head`](#head).\n\n## Examples\n\n```rescript\nList.headExn(list{1, 2, 3})->assertEqual(1)\n\nswitch List.headExn(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." ], - "signature": "let toOption: t<'a> => option<'a>" + "signature": "let headExn: list<'a> => 'a" }, { - "id": "Core.Null.fromOption", + "id": "Core.List.tail", "kind": "value", - "name": "fromOption", + "name": "tail", "docstrings": [ - "Turns an `option` into a `Null.t`. `None` will be converted to `null`.\n\n## Examples\n```rescript\nlet optString: option = None\nlet asNull = optString->Null.fromOption // Null.t\nConsole.log(asNull == Null.null) // Logs `true` to the console.\n```" + "`tail(list)` returns `None` if `list` is empty, otherwise it returns `Some(tail)`\nwhere `tail` is everything except the first element of `list`.\n\n## Examples\n\n```rescript\nList.tail(list{1, 2, 3}) // Some(list{2, 3})\n\nList.tail(list{}) // None\n```" ], - "signature": "let fromOption: option<'a> => t<'a>" + "signature": "let tail: list<'a> => option>" }, { - "id": "Core.Null.getOr", + "id": "Core.List.tailExn", "kind": "value", - "name": "getOr", + "name": "tailExn", "docstrings": [ - "`getOr(value, default)` returns `value` if not `null`, otherwise return\n`default`.\n\n## Examples\n\n```rescript\nNull.getOr(Null.null, \"Banana\") // Banana\nNull.getOr(Null.make(\"Apple\"), \"Banana\") // Apple\n\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Option.getOr(\"Anonymous\")\n\nNull.make(\"Jane\")->Null.toOption->greet // \"Greetings Jane\"\nNull.null->Null.toOption->greet // \"Greetings Anonymous\"\n```" + "`tailExn(list)` same as [`tail`](#tail).\n\n## Examples\n\n```rescript\nList.tailExn(list{1, 2, 3})->assertEqual(list{2, 3})\n\nswitch List.tailExn(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." ], - "signature": "let getOr: (t<'a>, 'a) => 'a" - }, - { - "id": "Core.Null.getWithDefault", - "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (t<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" + "signature": "let tailExn: list<'a> => list<'a>" }, { - "id": "Core.Null.getExn", + "id": "Core.List.add", "kind": "value", - "name": "getExn", + "name": "add", "docstrings": [ - "`getExn(value)` raises an exception if `null`, otherwise returns the value.\n\n```rescript\nNull.getExn(Null.make(3)) // 3\nNull.getExn(Null.null) /* Raises an Error */\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null`," + "`add(list, value)` adds a `value` to the beginning of list `list`.\n\n## Examples\n\n```rescript\nList.add(list{2, 3}, 1) // list{1, 2, 3}\n\nList.add(list{\"World\", \"!\"}, \"Hello\") // list{\"Hello\", \"World\", \"!\"}\n```" ], - "signature": "let getExn: t<'a> => 'a" + "signature": "let add: (list<'a>, 'a) => list<'a>" }, { - "id": "Core.Null.getUnsafe", + "id": "Core.List.get", "kind": "value", - "name": "getUnsafe", + "name": "get", "docstrings": [ - "`getUnsafe(value)` returns `value`.\n\n## Examples\n\n```rescript\nNull.getUnsafe(Null.make(3)) == 3\nNull.getUnsafe(Null.null) // Raises an error\n```\n\n## Important\n\n- This is an unsafe operation, it assumes `value` is not `null`." + "`get(list, index)` return the `index` element in `list`, or `None` if `index`\nis larger than the length of list `list`.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->List.get(1) // Some(\"B\")\n\nabc->List.get(4) // None\n```" ], - "signature": "let getUnsafe: t<'a> => 'a" + "signature": "let get: (list<'a>, int) => option<'a>" }, { - "id": "Core.Null.forEach", + "id": "Core.List.getExn", "kind": "value", - "name": "forEach", + "name": "getExn", "docstrings": [ - "`forEach(value, f)` call `f` on `value`. if `value` is not `null`, then if calls\n`f`, otherwise returns `unit`.\n\n## Examples\n\n```rescript\nNull.forEach(Null.make(\"thing\"), x => Console.log(x)) // logs \"thing\"\nNull.forEach(Null.null, x => Console.log(x)) // logs nothing\n```" + "`getExn(list, index)` same as [`get`](#get).\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc\n->List.getExn(1)\n->assertEqual(\"B\")\n\nswitch abc->List.getExn(4) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if `index` is larger than the length of list." ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let getExn: (list<'a>, int) => 'a" }, { - "id": "Core.Null.map", + "id": "Core.List.make", "kind": "value", - "name": "map", + "name": "make", "docstrings": [ - "`map(value, f)` returns `f(value)` if `value` is not `null`, otherwise returns\n`value` unchanged.\n\n## Examples\n\n```rescript\nNull.map(Null.make(3), x => x * x) // Null.make(9)\nNull.map(Null.null, x => x * x) // null\n```" + "`make(length, value)` returns a list of length `length` with each element filled\nwith `value`. Returns an empty list if `value` is negative.\n\n## Examples\n\n```rescript\nList.make(~length=3, 1) // list{1, 1, 1}\n```" ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let make: (~length: int, 'a) => list<'a>" }, { - "id": "Core.Null.mapOr", + "id": "Core.List.fromInitializer", "kind": "value", - "name": "mapOr", + "name": "fromInitializer", "docstrings": [ - "`mapOr(value, default, f)` returns `f(value)` if `value` is not `null`,\notherwise returns `default`.\n\n## Examples\n\n```rescript\nlet someValue = Null.make(3)\nsomeValue->Null.mapOr(0, x => x + 5) // 8\n\nlet noneValue = Null.null\nnoneValue->Null.mapOr(0, x => x + 5) // 0\n```" + "`fromInitializer(length, f)` return a list of length `length` with element initialized\nwith `f`. Returns an empty list if `length` is negative.\n\n## Examples\n\n```rescript\nList.fromInitializer(~length=5, i => i) // list{0, 1, 2, 3, 4}\n\nList.fromInitializer(~length=5, i => i * i) // list{0, 1, 4, 9, 16}\n```" ], - "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" - }, - { - "id": "Core.Null.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "signature": "let fromInitializer: (~length: int, int => 'a) => list<'a>" }, { - "id": "Core.Null.flatMap", - "kind": "value", - "name": "flatMap", - "docstrings": [ - "`flatMap(value, f)` returns `f(value)` if `value` is not `null`, otherwise\nreturns `value` unchanged.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Null.make(value + 1)\n } else {\n Null.null\n }\n\nNull.flatMap(Null.make(2), addIfAboveOne) // Null.make(3)\nNull.flatMap(Null.make(-4), addIfAboveOne) // null\nNull.flatMap(Null.null, addIfAboveOne) // null\n```" - ], - "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" - } - ] - }, - "core/math": { - "id": "Core.Math", - "name": "Math", - "docstrings": [ - "Functions for interacting with JavaScript Math.\nSee: [`Math`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)." - ], - "items": [ - { - "id": "Core.Math.abs", + "id": "Core.List.shuffle", "kind": "value", - "name": "abs", + "name": "shuffle", "docstrings": [ - "`abs(v)` returns absolute value of `v`.\nSee [`Math.abs`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs) on MDN.\n\n## Examples\n\n```rescript\nMath.abs(-2.0) // 2.0\nMath.abs(3.0) // 3.0\n```" + "`shuffle(list)` returns a new list in random order.\n\n## Examples\n\n```rescript\nList.shuffle(list{1, 2, 3}) // list{2, 1, 3}\n```" ], - "signature": "let abs: float => float" + "signature": "let shuffle: list<'a> => list<'a>" }, { - "id": "Core.Math.acos", + "id": "Core.List.toShuffled", "kind": "value", - "name": "acos", + "name": "toShuffled", "docstrings": [ - "`acos(v)` returns arccosine (in radians) of argument `v`, returns `NaN` if the\nargument is outside the range [-1.0, 1.0].\nSee [`Math.acos`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos) on MDN.\n\n## Examples\n\n```rescript\nMath.acos(-1.0) // 3.141592653589793\nMath.acos(-3.0)->Float.isNaN // true\n```" + "`toShuffled(list)` returns a new list in random order.\n\n## Examples\n\n```rescript\nList.toShuffled(list{1, 2, 3}) // list{2, 1, 3}\n```" ], - "signature": "let acos: float => float" + "signature": "let toShuffled: list<'a> => list<'a>", + "deprecated": "Use `shuffle` instead" }, { - "id": "Core.Math.acosh", + "id": "Core.List.drop", "kind": "value", - "name": "acosh", + "name": "drop", "docstrings": [ - "`acosh(v)` returns the inverse hyperbolic arccosine (in radians) of argument `v`,\nreturns `NaN` if the argument is less than `1.0`.\nSee [`Math.acosh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh) on MDN.\n\n## Examples\n\n```rescript\nMath.acosh(1.0) // 0.0\nMath.acosh(0.5)->Float.isNaN // true\n```" + "`drop(list, value)` return a new list, dropping the first `value` element.\nReturns `None` if `list` has fewer than `value` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.drop(2) // Some(list{3})\n\nlist{1, 2, 3}->List.drop(3) // Some(list{})\n\nlist{1, 2, 3}->List.drop(4) // None\n```" ], - "signature": "let acosh: float => float" + "signature": "let drop: (list<'a>, int) => option>" }, { - "id": "Core.Math.asin", + "id": "Core.List.take", "kind": "value", - "name": "asin", + "name": "take", "docstrings": [ - "`asin(v)` returns the inverse sine (in radians) of argument `v`, returns `NaN`\nif the argument `v` is outside the range [-1.0, 1.0].\nSee [`Math.asin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin) on MDN.\n\n## Examples\n\n```rescript\nMath.asin(-1.0) // -1.5707963267948966\nMath.asin(-2.0)->Float.isNaN // true\n```" + "`take(list, value)` returns a list with the first `value` elements from `list`,\nor `None` if `list` has fewer than `value` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.take(1) // Some(list{1})\n\nlist{1, 2, 3}->List.take(2) // Some(list{1, 2})\n\nlist{1, 2, 3}->List.take(4) // None\n```" ], - "signature": "let asin: float => float" + "signature": "let take: (list<'a>, int) => option>" }, { - "id": "Core.Math.asinh", + "id": "Core.List.splitAt", "kind": "value", - "name": "asinh", + "name": "splitAt", "docstrings": [ - "`asinh(v)` returns the inverse hyperbolic sine of argument `v`.\nSee [`Math.asinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh) on MDN.\n\n## Examples\n\n```rescript\nMath.asinh(-1.0) // -0.881373587019543\nMath.asinh(-0.0) // -0.0\n```" + "`splitAt(list, n)` split the list `list` at `n`. Returns `None` when the length\nof `list` is less than `n`.\n\n## Examples\n\n```rescript\nlist{\"Hello\", \"World\"}->List.splitAt(1) // Some((list{\"Hello\"}, list{\"World\"}))\n\nlist{0, 1, 2, 3, 4}->List.splitAt(2) // Some((list{0, 1}, list{2, 3, 4}))\n```" ], - "signature": "let asinh: float => float" + "signature": "let splitAt: (list<'a>, int) => option<(list<'a>, list<'a>)>" }, { - "id": "Core.Math.atan", + "id": "Core.List.concat", "kind": "value", - "name": "atan", + "name": "concat", "docstrings": [ - "`atan(v)` returns the inverse tangent (in radians) of argument `v`.\nSee [`Math.atan`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan) on MDN.\n\n## Examples\n\n```rescript\nMath.atan(-0.0) // -0.0\nMath.atan(0.0) // 0.0\nMath.atan(1.0) // 0.7853981633974483\n```" + "`concat(list1, list2)` returns the list obtained by adding `list1` after `list2`.\n\n## Examples\n\n```rescript\nList.concat(list{1, 2, 3}, list{4, 5}) // list{1, 2, 3, 4, 5}\n```" ], - "signature": "let atan: float => float" + "signature": "let concat: (list<'a>, list<'a>) => list<'a>" }, { - "id": "Core.Math.atanh", + "id": "Core.List.concatMany", "kind": "value", - "name": "atanh", + "name": "concatMany", "docstrings": [ - "`atanh(v)` returns the invert hyperbolic tangent of argument `v`. Returns `NaN`\nif the argument `v` is is outside the range [-1.0, 1.0] and `Infinity` if `v`\nis `-1.0` or `1.0`.\nSee [`Math.atanh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atanh) on MDN.\n\n## Examples\n\n```rescript\nMath.atanh(-2.0)->Float.isNaN // true\nMath.atanh(-1.0)->Float.isFinite // false\nMath.atanh(-0.0) // -0.0\nMath.atanh(0.0) // 0.0\nMath.atanh(0.5) // 0.5493061443340548\n```" + "`concatMany(arr)` returns the list obtained by concatenating all the lists in\narray `arr`, in order.\n\n## Examples\n\n```rescript\nList.concatMany([list{1, 2, 3}, list{}, list{3}]) // list{1, 2, 3, 3}\n```" ], - "signature": "let atanh: float => float" + "signature": "let concatMany: array> => list<'a>" }, { - "id": "Core.Math.atan2", + "id": "Core.List.reverseConcat", "kind": "value", - "name": "atan2", + "name": "reverseConcat", "docstrings": [ - "`atan2(~y, ~x)` returns the angle (in radians) of the quotient `y /. x`. It is\nalso the angle between the *x*-axis and point (*x*, *y*).\nSee [`Math.atan2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2) on MDN.\n\n## Examples\n\n```rescript\nMath.atan2(~y=0.0, ~x=10.0) == 0.0\nMath.atan2(~x=5.0, ~y=5.0) == Math.Constants.pi /. 4.0\nMath.atan2(~x=90.0, ~y=15.0) // 1.4056476493802699\nMath.atan2(~x=15.0, ~y=90.0) // 0.16514867741462683\n```" + "`reverseConcat(list1, list2)` is equivalent to writing: `concat(reverse(list1, list2)`\n\n## Examples\n\n```rescript\nList.reverseConcat(list{1, 2}, list{3, 4}) // list{2, 1, 3, 4}\n```" ], - "signature": "let atan2: (~y: float, ~x: float) => float" + "signature": "let reverseConcat: (list<'a>, list<'a>) => list<'a>" }, { - "id": "Core.Math.cbrt", + "id": "Core.List.flat", "kind": "value", - "name": "cbrt", + "name": "flat", "docstrings": [ - "`cbrt(v)` returns the cube root of argument `v`.\nSee [`Math.cbrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt) on MDN.\n\n## Examples\n\n```rescript\nMath.cbrt(-1.0) // -1.0\nMath.cbrt(-0.0) // -0.0\nMath.cbrt(0.0) // 0.0\n```" + "`flat(list)` return the list obtained by concatenating all the lists in\n`list`, in order.\n\n## Examples\n\n```rescript\nList.flat(list{list{1, 2, 3}, list{}, list{3}}) // list{1, 2, 3, 3}\n```" ], - "signature": "let cbrt: float => float" + "signature": "let flat: list> => list<'a>" }, { - "id": "Core.Math.ceil", + "id": "Core.List.map", "kind": "value", - "name": "ceil", + "name": "map", "docstrings": [ - "`ceil(v)` returns the smallest integral value greater than or equal to the\nargument `v`. The result is a `float` and is not restricted to the `int` data\ntype range.\nSee [`Math.ceil`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil) on MDN.\n\n## Examples\n\n```rescript\nMath.ceil(3.1) == 4.0\nMath.ceil(3.0) == 3.0\nMath.ceil(-3.1) == -3.0\nMath.ceil(2_150_000_000.3) == 2_150_000_001.0\n```" + "`map(list, f)` returns a new list with `f` applied to each element of `list`.\n\n## Examples\n\n```rescript\nlist{1, 2}->List.map(x => x + 1) // list{3, 4}\n```" ], - "signature": "let ceil: float => float" + "signature": "let map: (list<'a>, 'a => 'b) => list<'b>" }, { - "id": "Core.Math.cos", + "id": "Core.List.zip", "kind": "value", - "name": "cos", + "name": "zip", "docstrings": [ - "`cos(v)` returns the cosine of argument `v`, which must be specified in radians.\nSee [`Math.cos`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos) on MDN.\n\n## Examples\n\n```rescript\nMath.cos(-0.0) // 1.0\nMath.cos(0.0) // 1.0\nMath.cos(1.0) // 0.5403023058681398\n```" + "`zip(list1, list2)` returns a list of pairs from the two lists with the length\nof the shorter list.\n\n## Examples\n\n```rescript\nList.zip(list{1, 2}, list{3, 4, 5}) // list{(1, 3), (2, 4)}\n```" ], - "signature": "let cos: float => float" + "signature": "let zip: (list<'a>, list<'b>) => list<('a, 'b)>" }, { - "id": "Core.Math.cosh", + "id": "Core.List.zipBy", "kind": "value", - "name": "cosh", + "name": "zipBy", "docstrings": [ - "`cosh(v)` returns the hyperbolic cosine of argument `v`, which must be specified\nin radians.\nSee [`Math.cosh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cosh) on MDN.\n\n## Examples\n\n```rescript\nMath.cosh(-1.0) // 1.5430806348152437\nMath.cosh(-0.0) // 1.0\nMath.cosh(0.0) // 1.0\n```" + "`zipBy(list1, list2, f)`. See [`zip`](#zip)\n\n## Examples\n\n```rescript\nList.zipBy(list{1, 2, 3}, list{4, 5}, (a, b) => 2 * a + b) // list{6, 9}\n```" ], - "signature": "let cosh: float => float" + "signature": "let zipBy: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" }, { - "id": "Core.Math.exp", + "id": "Core.List.mapWithIndex", "kind": "value", - "name": "exp", + "name": "mapWithIndex", "docstrings": [ - "`exp(v)` returns natural exponentional, returns *e* (the base of natural logarithms)\nto the power of the given argument `v`.\nSee [`Math.exp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp) on MDN.\n\n## Examples\n\n```rescript\nMath.exp(-1.0) // 0.36787944117144233\nMath.exp(0.0) // 1.0\n```" + "`mapWithIndex(list, f)` applies `f` to each element of `list`. Function `f`\ntakes two arguments: the index starting from 0 and the element from `list`, in\nthat order.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.mapWithIndex((x, index) => index + x) // list{1, 3, 5}\n```" ], - "signature": "let exp: float => float" + "signature": "let mapWithIndex: (list<'a>, ('a, int) => 'b) => list<'b>" }, { - "id": "Core.Math.expm1", + "id": "Core.List.fromArray", "kind": "value", - "name": "expm1", + "name": "fromArray", "docstrings": [ - "`expm1(v)` returns *e* (the base of natural logarithms) to the power of the given\nargument `v` minus 1.\nSee [`Math.expm1`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/expm1) on MDN.\n\n## Examples\n\n```rescript\nMath.expm1(-1.0) // -0.6321205588285577\nMath.expm1(-0.0) // -0\n```" + "`fromArray(arr)` converts the given array `arr` to a list.\n\n## Examples\n\n```rescript\nList.fromArray([1, 2, 3]) // list{1, 2, 3}\n```" ], - "signature": "let expm1: float => float" + "signature": "let fromArray: array<'a> => list<'a>" }, { - "id": "Core.Math.floor", + "id": "Core.List.toArray", "kind": "value", - "name": "floor", + "name": "toArray", "docstrings": [ - "`floor(v)` returns the largest integral value less than or equal to the argument\n`v`. The result is a `float` and is not restricted to the `int` data type range.\nSee [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) on MDN.\n\n## Examples\n\n```rescript\nMath.floor(-45.95) // -46.0\nMath.floor(-45.05) // -46.0\nMath.floor(-0.0) // -0.0\n```" + "`toArray(list)` converts the given list `list` to an array.\n\n## Examples\n\n```rescript\nList.toArray(list{1, 2, 3}) // [1, 2, 3]\n```" ], - "signature": "let floor: float => float" + "signature": "let toArray: list<'a> => array<'a>" }, { - "id": "Core.Math.fround", + "id": "Core.List.reverse", "kind": "value", - "name": "fround", + "name": "reverse", "docstrings": [ - "`fround(v)` returns the nearest single precision float.\nSee [`Math.fround`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround) on MDN.\n\n## Examples\n\n```rescript\nMath.fround(5.5) == 5.5\nMath.fround(5.05) == 5.050000190734863\n```" + "`reverse(list)` returns a new list whose elements are those of `list` in\nreversed order.\n\n## Examples\n\n```rescript\nList.reverse(list{1, 2, 3}) // list{3, 2, 1}\n```" ], - "signature": "let fround: float => float" + "signature": "let reverse: list<'a> => list<'a>" }, { - "id": "Core.Math.hypot", + "id": "Core.List.mapReverse", "kind": "value", - "name": "hypot", + "name": "mapReverse", "docstrings": [ - "`hypot(a, b)` returns the square root of the sum of squares of its two arguments\n(the Pythagorean formula).\nSee [`Math.hypot`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot) on MDN.\n\n## Examples\n\n```rescript\nMath.hypot(3.0, 4.0) // 5.0\nMath.hypot(3.0, 5.0) // 5.8309518948453\n```" + "`mapReverse(list, f)` is equivalent to `map` function.\n\n## Examples\n\n```rescript\nlet f = x => x * x\nlet l = list{3, 4, 5}\n\nlet withMap = List.map(l, f)->List.reverse\nlet withMapReverse = l->List.mapReverse(f)\n\nConsole.log(withMap == withMapReverse) // true\n```" ], - "signature": "let hypot: (float, float) => float" + "signature": "let mapReverse: (list<'a>, 'a => 'b) => list<'b>" }, { - "id": "Core.Math.hypotMany", + "id": "Core.List.forEach", "kind": "value", - "name": "hypotMany", + "name": "forEach", "docstrings": [ - "`hypotMany(arr)` returns the square root of the sum of squares of the numbers in\nthe array argument (generalized Pythagorean equation). Using an array allows you\nto have more than two items. If `arr` is an empty array then returns `0.0`.\nSee [`Math.hypot`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot) on MDN.\n\n## Examples\n\n```rescript\nMath.hypotMany([3.0, 4.0, 5.0]) // 7.0710678118654755\nMath.hypotMany([]) // 0.0\n```" + "`forEach(list, f)` call `f` on each element of `list` from the beginning to end.\n`f` returns `unit`, so no new array is created. Use `forEach` when you are primarily\nconcerned with repetitively creating side effects.\n\n## Examples\n\n```rescript\nList.forEach(list{\"a\", \"b\", \"c\"}, x => Console.log(\"Item: \" ++ x))\n/*\n prints:\n Item: a\n Item: b\n Item: c\n*/\n```" ], - "signature": "let hypotMany: array => float" + "signature": "let forEach: (list<'a>, 'a => unit) => unit" }, { - "id": "Core.Math.log", + "id": "Core.List.forEachWithIndex", "kind": "value", - "name": "log", + "name": "forEachWithIndex", "docstrings": [ - "`log(v)` returns the natural logarithm of argument `v`, this is the number *x*\nsuch that `e^x` equals the argument. Returns `NaN` for negative arguments and\n`Infinity` for `0.0` or `-0.0`.\nSee [`Math.log`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log) on MDN.\n\n## Examples\n\n```rescript\nMath.log(-1.0)->Float.isNaN // true\nMath.log(-0.0)->Float.isFinite // false\nMath.log(0.0)->Float.isFinite // false\nMath.log(1.0) // 0\n```" + "`forEachWithIndex(list, f, index)` call `f` on each element of `list` from beginning\nto end. Function `f` takes two arguments: the `index` starting from 0 and the\nelement from `list`. `f` returns `unit`.\n\n## Examples\n\n```rescript\nList.forEachWithIndex(list{\"a\", \"b\", \"c\"}, (x, index) => {\n Console.log(\"Item \" ++ Int.toString(index) ++ \" is \" ++ x)\n})\n/*\n prints:\n Item 0 is a\n Item 1 is b\n Item 2 is cc\n*/\n```" ], - "signature": "let log: float => float" + "signature": "let forEachWithIndex: (list<'a>, ('a, int) => unit) => unit" }, { - "id": "Core.Math.log1p", + "id": "Core.List.reduce", "kind": "value", - "name": "log1p", + "name": "reduce", "docstrings": [ - "`log1p(v)` returns the natural logarithm of one plus the argument `v`.\nReturns `NaN` for arguments less than `-1` and `Infinity` if `v` is `-1.0`.\nSee [`Math.log1p`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p) on MDN.\n\n## Examples\n\n```rescript\nMath.log1p(-2.0)->Float.isNaN // true\nMath.log1p(-1.0)->Float.isFinite // false\nMath.log1p(-0.0) // -0\n```" + "`reduce(list, initialValue, f)` applies `f` to each element of `list` from\nbeginning to end. Function `f` has two parameters: the item from the list and\nan \"accumulator\", which starts with a value of `initialValue`. `reduce` returns\nthe final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduce(0, (a, b) => a + b) // 10\n\n// same as\n\nlist{1, 2, 3, 4}->List.reduce(0, (acc, item) => acc + item) // 10\n```" ], - "signature": "let log1p: float => float" + "signature": "let reduce: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" }, { - "id": "Core.Math.log10", + "id": "Core.List.reduceWithIndex", "kind": "value", - "name": "log10", + "name": "reduceWithIndex", "docstrings": [ - "`log10(v)` returns the base 10 logarithm of argument `v`. Returns `NaN` for\nnegative `v`. If `v` is `-0.0` or `0.0` returns `Infinity`.\nSee [`Math.log10`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10) on MDN.\n\n## Examples\n\n```rescript\nMath.log10(-2.0)->Float.isNaN // true\nMath.log10(-0.0)->Float.isFinite // false\nMath.log10(0.0)->Float.isFinite // false\nMath.log10(1.0) // 0\n```" + "`reduceWithIndex(list, initialValue, f)` applies `f` to each element of `list`\nfrom beginning to end. Function `f` has three parameters: the item from the list\nand an \"accumulator\", which starts with a value of `initialValue` and the index\nof each element. `reduceWithIndex` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduceWithIndex(0, (acc, item, index) => acc + item + index) // 16\n```" ], - "signature": "let log10: float => float" + "signature": "let reduceWithIndex: (list<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, { - "id": "Core.Math.log2", + "id": "Core.List.reduceReverse", "kind": "value", - "name": "log2", + "name": "reduceReverse", "docstrings": [ - "`log2(v)` returns the base 2 logarithm of argument `v`. Returns `NaN` for\nnegative `v` and `Infinity` if `v` is `-0.0` or `0.0`.\nSee [`Math.log2`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2) on MDN.\n\n## Examples\n\n```rescript\nMath.log2(-2.0)->Float.isNaN // true\nMath.log2(-0.0)->Float.isFinite // false\nMath.log2(0.0)->Float.isFinite // false\nMath.log2(1.0) // 0.0\n```" + "`reduceReverse(list, initialValue, f)` works like `reduce`, except that\nfunction `f` is applied to each item of `list` from the last back to the first.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->List.reduceReverse(0, (a, b) => a + b) // 10\n\nlist{1, 2, 3, 4}->List.reduceReverse(10, (a, b) => a - b) // 0\n\nlist{1, 2, 3, 4}->List.reduceReverse(list{}, List.add) // list{1, 2, 3, 4}\n```" ], - "signature": "let log2: float => float" + "signature": "let reduceReverse: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" }, { - "id": "Core.Math.min", + "id": "Core.List.mapReverse2", "kind": "value", - "name": "min", + "name": "mapReverse2", "docstrings": [ - "`min(a, b)` returns the minimum of its two float arguments.\nSee [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n## Examples\n\n```rescript\nMath.min(1.0, 2.0) // 1.0\nMath.min(-1.0, -2.0) // -2.0\n```" + "`mapReverse2(list1, list2, f)` is equivalent to `List.zipBy(list1, list2, f)->List.reverse`.\n\n## Examples\n\n```rescript\nList.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b) // list{4, 2}\n```" ], - "signature": "let min: (float, float) => float" + "signature": "let mapReverse2: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" }, { - "id": "Core.Math.minMany", + "id": "Core.List.forEach2", "kind": "value", - "name": "minMany", + "name": "forEach2", "docstrings": [ - "`minMany(arr)` returns the minimum of the float in the given array `arr`.\nReturns `Infinity` if `arr` is empty.\nSee [`Math.min`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min) on MDN.\n\n## Examples\n\n```rescript\nMath.minMany([1.0, 2.0]) // 1.0\nMath.minMany([-1.0, -2.0]) // -2.0\nMath.minMany([])->Float.isFinite // false\n```" + "`forEach2(list1, list2, f)` is similar to `forEach`, but accepts two lists and\nstops at the length of the shorter list.\n\n## Examples\n\n```rescript\nList.forEach2(list{\"Z\", \"Y\"}, list{\"A\", \"B\", \"C\"}, (x, y) => Console.log2(x, y))\n\n/*\n prints:\n \"Z\" \"A\"\n \"Y\" \"B\"\n*/\n```" ], - "signature": "let minMany: array => float" + "signature": "let forEach2: (list<'a>, list<'b>, ('a, 'b) => 'c) => unit" }, { - "id": "Core.Math.max", + "id": "Core.List.reduce2", "kind": "value", - "name": "max", + "name": "reduce2", "docstrings": [ - "`max(a, b)` returns the maximum of its two float arguments.\nSee [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n## Examples\n\n```rescript\nMath.max(1.0, 2.0) // 2.0\nMath.max(-1.0, -2.0) // -1.0\n```" + "`reduce2(list1, list2, initialValue, f)` applies `f` to each element of `list1`\nand `list2` from beginning to end. Stops with the shorter list. Function `f` has\nthree parameters: an accumulator which starts with a value of `initialValue`, an\nitem from `l1`, and an item from `l2`. `reduce2` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nList.reduce2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) // 0 + (1 * 1 + 4) + (2 * 2 + 5)\n```" ], - "signature": "let max: (float, float) => float" + "signature": "let reduce2: (list<'b>, list<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" }, { - "id": "Core.Math.maxMany", + "id": "Core.List.reduceReverse2", "kind": "value", - "name": "maxMany", + "name": "reduceReverse2", "docstrings": [ - "`maxMany(arr)` returns the maximum of the float in the given array `arr`.\nReturns `Infinity` if `arr` is empty.\nSee [`Math.max`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max) on MDN.\n\n## Examples\n\n```rescript\nMath.maxMany([1.0, 2.0]) // 2.0\nMath.maxMany([-1.0, -2.0]) // -1.0\nMath.maxMany([])->Float.isFinite // false\n```" + "`reduceReverse2(list1, list2, initialValue, f)` applies `f` to each element of\n`list1` and `list2`from end to beginning. Stops with the shorter list. Function\n`f` has three parameters: an accumulator which starts with a value of\n`initialValue`, an item from `l1`, and an item from `l2`. `reduce2` returns the\nfinal value of the accumulator.\n\n## Examples\n\n```rescript\nList.reduceReverse2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) // + (1 * 1 + 4) + (2 * 2 + 5)\n```" ], - "signature": "let maxMany: array => float" + "signature": "let reduceReverse2: (list<'a>, list<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" }, { - "id": "Core.Math.pow", + "id": "Core.List.every", "kind": "value", - "name": "pow", + "name": "every", "docstrings": [ - "`pow(a, ~exp)` raises the given base `a` to the given exponent `exp`.\nSee [`Math.pow`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow) on MDN.\n\n## Examples\n\n```rescript\nMath.pow(2.0, ~exp=4.0) // 16.0\nMath.pow(3.0, ~exp=4.0) // 81.0\n```" + "`every(list, f)` returns `true` if all elements in `list` satisfy `f`, where `f`\nis a predicate: a function taking an element and returning a bool.\n\n## Examples\n\n```rescript\nlet isBelow10 = value => value < 10\n\nlist{1, 9, 8, 2}->List.every(isBelow10) // true\n\nlist{1, 99, 8, 2}->List.every(isBelow10) // false\n```" ], - "signature": "let pow: (float, ~exp: float) => float" + "signature": "let every: (list<'a>, 'a => bool) => bool" }, { - "id": "Core.Math.random", + "id": "Core.List.some", "kind": "value", - "name": "random", + "name": "some", "docstrings": [ - "`random()` returns a random number in the half-closed interval [0,1].\nSee [`Math.random`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) on MDN.\n\n## Examples\n\n```rescript\nMath.random()\n```" + "`some(list, f)` returns `true` if at least _one_ of the elements in `list`\nsatisfies `f`, where `f` is a predicate: a function taking an element and\nreturning a bool.\n\n## Examples\n\n```rescript\nlet isAbove100 = value => value > 100\n\nlist{101, 1, 2, 3}->List.some(isAbove100) // true\n\nlist{1, 2, 3, 4}->List.some(isAbove100) // false\n```" ], - "signature": "let random: unit => float" + "signature": "let some: (list<'a>, 'a => bool) => bool" }, { - "id": "Core.Math.round", + "id": "Core.List.every2", "kind": "value", - "name": "round", + "name": "every2", "docstrings": [ - "`round(v)` returns then value of `v` rounded to nearest integral value\n(expressed as a float). If the fractional portion of the argument `v` is greater\nthan `0.5`, the argument `v` is rounded to the float with the next higher\nabsolute value.\nSee [`Math.round`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round) on MDN.\n\n## Examples\n\n```rescript\nMath.round(-20.5) // -20.0\nMath.round(-0.1) // -0.0\nMath.round(0.0) // 0.0\nMath.round(-0.0) // -0.0\n```" + "`every2(list1, list2, f)` returns `true` if predicate `f` is `true` for all\npairs of elements up to the shorter length (i.e. `min(length(list1), length(list2))`)\n\n## Examples\n\n```rescript\nList.every2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) // true\n\nList.every2(list{}, list{1}, (a, b) => a > b) // true\n\nList.every2(list{2, 3}, list{1}, (a, b) => a > b) // true\n\nList.every2(list{0, 1}, list{5, 0}, (a, b) => a > b) // false\n```" ], - "signature": "let round: float => float" + "signature": "let every2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Core.Math.sign", + "id": "Core.List.some2", "kind": "value", - "name": "sign", + "name": "some2", "docstrings": [ - "`sign(v)` returns the sign of its foat argument: `-1` if negative, `0` if\nzero, `1` if positive.\nSee [`Math.sign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign) on MDN.\n\n## Examples\n\n```rescript\nMath.sign(3.0) // 1.0\nMath.sign(-3.0) // 1.0\nMath.sign(0.0) // 0.0\n```" + "`some2(list1, list2, f)` returns `true` if predicate `f` is `true` for any pair\nof elements up to the shorter length (i.e. `min(length(list1), length(list2))`)\n\n## Examples\n\n```rescript\nList.some2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) // true\n\nList.some2(list{}, list{1}, (a, b) => a > b) // false\n\nList.some2(list{2, 3}, list{1}, (a, b) => a > b) // true\n\nList.some2(list{0, 1}, list{5, 0}, (a, b) => a > b) // true\n```" ], - "signature": "let sign: float => float" + "signature": "let some2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Core.Math.sin", + "id": "Core.List.compareLength", "kind": "value", - "name": "sin", + "name": "compareLength", "docstrings": [ - "`sin(v)` returns the sine of argument `v`, which must be specified in radians.\nSee [`Math.sin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin) on MDN.\n\n## Examples\n\n```rescript\nMath.sin(-0.0) // -0.0\nMath.sin(0.0) // 0.0\nMath.sin(1.0) // 0.8414709848078965\n```" + "`compareLength(list1, list2)` compare two lists solely by length. Returns `-1.` if\n`length(list1)` is less than `length(list2)`, `0.` if `length(list1)` equals\n`length(list2)`, and `1.` if `length(list1)` is greater than `length(list2)`.\n\n## Examples\n\n```rescript\nList.compareLength(list{1, 2}, list{3, 4, 5, 6}) // -1.\n\nList.compareLength(list{1, 2, 3}, list{4, 5, 6}) // 0.\n\nList.compareLength(list{1, 2, 3, 4}, list{5, 6}) // 1.\n```" ], - "signature": "let sin: float => float" + "signature": "let compareLength: (list<'a>, list<'a>) => Ordering.t" }, { - "id": "Core.Math.sinh", + "id": "Core.List.compare", "kind": "value", - "name": "sinh", + "name": "compare", "docstrings": [ - "`sinh(v)` returns then hyperbolic sine of argument `v`, which must be specified\nin radians.\nSee [`Math.sinh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sinh) on MDN.\n\n## Examples\n\n```rescript\nMath.sinh(-0.0) // -0.0\nMath.sinh(0.0) // 0.0\nMath.sinh(1.0) // 1.1752011936438014\n```" + "`compare(list1, list2, f)` compare elements one by one `f`. `f` returns a negative\nnumber if `list1` is \"less than\" `list2`, zero if `list1` is \"equal to\" `list2`,\na positive number if `list1` is \"greater than\" `list2`.\n\nThe comparison returns the first non-zero result of `f`, or zero if `f` returns\nzero for all `list1` and `list2`.\n\n- If all items have compared equal, but `list1` is exhausted first, return `-1.`. (`list1` is shorter).\n- If all items have compared equal, but `list2` is exhausted first, return `1.` (`list1` is longer).\n\n## Examples\n\n```rescript\nList.compare(list{3}, list{3, 7}, (a, b) => Int.compare(a, b)) // -1.\nList.compare(list{5, 3}, list{5}, (a, b) => Int.compare(a, b)) // 1.\nList.compare(list{1, 3, 5}, list{1, 4, 2}, (a, b) => Int.compare(a, b)) // -1.\nList.compare(list{1, 3, 5}, list{1, 2, 3}, (a, b) => Int.compare(a, b)) // 1.\nList.compare(list{1, 3, 5}, list{1, 3, 5}, (a, b) => Int.compare(a, b)) // 0.\n```\n\n**Please note:** The total ordering of List is different from Array,\nfor Array, we compare the length first and, only if the lengths are equal, elements one by one.\nFor lists, we just compare elements one by one." ], - "signature": "let sinh: float => float" + "signature": "let compare: (\n list<'a>,\n list<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" }, { - "id": "Core.Math.sqrt", + "id": "Core.List.equal", "kind": "value", - "name": "sqrt", + "name": "equal", "docstrings": [ - "`sqrt(v)` returns the square root of `v`. If `v` is negative returns `NaN`.\nSee [`Math.sqrt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) on MDN.\n\n## Examples\n\n```rescript\nMath.sqrt(-1.0)->Float.isNaN // true\nMath.sqrt(-0.0) // -0.0\nMath.sqrt(0.0) // 0.0\nMath.sqrt(1.0) // 1.0\nMath.sqrt(9.0) // 3.0\n```" + "`equal(list1, list2, f)` check equality of `list2` and `list2` using `f` for\nequality on elements, where `f` is a function that returns `true` if items `x` and\n`y` meet some criterion for equality, `false` otherwise. equal `false` if length\nof `list1` and `list2` are not the same.\n\n## Examples\n\n```rescript\nList.equal(list{1, 2, 3}, list{1, 2}, (a, b) => a == b) // false\n\nList.equal(list{1, 2}, list{1, 2}, (a, b) => a == b) // true\n\nList.equal(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)) // true\n```" ], - "signature": "let sqrt: float => float" + "signature": "let equal: (list<'a>, list<'a>, ('a, 'a) => bool) => bool" }, { - "id": "Core.Math.tan", + "id": "Core.List.has", "kind": "value", - "name": "tan", + "name": "has", "docstrings": [ - "`tan(v)` returns the tangent of argument `v`, which must be specified in\nradians. Returns `NaN` if `v` is positive `Infinity` or negative `Infinity`.\nSee [`Math.tan`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan) on MDN.\n\n## Examples\n\n```rescript\nMath.tan(-0.0) // -0.0\nMath.tan(0.0) // 0.0\nMath.tan(1.0) // 1.5574077246549023\n```" + "`has(list, element, f)` returns `true` if the list contains at least one\n`element` for which `f` returns `true'.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->List.has(2, (a, b) => a == b) // true\n\nlist{1, 2, 3}->List.has(4, (a, b) => a == b) // false\n\nlist{(-1), (-2), (-3)}->List.has(2, (a, b) => abs(a) == abs(b)) // true\n```" ], - "signature": "let tan: float => float" + "signature": "let has: (list<'a>, 'b, ('a, 'b) => bool) => bool" }, { - "id": "Core.Math.tanh", + "id": "Core.List.find", "kind": "value", - "name": "tanh", + "name": "find", "docstrings": [ - "`tanh(v)` returns the hyperbolic tangent of argument `v`, which must be\nspecified in radians.\nSee [`Math.tanh`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh) on MDN.\n\n## Examples\n\n```rescript\nMath.tanh(-0.0) // -0.0\nMath.tanh(0.0) // 0.0\nMath.tanh(1.0) // 0.7615941559557649\n```" + "`find(list, f)` returns `Some(value)` for the first value in `list` that\nsatisfies the predicate function `f`. Returns `None` if no element satisfies\nthe function.\n\n## Examples\n\n```rescript\nList.find(list{1, 4, 3, 2}, x => x > 3) // Some(4)\n\nList.find(list{1, 4, 3, 2}, x => x > 4) // None\n```" ], - "signature": "let tanh: float => float" + "signature": "let find: (list<'a>, 'a => bool) => option<'a>" }, { - "id": "Core.Math.trunc", + "id": "Core.List.filter", "kind": "value", - "name": "trunc", + "name": "filter", "docstrings": [ - "`trunc(v)` truncates the argument `v`, i.e., removes fractional digits.\nSee [`Math.trunc`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc) on MDN.\n\n## Examples\n\n```rescript\nMath.trunc(0.123) // 0.0\nMath.trunc(1.999) // 1.0\nMath.trunc(13.37) // 13.0\nMath.trunc(42.84) // 42.0\n```" + "`filter(list, f)` returns a list of all elements in `list` which satisfy the\npredicate function `f`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nList.filter(list{1, 2, 3, 4}, isEven) // list{2, 4}\n\nList.filter(list{None, Some(2), Some(3), None}, Option.isSome) // list{Some(2), Some(3)}\n```" ], - "signature": "let trunc: float => float" - } - ] - }, - "core/bigint": { - "id": "Core.BigInt", - "name": "BigInt", - "docstrings": [], - "items": [ - { - "id": "Core.BigInt.asIntN", - "kind": "value", - "name": "asIntN", - "docstrings": [], - "signature": "let asIntN: (~width: int, bigint) => bigint" + "signature": "let filter: (list<'a>, 'a => bool) => list<'a>" }, { - "id": "Core.BigInt.asUintN", + "id": "Core.List.filterWithIndex", "kind": "value", - "name": "asUintN", - "docstrings": [], - "signature": "let asUintN: (~width: int, bigint) => bigint" + "name": "filterWithIndex", + "docstrings": [ + "`filterWithIndex(list, f)` returns a list of all elements in `list` which\nsatisfy the predicate function `f`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nList.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)) // list{1, 3}\n```" + ], + "signature": "let filterWithIndex: (list<'a>, ('a, int) => bool) => list<'a>" }, { - "id": "Core.BigInt.fromString", + "id": "Core.List.filterMap", "kind": "value", - "name": "fromString", - "docstrings": [], - "signature": "let fromString: string => bigint" + "name": "filterMap", + "docstrings": [ + "`filterMap(list, f)` applies `f` to each element of `list`. If `f` returns\n`Some(value)`, then `value` is _kept_ in the resulting list. If `f` returns\n`None`, the element is _not_ retained in the result.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nlist{1, 2, 3, 4}\n->List.filterMap(x =>\n if (isEven(x)) {\n Some(x)\n } else {\n None\n }\n ) // list{2, 4}\n\nlist{Some(1), Some(2), None}->List.filterMap(x => x) // list{1, 2}\n```" + ], + "signature": "let filterMap: (list<'a>, 'a => option<'b>) => list<'b>" }, { - "id": "Core.BigInt.fromStringExn", + "id": "Core.List.partition", "kind": "value", - "name": "fromStringExn", + "name": "partition", "docstrings": [ - "Parses the given `string` into a `bigint` using JavaScript semantics. Return the\nnumber as a `bigint` if successfully parsed. Uncaught syntax exception otherwise.\n\n## Examples\n\n```rescript\n/* returns 123n */\nBigInt.fromStringExn(\"123\")\n\n/* returns 0n */\nBigInt.fromStringExn(\"\")\n\n/* returns 17n */\nBigInt.fromStringExn(\"0x11\")\n\n/* returns 3n */\nBigInt.fromStringExn(\"0b11\")\n\n/* returns 9n */\nBigInt.fromStringExn(\"0o11\")\n\n/* catch exception */\ntry {\n BigInt.fromStringExn(\"a\")\n} catch {\n| Exn.Error(_error) => 0n\n}\n```" + "`partition(list, f)` creates a pair of lists; the first list consists of all\nelements of `list` that satisfy the predicate function `f`, the second list\nconsists of all elements of `list` that _do not_ satisfy `f`.\n\n## Examples\n\n```rescript\n// (elementsThatSatisfies, elementsThatDoesNotSatisfy)\n\nList.partition(list{1, 2, 3, 4}, x => x > 2) // (list{3, 4}, list{1, 2})\n```" ], - "signature": "let fromStringExn: string => bigint" + "signature": "let partition: (list<'a>, 'a => bool) => (list<'a>, list<'a>)" }, { - "id": "Core.BigInt.fromInt", + "id": "Core.List.unzip", "kind": "value", - "name": "fromInt", - "docstrings": [], - "signature": "let fromInt: int => bigint" + "name": "unzip", + "docstrings": [ + "`unzip(list)` takes a list of pairs and creates a pair of lists. The first list\ncontains all the first items of the pairs, the second list contains all the\nsecond items.\n\n## Examples\n\n```rescript\nList.unzip(list{(1, 2), (3, 4)}) // (list{1, 3}, list{2, 4})\n\nList.unzip(list{(\"H\", \"W\"), (\"e\", \"o\"), (\"l\", \"r\"), (\"l\", \"l\"), (\"o\", \"d\"), (\" \", \"!\")})\n// (list{\"H\", \"e\", \"l\", \"l\", \"o\", \" \"}, list{\"W\", \"o\", \"r\", \"l\", \"d\", \"!\"})\n```" + ], + "signature": "let unzip: list<('a, 'b)> => (list<'a>, list<'b>)" }, { - "id": "Core.BigInt.fromFloat", + "id": "Core.List.getAssoc", "kind": "value", - "name": "fromFloat", - "docstrings": [], - "signature": "let fromFloat: float => bigint" + "name": "getAssoc", + "docstrings": [ + "`getAssoc(list, k, f)` return the second element of a pair in `list` where\nthe first element equals `k` as per the predicate function `f`, or `None` if\nnot found.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.getAssoc(3, (a, b) => a == b) // Some(\"c\")\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.getAssoc(15, (k, item) => k /* 15 */ == item /* 9, 5, 22 */)\n// Some(\"afternoon\")\n```" + ], + "signature": "let getAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>", + "deprecated": "Use a `Map` instead" }, { - "id": "Core.BigInt.toString", + "id": "Core.List.hasAssoc", "kind": "value", - "name": "toString", + "name": "hasAssoc", "docstrings": [ - "Formats a `bigint` as a string. Return a `string` representing the given value.\nSee [`toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\n/* prints \"123\" */\nJs.BigInt.toString(123n)->Js.log\n```" + "`hasAssoc(list, k, f)` returns `true` if there is a pair in `list` where the\nfirst element equals `k` as per the predicate function `f`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.hasAssoc(1, (a, b) => a == b) // true\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.hasAssoc(25, (k, item) => k /* 25 */ == item /* 9, 5, 22 */) // false\n```" ], - "signature": "let toString: (bigint, ~radix: int=?) => string" + "signature": "let hasAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => bool", + "deprecated": "Use a `Map` instead" }, { - "id": "Core.BigInt.toStringWithRadix", + "id": "Core.List.removeAssoc", "kind": "value", - "name": "toStringWithRadix", - "docstrings": [], - "signature": "let toStringWithRadix: (bigint, ~radix: int) => string", - "deprecated": "Use `toString` with `~radix` instead" + "name": "removeAssoc", + "docstrings": [ + "`removeAssoc(list, k, f)` return a list after removing the first pair whose\nfirst value is `k` per the equality predicate `f`, if not found, return a new\nlist identical to `list`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.removeAssoc(1, (a, b) => a == b) // list{(2, \"b\"), (3, \"c\")}\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->List.removeAssoc(9, (k, item) => k /* 9 */ == item /* 9, 5, 22 */)\n// list{(15, \"afternoon\"), (22, \"night\")}\n```" + ], + "signature": "let removeAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => list<('a, 'c)>", + "deprecated": "Use a `Map` instead" }, { - "id": "Core.BigInt.toLocaleString", + "id": "Core.List.setAssoc", "kind": "value", - "name": "toLocaleString", + "name": "setAssoc", "docstrings": [ - "Returns a string with a language-sensitive representation of this BigInt value.\n\n## Examples\n\n```rescript\n/* prints \"123\" */\nJs.BigInt.toString(123n)->Js.log\n```" + "`setAssoc(list, k, v, f)`. If `k` exists in `list` by satisfying the `f`\npredicate, return a new list with the key and value replaced by the new `k` and\n`v`, otherwise, return a new list with the pair `k`, `v` added to the head of\n`list`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.setAssoc(2, \"x\", (a, b) => a == b) // list{(1, \"a\"), (2, \"x\"), (3, \"c\")}\n\nlist{(1, \"a\"), (3, \"c\")}->List.setAssoc(2, \"b\", (a, b) => a == b) // list{(2, \"b\"), (1, \"a\"), (3, \"c\")}\n\nlist{(9, \"morning\"), (3, \"morning?!\"), (22, \"night\")}\n->List.setAssoc(15, \"afternoon\", (a, b) => mod(a, 12) == mod(b, 12))\n// list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n```\n\n**Please note**: In the last example, since: `15 mod 12` equals `3 mod 12`. Both\nthe key _and_ the value are replaced in the list." ], - "signature": "let toLocaleString: bigint => string" + "signature": "let setAssoc: (list<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => list<('a, 'c)>", + "deprecated": "Use a `Map` instead" }, { - "id": "Core.BigInt.toFloat", + "id": "Core.List.sort", "kind": "value", - "name": "toFloat", - "docstrings": [], - "signature": "let toFloat: bigint => float" - }, + "name": "sort", + "docstrings": [ + "`sort(list, f)` returns a sorted list.\n\n## Examples\n\n```rescript\nList.sort(list{5, 4, 9, 3, 7}, Int.compare) // list{3, 4, 5, 7, 9}\n```" + ], + "signature": "let sort: (list<'a>, ('a, 'a) => Ordering.t) => list<'a>" + } + ] + }, + "core/json": { + "id": "Core.JSON", + "name": "JSON", + "docstrings": [ + "Functions for interacting with JSON." + ], + "items": [ { - "id": "Core.BigInt.toInt", - "kind": "value", - "name": "toInt", - "docstrings": [], - "signature": "let toInt: bigint => int" + "id": "Core.JSON.t", + "kind": "type", + "name": "t", + "docstrings": [ + "A type representing a JSON object." + ], + "signature": "@unboxed\ntype t =\n | Boolean(bool)\n | @as(null) Null\n | String(string)\n | Number(float)\n | Object(dict)\n | Array(array)" }, { - "id": "Core.BigInt.+", - "kind": "value", - "name": "+", + "id": "Core.JSON.replacer", + "kind": "type", + "name": "replacer", "docstrings": [], - "signature": "let +: (bigint, bigint) => bigint" + "signature": "@unboxed\ntype replacer =\n | Keys(array)\n | Replacer((string, t) => t)" }, { - "id": "Core.BigInt.-", + "id": "Core.JSON.parseExn", "kind": "value", - "name": "-", - "docstrings": [], - "signature": "let -: (bigint, bigint) => bigint" + "name": "parseExn", + "docstrings": [ + "`parseExn(string, ~reviver=?)` \n\nParses a JSON string or throws a JavaScript exception (SyntaxError), if the string isn't valid.\nThe reviver describes how the value should be transformed. It is a function which receives a key and a value.\nIt returns a JSON type.\n\n## Examples\n```rescript\ntry {\n let _ = JSON.parseExn(`{\"foo\":\"bar\",\"hello\":\"world\"}`)\n // { foo: 'bar', hello: 'world' }\n\n let _ = JSON.parseExn(\"\")\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n\nlet reviver = (_, value: JSON.t) =>\n switch value {\n | String(string) => string->String.toUpperCase->JSON.Encode.string\n | Number(number) => (number *. 2.0)->JSON.Encode.float\n | _ => value\n }\n\nlet jsonString = `{\"hello\":\"world\",\"someNumber\":21}`\n\ntry {\n JSON.parseExn(jsonString, ~reviver)->Console.log\n // { hello: 'WORLD', someNumber: 42 }\n\n JSON.parseExn(\"\", ~reviver)->Console.log\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError (Exn.t) if the string isn't valid JSON." + ], + "signature": "let parseExn: (string, ~reviver: (string, t) => t=?) => t" }, { - "id": "Core.BigInt.*", + "id": "Core.JSON.parseExnWithReviver", "kind": "value", - "name": "*", - "docstrings": [], - "signature": "let *: (bigint, bigint) => bigint" + "name": "parseExnWithReviver", + "docstrings": [ + "`parseExnWithReviver(string, reviver)` \n\nParses a JSON string or throws a JavaScript exception (SyntaxError), if the string isn't valid.\nThe reviver describes how the value should be transformed. It is a function which receives a key and a value.\nIt returns a JSON type.\n\n## Examples\n```rescript\nlet reviver = (_, value: JSON.t) =>\n switch value {\n | String(string) => string->String.toUpperCase->JSON.Encode.string\n | Number(number) => (number *. 2.0)->JSON.Encode.float\n | _ => value\n }\n\nlet jsonString = `{\"hello\":\"world\",\"someNumber\":21}`\n\ntry {\n JSON.parseExnWithReviver(jsonString, reviver)->Console.log\n // { hello: 'WORLD', someNumber: 42 }\n\n JSON.parseExnWithReviver(\"\", reviver)->Console.log\n // error\n} catch {\n| Exn.Error(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError if the string isn't valid JSON." + ], + "signature": "let parseExnWithReviver: (string, (string, t) => t) => t", + "deprecated": "Use `parseExn` with optional parameter instead" }, { - "id": "Core.BigInt./", + "id": "Core.JSON.stringify", "kind": "value", - "name": "/", - "docstrings": [], - "signature": "let /: (bigint, bigint) => bigint" + "name": "stringify", + "docstrings": [ + "`stringify(json, ~replacer=?, ~space=?)` \n\nConverts a JSON object to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value,\nor an array of keys which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAny` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringify(json)\n// {\"foo\":\"bar\",\"hello\":\"world\",\"someNumber\":42}\n\nJSON.stringify(json, ~space=2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n\nJSON.stringify(json, ~replacer=Keys([\"foo\", \"someNumber\"]))\n// {\"foo\":\"bar\",\"someNumber\":42}\n\nlet replacer = JSON.Replacer((_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n})\n\nJSON.stringify(json, ~replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n```" + ], + "signature": "let stringify: (t, ~replacer: replacer=?, ~space: int=?) => string" }, { - "id": "Core.BigInt.~-", + "id": "Core.JSON.stringifyWithIndent", "kind": "value", - "name": "~-", - "docstrings": [], - "signature": "let ~-: bigint => bigint" + "name": "stringifyWithIndent", + "docstrings": [ + "`stringifyWithIndent(json, indentation)` \n\nConverts a JSON object to a JSON string. The output will be indented.\nIf you want to stringify any type, use `JSON.stringifyAnyWithIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithIndent(json, 2)\n// {\n// \"foo\": \"bar\",\n// \"hello\": \"world\",\n// \"someNumber\": 42\n// }\n```" + ], + "signature": "let stringifyWithIndent: (t, int) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Core.BigInt.~+", + "id": "Core.JSON.stringifyWithReplacer", "kind": "value", - "name": "~+", - "docstrings": [], - "signature": "let ~+: bigint => bigint" + "name": "stringifyWithReplacer", + "docstrings": [ + "`stringifyWithReplacer(json, replacer)` \n\nConverts a JSON object to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nIf you want to stringify any type, use `JSON.stringifyAnyWithReplacer` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyWithReplacer(json, replacer)\n// {\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}\n```" + ], + "signature": "let stringifyWithReplacer: (t, (string, t) => t) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Core.BigInt.**", + "id": "Core.JSON.stringifyWithReplacerAndIndent", "kind": "value", - "name": "**", - "docstrings": [], - "signature": "let **: (bigint, bigint) => bigint" + "name": "stringifyWithReplacerAndIndent", + "docstrings": [ + "`stringifyWithReplacerAndIndent(json, replacer, indentation)`\n\nConverts a JSON object to a JSON string. The output will be indented.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nIf you want to stringify any type, use `JSON.stringifyAnyWithReplacerAndIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\nJSON.stringifyWithReplacerAndIndent(json, replacer, 2)\n// {\n// \"foo\": \"BAR\",\n// \"hello\": \"WORLD\",\n// \"someNumber\": 42\n// }\n```" + ], + "signature": "let stringifyWithReplacerAndIndent: (t, (string, t) => t, int) => string", + "deprecated": "Use `stringify` with optional parameters instead" }, { - "id": "Core.BigInt.add", + "id": "Core.JSON.stringifyWithFilter", "kind": "value", - "name": "add", - "docstrings": [], - "signature": "let add: (bigint, bigint) => bigint" + "name": "stringifyWithFilter", + "docstrings": [ + "`stringifyWithFilter(json, filter)` \n\nConverts a JSON object to a JSON string.\nThe filter is an array of keys, which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAnyWithFilter` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithFilter(json, [\"foo\", \"someNumber\"])\n// {\"foo\":\"bar\",\"someNumber\":42}\n```" + ], + "signature": "let stringifyWithFilter: (t, array) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Core.BigInt.sub", + "id": "Core.JSON.stringifyWithFilterAndIndent", "kind": "value", - "name": "sub", - "docstrings": [], - "signature": "let sub: (bigint, bigint) => bigint" + "name": "stringifyWithFilterAndIndent", + "docstrings": [ + "`stringifyWithFilterAndIndent(json, filter, indentation)` \n\nConverts a JSON object to a JSON string. The output will be indented.\nThe filter is an array of keys, which should be included in the output.\nIf you want to stringify any type, use `JSON.stringifyAnyWithFilterAndIndent` instead.\n\n## Examples\n```rescript\nlet json =\n Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n ])->JSON.Encode.object\n\nJSON.stringifyWithFilterAndIndent(json, [\"foo\", \"someNumber\"], 2)\n// {\n// \"foo\": \"bar\",\n// \"someNumber\": 42\n// }\n```" + ], + "signature": "let stringifyWithFilterAndIndent: (t, array, int) => string", + "deprecated": "Use `stringify` with optional parameters instead" }, { - "id": "Core.BigInt.mul", + "id": "Core.JSON.stringifyAny", "kind": "value", - "name": "mul", - "docstrings": [], - "signature": "let mul: (bigint, bigint) => bigint" + "name": "stringifyAny", + "docstrings": [ + "`stringifyAny(any, ~replacer=?, ~space=?)`\n\nConverts any type to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringify` instead.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\ndict\n->JSON.stringifyAny\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"bar\",\"hello\":\"world\",\"someNumber\":42}`)\n\ndict\n->JSON.stringifyAny(~space=2)\n->Option.getUnsafe\n->assertEqual(`{\n \"foo\": \"bar\",\n \"hello\": \"world\",\n \"someNumber\": 42\n}`)\n\ndict\n->JSON.stringifyAny(~replacer=Keys([\"foo\", \"someNumber\"]))\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"bar\",\"someNumber\":42}`)\n\nlet replacer = JSON.Replacer((_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n})\n\ndict\n->JSON.stringifyAny(~replacer)\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}`)\n\nJSON.stringifyAny(() => \"hello world\")\n->assertEqual(None)\n\n// Raise a exception\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAny: ('a, ~replacer: replacer=?, ~space: int=?) => option" }, { - "id": "Core.BigInt.div", + "id": "Core.JSON.stringifyAnyWithIndent", "kind": "value", - "name": "div", - "docstrings": [], - "signature": "let div: (bigint, bigint) => bigint" + "name": "stringifyAnyWithIndent", + "docstrings": [ + "`stringifyAnyWithIndent(any, indentation)`\n\nConverts any type to a JSON string. The output will be indented.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithIndent` instead.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\ndict\n->JSON.stringifyAnyWithIndent(2)\n->Option.getUnsafe\n->assertEqual(`{\n \"foo\": \"bar\",\n \"hello\": \"world\",\n \"someNumber\": 42\n}`)\n\nJSON.stringifyAny(() => \"hello world\")->assertEqual(None)\n\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAnyWithIndent: ('a, int) => option", + "deprecated": "Use `stringifyAny` with optional parameter instead" }, { - "id": "Core.BigInt.mod", + "id": "Core.JSON.stringifyAnyWithReplacer", "kind": "value", - "name": "mod", - "docstrings": [], - "signature": "let mod: (bigint, bigint) => bigint" + "name": "stringifyAnyWithReplacer", + "docstrings": [ + "`stringifyAnyWithReplacer(json, replacer)`\n\nConverts any type to a JSON string.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithReplacer` instead.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\ndict\n->JSON.stringifyAnyWithReplacer(replacer)\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}`)\n\nJSON.stringifyAny(() => \"hello world\")->assertEqual(None)\n\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAnyWithReplacer: ('a, (string, t) => t) => option", + "deprecated": "Use `stringifyAny` with optional parameter instead" }, { - "id": "Core.BigInt.land", + "id": "Core.JSON.stringifyAnyWithReplacerAndIndent", "kind": "value", - "name": "land", - "docstrings": [], - "signature": "let land: (bigint, bigint) => bigint" + "name": "stringifyAnyWithReplacerAndIndent", + "docstrings": [ + "`stringifyAnyWithReplacerAndIndent(json, replacer, indentation)`\n\nConverts any type to a JSON string. The output will be indented.\nThe replacer describes how the value should be transformed. It is a function which receives a key and a value.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithReplacerAndIndent` instead.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\nlet replacer = (_, value) => {\n let decodedValue = value->JSON.Decode.string\n\n switch decodedValue {\n | Some(string) => string->String.toUpperCase->JSON.Encode.string\n | None => value\n }\n}\n\ndict\n->JSON.stringifyAnyWithReplacer(replacer)\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"BAR\",\"hello\":\"WORLD\",\"someNumber\":42}`)\n\nJSON.stringifyAny(() => \"hello world\")->assertEqual(None)\n\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAnyWithReplacerAndIndent: ('a, (string, t) => t, int) => option", + "deprecated": "Use `stringifyAny` with optional parameters instead" }, { - "id": "Core.BigInt.lor", + "id": "Core.JSON.stringifyAnyWithFilter", "kind": "value", - "name": "lor", - "docstrings": [], - "signature": "let lor: (bigint, bigint) => bigint" + "name": "stringifyAnyWithFilter", + "docstrings": [ + "`stringifyAnyWithFilter(json, filter)`\n\nConverts any type to a JSON string.\nThe filter is an array of keys, which should be included in the output.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithFilter` instead.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\ndict\n->JSON.stringifyAnyWithFilter([\"foo\", \"someNumber\"])\n->assertEqual(`{\"foo\":\"bar\",\"someNumber\":42}`)\n\nJSON.stringifyAny(() => \"hello world\")->assertEqual(None)\n\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAnyWithFilter: ('a, array) => string", + "deprecated": "Use `stringifyAny` with optional parameter instead" }, { - "id": "Core.BigInt.lxor", + "id": "Core.JSON.stringifyAnyWithFilterAndIndent", "kind": "value", - "name": "lxor", - "docstrings": [], - "signature": "let lxor: (bigint, bigint) => bigint" - }, + "name": "stringifyAnyWithFilterAndIndent", + "docstrings": [ + "`stringifyAnyWithFilterAndIndent(json, filter, indentation)`\n\nConverts any type to a JSON string. The output will be indented.\nThe filter is an array of keys, which should be included in the output.\nStringifying a function or `undefined` will return `None`.\nIf the value contains circular references or `BigInt`s, the function will throw a JavaScript exception (TypeError).\nIf you want to stringify a JSON object, use `JSON.stringifyWithFilterAndIndent` instead.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([\n (\"foo\", JSON.Encode.string(\"bar\")),\n (\"hello\", JSON.Encode.string(\"world\")),\n (\"someNumber\", JSON.Encode.int(42)),\n])\n\ndict\n->JSON.stringifyAny\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"bar\",\"hello\":\"world\",\"someNumber\":42}`)\n\ndict\n->JSON.stringifyAny(~space=2)\n->Option.getUnsafe\n->assertEqual(`{\n \"foo\": \"bar\",\n \"hello\": \"world\",\n \"someNumber\": 42\n}`)\n\ndict\n->JSON.stringifyAny(~replacer=Keys([\"foo\", \"someNumber\"]))\n->Option.getUnsafe\n->assertEqual(`{\"foo\":\"bar\",\"someNumber\":42}`)\n\nJSON.stringifyAny(() => \"hello world\")->assertEqual(None)\n\nswitch BigInt.fromInt(0)->JSON.stringifyAny {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions \n\n- Raises a TypeError if the value contains circular references.\n- Raises a TypeError if the value contains `BigInt`s." + ], + "signature": "let stringifyAnyWithFilterAndIndent: ('a, array, int) => string", + "deprecated": "Use `stringifyAny` with optional parameters instead" + } + ] + }, + "core/intl": { + "id": "Core.Intl", + "name": "Intl", + "docstrings": [], + "items": [ { - "id": "Core.BigInt.lsl", + "id": "Core.Intl.getCanonicalLocalesExn", "kind": "value", - "name": "lsl", - "docstrings": [], - "signature": "let lsl: (bigint, bigint) => bigint" + "name": "getCanonicalLocalesExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let getCanonicalLocalesExn: string => array" }, { - "id": "Core.BigInt.asr", + "id": "Core.Intl.getCanonicalLocalesManyExn", "kind": "value", - "name": "asr", - "docstrings": [], - "signature": "let asr: (bigint, bigint) => bigint" + "name": "getCanonicalLocalesManyExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let getCanonicalLocalesManyExn: array => array" }, { - "id": "Core.BigInt.lnot", + "id": "Core.Intl.supportedValuesOfExn", "kind": "value", - "name": "lnot", - "docstrings": [], - "signature": "let lnot: bigint => bigint" + "name": "supportedValuesOfExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let supportedValuesOfExn: string => array" } ] }, @@ -7208,6 +7362,15 @@ "Functions for interacting with JavaScript Number.\nSee: [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)." ], "items": [ + { + "id": "Core.Int.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing an int." + ], + "signature": "type t = int" + }, { "id": "Core.Int.equal", "kind": "value", @@ -7220,7 +7383,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (int, int) => Core__Ordering.t" + "signature": "let compare: (int, int) => Ordering.t" }, { "id": "Core.Int.toExponential", @@ -7389,6 +7552,15 @@ "Functions for interacting with float." ], "items": [ + { + "id": "Core.Float.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing a float." + ], + "signature": "type t = float" + }, { "id": "Core.Float.equal", "kind": "value", @@ -7401,7 +7573,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (float, float) => Core__Ordering.t" + "signature": "let compare: (float, float) => Ordering.t" }, { "id": "Core.Float.isNaN", @@ -7595,7 +7767,7 @@ "docstrings": [ "Represents a JavaScript exception." ], - "signature": "type t = Js.Exn.t" + "signature": "type t = Exn.t" }, { "id": "Core.Error.fromException", @@ -7668,13 +7840,126 @@ "signature": "let raise: t => 'a" }, { - "id": "Core.Error.panic", + "id": "Core.Error.panic", + "kind": "value", + "name": "panic", + "docstrings": [ + "Raises a panic exception with the given message.\n\nA panic exception is a native JavaScript exception that is not intended to be caught and\nhandled. Compared to a ReScript exception this will give a better stack trace and\ndebugging experience.\n\n## Examples\n\n```rescript\ntry {\n Error.panic(\"Uh oh. This was unexpected!\")\n} catch {\n| Exn.Error(obj) =>\n switch Exn.message(obj) {\n | Some(m) => assert(m == \"Panic! Uh oh. This was unexpected!\")\n | None => assert(false)\n }\n| _ => assert(false)\n}\n```" + ], + "signature": "let panic: string => 'a" + } + ] + }, + "core/exn": { + "id": "Core.Exn", + "name": "Exn", + "docstrings": [ + "Provide utilities for dealing with JS exceptions." + ], + "items": [ + { + "id": "Core.Exn.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Represents a JS exception" + ], + "signature": "type t" + }, + { + "id": "Core.Exn.asJsExn", + "kind": "value", + "name": "asJsExn", + "docstrings": [], + "signature": "let asJsExn: exn => option" + }, + { + "id": "Core.Exn.stack", + "kind": "value", + "name": "stack", + "docstrings": [], + "signature": "let stack: t => option" + }, + { + "id": "Core.Exn.message", + "kind": "value", + "name": "message", + "docstrings": [], + "signature": "let message: t => option" + }, + { + "id": "Core.Exn.name", + "kind": "value", + "name": "name", + "docstrings": [], + "signature": "let name: t => option" + }, + { + "id": "Core.Exn.fileName", + "kind": "value", + "name": "fileName", + "docstrings": [], + "signature": "let fileName: t => option" + }, + { + "id": "Core.Exn.anyToExnInternal", + "kind": "value", + "name": "anyToExnInternal", + "docstrings": [ + "`anyToExnInternal(obj)` will take any value `obj` and wrap it\nin a Exn.Error if given value is not an exn already. If\n`obj` is an exn, it will return `obj` without any changes.\n\nThis function is mostly useful for cases where you want to unify a type of a value\nthat potentially is either exn, a JS error, or any other JS value really (e.g. for\na value passed to a Promise.catch callback)\n\n**IMPORTANT**: This is an internal API and may be changed / removed any time in the future." + ], + "signature": "let anyToExnInternal: 'a => exn" + }, + { + "id": "Core.Exn.raiseError", + "kind": "value", + "name": "raiseError", + "docstrings": [ + "Raise Js exception Error object with stacktrace" + ], + "signature": "let raiseError: string => 'a" + }, + { + "id": "Core.Exn.raiseEvalError", + "kind": "value", + "name": "raiseEvalError", + "docstrings": [], + "signature": "let raiseEvalError: string => 'a" + }, + { + "id": "Core.Exn.raiseRangeError", + "kind": "value", + "name": "raiseRangeError", + "docstrings": [], + "signature": "let raiseRangeError: string => 'a" + }, + { + "id": "Core.Exn.raiseReferenceError", + "kind": "value", + "name": "raiseReferenceError", + "docstrings": [], + "signature": "let raiseReferenceError: string => 'a" + }, + { + "id": "Core.Exn.raiseSyntaxError", + "kind": "value", + "name": "raiseSyntaxError", + "docstrings": [], + "signature": "let raiseSyntaxError: string => 'a" + }, + { + "id": "Core.Exn.raiseTypeError", + "kind": "value", + "name": "raiseTypeError", + "docstrings": [], + "signature": "let raiseTypeError: string => 'a" + }, + { + "id": "Core.Exn.raiseUriError", "kind": "value", - "name": "panic", - "docstrings": [ - "Raises a panic exception with the given message.\n\nA panic exception is a native JavaScript exception that is not intended to be caught and\nhandled. Compared to a ReScript exception this will give a better stack trace and\ndebugging experience.\n\n## Examples\n```rescript\nError.panic(\"Uh oh. This was unexpected!\")\n```" - ], - "signature": "let panic: string => 'a" + "name": "raiseUriError", + "docstrings": [], + "signature": "let raiseUriError: string => 'a" } ] }, @@ -7692,25 +7977,25 @@ "docstrings": [ "Type representing a dictionary of value `'a`." ], - "signature": "type t<'a> = Js.Dict.t<'a>" + "signature": "type t<'a> = dict<'a>" }, { "id": "Core.Dict.getUnsafe", "kind": "value", "name": "getUnsafe", "docstrings": [ - "`getUnsafe(dict, key)` Returns the `value` at the provided `key`.\n\nThis is _unsafe_, meaning it will return `undefined` value if `key` does not exist in `dict`.\n\nUse `Dict.getUnsafe` only when you are sure the key exists (i.e. when iterating `Dict.keys` result).\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"key1\", \"value1\"), (\"key2\", \"value2\")])\nlet value = dict->Dict.getUnsafe(\"key1\")\nConsole.log(value) // value1\n```" + "`getUnsafe(dict, key)` Returns the `value` at the provided `key`.\n\nThis is _unsafe_, meaning it will return `undefined` value if `key` does not exist in `dict`.\n\nUse `Dict.getUnsafe` only when you are sure the key exists (i.e. when iterating `Dict.keys` result).\n\n## Examples\n```rescript\nlet dict = dict{\"key1\": \"value1\", \"key2\": \"value2\"}\nlet value = dict->Dict.getUnsafe(\"key1\")\nConsole.log(value) // value1\n```" ], - "signature": "let getUnsafe: (t<'a>, string) => 'a" + "signature": "let getUnsafe: (dict<'a>, string) => 'a" }, { "id": "Core.Dict.get", "kind": "value", "name": "get", "docstrings": [ - "Returns the value at the provided key, if it exists. Returns an option.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"someKey\", \"someValue\")])\n\nswitch dict->Dict.get(\"someKey\") {\n| None => Console.log(\"Nope, didn't have the key.\")\n| Some(value) => Console.log(value)\n}\n```" + "Returns the value at the provided key, if it exists. Returns an option.\n\n## Examples\n```rescript\nlet dict = dict{\"someKey\": \"someValue\"}\n\nswitch dict->Dict.get(\"someKey\") {\n| None => Console.log(\"Nope, didn't have the key.\")\n| Some(value) => Console.log(value)\n}\n```" ], - "signature": "let get: (t<'a>, string) => option<'a>" + "signature": "let get: (dict<'a>, string) => option<'a>" }, { "id": "Core.Dict.set", @@ -7719,25 +8004,25 @@ "docstrings": [ "`set(dictionary, key, value)` sets the value at the provided key to the provided value.\n\n## Examples\n```rescript\nlet dict = Dict.make()\n\ndict->Dict.set(\"someKey\", \"someValue\")\n```" ], - "signature": "let set: (t<'a>, string, 'a) => unit" + "signature": "let set: (dict<'a>, string, 'a) => unit" }, { "id": "Core.Dict.delete", "kind": "value", "name": "delete", "docstrings": [ - "`delete(dictionary, key)` deletes the value at `key`, if it exists.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"someKey\", \"someValue\")])\n\ndict->Dict.delete(\"someKey\")\n```" + "`delete(dictionary, key)` deletes the value at `key`, if it exists.\n\n## Examples\n```rescript\nlet dict = dict{\"someKey\": \"someValue\"}\n\ndict->Dict.delete(\"someKey\")\n```" ], - "signature": "let delete: (t<'a>, string) => unit" + "signature": "let delete: (dict<'a>, string) => unit" }, { "id": "Core.Dict.make", "kind": "value", "name": "make", "docstrings": [ - "`make()` creates a new, empty dictionary.\n\n## Examples\n```rescript\nlet dict1: Dict.t = Dict.make() // You can annotate the type of the values of your dict yourself if you want\n\nlet dict2 = Dict.make() // Or you can let ReScript infer it via usage.\ndict2->Dict.set(\"someKey\", 12)\n```" + "`make()` creates a new, empty dictionary.\n\n## Examples\n```rescript\nlet dict1: dict = Dict.make() // You can annotate the type of the values of your dict yourself if you want\n\nlet dict2 = Dict.make() // Or you can let ReScript infer it via usage.\ndict2->Dict.set(\"someKey\", 12)\n```" ], - "signature": "let make: unit => t<'a>" + "signature": "let make: unit => dict<'a>" }, { "id": "Core.Dict.fromArray", @@ -7746,16 +8031,16 @@ "docstrings": [ "`fromArray(entries)` creates a new dictionary from the provided array of key/value pairs.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"key1\", \"value1\"), (\"key2\", \"value2\")])\n```" ], - "signature": "let fromArray: array<(string, 'a)> => t<'a>" + "signature": "let fromArray: array<(string, 'a)> => dict<'a>" }, { "id": "Core.Dict.fromIterator", "kind": "value", "name": "fromIterator", "docstrings": [ - "`fromIterator(entries)` creates a new dictionary from the provided iterator of key/value pairs.\n\n## Examples\n```rescript\n// Pretend we have an iterator of the correct shape\n@val external someIterator: Iterator.t<(string, int)> = \"someIterator\"\n\nlet dict = Dict.fromIterator(someIterator) // Dict.t\n```" + "`fromIterator(entries)` creates a new dictionary from the provided iterator of key/value pairs.\n\n## Examples\n\n```rescript\nlet iterator: Iterator.t<(string, int)> = %raw(`\n (() => {\n var map1 = new Map();\n map1.set('first', 1);\n map1.set('second', 2);\n var iterator1 = map1[Symbol.iterator]();\n return iterator1;\n })()\n`)\niterator\n->Dict.fromIterator\n->Dict.valuesToArray\n->assertEqual([1, 2])\n```" ], - "signature": "let fromIterator: Core__Iterator.t<(string, 'a)> => t<'a>" + "signature": "let fromIterator: Iterator.t<(string, 'a)> => dict<'a>" }, { "id": "Core.Dict.toArray", @@ -7764,7 +8049,7 @@ "docstrings": [ "`toArray(dictionary)` returns an array of all the key/value pairs of the dictionary.\n\n## Examples\n```rescript\nlet dict = Dict.make()\ndict->Dict.set(\"someKey\", 1)\ndict->Dict.set(\"someKey2\", 2)\nlet asArray = dict->Dict.toArray\nConsole.log(asArray) // Logs `[[\"someKey\", 1], [\"someKey2\", 2]]` to the console\n```" ], - "signature": "let toArray: t<'a> => array<(string, 'a)>" + "signature": "let toArray: dict<'a> => array<(string, 'a)>" }, { "id": "Core.Dict.keysToArray", @@ -7773,7 +8058,7 @@ "docstrings": [ "`keysToArray(dictionary)` returns an array of all the keys of the dictionary.\n\n## Examples\n```rescript\nlet dict = Dict.make()\ndict->Dict.set(\"someKey\", 1)\ndict->Dict.set(\"someKey2\", 2)\nlet keys = dict->Dict.keysToArray\nConsole.log(keys) // Logs `[\"someKey\", \"someKey2\"]` to the console\n```" ], - "signature": "let keysToArray: t<'a> => array" + "signature": "let keysToArray: dict<'a> => array" }, { "id": "Core.Dict.valuesToArray", @@ -7782,7 +8067,7 @@ "docstrings": [ "`valuesToArray(dictionary)` returns an array of all the values of the dictionary.\n\n## Examples\n```rescript\nlet dict = Dict.make()\ndict->Dict.set(\"someKey\", 1)\ndict->Dict.set(\"someKey2\", 2)\nlet values = dict->Dict.valuesToArray\nConsole.log(values) // Logs `[1, 2]` to the console\n```" ], - "signature": "let valuesToArray: t<'a> => array<'a>" + "signature": "let valuesToArray: dict<'a> => array<'a>" }, { "id": "Core.Dict.assign", @@ -7791,43 +8076,52 @@ "docstrings": [ "`assign(dictionary1, dictionary2)` [shallowly](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) merges dictionary2 into dictionary1, and returns dictionary1.\n\nBeware this will *mutate* dictionary1. If you're looking for a way to copy a dictionary, check out `Dict.copy`.\n\n## Examples\n```rescript\nlet dict1 = Dict.make()\ndict1->Dict.set(\"firstKey\", 1)\nConsole.log(dict1->Dict.keysToArray) // Logs `[\"firstKey\"]`\n\nlet dict2 = Dict.make()\ndict2->Dict.set(\"someKey\", 2)\ndict2->Dict.set(\"someKey2\", 3)\n\nlet dict1 = dict1->Dict.assign(dict2)\n\nConsole.log(dict1->Dict.keysToArray) // Logs `[\"firstKey\", \"someKey\", \"someKey2\"]`\n\n```" ], - "signature": "let assign: (t<'a>, t<'a>) => t<'a>" + "signature": "let assign: (dict<'a>, dict<'a>) => dict<'a>" }, { "id": "Core.Dict.copy", "kind": "value", "name": "copy", "docstrings": [ - "`copy(dictionary)` [shallowly copies](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) the provided dictionary to a new dictionary.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"key1\", \"value1\"), (\"key2\", \"value2\")])\nlet dict2 = dict->Dict.copy\n\n// Both log `[\"key1\", \"key2\"]` here.\nConsole.log2(dict->Dict.keysToArray, dict2->Dict.keysToArray)\n```" + "`copy(dictionary)` [shallowly copies](https://developer.mozilla.org/en-US/docs/Glossary/Shallow_copy) the provided dictionary to a new dictionary.\n\n## Examples\n```rescript\nlet dict = dict{\"key1\": \"value1\", \"key2\": \"value2\"}\nlet dict2 = dict->Dict.copy\n\n// Both log `[\"key1\", \"key2\"]` here.\nConsole.log2(dict->Dict.keysToArray, dict2->Dict.keysToArray)\n```" ], - "signature": "let copy: t<'a> => t<'a>" + "signature": "let copy: dict<'a> => dict<'a>" }, { "id": "Core.Dict.forEach", "kind": "value", "name": "forEach", "docstrings": [ - "`forEach(dictionary, f)` iterates through all values of the dict.\n\n> Please note that this is *without the keys*, just the values. If you need the key as well, use `Dict.forEachWithKey`.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"key1\", \"value1\"), (\"key2\", \"value2\")])\n\ndict->Dict.forEach(value => {\n Console.log(value)\n})\n```" + "`forEach(dictionary, f)` iterates through all values of the dict.\n\n> Please note that this is *without the keys*, just the values. If you need the key as well, use `Dict.forEachWithKey`.\n\n## Examples\n```rescript\nlet dict = dict{\"key1\": \"value1\", \"key2\": \"value2\"}\n\ndict->Dict.forEach(value => {\n Console.log(value)\n})\n```" ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let forEach: (dict<'a>, 'a => unit) => unit" }, { "id": "Core.Dict.forEachWithKey", "kind": "value", "name": "forEachWithKey", "docstrings": [ - "`forEachWithKey(dictionary, f)` iterates through all values of the dict, including the key for each value.\n\n## Examples\n```rescript\nlet dict = Dict.fromArray([(\"key1\", \"value1\"), (\"key2\", \"value2\")])\n\ndict->Dict.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" + "`forEachWithKey(dictionary, f)` iterates through all values of the dict, including the key for each value.\n\n## Examples\n```rescript\nlet dict = dict{\"key1\": \"value1\", \"key2\": \"value2\"}\n\ndict->Dict.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" ], - "signature": "let forEachWithKey: (t<'a>, ('a, string) => unit) => unit" + "signature": "let forEachWithKey: (dict<'a>, ('a, string) => unit) => unit" }, { "id": "Core.Dict.mapValues", "kind": "value", "name": "mapValues", "docstrings": [ - "`mapValues(dictionary, f)` returns a new dictionary with the same keys, and `f` applied to each value in the original dictionary.\n\n## Examples\n\n```rescript\nlet dict = Dict.fromArray([(\"key1\", 1), (\"key2\", 2)])\n\ndict->Dict.mapValues(v => v + 10)->Dict.toArray // [(\"key1\", 11), (\"key2\", 12)]\ndict->Dict.mapValues(v => Int.toString(v))->Dict.toArray // [(\"key1\", \"1\"), (\"key2\", \"2\")]\n```" + "`mapValues(dictionary, f)` returns a new dictionary with the same keys, and `f` applied to each value in the original dictionary.\n\n## Examples\n\n```rescript\nlet dict = dict{\"key1\": 1, \"key2\": 2}\n\ndict->Dict.mapValues(v => v + 10)->Dict.toArray // [(\"key1\", 11), (\"key2\", 12)]\ndict->Dict.mapValues(v => Int.toString(v))->Dict.toArray // [(\"key1\", \"1\"), (\"key2\", \"2\")]\n```" + ], + "signature": "let mapValues: (dict<'a>, 'a => 'b) => dict<'b>" + }, + { + "id": "Core.Dict.has", + "kind": "value", + "name": "has", + "docstrings": [ + "`has(dictionary, \"key\")` returns true if the \"key\" is present in the dictionary.\n\n## Examples\n\n```rescript\nlet dict = dict{\"key1\": Some(1), \"key2\": None}\n\ndict->Dict.has(\"key1\") // true\ndict->Dict.has(\"key2\") // true\ndict->Dict.has(\"key3\") // false\n```" ], - "signature": "let mapValues: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let has: (dict<'a>, string) => bool" } ] }, @@ -7845,7 +8139,7 @@ "docstrings": [ "A type representing a JavaScript date." ], - "signature": "type t = Js.Date.t" + "signature": "type t" }, { "id": "Core.Date.msSinceEpoch", @@ -7906,45 +8200,45 @@ "kind": "value", "name": "makeWithYMD", "docstrings": [ - "Creates a date object with the given year, month and date (day of month).\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMD(~year=2023, ~month=1, ~date=20)\n// 2023-02-20T00:00:00.000Z\n\nDate.makeWithYMD(~year=2023, ~month=1, ~date=-1)\n// 2022-11-29T00:00:00.000Z\n\nDate.makeWithYMD(~year=2023, ~month=1, ~date=29)\n// 2023-03-01T00:00:00.000Z\n```" + "Creates a date object with the given year, month and date (day of month).\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMD(~year=2023, ~month=1, ~day=20)\n// 2023-02-20T00:00:00.000Z\n\nDate.makeWithYMD(~year=2023, ~month=1, ~day=-1)\n// 2022-11-29T00:00:00.000Z\n\nDate.makeWithYMD(~year=2023, ~month=1, ~day=29)\n// 2023-03-01T00:00:00.000Z\n```" ], - "signature": "let makeWithYMD: (~year: int, ~month: int, ~date: int) => t" + "signature": "let makeWithYMD: (~year: int, ~month: int, ~day: int) => t" }, { "id": "Core.Date.makeWithYMDH", "kind": "value", "name": "makeWithYMDH", "docstrings": [ - "Creates a date object with the given year, month, date (day of month) and hours.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=16)\n// 2023-02-20T16:00:00.000Z\n\nDate.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=24)\n// 2023-02-21T00:00:00.000Z\n\nDate.makeWithYMDH(~year=2023, ~month=1, ~date=20, ~hours=-1)\n// 2023-02-19T23:00:00.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" + "Creates a date object with the given year, month, date (day of month) and hours.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=16)\n// 2023-02-20T16:00:00.000Z\n\nDate.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=24)\n// 2023-02-21T00:00:00.000Z\n\nDate.makeWithYMDH(~year=2023, ~month=1, ~day=20, ~hours=-1)\n// 2023-02-19T23:00:00.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" ], - "signature": "let makeWithYMDH: (~year: int, ~month: int, ~date: int, ~hours: int) => t" + "signature": "let makeWithYMDH: (~year: int, ~month: int, ~day: int, ~hours: int) => t" }, { "id": "Core.Date.makeWithYMDHM", "kind": "value", "name": "makeWithYMDHM", "docstrings": [ - "Creates a date object with the given year, month, date (day of month), hours and minutes.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=60)\n// 2023-02-20T17:00:00.000Z\n\nDate.makeWithYMDHM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=-1)\n// 2023-02-20T15:59:00.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" + "Creates a date object with the given year, month, date (day of month), hours and minutes.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=60)\n// 2023-02-20T17:00:00.000Z\n\nDate.makeWithYMDHM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=-1)\n// 2023-02-20T15:59:00.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" ], - "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n) => t" + "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n) => t" }, { "id": "Core.Date.makeWithYMDHMS", "kind": "value", "name": "makeWithYMDHMS", "docstrings": [ - "Creates a date object with the given year, month, date (day of month), hours, minutes and seconds.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=60)\n// 2023-02-20T16:41:00.000Z\n\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=-1)\n// 2023-02-20T16:39:59.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" + "Creates a date object with the given year, month, date (day of month), hours, minutes and seconds.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=60)\n// 2023-02-20T16:41:00.000Z\n\nDate.makeWithYMDHMS(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=-1)\n// 2023-02-20T16:39:59.000Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" ], - "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => t" + "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => t" }, { "id": "Core.Date.makeWithYMDHMSM", "kind": "value", "name": "makeWithYMDHMSM", "docstrings": [ - "Creates a date object with the given year, month, date (day of month), hours, minutes, seconds and milliseconds.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=0)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=1000)\n// 2023-02-20T16:40:01.000Z\n\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~date=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=-1)\n// 2023-02-20T16:39:59.999Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" + "Creates a date object with the given year, month, date (day of month), hours, minutes, seconds and milliseconds.\nBe aware of using a value for year < 100, because it behaves inconsistent (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#interpretation_of_two-digit_years).\nMonths are 0-indexed (0 = January, 11 = December).\nValues, which are out of range, will be carried over to the next bigger unit (s. example).\n\n## Examples\n```rescript\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=0)\n// 2023-02-20T16:40:00.000Z\n\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=1000)\n// 2023-02-20T16:40:01.000Z\n\nDate.makeWithYMDHMSM(~year=2023, ~month=1, ~day=20, ~hours=16, ~minutes=40, ~seconds=0, ~milliseconds=-1)\n// 2023-02-20T16:39:59.999Z\n\n// Note: The output depends on your local time zone.\n// In nodejs you can change it by using the TZ env (`export TZ='Europe/London' && node index.bs.js`)\n\n```" ], - "signature": "let makeWithYMDHMSM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => t" + "signature": "let makeWithYMDHMSM: (\n ~year: int,\n ~month: int,\n ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => t" }, { "id": "Core.Date.now", @@ -7967,7 +8261,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (t, t) => Core__Ordering.t" + "signature": "let compare: (t, t) => Ordering.t" }, { "id": "Core.Date.getTime", @@ -8082,9 +8376,9 @@ "kind": "value", "name": "setFullYearMD", "docstrings": [ - "`setFullYearMD(date, ~year, ~month, ~date)`\n\nSets the year, month and date (day of month) of a date (according to local time).\nBeware this will *mutate* the date.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.setFullYearMD(~year=2024, ~month=0, ~date=1)\n```" + "`setFullYearMD(date, ~year, ~month, ~day)`\n\nSets the year, month and date (day of month) of a date (according to local time).\nBeware this will *mutate* the date.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.setFullYearMD(~year=2024, ~month=0, ~day=1)\n```" ], - "signature": "let setFullYearMD: (t, ~year: int, ~month: int, ~date: int) => unit" + "signature": "let setFullYearMD: (t, ~year: int, ~month: int, ~day: int) => unit" }, { "id": "Core.Date.setMonth", @@ -8289,9 +8583,9 @@ "kind": "value", "name": "setUTCFullYearMD", "docstrings": [ - "`setUTCFullYearMD(date, ~year, ~month, ~date)`\n\nSets the year, month and date (day of month) of a date (according to UTC time).\nBeware this will *mutate* the date.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.setUTCFullYearMD(~year=2024, ~month=0, ~date=1)\n```" + "`setUTCFullYearMD(date, ~year, ~month, ~day)`\n\nSets the year, month and date (day of month) of a date (according to UTC time).\nBeware this will *mutate* the date.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.setUTCFullYearMD(~year=2024, ~month=0, ~day=1)\n```" ], - "signature": "let setUTCFullYearMD: (t, ~year: int, ~month: int, ~date: int) => unit" + "signature": "let setUTCFullYearMD: (t, ~year: int, ~month: int, ~day: int) => unit" }, { "id": "Core.Date.setUTCMonth", @@ -8555,28 +8849,28 @@ "kind": "value", "name": "fromBuffer", "docstrings": [], - "signature": "let fromBuffer: Core__ArrayBuffer.t => t" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { "id": "Core.DataView.fromBufferToEnd", "kind": "value", "name": "fromBufferToEnd", "docstrings": [], - "signature": "let fromBufferToEnd: (Core__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { "id": "Core.DataView.fromBufferWithRange", "kind": "value", "name": "fromBufferWithRange", "docstrings": [], - "signature": "let fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { "id": "Core.DataView.buffer", "kind": "value", "name": "buffer", "docstrings": [], - "signature": "let buffer: t => Core__ArrayBuffer.t" + "signature": "let buffer: t => ArrayBuffer.t" }, { "id": "Core.DataView.byteLength", @@ -8597,140 +8891,140 @@ "kind": "value", "name": "getInt8", "docstrings": [], - "signature": "let getInt8: t => int" + "signature": "let getInt8: (t, int) => int" }, { "id": "Core.DataView.getUint8", "kind": "value", "name": "getUint8", "docstrings": [], - "signature": "let getUint8: t => int" + "signature": "let getUint8: (t, int) => int" }, { "id": "Core.DataView.getInt16", "kind": "value", "name": "getInt16", "docstrings": [], - "signature": "let getInt16: t => int" + "signature": "let getInt16: (t, int) => int" }, { "id": "Core.DataView.getUint16", "kind": "value", "name": "getUint16", "docstrings": [], - "signature": "let getUint16: t => int" + "signature": "let getUint16: (t, int) => int" }, { "id": "Core.DataView.getInt32", "kind": "value", "name": "getInt32", "docstrings": [], - "signature": "let getInt32: t => int" + "signature": "let getInt32: (t, int) => int" }, { "id": "Core.DataView.getUint32", "kind": "value", "name": "getUint32", "docstrings": [], - "signature": "let getUint32: t => int" + "signature": "let getUint32: (t, int) => int" }, { "id": "Core.DataView.getFloat32", "kind": "value", "name": "getFloat32", "docstrings": [], - "signature": "let getFloat32: t => float" + "signature": "let getFloat32: (t, int) => float" }, { "id": "Core.DataView.getFloat64", "kind": "value", "name": "getFloat64", "docstrings": [], - "signature": "let getFloat64: t => float" + "signature": "let getFloat64: (t, int) => float" }, { "id": "Core.DataView.getBigInt64", "kind": "value", "name": "getBigInt64", "docstrings": [], - "signature": "let getBigInt64: t => bigint" + "signature": "let getBigInt64: (t, int) => bigint" }, { "id": "Core.DataView.getBigUint64", "kind": "value", "name": "getBigUint64", "docstrings": [], - "signature": "let getBigUint64: t => bigint" + "signature": "let getBigUint64: (t, int) => bigint" }, { "id": "Core.DataView.setInt8", "kind": "value", "name": "setInt8", "docstrings": [], - "signature": "let setInt8: (t, int) => unit" + "signature": "let setInt8: (t, int, int) => unit" }, { "id": "Core.DataView.setUint8", "kind": "value", "name": "setUint8", "docstrings": [], - "signature": "let setUint8: (t, int) => unit" + "signature": "let setUint8: (t, int, int) => unit" }, { "id": "Core.DataView.setInt16", "kind": "value", "name": "setInt16", "docstrings": [], - "signature": "let setInt16: (t, int) => unit" + "signature": "let setInt16: (t, int, int) => unit" }, { "id": "Core.DataView.setUint16", "kind": "value", "name": "setUint16", "docstrings": [], - "signature": "let setUint16: (t, int) => unit" + "signature": "let setUint16: (t, int, int) => unit" }, { "id": "Core.DataView.setInt32", "kind": "value", "name": "setInt32", "docstrings": [], - "signature": "let setInt32: (t, int) => unit" + "signature": "let setInt32: (t, int, int) => unit" }, { "id": "Core.DataView.setUint32", "kind": "value", "name": "setUint32", "docstrings": [], - "signature": "let setUint32: (t, int) => unit" + "signature": "let setUint32: (t, int, int) => unit" }, { "id": "Core.DataView.setFloat32", "kind": "value", "name": "setFloat32", "docstrings": [], - "signature": "let setFloat32: (t, float) => unit" + "signature": "let setFloat32: (t, int, float) => unit" }, { "id": "Core.DataView.setFloat64", "kind": "value", "name": "setFloat64", "docstrings": [], - "signature": "let setFloat64: (t, float) => unit" + "signature": "let setFloat64: (t, int, float) => unit" }, { "id": "Core.DataView.setBigInt64", "kind": "value", "name": "setBigInt64", "docstrings": [], - "signature": "let setBigInt64: (t, bigint) => unit" + "signature": "let setBigInt64: (t, int, bigint) => unit" }, { "id": "Core.DataView.setBigUint64", "kind": "value", "name": "setBigUint64", "docstrings": [], - "signature": "let setBigUint64: (t, bigint) => unit" + "signature": "let setBigUint64: (t, int, bigint) => unit" } ] }, @@ -9238,40 +9532,284 @@ } ] }, + "core/bigint": { + "id": "Core.BigInt", + "name": "BigInt", + "docstrings": [], + "items": [ + { + "id": "Core.BigInt.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing a bigint." + ], + "signature": "type t = bigint" + }, + { + "id": "Core.BigInt.asIntN", + "kind": "value", + "name": "asIntN", + "docstrings": [], + "signature": "let asIntN: (~width: int, bigint) => bigint" + }, + { + "id": "Core.BigInt.asUintN", + "kind": "value", + "name": "asUintN", + "docstrings": [], + "signature": "let asUintN: (~width: int, bigint) => bigint" + }, + { + "id": "Core.BigInt.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [], + "signature": "let fromString: string => bigint" + }, + { + "id": "Core.BigInt.fromStringExn", + "kind": "value", + "name": "fromStringExn", + "docstrings": [ + "Parses the given `string` into a `bigint` using JavaScript semantics. Return the\nnumber as a `bigint` if successfully parsed. Uncaught syntax exception otherwise.\n\n## Examples\n\n```rescript\nBigInt.fromStringExn(\"123\")->assertEqual(123n)\n\nBigInt.fromStringExn(\"\")->assertEqual(0n)\n\nBigInt.fromStringExn(\"0x11\")->assertEqual(17n)\n\nBigInt.fromStringExn(\"0b11\")->assertEqual(3n)\n\nBigInt.fromStringExn(\"0o11\")->assertEqual(9n)\n\n/* catch exception */\nswitch BigInt.fromStringExn(\"a\") {\n| exception Exn.Error(_error) => assert(true)\n| _bigInt => assert(false)\n}\n```" + ], + "signature": "let fromStringExn: string => bigint" + }, + { + "id": "Core.BigInt.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [], + "signature": "let fromInt: int => bigint" + }, + { + "id": "Core.BigInt.fromFloat", + "kind": "value", + "name": "fromFloat", + "docstrings": [], + "signature": "let fromFloat: float => bigint" + }, + { + "id": "Core.BigInt.toString", + "kind": "value", + "name": "toString", + "docstrings": [ + "Formats a `bigint` as a string. Return a `string` representing the given value.\nSee [`toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\nBigInt.toString(123n)->assertEqual(\"123\")\n```" + ], + "signature": "let toString: (bigint, ~radix: int=?) => string" + }, + { + "id": "Core.BigInt.toStringWithRadix", + "kind": "value", + "name": "toStringWithRadix", + "docstrings": [], + "signature": "let toStringWithRadix: (bigint, ~radix: int) => string", + "deprecated": "Use `toString` with `~radix` instead" + }, + { + "id": "Core.BigInt.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [ + "Returns a string with a language-sensitive representation of this BigInt value.\n\n## Examples\n\n```rescript\nBigInt.toString(123n)->assertEqual(\"123\")\n```" + ], + "signature": "let toLocaleString: bigint => string" + }, + { + "id": "Core.BigInt.toFloat", + "kind": "value", + "name": "toFloat", + "docstrings": [], + "signature": "let toFloat: bigint => float" + }, + { + "id": "Core.BigInt.toInt", + "kind": "value", + "name": "toInt", + "docstrings": [], + "signature": "let toInt: bigint => int" + }, + { + "id": "Core.BigInt.+", + "kind": "value", + "name": "+", + "docstrings": [], + "signature": "let +: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.-", + "kind": "value", + "name": "-", + "docstrings": [], + "signature": "let -: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.*", + "kind": "value", + "name": "*", + "docstrings": [], + "signature": "let *: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt./", + "kind": "value", + "name": "/", + "docstrings": [], + "signature": "let /: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.~-", + "kind": "value", + "name": "~-", + "docstrings": [], + "signature": "let ~-: bigint => bigint" + }, + { + "id": "Core.BigInt.~+", + "kind": "value", + "name": "~+", + "docstrings": [], + "signature": "let ~+: bigint => bigint" + }, + { + "id": "Core.BigInt.**", + "kind": "value", + "name": "**", + "docstrings": [], + "signature": "let **: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.add", + "kind": "value", + "name": "add", + "docstrings": [], + "signature": "let add: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.sub", + "kind": "value", + "name": "sub", + "docstrings": [], + "signature": "let sub: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.mul", + "kind": "value", + "name": "mul", + "docstrings": [], + "signature": "let mul: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.div", + "kind": "value", + "name": "div", + "docstrings": [], + "signature": "let div: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.mod", + "kind": "value", + "name": "mod", + "docstrings": [], + "signature": "let mod: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.land", + "kind": "value", + "name": "land", + "docstrings": [], + "signature": "let land: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.lor", + "kind": "value", + "name": "lor", + "docstrings": [], + "signature": "let lor: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.lxor", + "kind": "value", + "name": "lxor", + "docstrings": [], + "signature": "let lxor: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.lsl", + "kind": "value", + "name": "lsl", + "docstrings": [], + "signature": "let lsl: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.asr", + "kind": "value", + "name": "asr", + "docstrings": [], + "signature": "let asr: (bigint, bigint) => bigint" + }, + { + "id": "Core.BigInt.lnot", + "kind": "value", + "name": "lnot", + "docstrings": [], + "signature": "let lnot: bigint => bigint" + } + ] + }, "core/array": { "id": "Core.Array", "name": "Array", - "docstrings": [], + "docstrings": [ + "A mutable array.\n\nCompiles to a regular JavaScript array." + ], "items": [ + { + "id": "Core.Array.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing an array of value `'a`." + ], + "signature": "type t<'a> = array<'a>" + }, + { + "id": "Core.Array.arrayLike", + "kind": "type", + "name": "arrayLike", + "docstrings": [], + "signature": "type arrayLike<'a>" + }, { "id": "Core.Array.fromIterator", "kind": "value", "name": "fromIterator", "docstrings": [ - "`fromIterator(iterator)`\n\n Creates an array from the provided `iterator`\n\n ```res example\n let map = Map.fromArray([(\"foo\", 1), (\"bar\", 2)])\n\n Array.fromIterator(map->Map.values) // [1, 2]\n ```" + "`fromIterator(iterator)`\n\nCreates an array from the provided `iterator`\n\n## Examples\n\n```rescript\nMap.fromArray([(\"foo\", 1), (\"bar\", 2)])\n->Map.values\n->Array.fromIterator\n->assertEqual([1, 2])\n```" ], - "signature": "let fromIterator: Core__Iterator.t<'a> => array<'a>" + "signature": "let fromIterator: Iterator.t<'a> => array<'a>" }, { "id": "Core.Array.fromArrayLike", "kind": "value", "name": "fromArrayLike", "docstrings": [], - "signature": "let fromArrayLike: Js.Array2.array_like<'a> => array<'a>" + "signature": "let fromArrayLike: arrayLike<'a> => array<'a>" }, { "id": "Core.Array.fromArrayLikeWithMap", "kind": "value", "name": "fromArrayLikeWithMap", "docstrings": [], - "signature": "let fromArrayLikeWithMap: (Js.Array2.array_like<'a>, 'a => 'b) => array<'b>" + "signature": "let fromArrayLikeWithMap: (arrayLike<'a>, 'a => 'b) => array<'b>" }, { "id": "Core.Array.make", "kind": "value", "name": "make", "docstrings": [ - "`make(~length, init)`\n\n Creates an array of length `length` initialized with the value of `init`.\n\n ```res example\n Array.make(~length=3, #apple) == [#apple, #apple, #apple]\n ```" + "`make(~length, init)`\n\nCreates an array of length `length` initialized with the value of `init`.\n\n## Examples\n\n```rescript\nArray.make(~length=3, #apple)->assertEqual([#apple, #apple, #apple])\nArray.make(~length=6, 7)->assertEqual([7, 7, 7, 7, 7, 7])\n```" ], "signature": "let make: (~length: int, 'a) => array<'a>" }, @@ -9280,7 +9818,7 @@ "kind": "value", "name": "fromInitializer", "docstrings": [ - "`fromInitializer(~length, f)`\n\n Creates an array of length `length` initialized with the value returned from `f ` for each index.\n\n ```res example\n Array.fromInitializer(~length=3, i => i + 3) == [3, 4, 5]\n ```" + "`fromInitializer(~length, f)`\n\nCreates an array of length `length` initialized with the value returned from `f ` for each index.\n\n## Examples\n\n```rescript\nArray.fromInitializer(~length=3, i => i + 3)->assertEqual([3, 4, 5])\n\nArray.fromInitializer(~length=7, i => i + 3)->assertEqual([3, 4, 5, 6, 7, 8, 9])\n```" ], "signature": "let fromInitializer: (~length: int, int => 'a) => array<'a>" }, @@ -9296,7 +9834,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Core__Ordering.t,\n) => Core__Ordering.t" + "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" }, { "id": "Core.Array.isArray", @@ -9310,7 +9848,7 @@ "kind": "value", "name": "length", "docstrings": [ - "`length(array)` returns the length of (i.e. number of items in) the array.\n\nSee [`Array.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nConsole.log(someArray->Array.length) // 2\n```" + "`length(array)` returns the length of (i.e. number of items in) the array.\n\nSee [`Array.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray\n->Array.length\n->assertEqual(2)\n```" ], "signature": "let length: array<'a> => int" }, @@ -9340,7 +9878,7 @@ "kind": "value", "name": "fillAll", "docstrings": [ - "`fillAll(array, value)` fills the entire `array` with `value`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3, 4]\nmyArray->Array.fillAll(9)\n\nConsole.log(myArray) // [9, 9, 9, 9]\n```" + "`fillAll(array, value)` fills the entire `array` with `value`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n\n```rescript\nlet myArray = [1, 2, 3, 4]\nmyArray->Array.fillAll(9)\nmyArray->assertEqual([9, 9, 9, 9])\n```" ], "signature": "let fillAll: (array<'a>, 'a) => unit" }, @@ -9349,7 +9887,7 @@ "kind": "value", "name": "fillToEnd", "docstrings": [ - "`fillToEnd(array, value, ~start)` fills `array` with `value` from the `start` index.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3, 4]\nmyArray->Array.fillToEnd(9, ~start=1)\n\nConsole.log(myArray) // [1, 9, 9, 9]\n```" + "`fillToEnd(array, value, ~start)` fills `array` with `value` from the `start` index.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n\n```rescript\nlet myArray = [1, 2, 3, 4]\nmyArray->Array.fillToEnd(9, ~start=1)\nmyArray->assertEqual([1, 9, 9, 9])\n```" ], "signature": "let fillToEnd: (array<'a>, 'a, ~start: int) => unit" }, @@ -9358,7 +9896,7 @@ "kind": "value", "name": "fill", "docstrings": [ - "`fill(array, value, ~start, ~end)` fills `array` with `value` from `start` to `end`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3, 4]\nmyArray->Array.fill(9, ~start=1, ~end=2)\n\nConsole.log(myArray) // [1, 9, 9, 4]\n```" + "`fill(array, value, ~start, ~end)` fills `array` with `value` from `start` to `end`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.\n\n## Examples\n\n```rescript\nlet myArray = [1, 2, 3, 4]\n\nmyArray->Array.fill(9, ~start=1, ~end=3)\n\nmyArray->assertEqual([1, 9, 9, 4])\n```" ], "signature": "let fill: (array<'a>, 'a, ~start: int, ~end: int) => unit" }, @@ -9367,7 +9905,7 @@ "kind": "value", "name": "pop", "docstrings": [ - "`pop(array)` removes the last item from `array` and returns it.\n\nBeware this will *mutate* the array.\n\nSee [`Array.pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nlet lastItem = someArray->Array.pop // \"hello\"\n\nConsole.log(someArray) // [\"hi\"]. Notice last item is gone.\n```" + "`pop(array)` removes the last item from `array` and returns it.\n\nBeware this will *mutate* the array.\n\nSee [`Array.pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray\n->Array.pop\n->assertEqual(Some(\"hello\"))\n\nsomeArray->assertEqual([\"hi\"]) // Notice last item is gone.\n```" ], "signature": "let pop: array<'a> => option<'a>" }, @@ -9376,7 +9914,7 @@ "kind": "value", "name": "push", "docstrings": [ - "`push(array, item)` appends `item` to the end of `array`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.push(\"yay\")\n\nConsole.log(someArray) // [\"hi\", \"hello\", \"yay\"]\n```" + "`push(array, item)` appends `item` to the end of `array`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray->Array.push(\"yay\")\n\nsomeArray->assertEqual([\"hi\", \"hello\", \"yay\"])\n```" ], "signature": "let push: (array<'a>, 'a) => unit" }, @@ -9385,7 +9923,7 @@ "kind": "value", "name": "pushMany", "docstrings": [ - "`pushMany(array, itemsArray)` appends many new items to the end of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.pushMany([\"yay\", \"wehoo\"])\n\nConsole.log(someArray) // [\"hi\", \"hello\", \"yay\", \"wehoo\"]\n```" + "`pushMany(array, itemsArray)` appends many new items to the end of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray->Array.pushMany([\"yay\", \"wehoo\"])\nsomeArray->assertEqual([\"hi\", \"hello\", \"yay\", \"wehoo\"])\n```" ], "signature": "let pushMany: (array<'a>, array<'a>) => unit" }, @@ -9394,7 +9932,7 @@ "kind": "value", "name": "reverse", "docstrings": [ - "`reverse(array)` reverses the order of the items in `array`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.reverse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.reverse\n\nConsole.log(someArray) // [\"hello\", \"h1\"]\n```" + "`reverse(array)` reverses the order of the items in `array`.\n\nBeware this will *mutate* the array.\n\nSee [`Array.reverse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.reverse\n\nsomeArray->assertEqual([\"hello\", \"hi\"])\n```" ], "signature": "let reverse: array<'a> => unit" }, @@ -9403,7 +9941,7 @@ "kind": "value", "name": "shift", "docstrings": [ - "`shift(array)` removes the first item in the array, and returns it.\n\nBeware this will *mutate* the array.\n\nSee [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nlet lastItem = someArray->Array.shift // \"hi\"\n\nConsole.log(someArray) // [\"hello\"]. Notice first item is gone.\n```" + "`shift(array)` removes the first item in the array, and returns it.\n\nBeware this will *mutate* the array.\n\nSee [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray\n->Array.shift\n->assertEqual(Some(\"hi\"))\n\nsomeArray->assertEqual([\"hello\"]) // Notice first item is gone.\n```" ], "signature": "let shift: array<'a> => option<'a>" }, @@ -9412,18 +9950,18 @@ "kind": "value", "name": "toSorted", "docstrings": [ - "`toSorted(array, comparator)` returns a new, sorted array from `array`, using the `comparator` function.\n\nSee [`Array.toSorted`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted) on MDN.\n\n## Examples\n```rescript\nlet someArray = [3, 2, 1]\nlet sorted = someArray->Array.toSorted(Int.compare)\n\nConsole.log(sorted) // [1, 2, 3]\nConsole.log(someArray) // [3, 2, 1]. Original unchanged\n```" + "`toSorted(array, comparator)` returns a new, sorted array from `array`, using the `comparator` function.\n\nSee [`Array.toSorted`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [3, 2, 1]\n\nsomeArray\n->Array.toSorted(Int.compare)\n->assertEqual([1, 2, 3])\n\nsomeArray->assertEqual([3, 2, 1]) // Original unchanged\n```" ], - "signature": "let toSorted: (array<'a>, ('a, 'a) => Core__Ordering.t) => array<'a>" + "signature": "let toSorted: (array<'a>, ('a, 'a) => Ordering.t) => array<'a>" }, { "id": "Core.Array.sort", "kind": "value", "name": "sort", "docstrings": [ - "`sort(array, comparator)` sorts `array` in-place using the `comparator` function.\n\nBeware this will *mutate* the array.\n\nSee [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN.\n\n## Examples\n```rescript\nlet someArray = [3, 2, 1]\nsomeArray->Array.sort((a, b) => float(a - b))\n\nConsole.log(someArray) // [1, 2, 3]\n```" + "`sort(array, comparator)` sorts `array` in-place using the `comparator` function.\n\nBeware this will *mutate* the array.\n\nSee [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN.\n\n## Examples\n\n```rescript\nlet array = [3, 2, 1]\narray->Array.sort((a, b) => float(a - b))\narray->assertEqual([1, 2, 3])\n```" ], - "signature": "let sort: (array<'a>, ('a, 'a) => Core__Ordering.t) => unit" + "signature": "let sort: (array<'a>, ('a, 'a) => Ordering.t) => unit" }, { "id": "Core.Array.splice", @@ -9451,7 +9989,7 @@ "kind": "value", "name": "unshift", "docstrings": [ - "`unshift(array, item)` inserts a new item at the start of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.unshift(\"yay\")\n\nConsole.log(someArray) // [\"yay\", \"hi\", \"hello\"]\n```" + "`unshift(array, item)` inserts a new item at the start of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.unshift(\"yay\")\nsomeArray->assertEqual([\"yay\", \"hi\", \"hello\"])\n```" ], "signature": "let unshift: (array<'a>, 'a) => unit" }, @@ -9460,7 +9998,7 @@ "kind": "value", "name": "unshiftMany", "docstrings": [ - "`unshiftMany(array, itemsArray)` inserts many new items to the start of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.unshiftMany([\"yay\", \"wehoo\"])\n\nConsole.log(someArray) // [\"yay\", \"wehoo\", \"hi\", \"hello\"]\n```" + "`unshiftMany(array, itemsArray)` inserts many new items to the start of the array.\n\nBeware this will *mutate* the array.\n\nSee [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.unshiftMany([\"yay\", \"wehoo\"])\nsomeArray->assertEqual([\"yay\", \"wehoo\", \"hi\", \"hello\"])\n```" ], "signature": "let unshiftMany: (array<'a>, array<'a>) => unit" }, @@ -9469,7 +10007,7 @@ "kind": "value", "name": "concat", "docstrings": [ - "`concat(array1, array2)` concatenates the two arrays, creating a new array.\n\nSee [`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) on MDN.\n\n## Examples\n```rescript\nlet array1 = [\"hi\", \"hello\"]\nlet array2 = [\"yay\", \"wehoo\"]\n\nlet someArray = array1->Array.concat(array2)\n\nConsole.log(someArray) // [\"hi\", \"hello\", \"yay\", \"wehoo\"]\n```" + "`concat(array1, array2)` concatenates the two arrays, creating a new array.\n\nSee [`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) on MDN.\n\n## Examples\n\n```rescript\nlet array1 = [\"hi\", \"hello\"]\nlet array2 = [\"yay\", \"wehoo\"]\n\nlet someArray = array1->Array.concat(array2)\n\nsomeArray->assertEqual([\"hi\", \"hello\", \"yay\", \"wehoo\"])\n```" ], "signature": "let concat: (array<'a>, array<'a>) => array<'a>" }, @@ -9487,7 +10025,7 @@ "kind": "value", "name": "flat", "docstrings": [ - "`flat(arrays)` concatenates an array of arrays into a single array.\n\nSee [`Array.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) on MDN.\n\n## Examples\n```rescript\nConsole.log([[1], [2], [3, 4]]->Array.flat) // [1, 2, 3, 4]\n```" + "`flat(arrays)` concatenates an array of arrays into a single array.\n\nSee [`Array.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) on MDN.\n\n## Examples\n\n```rescript\n[[1], [2], [3, 4]]\n->Array.flat\n->assertEqual([1, 2, 3, 4])\n```" ], "signature": "let flat: array> => array<'a>" }, @@ -9496,7 +10034,7 @@ "kind": "value", "name": "includes", "docstrings": [ - "`includes(array, item)` checks whether `array` includes `item`, by doing a [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality).\n\nSee [`Array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) on MDN.\n\n## Examples\n```rescript\nConsole.log([1, 2]->Array.includes(1)) // true\nConsole.log([1, 2]->Array.includes(3)) // false\nConsole.log([{\"language\": \"ReScript\"}]->Array.includes({\"language\": \"ReScript\"})) // false, because of strict equality\n```" + "`includes(array, item)` checks whether `array` includes `item`, by doing a [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality).\n\nSee [`Array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) on MDN.\n\n## Examples\n\n```rescript\n[1, 2]->Array.includes(1)->assertEqual(true)\n[1, 2]->Array.includes(3)->assertEqual(false)\n\n[{\"language\": \"ReScript\"}]\n->Array.includes({\"language\": \"ReScript\"})\n->assertEqual(false) // false, because of strict equality\n```" ], "signature": "let includes: (array<'a>, 'a) => bool" }, @@ -9505,7 +10043,7 @@ "kind": "value", "name": "indexOf", "docstrings": [ - "`indexOf(array, item)` returns the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.\n\nReturns `-1` if the item doesn not exist. Check out `Array.indexOfOpt` for a version that returns `None` instead of `-1` if the item does not exist.\n\nSee [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.\n\n## Examples\n```rescript\nConsole.log([1, 2]->Array.indexOf(2)) // 1\nConsole.log([1, 2]->Array.indexOf(3)) // -1\nConsole.log([{\"language\": \"ReScript\"}]->Array.indexOf({\"language\": \"ReScript\"})) // -1, because of strict equality\n```" + "`indexOf(array, item)` returns the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.\n\nReturns `-1` if the item doesn not exist. Check out `Array.indexOfOpt` for a version that returns `None` instead of `-1` if the item does not exist.\n\nSee [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.\n\n## Examples\n\n```rescript\n[1, 2]->Array.indexOf(2)->assertEqual(1)\n[1, 2]->Array.indexOf(3)->assertEqual(-1)\n\n[{\"language\": \"ReScript\"}]\n->Array.indexOf({\"language\": \"ReScript\"})\n->assertEqual(-1) // -1, because of strict equality\n```" ], "signature": "let indexOf: (array<'a>, 'a) => int" }, @@ -9514,7 +10052,7 @@ "kind": "value", "name": "indexOfOpt", "docstrings": [ - "`indexOfOpt(array, item)` returns an option of the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.\n\nSee [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.\n\n## Examples\n```rescript\nConsole.log([1, 2]->Array.indexOfOpt(2)) // Some(1)\nConsole.log([1, 2]->Array.indexOfOpt(3)) // None\nConsole.log([{\"language\": \"ReScript\"}]->Array.indexOfOpt({\"language\": \"ReScript\"})) // None, because of strict equality\n```" + "`indexOfOpt(array, item)` returns an option of the index of the provided `item` in `array`. Uses [strict check for equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality) when comparing items.\n\nSee [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) on MDN.\n\n## Examples\n\n```rescript\n[1, 2]->Array.indexOfOpt(2)->assertEqual(Some(1))\n[1, 2]->Array.indexOfOpt(3)->assertEqual(None)\n[{\"language\": \"ReScript\"}]\n->Array.indexOfOpt({\"language\": \"ReScript\"})\n->assertEqual(None) // None, because of strict equality\n```" ], "signature": "let indexOfOpt: (array<'a>, 'a) => option" }, @@ -9530,7 +10068,7 @@ "kind": "value", "name": "join", "docstrings": [ - "`join(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Array items must be strings, to join number or other arrays, use `joinUnsafe`. Under the hood this will run JavaScript's `toString` on all the array items.\n\nSee [Array.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)\n\n## Examples\n```rescript\nlet array = [\"One\", \"Two\", \"Three\"]\n\nConsole.log(array->Array.join(\" -- \")) // One -- Two -- Three\n```" + "`join(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Array items must be strings, to join number or other arrays, use `joinUnsafe`. Under the hood this will run JavaScript's `toString` on all the array items.\n\nSee [Array.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)\n\n## Examples\n\n```rescript\n[\"One\", \"Two\", \"Three\"]\n->Array.join(\" -- \")\n->assertEqual(\"One -- Two -- Three\")\n```" ], "signature": "let join: (array, string) => string" }, @@ -9539,7 +10077,7 @@ "kind": "value", "name": "joinWith", "docstrings": [ - "`joinWith(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Array items must be strings, to join number or other arrays, use `joinWithUnsafe`. Under the hood this will run JavaScript's `toString` on all the array items.\n\n## Examples\n```rescript\nlet array = [\"One\", \"Two\", \"Three\"]\n\nConsole.log(array->Array.joinWith(\" -- \")) // One -- Two -- Three\n```" + "`joinWith(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Array items must be strings, to join number or other arrays, use `joinWithUnsafe`. Under the hood this will run JavaScript's `toString` on all the array items.\n\n## Examples\n\n```rescript\n[\"One\", \"Two\", \"Three\"]\n->Array.joinWith(\" -- \")\n->assertEqual(\"One -- Two -- Three\")\n```" ], "signature": "let joinWith: (array, string) => string", "deprecated": "Use `join` instead" @@ -9549,7 +10087,7 @@ "kind": "value", "name": "joinUnsafe", "docstrings": [ - "`joinUnsafe(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Under the hood this will run JavaScript's `toString` on all the array items.\n\nSee [Array.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)\n\n## Examples\n```rescript\nlet array = [1, 2, 3]\n\nConsole.log(array->Array.joinUnsafe(\" -- \")) // 1 -- 2 -- 3\n```" + "`joinUnsafe(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Under the hood this will run JavaScript's `toString` on all the array items.\n\nSee [Array.join](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)\n\n## Examples\n\n```rescript\n[1, 2, 3]\n->Array.joinUnsafe(\" -- \")\n->assertEqual(\"1 -- 2 -- 3\")\n```" ], "signature": "let joinUnsafe: (array<'a>, string) => string" }, @@ -9558,7 +10096,7 @@ "kind": "value", "name": "joinWithUnsafe", "docstrings": [ - "`joinWithUnsafe(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Under the hood this will run JavaScript's `toString` on all the array items.\n\n## Examples\n```rescript\nlet array = [1, 2, 3]\n\nConsole.log(array->Array.joinWithUnsafe(\" -- \")) // 1 -- 2 -- 3\n```" + "`joinWithUnsafe(array, separator)` produces a string where all items of `array` are printed, separated by `separator`. Under the hood this will run JavaScript's `toString` on all the array items.\n\n## Examples\n\n```rescript\n[1, 2, 3]\n->Array.joinWithUnsafe(\" -- \")\n->assertEqual(\"1 -- 2 -- 3\")\n```" ], "signature": "let joinWithUnsafe: (array<'a>, string) => string", "deprecated": "Use `joinUnsafe` instead" @@ -9589,7 +10127,7 @@ "kind": "value", "name": "slice", "docstrings": [ - "`slice(array, ~start, ~end)` creates a new array of items copied from `array` from `start` until (but not including) `end`.\n\nSee [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3, 4]\n\nConsole.log(myArray->Array.slice(~start=1, ~end=3)) // [2, 3]\n```" + "`slice(array, ~start, ~end)` creates a new array of items copied from `array` from `start` until (but not including) `end`.\n\nSee [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN.\n\n## Examples\n\n```rescript\n[1, 2, 3, 4]\n->Array.slice(~start=1, ~end=3)\n->assertEqual([2, 3])\n```" ], "signature": "let slice: (array<'a>, ~start: int, ~end: int) => array<'a>" }, @@ -9598,7 +10136,7 @@ "kind": "value", "name": "sliceToEnd", "docstrings": [ - "`sliceToEnd(array, start)` creates a new array from `array`, with all items from `array` starting from `start`.\n\nSee [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3, 4]\n\nConsole.log(myArray->Array.sliceToEnd(~start=1)) // [2, 3, 4]\n```" + "`sliceToEnd(array, start)` creates a new array from `array`, with all items from `array` starting from `start`.\n\nSee [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN.\n\n## Examples\n\n```rescript\n[1, 2, 3, 4]\n->Array.sliceToEnd(~start=1)\n->assertEqual([2, 3, 4])\n```" ], "signature": "let sliceToEnd: (array<'a>, ~start: int) => array<'a>" }, @@ -9607,7 +10145,7 @@ "kind": "value", "name": "copy", "docstrings": [ - "`copy(array)` makes a copy of the array with the items in it, but does not make copies of the items themselves.\n\n## Examples\n```rescript\nlet myArray = [1, 2, 3]\nlet copyOfMyArray = myArray->Array.copy\n\nConsole.log(copyOfMyArray) // [1, 2, 3]\nConsole.log(myArray === copyOfMyArray) // false\n```" + "`copy(array)` makes a copy of the array with the items in it, but does not make copies of the items themselves.\n\n## Examples\n\n```rescript\nlet myArray = [1, 2, 3]\nlet copyOfMyArray = myArray->Array.copy\n\ncopyOfMyArray->assertEqual([1, 2, 3])\nassertEqual(myArray === copyOfMyArray, false)\n```" ], "signature": "let copy: array<'a> => array<'a>" }, @@ -9616,7 +10154,7 @@ "kind": "value", "name": "toString", "docstrings": [ - "`toString(array)` stringifies `array` by running `toString` on all of the array elements and joining them with \",\".\n\nSee [`Array.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString) on MDN.\n\n## Examples\n```rescript\nlet array = [1, 2, 3, 4]\n\nConsole.log(array->Array.toString) // \"1,2,3,4\"\n```" + "`toString(array)` stringifies `array` by running `toString` on all of the array elements and joining them with \",\".\n\nSee [`Array.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString) on MDN.\n\n## Examples\n\n```rescript\n[1, 2, 3, 4]\n->Array.toString\n->assertEqual(\"1,2,3,4\")\n```" ], "signature": "let toString: array<'a> => string" }, @@ -9632,7 +10170,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\n```rescript\nlet array = [1, 2, 3, 4]\n\narray\n->Array.every(num => num <= 4)\n->assertEqual(true)\n\narray\n->Array.every(num => num === 1)\n->assertEqual(false)\n```" ], "signature": "let every: (array<'a>, 'a => bool) => bool" }, @@ -9641,7 +10179,7 @@ "kind": "value", "name": "everyWithIndex", "docstrings": [ - "`everyWithIndex(array, checker)` returns true if all items in `array` returns true when running the provided `checker` function.\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.everyWithIndex((num, index) => index < 2 && num <= 2)) // true\nConsole.log(array->Array.everyWithIndex((num, index) => index < 2 && num >= 2)) // false\n```" + "`everyWithIndex(array, checker)` returns true if all items in `array` returns true when running the provided `checker` function.\n\nSee [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.\n\n## Examples\n\n```rescript\nlet array = [1, 2, 3, 4]\n\narray\n->Array.everyWithIndex((num, index) => index < 5 && num <= 4)\n->assertEqual(true)\n\narray\n->Array.everyWithIndex((num, index) => index < 2 && num >= 2)\n->assertEqual(false)\n```" ], "signature": "let everyWithIndex: (array<'a>, ('a, int) => bool) => bool" }, @@ -9650,7 +10188,7 @@ "kind": "value", "name": "filter", "docstrings": [ - "`filter(array, checker)` returns a new array containing all elements from `array` for which the provided `checker` function returns true.\n\nSee [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.\n\n## Examples\n```rescript\nlet array = [1, 2, 3, 4]\n\nConsole.log(array->Array.filter(num => num > 2)) // [3, 4]\n```" + "`filter(array, checker)` returns a new array containing all elements from `array` for which the provided `checker` function returns true.\n\nSee [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.\n\n## Examples\n\n```rescript\n[1, 2, 3, 4]\n->Array.filter(num => num > 2)\n->assertEqual([3, 4])\n```" ], "signature": "let filter: (array<'a>, 'a => bool) => array<'a>" }, @@ -9659,7 +10197,7 @@ "kind": "value", "name": "filterWithIndex", "docstrings": [ - "`filterWithIndex(array, checker)` returns a new array containing all elements from `array` for which the provided `checker` function returns true.\n\nSee [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.\n\n## Examples\n```rescript\nlet array = [1, 2, 3, 4]\n\nConsole.log(array->Array.filterWithIndex((num, index) => index === 0 || num === 2)) // [1, 2]\n```" + "`filterWithIndex(array, checker)` returns a new array containing all elements from `array` for which the provided `checker` function returns true.\n\nSee [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.\n\n## Examples\n\n```rescript\n[1, 2, 3, 4]\n->Array.filterWithIndex((num, index) => index === 0 || num === 2)\n->assertEqual([1, 2])\n```" ], "signature": "let filterWithIndex: (array<'a>, ('a, int) => bool) => array<'a>" }, @@ -9668,7 +10206,7 @@ "kind": "value", "name": "find", "docstrings": [ - "`find(array, checker)` returns the first element of `array` where the provided `checker` function returns true.\n\nSee [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\nswitch array->Array.find(item => item == ReScript) {\n| None => Console.log(\"No item...\")\n| Some(_) => Console.log(\"Yay, ReScript!\")\n}\n```" + "`find(array, checker)` returns the first element of `array` where the provided `checker` function returns true.\n\nSee [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\narray\n->Array.find(item => item == ReScript)\n->assertEqual(Some(ReScript))\n```" ], "signature": "let find: (array<'a>, 'a => bool) => option<'a>" }, @@ -9677,7 +10215,7 @@ "kind": "value", "name": "findWithIndex", "docstrings": [ - "`findWithIndex(array, checker)` returns the first element of `array` where the provided `checker` function returns true.\n\nSee [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [TypeScript, JavaScript, ReScript]\n\nswitch array->Array.findWithIndex((item, index) => index > 1 && item == ReScript) {\n| None => Console.log(\"No item...\")\n| Some(_) => Console.log(\"Yay, ReScript exists in a later position!\")\n}\n```" + "`findWithIndex(array, checker)` returns the first element of `array` where the provided `checker` function returns true.\n\nSee [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [TypeScript, JavaScript, ReScript]\n\narray\n->Array.findWithIndex((item, index) => index > 1 && item == ReScript)\n->assertEqual(Some(ReScript))\n```" ], "signature": "let findWithIndex: (array<'a>, ('a, int) => bool) => option<'a>" }, @@ -9686,7 +10224,7 @@ "kind": "value", "name": "findIndex", "docstrings": [ - "`findIndex(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript]\n\nConsole.log(array->Array.findIndex(item => item == ReScript)) // 0\nConsole.log(array->Array.findIndex(item => item == TypeScript)) // -1\n```" + "`findIndex(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript]\n\narray\n->Array.findIndex(item => item == ReScript)\n->assertEqual(0)\n\narray->Array.findIndex(item => item == TypeScript)\n->assertEqual(-1)\n```" ], "signature": "let findIndex: (array<'a>, 'a => bool) => int" }, @@ -9695,7 +10233,7 @@ "kind": "value", "name": "findIndexWithIndex", "docstrings": [ - "`findIndexWithIndex(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript]\n\nlet isReScriptFirst = array->Array.findIndexWithIndex((item, index) => index === 0 && item == ReScript)\nlet isTypeScriptFirst = array->Array.findIndexWithIndex((item, index) => index === 0 && item == TypeScript)\n\nConsole.log(isReScriptFirst) // 0\nConsole.log(isTypeScriptFirst) // -1\n```" + "`findIndexWithIndex(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript]\n\nlet isReScriptFirst = array->Array.findIndexWithIndex((item, index) => index === 0 && item == ReScript)\nlet isTypeScriptFirst = array->Array.findIndexWithIndex((item, index) => index === 0 && item == TypeScript)\n\nassertEqual(isReScriptFirst, 0)\nassertEqual(isTypeScriptFirst, -1)\n```" ], "signature": "let findIndexWithIndex: (array<'a>, ('a, int) => bool) => int" }, @@ -9713,7 +10251,7 @@ "kind": "value", "name": "forEachWithIndex", "docstrings": [ - "`forEachWithIndex(array, fn)` runs the provided `fn` on every element of `array`.\n\nSee [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray->Array.forEachWithIndex((item, index) => {\n Console.log(\"At item \" ++ Int.toString(index) ++ \": \" ++ item)\n})\n```" + "`forEachWithIndex(array, fn)` runs the provided `fn` on every element of `array`.\n\nSee [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray->Array.forEachWithIndex((item, index) => {\n Console.log(\"At item \" ++ Int.toString(index) ++ \": \" ++ item)\n})\n```" ], "signature": "let forEachWithIndex: (array<'a>, ('a, int) => unit) => unit" }, @@ -9722,7 +10260,7 @@ "kind": "value", "name": "map", "docstrings": [ - "`map(array, fn)` returns a new array with all elements from `array`, each element transformed using the provided `fn`.\n\nSee [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on MDN.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet mappedArray = array->Array.map(greeting => greeting ++ \" to you\")\n\nConsole.log(mappedArray) // [\"Hello to you\", \"Hi to you\", \"Good bye to you\"]\n```" + "`map(array, fn)` returns a new array with all elements from `array`, each element transformed using the provided `fn`.\n\nSee [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet mappedArray = array->Array.map(greeting => greeting ++ \" to you\")\n\nassertEqual(mappedArray, [\"Hello to you\", \"Hi to you\", \"Good bye to you\"])\n```" ], "signature": "let map: (array<'a>, 'a => 'b) => array<'b>" }, @@ -9731,7 +10269,7 @@ "kind": "value", "name": "mapWithIndex", "docstrings": [ - "`mapWithIndex(array, fn)` returns a new array with all elements from `array`, each element transformed using the provided `fn`.\n\nSee [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on MDN.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet mappedArray =\n array->Array.mapWithIndex((greeting, index) =>\n greeting ++ \" at position \" ++ Int.toString(index)\n )\n\nConsole.log(mappedArray) // [\"Hello at position 0\", \"Hi at position 1\", \"Good bye at position 2\"]\n```" + "`mapWithIndex(array, fn)` returns a new array with all elements from `array`, each element transformed using the provided `fn`.\n\nSee [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet mappedArray =\n array->Array.mapWithIndex((greeting, index) =>\n greeting ++ \" at position \" ++ Int.toString(index)\n )\n\nassertEqual(mappedArray, [\"Hello at position 0\", \"Hi at position 1\", \"Good bye at position 2\"])\n```" ], "signature": "let mapWithIndex: (array<'a>, ('a, int) => 'b) => array<'b>" }, @@ -9740,7 +10278,7 @@ "kind": "value", "name": "reduce", "docstrings": [ - "`reduce(xs, init, fn)`\n\n Applies `fn` to each element of `xs` from beginning to end. Function `fn` has two parameters: the item from the list and an “accumulator”; which starts with a value of `init`. `reduce` returns the final value of the accumulator.\n\n ```res example\n Array.reduce([2, 3, 4], 1, (a, b) => a + b) == 10\n\n Array.reduce([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b) == \"abcd\"\n ```" + "`reduce(xs, init, fn)`\n\nApplies `fn` to each element of `xs` from beginning to end. Function `fn` has two parameters: the item from the list and an “accumulator”; which starts with a value of `init`. `reduce` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nArray.reduce([2, 3, 4], 1, (a, b) => a + b)->assertEqual(10)\n\nArray.reduce([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b)->assertEqual(\"abcd\")\n\n[1, 2, 3]\n->Array.reduce(list{}, List.add)\n->assertEqual(list{3, 2, 1})\n\nArray.reduce([], list{}, List.add)->assertEqual(list{})\n```" ], "signature": "let reduce: (array<'a>, 'b, ('b, 'a) => 'b) => 'b" }, @@ -9749,7 +10287,7 @@ "kind": "value", "name": "reduceWithIndex", "docstrings": [ - "`reduceWithIndex(x, init, fn)`\n\n Applies `fn` to each element of `xs` from beginning to end. Function `fn` has three parameters: the item from the array and an “accumulator”, which starts with a value of `init` and the index of each element. `reduceWithIndex` returns the final value of the accumulator.\n\n ```res example\n Array.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i) == 16\n ```" + "`reduceWithIndex(x, init, fn)`\n\nApplies `fn` to each element of `xs` from beginning to end. Function `fn` has three parameters: the item from the array and an “accumulator”, which starts with a value of `init` and the index of each element. `reduceWithIndex` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nArray.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i)->assertEqual(16)\n\nArray.reduceWithIndex([1, 2, 3], list{}, (acc, v, i) => list{v + i, ...acc})->assertEqual(list{5, 3, 1})\n\nArray.reduceWithIndex([], list{}, (acc, v, i) => list{v + i, ...acc})->assertEqual(list{})\n```" ], "signature": "let reduceWithIndex: (array<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, @@ -9758,7 +10296,7 @@ "kind": "value", "name": "reduceRight", "docstrings": [ - "`reduceRight(xs, init, fn)`\n\n Works like `Array.reduce`; except that function `fn` is applied to each item of `xs` from the last back to the first.\n\n ```res example\n Array.reduceRight([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b) == \"dcba\"\n ```" + "`reduceRight(xs, init, fn)`\n\nWorks like `Array.reduce`; except that function `fn` is applied to each item of `xs` from the last back to the first.\n\n## Examples\n\n```rescript\nArray.reduceRight([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b)->assertEqual(\"dcba\")\n\nArray.reduceRight([1, 2, 3], list{}, List.add)->assertEqual(list{1, 2, 3})\n\nArray.reduceRight([], list{}, List.add)->assertEqual(list{})\n```" ], "signature": "let reduceRight: (array<'a>, 'b, ('b, 'a) => 'b) => 'b" }, @@ -9767,7 +10305,7 @@ "kind": "value", "name": "reduceRightWithIndex", "docstrings": [ - "`reduceRightWithIndex(xs, init, fn)`\n\n Like `reduceRight`, but with an additional index argument on the callback function.\n\n ```res example\n Array.reduceRightWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i) == 16\n ```" + "`reduceRightWithIndex(xs, init, fn)`\n\nLike `reduceRight`, but with an additional index argument on the callback function.\n\n## Examples\n\n```rescript\nArray.reduceRightWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i)->assertEqual(16)\n\nArray.reduceRightWithIndex([], list{}, (acc, v, i) => list{v + i, ...acc})->assertEqual(list{})\n```" ], "signature": "let reduceRightWithIndex: (array<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, @@ -9776,7 +10314,7 @@ "kind": "value", "name": "some", "docstrings": [ - "`some(array, predicate)` returns true if `predicate` returns true for any element in `array`.\n\nSee [`Array.some`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) on MDN.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\nConsole.log(array->Array.some(greeting => greeting === \"Hello\")) // true\n```" + "`some(array, predicate)` returns true if `predicate` returns true for any element in `array`.\n\nSee [`Array.some`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray\n->Array.some(greeting => greeting === \"Hello\")\n->assertEqual(true)\n```" ], "signature": "let some: (array<'a>, 'a => bool) => bool" }, @@ -9785,7 +10323,7 @@ "kind": "value", "name": "someWithIndex", "docstrings": [ - "`someWithIndex(array, checker)` returns true if running the provided `checker` function on any element in `array` returns true.\n\nSee [`Array.some`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) on MDN.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\nConsole.log(array->Array.someWithIndex((greeting, index) => greeting === \"Hello\" && index === 0)) // true\n```" + "`someWithIndex(array, checker)` returns true if running the provided `checker` function on any element in `array` returns true.\n\nSee [`Array.some`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray\n->Array.someWithIndex((greeting, index) => greeting === \"Hello\" && index === 0)\n->assertEqual(true)\n```" ], "signature": "let someWithIndex: (array<'a>, ('a, int) => bool) => bool" }, @@ -9794,7 +10332,7 @@ "kind": "value", "name": "get", "docstrings": [ - "`get(array, index)` returns the element at `index` of `array`.\n\nReturns `None` if the index does not exist in the array. Equivalent to doing `array[index]` in JavaScript.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray->Array.get(0) == Some(\"Hello\") // true\narray->Array.get(3) == None // true\n```" + "`get(array, index)` returns the element at `index` of `array`.\n\nReturns `None` if the index does not exist in the array. Equivalent to doing `array[index]` in JavaScript.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray\n->Array.get(0)\n->assertEqual(Some(\"Hello\"))\n\narray\n->Array.get(3)\n->assertEqual(None)\n```" ], "signature": "let get: (array<'a>, int) => option<'a>" }, @@ -9803,7 +10341,7 @@ "kind": "value", "name": "set", "docstrings": [ - "`set(array, index, item)` sets the provided `item` at `index` of `array`.\n\nBeware this will *mutate* the array.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.set(1, \"Hello\")\n\nConsole.log(array[1]) // \"Hello\"\n```" + "`set(array, index, item)` sets the provided `item` at `index` of `array`.\n\nBeware this will *mutate* the array.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.set(1, \"Hello\")\n\narray[1]->assertEqual(Some(\"Hello\"))\n```" ], "signature": "let set: (array<'a>, int, 'a) => unit" }, @@ -9812,21 +10350,21 @@ "kind": "value", "name": "getSymbol", "docstrings": [], - "signature": "let getSymbol: (array<'a>, Core__Symbol.t) => option<'b>" + "signature": "let getSymbol: (array<'a>, Symbol.t) => option<'b>" }, { "id": "Core.Array.getSymbolUnsafe", "kind": "value", "name": "getSymbolUnsafe", "docstrings": [], - "signature": "let getSymbolUnsafe: (array<'a>, Core__Symbol.t) => 'b" + "signature": "let getSymbolUnsafe: (array<'a>, Symbol.t) => 'b" }, { "id": "Core.Array.setSymbol", "kind": "value", "name": "setSymbol", "docstrings": [], - "signature": "let setSymbol: (array<'a>, Core__Symbol.t, 'b) => unit" + "signature": "let setSymbol: (array<'a>, Symbol.t, 'b) => unit" }, { "id": "Core.Array.getUnsafe", @@ -9837,12 +10375,22 @@ ], "signature": "let getUnsafe: (array<'a>, int) => 'a" }, + { + "id": "Core.Array.unsafe_get", + "kind": "value", + "name": "unsafe_get", + "docstrings": [ + "`unsafe_get(array, index)` returns the element at `index` of `array`.\n\nThis is _unsafe_, meaning it will return `undefined` value if `index` does not exist in `array`.\n\nUse `Array.unsafe_get` only when you are sure the `index` exists (i.e. when using for-loop).\n\n## Examples\n\n```rescript\nlet array = [1, 2, 3]\nfor index in 0 to array->Array.length - 1 {\n let value = array->Array.unsafe_get(index)\n Console.log(value)\n}\n```" + ], + "signature": "let unsafe_get: (array<'a>, int) => 'a", + "deprecated": "Use getUnsafe instead. This will be removed in v13" + }, { "id": "Core.Array.setUnsafe", "kind": "value", "name": "setUnsafe", "docstrings": [ - "`setUnsafe(array, index, item)` sets the provided `item` at `index` of `array`.\n\nBeware this will *mutate* the array, and is *unsafe*.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.setUnsafe(1, \"Hello\")\n\nConsole.log(array[1]) // \"Hello\"\n```" + "`setUnsafe(array, index, item)` sets the provided `item` at `index` of `array`.\n\nBeware this will *mutate* the array, and is *unsafe*.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.setUnsafe(1, \"Hello\")\n\nassertEqual(array[1], Some(\"Hello\"))\n```" ], "signature": "let setUnsafe: (array<'a>, int, 'a) => unit" }, @@ -9851,7 +10399,7 @@ "kind": "value", "name": "findIndexOpt", "docstrings": [ - "`findIndexOpt(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `None` if no item matches.\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\nswitch array->Array.findIndexOpt(item => item == ReScript) {\n| None => Console.log(\"Ahh, no ReScript...\")\n| Some(index) => Console.log(\"Yay, ReScript at index \" ++ Int.toString(index))\n}\n```" + "`findIndexOpt(array, checker)` returns the index of the first element of `array` where the provided `checker` function returns true.\n\nReturns `None` if no item matches.\n\nSee [`Array.findIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\narray\n->Array.findIndexOpt(item => item == ReScript)\n->assertEqual(Some(0))\n```" ], "signature": "let findIndexOpt: (array<'a>, 'a => bool) => option" }, @@ -9860,7 +10408,7 @@ "kind": "value", "name": "toReversed", "docstrings": [ - "`toReversed(array)` creates a new array with all items from `array` in reversed order.\n\nSee [`Array.toReversed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed) on MDN.\n\n## Examples\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nlet reversed = someArray->Array.toReversed\n\nConsole.log(reversed) // [\"hello\", \"h1\"]\nConsole.log(someArray) // [\"h1\", \"hello\"]. Original unchanged\n```" + "`toReversed(array)` creates a new array with all items from `array` in reversed order.\n\nSee [`Array.toReversed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toReversed) on MDN.\n\n## Examples\n\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nlet reversed = someArray->Array.toReversed\n\nreversed->assertEqual([\"hello\", \"hi\"])\nsomeArray->assertEqual([\"hi\", \"hello\"]) // Original unchanged\n```" ], "signature": "let toReversed: array<'a> => array<'a>" }, @@ -9869,7 +10417,7 @@ "kind": "value", "name": "filterMap", "docstrings": [ - "`filterMap(array, fn)`\n\nCalls `fn` for each element and returns a new array containing results of the `fn` calls which are not `None`.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\nConsole.log(\n array->Array.filterMap(item =>\n switch item {\n | \"Hello\" => Some(item->String.length)\n | _ => None\n }\n ),\n) // [5]\n```" + "`filterMap(array, fn)`\n\nCalls `fn` for each element and returns a new array containing results of the `fn` calls which are not `None`.\n\n## Examples\n\n```rescript\n[\"Hello\", \"Hi\", \"Good bye\"]\n->Array.filterMap(item =>\n switch item {\n | \"Hello\" => Some(item->String.length)\n | _ => None\n }\n)\n->assertEqual([5])\n\n[1, 2, 3, 4, 5, 6]\n->Array.filterMap(n => mod(n, 2) == 0 ? Some(n * n) : None)\n->assertEqual([4, 16, 36])\n\nArray.filterMap([1, 2, 3, 4, 5, 6], _ => None)->assertEqual([])\n\nArray.filterMap([], n => mod(n, 2) == 0 ? Some(n * n) : None)->assertEqual([])\n```" ], "signature": "let filterMap: (array<'a>, 'a => option<'b>) => array<'b>" }, @@ -9878,7 +10426,7 @@ "kind": "value", "name": "keepSome", "docstrings": [ - "`keepSome(arr)`\n\n Returns a new array containing `value` for all elements that are `Some(value)`\n and ignoring every value that is `None`\n\n ```res example\n Array.keepSome([Some(1), None, Some(3)]) == [1, 3]\n ```" + "`keepSome(arr)`\n\nReturns a new array containing `value` for all elements that are `Some(value)`\nand ignoring every value that is `None`\n\n## Examples\n\n```rescript\nArray.keepSome([Some(1), None, Some(3)])->assertEqual([1, 3])\n\nArray.keepSome([Some(1), Some(2), Some(3)])->assertEqual([1, 2, 3])\n\nArray.keepSome([None, None, None])->assertEqual([])\n\nArray.keepSome([])->assertEqual([])\n```" ], "signature": "let keepSome: array> => array<'a>" }, @@ -9887,7 +10435,7 @@ "kind": "value", "name": "toShuffled", "docstrings": [ - "`toShuffled(array)` returns a new array with all items in `array` in a random order.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet shuffledArray = array->Array.toShuffled\n\nConsole.log(shuffledArray)\n```" + "`toShuffled(array)` returns a new array with all items in `array` in a random order.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\nlet shuffledArray = array->Array.toShuffled\nConsole.log(shuffledArray)\n\nArray.toShuffled([1, 2, 3])\n->Array.length\n->assertEqual(3)\n```" ], "signature": "let toShuffled: array<'a> => array<'a>" }, @@ -9896,7 +10444,7 @@ "kind": "value", "name": "shuffle", "docstrings": [ - "`shuffle(array)` randomizes the position of all items in `array`.\n\nBeware this will *mutate* the array.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.shuffle\n\nConsole.log(array)\n```" + "`shuffle(array)` randomizes the position of all items in `array`.\n\nBeware this will *mutate* the array.\n\n## Examples\n\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\narray->Array.shuffle\nConsole.log(array)\n\nlet array2 = [1, 2, 3]\narray2->Array.shuffle\n\narray2\n->Array.length\n->assertEqual(3)\n```" ], "signature": "let shuffle: array<'a> => unit" }, @@ -9905,7 +10453,7 @@ "kind": "value", "name": "flatMap", "docstrings": [ - "`flatMap(array, mapper)` returns a new array concatenating the arrays returned from running `mapper` on all items in `array`.\n\n## Examples\n```rescript\ntype language = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\nConsole.log(\n array->Array.flatMap(item =>\n switch item {\n | ReScript => [1, 2, 3]\n | TypeScript => [4, 5, 6]\n | JavaScript => [7, 8, 9]\n }\n ),\n)\n// [1, 2, 3, 4, 5, 6, 7, 8, 9]\n```" + "`flatMap(array, mapper)` returns a new array concatenating the arrays returned from running `mapper` on all items in `array`.\n\n## Examples\n\n```rescript\ntype language = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\narray\n->Array.flatMap(item =>\n switch item {\n | ReScript => [1, 2, 3]\n | TypeScript => [4, 5, 6]\n | JavaScript => [7, 8, 9]\n }\n)\n->assertEqual([1, 2, 3, 4, 5, 6, 7, 8, 9])\n```" ], "signature": "let flatMap: (array<'a>, 'a => array<'b>) => array<'b>" }, @@ -9914,7 +10462,7 @@ "kind": "value", "name": "flatMapWithIndex", "docstrings": [ - "`flatMapWithIndex(array, mapper)` returns a new array concatenating the arrays returned from running `mapper` on all items in `array`.\n\n## Examples\n```rescript\ntype language = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\nConsole.log(\n array->Array.flatMapWithIndex((item, index) =>\n switch item {\n | ReScript => [index]\n | TypeScript => [index, index + 1]\n | JavaScript => [index, index + 1, index + 2]\n }\n ),\n)\n// [0, 1, 2, 2, 3, 4]\n```" + "`flatMapWithIndex(array, mapper)` returns a new array concatenating the arrays returned from running `mapper` on all items in `array`.\n\n## Examples\n\n```rescript\ntype language = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, TypeScript, JavaScript]\n\n\narray\n->Array.flatMapWithIndex((item, index) =>\n switch item {\n | ReScript => [index]\n | TypeScript => [index, index + 1]\n | JavaScript => [index, index + 1, index + 2]\n }\n)\n->assertEqual([0, 1, 2, 2, 3, 4])\n```" ], "signature": "let flatMapWithIndex: (array<'a>, ('a, int) => array<'b>) => array<'b>" }, @@ -9923,7 +10471,7 @@ "kind": "value", "name": "findMap", "docstrings": [ - "`findMap(arr, fn)`\n\n Calls `fn` for each element and returns the first value from `fn` that is `Some(_)`.\n Otherwise returns `None`\n\n ```res example\n Array.findMap([1, 2, 3], n => mod(n, 2) == 0 ? Some(n - 2) : None) == Some(0) // true\n ```" + "`findMap(arr, fn)`\n\nCalls `fn` for each element and returns the first value from `fn` that is `Some(_)`.\nOtherwise returns `None`\n\n## Examples\n\n```rescript\nArray.findMap([1, 2, 3], n => mod(n, 2) == 0 ? Some(n - 2) : None)->assertEqual(Some(0))\n\nArray.findMap([1, 2, 3, 4, 5, 6], n => mod(n, 2) == 0 ? Some(n - 8) : None)->assertEqual(Some(-6))\n\nArray.findMap([1, 2, 3, 4, 5, 6], _ => None)->assertEqual(None)\n\nArray.findMap([], n => mod(n, 2) == 0 ? Some(n * n) : None)->assertEqual(None)\n```" ], "signature": "let findMap: (array<'a>, 'a => option<'b>) => option<'b>" }, @@ -9932,7 +10480,7 @@ "kind": "value", "name": "at", "docstrings": [ - "`at(array, index)`\n\n Get an element by its index. Negative indices count backwards from the last item.\n\n ## Examples\n ```rescript\n [\"a\", \"b\", \"c\"]->Array.at(0) // Some(\"a\")\n [\"a\", \"b\", \"c\"]->Array.at(2) // Some(\"c\")\n [\"a\", \"b\", \"c\"]->Array.at(3) // None\n [\"a\", \"b\", \"c\"]->Array.at(-1) // Some(\"c\")\n [\"a\", \"b\", \"c\"]->Array.at(-3) // Some(\"a\")\n [\"a\", \"b\", \"c\"]->Array.at(-4) // None\n ```" + "`at(array, index)`\n\nGet an element by its index. Negative indices count backwards from the last item.\n\n## Examples\n\n```rescript\n[\"a\", \"b\", \"c\"]->Array.at(0)->assertEqual(Some(\"a\"))\n[\"a\", \"b\", \"c\"]->Array.at(2)->assertEqual(Some(\"c\"))\n[\"a\", \"b\", \"c\"]->Array.at(3)->assertEqual(None)\n[\"a\", \"b\", \"c\"]->Array.at(-1)->assertEqual(Some(\"c\"))\n[\"a\", \"b\", \"c\"]->Array.at(-3)->assertEqual(Some(\"a\"))\n[\"a\", \"b\", \"c\"]->Array.at(-4)->assertEqual(None)\n```" ], "signature": "let at: (array<'a>, int) => option<'a>" }, @@ -9941,7 +10489,7 @@ "kind": "value", "name": "last", "docstrings": [ - "`last(array)` returns the last element of `array`.\n\nReturns `None` if the array is empty.\n\n## Examples\n```rescript\nlet array = [\"Hello\", \"Hi\", \"Good bye\"]\n\narray->Array.last == Some(\"Good bye\") // true\n[]->Array.last == None // true\n```" + "`last(array)` returns the last element of `array`.\n\nReturns `None` if the array is empty.\n\n## Examples\n\n```rescript\n[\"Hello\", \"Hi\", \"Good bye\"]\n->Array.last\n->assertEqual(Some(\"Good bye\"))\n\n[]\n->Array.last\n->assertEqual(None)\n```" ], "signature": "let last: array<'a> => option<'a>" } diff --git a/data/api/v12.0.0/toc_tree.json b/data/api/v12.0.0/toc_tree.json index faf8bb122..4ab479b89 100644 --- a/data/api/v12.0.0/toc_tree.json +++ b/data/api/v12.0.0/toc_tree.json @@ -1 +1 @@ -{"js":{"name":"Js","path":["js"],"children":[{"name":"WeakMap","path":["js","weakmap"],"children":[]},{"name":"Map","path":["js","map"],"children":[]},{"name":"WeakSet","path":["js","weakset"],"children":[]},{"name":"Set","path":["js","set"],"children":[]},{"name":"Console","path":["js","console"],"children":[]},{"name":"Vector","path":["js","vector"],"children":[]},{"name":"List","path":["js","list"],"children":[]},{"name":"Result","path":["js","result"],"children":[]},{"name":"Option","path":["js","option"],"children":[]},{"name":"Blob","path":["js","blob"],"children":[]},{"name":"File","path":["js","file"],"children":[]},{"name":"BigInt","path":["js","bigint"],"children":[]},{"name":"Int","path":["js","int"],"children":[]},{"name":"Float","path":["js","float"],"children":[]},{"name":"Types","path":["js","types"],"children":[]},{"name":"TypedArray2","path":["js","typedarray2"],"children":[{"name":"DataView","path":["js","typedarray2","dataview"],"children":[]},{"name":"Float64Array","path":["js","typedarray2","float64array"],"children":[]},{"name":"Float32Array","path":["js","typedarray2","float32array"],"children":[]},{"name":"Uint32Array","path":["js","typedarray2","uint32array"],"children":[]},{"name":"Int32Array","path":["js","typedarray2","int32array"],"children":[]},{"name":"Uint16Array","path":["js","typedarray2","uint16array"],"children":[]},{"name":"Int16Array","path":["js","typedarray2","int16array"],"children":[]},{"name":"Uint8ClampedArray","path":["js","typedarray2","uint8clampedarray"],"children":[]},{"name":"Uint8Array","path":["js","typedarray2","uint8array"],"children":[]},{"name":"Int8Array","path":["js","typedarray2","int8array"],"children":[]},{"name":"ArrayBuffer","path":["js","typedarray2","arraybuffer"],"children":[]}]},{"name":"Typed_array","path":["js","typed_array"],"children":[{"name":"DataView","path":["js","typed_array","dataview"],"children":[]},{"name":"Float64_array","path":["js","typed_array","float64_array"],"children":[]},{"name":"Float64Array","path":["js","typed_array","float64array"],"children":[]},{"name":"Float32_array","path":["js","typed_array","float32_array"],"children":[]},{"name":"Float32Array","path":["js","typed_array","float32array"],"children":[]},{"name":"Uint32Array","path":["js","typed_array","uint32array"],"children":[]},{"name":"Int32_array","path":["js","typed_array","int32_array"],"children":[]},{"name":"Int32Array","path":["js","typed_array","int32array"],"children":[]},{"name":"Uint16Array","path":["js","typed_array","uint16array"],"children":[]},{"name":"Int16Array","path":["js","typed_array","int16array"],"children":[]},{"name":"Uint8ClampedArray","path":["js","typed_array","uint8clampedarray"],"children":[]},{"name":"Uint8Array","path":["js","typed_array","uint8array"],"children":[]},{"name":"Int8Array","path":["js","typed_array","int8array"],"children":[]},{"name":"S","path":["js","typed_array","s"],"children":[]},{"name":"ArrayBuffer","path":["js","typed_array","arraybuffer"],"children":[]},{"name":"Type","path":["js","typed_array","type"],"children":[]}]},{"name":"Obj","path":["js","obj"],"children":[]},{"name":"Math","path":["js","math"],"children":[]},{"name":"Json","path":["js","json"],"children":[{"name":"Kind","path":["js","json","kind"],"children":[]}]},{"name":"Global","path":["js","global"],"children":[]},{"name":"Dict","path":["js","dict"],"children":[]},{"name":"Date","path":["js","date"],"children":[]},{"name":"Promise2","path":["js","promise2"],"children":[]},{"name":"Promise","path":["js","promise"],"children":[]},{"name":"Re","path":["js","re"],"children":[]},{"name":"String2","path":["js","string2"],"children":[]},{"name":"String","path":["js","string"],"children":[]},{"name":"Array2","path":["js","array2"],"children":[]},{"name":"Array","path":["js","array"],"children":[]},{"name":"Exn","path":["js","exn"],"children":[]},{"name":"Null_undefined","path":["js","null_undefined"],"children":[]},{"name":"Nullable","path":["js","nullable"],"children":[]},{"name":"Undefined","path":["js","undefined"],"children":[]},{"name":"Null","path":["js","null"],"children":[]}]},"belt":{"name":"Belt","path":["belt"],"children":[{"name":"Float","path":["belt","float"],"children":[]},{"name":"Int","path":["belt","int"],"children":[]},{"name":"Result","path":["belt","result"],"children":[]},{"name":"Option","path":["belt","option"],"children":[]},{"name":"HashMap","path":["belt","hashmap"],"children":[{"name":"String","path":["belt","hashmap","string"],"children":[]},{"name":"Int","path":["belt","hashmap","int"],"children":[]}]},{"name":"HashSet","path":["belt","hashset"],"children":[{"name":"String","path":["belt","hashset","string"],"children":[]},{"name":"Int","path":["belt","hashset","int"],"children":[]}]},{"name":"MutableMap","path":["belt","mutablemap"],"children":[{"name":"String","path":["belt","mutablemap","string"],"children":[]},{"name":"Int","path":["belt","mutablemap","int"],"children":[]}]},{"name":"MutableSet","path":["belt","mutableset"],"children":[{"name":"String","path":["belt","mutableset","string"],"children":[]},{"name":"Int","path":["belt","mutableset","int"],"children":[]}]},{"name":"Map","path":["belt","map"],"children":[{"name":"Dict","path":["belt","map","dict"],"children":[]},{"name":"String","path":["belt","map","string"],"children":[]},{"name":"Int","path":["belt","map","int"],"children":[]}]},{"name":"Set","path":["belt","set"],"children":[{"name":"Dict","path":["belt","set","dict"],"children":[]},{"name":"String","path":["belt","set","string"],"children":[]},{"name":"Int","path":["belt","set","int"],"children":[]}]},{"name":"Range","path":["belt","range"],"children":[]},{"name":"List","path":["belt","list"],"children":[]},{"name":"MutableStack","path":["belt","mutablestack"],"children":[]},{"name":"MutableQueue","path":["belt","mutablequeue"],"children":[]},{"name":"SortArray","path":["belt","sortarray"],"children":[{"name":"String","path":["belt","sortarray","string"],"children":[]},{"name":"Int","path":["belt","sortarray","int"],"children":[]}]},{"name":"Array","path":["belt","array"],"children":[]},{"name":"Id","path":["belt","id"],"children":[{"name":"MakeHashable","path":["belt","id","makehashable"],"children":[]},{"name":"MakeHashableU","path":["belt","id","makehashableu"],"children":[]},{"name":"MakeComparable","path":["belt","id","makecomparable"],"children":[]},{"name":"MakeComparableU","path":["belt","id","makecomparableu"],"children":[]}]}]},"dom":{"name":"Dom","path":["dom"],"children":[{"name":"Storage2","path":["dom","storage2"],"children":[]},{"name":"Storage","path":["dom","storage"],"children":[]}]},"core":{"name":"Core","path":["core"],"children":[{"name":"Result","path":["core","result"],"children":[]},{"name":"List","path":["core","list"],"children":[]},{"name":"Option","path":["core","option"],"children":[]},{"name":"Exn","path":["core","exn"],"children":[]},{"name":"Intl","path":["core","intl"],"children":[{"name":"Segments","path":["core","intl","segments"],"children":[]},{"name":"Segmenter","path":["core","intl","segmenter"],"children":[]},{"name":"RelativeTimeFormat","path":["core","intl","relativetimeformat"],"children":[]},{"name":"PluralRules","path":["core","intl","pluralrules"],"children":[]},{"name":"NumberFormat","path":["core","intl","numberformat"],"children":[{"name":"Grouping","path":["core","intl","numberformat","grouping"],"children":[]}]},{"name":"Locale","path":["core","intl","locale"],"children":[]},{"name":"ListFormat","path":["core","intl","listformat"],"children":[]},{"name":"DateTimeFormat","path":["core","intl","datetimeformat"],"children":[]},{"name":"Collator","path":["core","intl","collator"],"children":[]},{"name":"Common","path":["core","intl","common"],"children":[]}]},{"name":"BigUint64Array","path":["core","biguint64array"],"children":[{"name":"Constants","path":["core","biguint64array","constants"],"children":[]}]},{"name":"BigInt64Array","path":["core","bigint64array"],"children":[{"name":"Constants","path":["core","bigint64array","constants"],"children":[]}]},{"name":"Uint8ClampedArray","path":["core","uint8clampedarray"],"children":[{"name":"Constants","path":["core","uint8clampedarray","constants"],"children":[]}]},{"name":"Uint32Array","path":["core","uint32array"],"children":[{"name":"Constants","path":["core","uint32array","constants"],"children":[]}]},{"name":"Uint16Array","path":["core","uint16array"],"children":[{"name":"Constants","path":["core","uint16array","constants"],"children":[]}]},{"name":"Uint8Array","path":["core","uint8array"],"children":[{"name":"Constants","path":["core","uint8array","constants"],"children":[]}]},{"name":"Int32Array","path":["core","int32array"],"children":[{"name":"Constants","path":["core","int32array","constants"],"children":[]}]},{"name":"Int16Array","path":["core","int16array"],"children":[{"name":"Constants","path":["core","int16array","constants"],"children":[]}]},{"name":"Int8Array","path":["core","int8array"],"children":[{"name":"Constants","path":["core","int8array","constants"],"children":[]}]},{"name":"Float64Array","path":["core","float64array"],"children":[{"name":"Constants","path":["core","float64array","constants"],"children":[]}]},{"name":"Float32Array","path":["core","float32array"],"children":[{"name":"Constants","path":["core","float32array","constants"],"children":[]}]},{"name":"TypedArray","path":["core","typedarray"],"children":[]},{"name":"ArrayBuffer","path":["core","arraybuffer"],"children":[]},{"name":"WeakSet","path":["core","weakset"],"children":[]},{"name":"Set","path":["core","set"],"children":[]},{"name":"WeakMap","path":["core","weakmap"],"children":[]},{"name":"Map","path":["core","map"],"children":[]},{"name":"AsyncIterator","path":["core","asynciterator"],"children":[]},{"name":"Iterator","path":["core","iterator"],"children":[]},{"name":"JSON","path":["core","json"],"children":[{"name":"Decode","path":["core","json","decode"],"children":[]},{"name":"Encode","path":["core","json","encode"],"children":[]},{"name":"Classify","path":["core","json","classify"],"children":[]}]},{"name":"Type","path":["core","type"],"children":[{"name":"Classify","path":["core","type","classify"],"children":[]}]},{"name":"Symbol","path":["core","symbol"],"children":[]},{"name":"String","path":["core","string"],"children":[]},{"name":"RegExp","path":["core","regexp"],"children":[{"name":"Result","path":["core","regexp","result"],"children":[]}]},{"name":"Promise","path":["core","promise"],"children":[]},{"name":"Ordering","path":["core","ordering"],"children":[]},{"name":"Object","path":["core","object"],"children":[]},{"name":"Nullable","path":["core","nullable"],"children":[]},{"name":"Null","path":["core","null"],"children":[]},{"name":"Math","path":["core","math"],"children":[{"name":"Int","path":["core","math","int"],"children":[]},{"name":"Constants","path":["core","math","constants"],"children":[]}]},{"name":"BigInt","path":["core","bigint"],"children":[]},{"name":"Int","path":["core","int"],"children":[{"name":"Constants","path":["core","int","constants"],"children":[]}]},{"name":"Float","path":["core","float"],"children":[{"name":"Constants","path":["core","float","constants"],"children":[]}]},{"name":"Error","path":["core","error"],"children":[{"name":"URIError","path":["core","error","urierror"],"children":[]},{"name":"TypeError","path":["core","error","typeerror"],"children":[]},{"name":"SyntaxError","path":["core","error","syntaxerror"],"children":[]},{"name":"ReferenceError","path":["core","error","referenceerror"],"children":[]},{"name":"RangeError","path":["core","error","rangeerror"],"children":[]},{"name":"EvalError","path":["core","error","evalerror"],"children":[]}]},{"name":"Dict","path":["core","dict"],"children":[]},{"name":"Date","path":["core","date"],"children":[{"name":"UTC","path":["core","date","utc"],"children":[]}]},{"name":"DataView","path":["core","dataview"],"children":[]},{"name":"Console","path":["core","console"],"children":[]},{"name":"Array","path":["core","array"],"children":[]}]}} \ No newline at end of file +{"belt":{"name":"Belt","path":["belt"],"children":[{"name":"Float","path":["belt","float"],"children":[]},{"name":"Int","path":["belt","int"],"children":[]},{"name":"Result","path":["belt","result"],"children":[]},{"name":"Option","path":["belt","option"],"children":[]},{"name":"HashMap","path":["belt","hashmap"],"children":[{"name":"String","path":["belt","hashmap","string"],"children":[]},{"name":"Int","path":["belt","hashmap","int"],"children":[]}]},{"name":"HashSet","path":["belt","hashset"],"children":[{"name":"String","path":["belt","hashset","string"],"children":[]},{"name":"Int","path":["belt","hashset","int"],"children":[]}]},{"name":"MutableMap","path":["belt","mutablemap"],"children":[{"name":"String","path":["belt","mutablemap","string"],"children":[]},{"name":"Int","path":["belt","mutablemap","int"],"children":[]}]},{"name":"MutableSet","path":["belt","mutableset"],"children":[{"name":"String","path":["belt","mutableset","string"],"children":[]},{"name":"Int","path":["belt","mutableset","int"],"children":[]}]},{"name":"Map","path":["belt","map"],"children":[{"name":"Dict","path":["belt","map","dict"],"children":[]},{"name":"String","path":["belt","map","string"],"children":[]},{"name":"Int","path":["belt","map","int"],"children":[]}]},{"name":"Set","path":["belt","set"],"children":[{"name":"Dict","path":["belt","set","dict"],"children":[]},{"name":"String","path":["belt","set","string"],"children":[]},{"name":"Int","path":["belt","set","int"],"children":[]}]},{"name":"Range","path":["belt","range"],"children":[]},{"name":"List","path":["belt","list"],"children":[]},{"name":"MutableStack","path":["belt","mutablestack"],"children":[]},{"name":"MutableQueue","path":["belt","mutablequeue"],"children":[]},{"name":"SortArray","path":["belt","sortarray"],"children":[{"name":"String","path":["belt","sortarray","string"],"children":[]},{"name":"Int","path":["belt","sortarray","int"],"children":[]}]},{"name":"Array","path":["belt","array"],"children":[]},{"name":"Id","path":["belt","id"],"children":[{"name":"MakeHashable","path":["belt","id","makehashable"],"children":[]},{"name":"MakeHashableU","path":["belt","id","makehashableu"],"children":[]},{"name":"MakeComparable","path":["belt","id","makecomparable"],"children":[]},{"name":"MakeComparableU","path":["belt","id","makecomparableu"],"children":[]}]}]},"dom":{"name":"Dom","path":["dom"],"children":[{"name":"Storage2","path":["dom","storage2"],"children":[]},{"name":"Storage","path":["dom","storage"],"children":[]}]},"core":{"name":"Core","path":["core"],"children":[{"name":"BigUint64Array","path":["core","biguint64array"],"children":[{"name":"Constants","path":["core","biguint64array","constants"],"children":[]}]},{"name":"BigInt64Array","path":["core","bigint64array"],"children":[{"name":"Constants","path":["core","bigint64array","constants"],"children":[]}]},{"name":"Uint8ClampedArray","path":["core","uint8clampedarray"],"children":[{"name":"Constants","path":["core","uint8clampedarray","constants"],"children":[]}]},{"name":"Uint32Array","path":["core","uint32array"],"children":[{"name":"Constants","path":["core","uint32array","constants"],"children":[]}]},{"name":"Uint16Array","path":["core","uint16array"],"children":[{"name":"Constants","path":["core","uint16array","constants"],"children":[]}]},{"name":"Uint8Array","path":["core","uint8array"],"children":[{"name":"Constants","path":["core","uint8array","constants"],"children":[]}]},{"name":"Int32Array","path":["core","int32array"],"children":[{"name":"Constants","path":["core","int32array","constants"],"children":[]}]},{"name":"Int16Array","path":["core","int16array"],"children":[{"name":"Constants","path":["core","int16array","constants"],"children":[]}]},{"name":"Int8Array","path":["core","int8array"],"children":[{"name":"Constants","path":["core","int8array","constants"],"children":[]}]},{"name":"Float64Array","path":["core","float64array"],"children":[{"name":"Constants","path":["core","float64array","constants"],"children":[]}]},{"name":"Float32Array","path":["core","float32array"],"children":[{"name":"Constants","path":["core","float32array","constants"],"children":[]}]},{"name":"TypedArray","path":["core","typedarray"],"children":[]},{"name":"ArrayBuffer","path":["core","arraybuffer"],"children":[]},{"name":"WeakSet","path":["core","weakset"],"children":[]},{"name":"Set","path":["core","set"],"children":[]},{"name":"WeakMap","path":["core","weakmap"],"children":[]},{"name":"Map","path":["core","map"],"children":[]},{"name":"AsyncIterator","path":["core","asynciterator"],"children":[]},{"name":"Iterator","path":["core","iterator"],"children":[]},{"name":"Type","path":["core","type"],"children":[{"name":"Classify","path":["core","type","classify"],"children":[]}]},{"name":"Symbol","path":["core","symbol"],"children":[]},{"name":"String","path":["core","string"],"children":[]},{"name":"Result","path":["core","result"],"children":[]},{"name":"RegExp","path":["core","regexp"],"children":[{"name":"Result","path":["core","regexp","result"],"children":[]}]},{"name":"Promise","path":["core","promise"],"children":[]},{"name":"Ordering","path":["core","ordering"],"children":[]},{"name":"Option","path":["core","option"],"children":[]},{"name":"Object","path":["core","object"],"children":[]},{"name":"Nullable","path":["core","nullable"],"children":[]},{"name":"Null","path":["core","null"],"children":[]},{"name":"Math","path":["core","math"],"children":[{"name":"Int","path":["core","math","int"],"children":[]},{"name":"Constants","path":["core","math","constants"],"children":[]}]},{"name":"List","path":["core","list"],"children":[]},{"name":"JSON","path":["core","json"],"children":[{"name":"Decode","path":["core","json","decode"],"children":[]},{"name":"Encode","path":["core","json","encode"],"children":[]},{"name":"Classify","path":["core","json","classify"],"children":[]}]},{"name":"Intl","path":["core","intl"],"children":[{"name":"Segments","path":["core","intl","segments"],"children":[]},{"name":"Segmenter","path":["core","intl","segmenter"],"children":[]},{"name":"RelativeTimeFormat","path":["core","intl","relativetimeformat"],"children":[]},{"name":"PluralRules","path":["core","intl","pluralrules"],"children":[]},{"name":"NumberFormat","path":["core","intl","numberformat"],"children":[{"name":"Grouping","path":["core","intl","numberformat","grouping"],"children":[]}]},{"name":"Locale","path":["core","intl","locale"],"children":[]},{"name":"ListFormat","path":["core","intl","listformat"],"children":[]},{"name":"DateTimeFormat","path":["core","intl","datetimeformat"],"children":[]},{"name":"Collator","path":["core","intl","collator"],"children":[]},{"name":"Common","path":["core","intl","common"],"children":[]}]},{"name":"Int","path":["core","int"],"children":[{"name":"Bitwise","path":["core","int","bitwise"],"children":[]},{"name":"Constants","path":["core","int","constants"],"children":[]}]},{"name":"Float","path":["core","float"],"children":[{"name":"Constants","path":["core","float","constants"],"children":[]}]},{"name":"Error","path":["core","error"],"children":[{"name":"URIError","path":["core","error","urierror"],"children":[]},{"name":"TypeError","path":["core","error","typeerror"],"children":[]},{"name":"SyntaxError","path":["core","error","syntaxerror"],"children":[]},{"name":"ReferenceError","path":["core","error","referenceerror"],"children":[]},{"name":"RangeError","path":["core","error","rangeerror"],"children":[]},{"name":"EvalError","path":["core","error","evalerror"],"children":[]}]},{"name":"Exn","path":["core","exn"],"children":[]},{"name":"Dict","path":["core","dict"],"children":[]},{"name":"Date","path":["core","date"],"children":[{"name":"UTC","path":["core","date","utc"],"children":[]}]},{"name":"DataView","path":["core","dataview"],"children":[]},{"name":"Console","path":["core","console"],"children":[]},{"name":"BigInt","path":["core","bigint"],"children":[]},{"name":"Array","path":["core","array"],"children":[]}]}} \ No newline at end of file diff --git a/scripts/gendocs.res b/scripts/gendocs.res index 23d5124fa..1fe4b484e 100644 --- a/scripts/gendocs.res +++ b/scripts/gendocs.res @@ -4,13 +4,13 @@ Generate docs from ReScript Compiler ## Run ```bash -node scripts/gendocs.mjs path/to/rescript-compiler path/to/rescript-core/src/RescriptCore.res version forceReWrite +node scripts/gendocs.mjs path/to/rescript-monorepo version forceReWrite ``` ## Examples ```bash -node scripts/gendocs.mjs path/to/rescript-compiler latest true +node scripts/gendocs.mjs path/to/rescript-monorepo latest true ``` */ @val @scope(("import", "meta")) external url: string = "url" @@ -25,21 +25,16 @@ let dirname = ->Path.dirname let compilerLibPath = switch args->Array.get(0) { -| Some(path) => Path.join([path, "jscomp", "others"]) +| Some(path) => Path.join([path, "runtime"]) | None => failwith("First argument should be path to rescript-compiler repo") } -let corePath = switch args->Array.get(1) { -| Some(path) => path -| _ => failwith("Second argument should be path to rescript-core/src/RescriptCore.res") -} - -let version = switch args->Array.get(2) { +let version = switch args->Array.get(1) { | Some(version) => version -| None => failwith("Third argument should be a version, `latest`, `v10`") +| None => failwith("Second argument should be a version, `latest`, `v10`") } -let forceReWrite = switch args->Array.get(3) { +let forceReWrite = switch args->Array.get(2) { | Some("true") => true | _ => false } @@ -55,7 +50,8 @@ if Fs.existsSync(dirVersion) { Fs.mkdirSync(dirVersion) } -let entryPointFiles = ["js.ml", "belt.res", "dom.res"] +// "Js.res" does not work for some reason +let entryPointFiles = ["Belt.res", "Dom.res", "Stdlib.res"] let hiddenModules = ["Js.Internal", "Js.MapperRt"] @@ -79,7 +75,7 @@ let env = Process.env let docsDecoded = entryPointFiles->Array.map(libFile => { let entryPointFile = Path.join2(compilerLibPath, libFile) - Dict.set(env, "FROM_COMPILER", "true") + Dict.set(env, "FROM_COMPILER", "false") let output = ChildProcess.execSync( @@ -91,18 +87,10 @@ let docsDecoded = entryPointFiles->Array.map(libFile => { ->Docgen.decodeFromJson }) -let coreDocs = { - Dict.set(env, "FROM_COMPILER", "false") +let isStdlib = (id: string) => String.startsWith(id, "Stdlib") +let replaceIdWithStdlib = (id: string) => isStdlib(id) ? String.replace(id, "Stdlib", "Core") : id - let output = - ChildProcess.execSync(`./node_modules/.bin/rescript-tools doc ${corePath}`)->Buffer.toString - - output - ->JSON.parseExn - ->Docgen.decodeFromJson -} - -let docsDecoded = Array.concat(docsDecoded, [coreDocs]) +let removeStdlibOrPrimitive = s => s->String.replaceAllRegExp(/Stdlib_|Primitive_js_extern\./g, "") let docs = docsDecoded->Array.map(doc => { let topLevelItems = doc.items->Array.filterMap(item => @@ -123,9 +111,7 @@ let docs = docsDecoded->Array.map(doc => { if Array.includes(hiddenModules, id) { getModules(rest, moduleNames) } else { - let id = String.startsWith(id, "RescriptCore") - ? String.replace(id, "RescriptCore", "Core") - : id + let id = replaceIdWithStdlib(id) getModules( list{...rest, ...List.fromArray(items)}, list{{id, items, name, docstrings}, ...moduleNames}, @@ -135,9 +121,7 @@ let docs = docsDecoded->Array.map(doc => { | list{} => moduleNames } - let id = String.startsWith(doc.name, "RescriptCore") - ? String.replace(doc.name, "RescriptCore", "Core") - : doc.name + let id = replaceIdWithStdlib(doc.name) let top = {id, name: id, docstrings: doc.docstrings, items: topLevelItems} let submodules = getModules(doc.items->List.fromArray, list{})->List.toArray @@ -151,9 +135,7 @@ let allModules = { let encodeItem = (docItem: Docgen.item) => { switch docItem { | Value({id, name, docstrings, signature, ?deprecated}) => { - let id = String.startsWith(id, "RescriptCore") - ? String.replace(id, "RescriptCore", "Core") - : id + let id = replaceIdWithStdlib(id) let dict = Dict.fromArray( [ ("id", id->String), @@ -162,10 +144,15 @@ let allModules = { ( "docstrings", docstrings - ->Array.map(s => s->String) + ->Array.map(s => s->removeStdlibOrPrimitive->String) ->Array, ), - ("signature", signature->String), + ( + "signature", + signature + ->removeStdlibOrPrimitive + ->String, + ), ]->Array.concat( switch deprecated { | Some(v) => [("deprecated", v->String)] @@ -177,16 +164,14 @@ let allModules = { } | Type({id, name, docstrings, signature, ?deprecated}) => - let id = String.startsWith(id, "RescriptCore") - ? String.replace(id, "RescriptCore", "Core") - : id + let id = replaceIdWithStdlib(id) let dict = Dict.fromArray( [ ("id", id->String), ("kind", "type"->String), ("name", name->String), - ("docstrings", docstrings->Array.map(s => s->String)->Array), - ("signature", signature->String), + ("docstrings", docstrings->Array.map(s => s->removeStdlibOrPrimitive->String)->Array), + ("signature", signature->removeStdlibOrPrimitive->String), ]->Array.concat( switch deprecated { | Some(v) => [("deprecated", v->String)] @@ -209,7 +194,7 @@ let allModules = { ->Array.filterMap(item => encodeItem(item)) ->Array - let id = String.startsWith(mod.id, "RescriptCore") ? "Core" : mod.id + let id = replaceIdWithStdlib(mod.id) let rest = Dict.fromArray([ ("id", id->String), @@ -235,7 +220,7 @@ let () = { allModules->Array.forEach(((topLevelName, mod)) => { let json = JSON.Object(mod) - let topLevelName = String.startsWith(topLevelName, "RescriptCore") ? "Core" : topLevelName + let topLevelName = replaceIdWithStdlib(topLevelName) Fs.writeFileSync( Path.join([dirVersion, `${topLevelName->String.toLowerCase}.json`]), @@ -279,7 +264,7 @@ let () = { } let tocTree = docsDecoded->Array.map(({name, items}) => { - let name = String.startsWith(name, "RescriptCore") ? "Core" : name + let name = replaceIdWithStdlib(name) let path = name->String.toLowerCase ( path,