From 45ff71799258c8c21a11684729b22202f61dbd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Tsnobiladz=C3=A9?= Date: Mon, 17 Mar 2025 09:31:55 +0100 Subject: [PATCH 01/10] WIP sync stdlib docs (Js does not work for now) --- data/api/v12.0.0/belt.json | 793 +-- data/api/v12.0.0/core.json | 8618 +++++++++++++++++--------------- data/api/v12.0.0/toc_tree.json | 2 +- scripts/gendocs.res | 71 +- 4 files changed, 5120 insertions(+), 4364 deletions(-) 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, From bcb7c2d312150bcbafb3f211f3525e759a7dde48 Mon Sep 17 00:00:00 2001 From: tsnobip Date: Sun, 15 Jun 2025 19:59:49 +0200 Subject: [PATCH 02/10] rename core to stdlib for >= v12 --- data/api/v12.0.0/stdlib.json | 9894 +++++++++++++++++++++++++++++ pages/docs/manual/v12.0.0/api.mdx | 16 +- src/ApiDocs.res | 2 +- src/layouts/ApiOverviewLayout.res | 6 +- 4 files changed, 9911 insertions(+), 7 deletions(-) create mode 100644 data/api/v12.0.0/stdlib.json diff --git a/data/api/v12.0.0/stdlib.json b/data/api/v12.0.0/stdlib.json new file mode 100644 index 000000000..ff93bb6cc --- /dev/null +++ b/data/api/v12.0.0/stdlib.json @@ -0,0 +1,9894 @@ +{ + "stdlib": { + "id": "Stdlib", + "name": "Stdlib", + "docstrings": [], + "items": [ + { + "id": "Stdlib.timeoutId", + "kind": "type", + "name": "timeoutId", + "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" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let setTimeout: (unit => unit, int) => timeoutId" + }, + { + "id": "Stdlib.setTimeoutFloat", + "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```" + ], + "signature": "let setTimeoutFloat: (unit => unit, float) => timeoutId" + }, + { + "id": "Stdlib.clearTimeout", + "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```" + ], + "signature": "let clearTimeout: timeoutId => unit" + }, + { + "id": "Stdlib.intervalId", + "kind": "type", + "name": "intervalId", + "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" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let setInterval: (unit => unit, int) => intervalId" + }, + { + "id": "Stdlib.setIntervalFloat", + "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```" + ], + "signature": "let setIntervalFloat: (unit => unit, float) => intervalId" + }, + { + "id": "Stdlib.clearInterval", + "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```" + ], + "signature": "let clearInterval: intervalId => unit" + }, + { + "id": "Stdlib.encodeURI", + "kind": "value", + "name": "encodeURI", + "docstrings": [ + "Encodes a URI by replacing characters in the provided string that aren't valid in a URL.\n\nThis is intended to operate on full URIs, so it encodes fewer characters than what `encodeURIComponent` does.\nIf you're looking to encode just parts of a URI, like a query parameter, prefer `encodeURIComponent`.\n\nSee [`encodeURI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI) on MDN.\n\n## Examples\n```rescript\nConsole.log(encodeURI(\"https://rescript-lang.org?array=[someValue]\"))\n// Logs \"https://rescript-lang.org?array=%5BsomeValue%5D\" to the console.\n```" + ], + "signature": "let encodeURI: string => string" + }, + { + "id": "Stdlib.decodeURI", + "kind": "value", + "name": "decodeURI", + "docstrings": [ + "Decodes a previously encoded URI back to a regular string.\n\nThis is intended to operate on full URIs, so it decodes fewer characters than what `decodeURIComponent` does.\nIf you're looking to decode just parts of a URI, like a query parameter, prefer `decodeURIComponent`.\n\nSee [`decodeURI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI) on MDN.\n\n## Examples\n```rescript\nConsole.log(decodeURI(\"https://rescript-lang.org?array=%5BsomeValue%5D\"))\n// Logs \"https://rescript-lang.org?array=[someValue]\" to the console.\n```" + ], + "signature": "let decodeURI: string => string" + }, + { + "id": "Stdlib.encodeURIComponent", + "kind": "value", + "name": "encodeURIComponent", + "docstrings": [ + "Encodes a string so it can be used as part of a URI.\n\nSee [`encodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) on MDN.\n\n## Examples\n```rescript\nConsole.log(encodeURIComponent(\"array=[someValue]\"))\n// Logs \"array%3D%5BsomeValue%5D\" to the console.\n```" + ], + "signature": "let encodeURIComponent: string => string" + }, + { + "id": "Stdlib.decodeURIComponent", + "kind": "value", + "name": "decodeURIComponent", + "docstrings": [ + "Decodes a previously URI encoded string back to its original form.\n\nSee [`decodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) on MDN.\n\n## Examples\n```rescript\nConsole.log(decodeURIComponent(\"array%3D%5BsomeValue%5D\"))\n// Logs \"array=[someValue]\" to the console.\n```" + ], + "signature": "let decodeURIComponent: string => string" + }, + { + "id": "Stdlib.window", + "kind": "value", + "name": "window", + "docstrings": [], + "signature": "let window: Dom.window" + }, + { + "id": "Stdlib.document", + "kind": "value", + "name": "document", + "docstrings": [], + "signature": "let document: Dom.document" + }, + { + "id": "Stdlib.globalThis", + "kind": "value", + "name": "globalThis", + "docstrings": [], + "signature": "let globalThis: {..}" + }, + { + "id": "Stdlib.null", + "kind": "value", + "name": "null", + "docstrings": [], + "signature": "let null: Stdlib__Nullable.t<'a>" + }, + { + "id": "Stdlib.undefined", + "kind": "value", + "name": "undefined", + "docstrings": [], + "signature": "let undefined: Stdlib__Nullable.t<'a>" + }, + { + "id": "Stdlib.typeof", + "kind": "value", + "name": "typeof", + "docstrings": [], + "signature": "let typeof: 'a => Stdlib__Type.t" + }, + { + "id": "Stdlib.import", + "kind": "value", + "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`Stdlib__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 `Stdlib__Array.res`\n\n```rescript\nlet main = async () => {\n let indexOfOpt = await import(Stdlib__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(\"./Stdlib__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": "Stdlib.null", + "kind": "type", + "name": "null", + "docstrings": [], + "signature": "type null<'a> = Js.null<'a>" + }, + { + "id": "Stdlib.undefined", + "kind": "type", + "name": "undefined", + "docstrings": [], + "signature": "type undefined<'a> = Js.undefined<'a>" + }, + { + "id": "Stdlib.nullable", + "kind": "type", + "name": "nullable", + "docstrings": [], + "signature": "type nullable<'a> = Js.nullable<'a>" + }, + { + "id": "Stdlib.panic", + "kind": "value", + "name": "panic", + "docstrings": [], + "signature": "let panic: string => 'a" + } + ] + }, + "stdlib/intl/numberformat/grouping": { + "id": "Stdlib.Intl.NumberFormat.Grouping", + "name": "Grouping", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.NumberFormat.Grouping.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.NumberFormat.Grouping.parsed", + "kind": "type", + "name": "parsed", + "docstrings": [], + "signature": "type parsed = [#always | #auto | #bool(bool) | #min2]" + }, + { + "id": "Stdlib.Intl.NumberFormat.Grouping.fromBool", + "kind": "value", + "name": "fromBool", + "docstrings": [], + "signature": "let fromBool: bool => t" + }, + { + "id": "Stdlib.Intl.NumberFormat.Grouping.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [], + "signature": "let fromString: [#always | #auto | #min2] => t" + }, + { + "id": "Stdlib.Intl.NumberFormat.Grouping.parseJsValue", + "kind": "value", + "name": "parseJsValue", + "docstrings": [], + "signature": "let parseJsValue: 'a => option<[> #always | #auto | #bool(bool) | #min2]>" + } + ] + }, + "stdlib/intl/segments": { + "id": "Stdlib.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": "Stdlib.Intl.Segments.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.Segments.containing", + "kind": "value", + "name": "containing", + "docstrings": [], + "signature": "let containing: t => segmentData" + }, + { + "id": "Stdlib.Intl.Segments.containingWithIndex", + "kind": "value", + "name": "containingWithIndex", + "docstrings": [], + "signature": "let containingWithIndex: (t, int) => segmentData" + } + ] + }, + "stdlib/intl/segmenter": { + "id": "Stdlib.Intl.Segmenter", + "name": "Segmenter", + "docstrings": ["Not supported in Firefox"], + "items": [ + { + "id": "Stdlib.Intl.Segmenter.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.Segmenter.granularity", + "kind": "type", + "name": "granularity", + "docstrings": [], + "signature": "type granularity = [#grapheme | #sentence | #word]" + }, + { + "id": "Stdlib.Intl.Segmenter.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n granularity?: granularity,\n}" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.Segmenter.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n granularity: granularity,\n}" + }, + { + "id": "Stdlib.Intl.Segmenter.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.Segmenter.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.Segmenter.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.Segmenter.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.Segmenter.segment", + "kind": "value", + "name": "segment", + "docstrings": [], + "signature": "let segment: (t, string) => Stdlib__Intl__Segments.t" + } + ] + }, + "stdlib/intl/relativetimeformat": { + "id": "Stdlib.Intl.RelativeTimeFormat", + "name": "RelativeTimeFormat", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.RelativeTimeFormat.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.numeric", + "kind": "type", + "name": "numeric", + "docstrings": [], + "signature": "type numeric = [#always | #auto]" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.style", + "kind": "type", + "name": "style", + "docstrings": [], + "signature": "type style = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.RelativeTimeFormat.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n numeric: numeric,\n style: style,\n numberingSystem: string,\n}" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.relativeTimePartComponent", + "kind": "type", + "name": "relativeTimePartComponent", + "docstrings": [], + "signature": "type relativeTimePartComponent = [#integer | #literal]" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.relativeTimePart", + "kind": "type", + "name": "relativeTimePart", + "docstrings": [], + "signature": "type relativeTimePart = {\n \\\"type\": relativeTimePartComponent,\n value: string,\n unit?: timeUnit,\n}" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.format", + "kind": "value", + "name": "format", + "docstrings": [], + "signature": "let format: (t, int, timeUnit) => string" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.formatToParts", + "kind": "value", + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, int, timeUnit) => array" + } + ] + }, + "stdlib/intl/pluralrules": { + "id": "Stdlib.Intl.PluralRules", + "name": "PluralRules", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.PluralRules.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.PluralRules.localeType", + "kind": "type", + "name": "localeType", + "docstrings": [], + "signature": "type localeType = [#cardinal | #ordinal]" + }, + { + "id": "Stdlib.Intl.PluralRules.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n \\\"type\"?: localeType,\n minimumIntegerDigits?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n}" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.PluralRules.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n pluralCategories: array,\n \\\"type\": localeType,\n minimumIntegerDigits?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n}" + }, + { + "id": "Stdlib.Intl.PluralRules.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.PluralRules.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.PluralRules.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.PluralRules.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.PluralRules.rule", + "kind": "type", + "name": "rule", + "docstrings": [], + "signature": "type rule = [#few | #many | #one | #other | #two | #zero]" + }, + { + "id": "Stdlib.Intl.PluralRules.select", + "kind": "value", + "name": "select", + "docstrings": [], + "signature": "let select: (t, float) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.selectInt", + "kind": "value", + "name": "selectInt", + "docstrings": [], + "signature": "let selectInt: (t, int) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.selectBigInt", + "kind": "value", + "name": "selectBigInt", + "docstrings": [], + "signature": "let selectBigInt: (t, bigint) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.selectRange", + "kind": "value", + "name": "selectRange", + "docstrings": [], + "signature": "let selectRange: (t, ~start: float, ~end: float) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.selectRangeInt", + "kind": "value", + "name": "selectRangeInt", + "docstrings": [], + "signature": "let selectRangeInt: (t, ~start: int, ~end: int) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.selectRangeBigInt", + "kind": "value", + "name": "selectRangeBigInt", + "docstrings": [], + "signature": "let selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule" + } + ] + }, + "stdlib/intl/numberformat": { + "id": "Stdlib.Intl.NumberFormat", + "name": "NumberFormat", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.NumberFormat.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.NumberFormat.currency", + "kind": "type", + "name": "currency", + "docstrings": ["An ISO 4217 currency code. e.g. USD, EUR, CNY"], + "signature": "type currency = string" + }, + { + "id": "Stdlib.Intl.NumberFormat.currencyDisplay", + "kind": "type", + "name": "currencyDisplay", + "docstrings": [], + "signature": "type currencyDisplay = [\n | #code\n | #name\n | #narrowSymbol\n | #symbol\n]" + }, + { + "id": "Stdlib.Intl.NumberFormat.currencySign", + "kind": "type", + "name": "currencySign", + "docstrings": [], + "signature": "type currencySign = [#accounting | #standard]" + }, + { + "id": "Stdlib.Intl.NumberFormat.notation", + "kind": "type", + "name": "notation", + "docstrings": [], + "signature": "type notation = [\n | #compact\n | #engineering\n | #scientific\n | #standard\n]" + }, + { + "id": "Stdlib.Intl.NumberFormat.compactDisplay", + "kind": "type", + "name": "compactDisplay", + "docstrings": ["Used only when notation is #compact"], + "signature": "type compactDisplay = [#long | #short]" + }, + { + "id": "Stdlib.Intl.NumberFormat.signDisplay", + "kind": "type", + "name": "signDisplay", + "docstrings": [], + "signature": "type signDisplay = [\n | #always\n | #auto\n | #exceptZero\n | #negative\n | #never\n]" + }, + { + "id": "Stdlib.Intl.NumberFormat.style", + "kind": "type", + "name": "style", + "docstrings": [], + "signature": "type style = [#currency | #decimal | #percent | #unit]" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.NumberFormat.unitDisplay", + "kind": "type", + "name": "unitDisplay", + "docstrings": ["Only used when style is #unit"], + "signature": "type unitDisplay = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.NumberFormat.roundingPriority", + "kind": "type", + "name": "roundingPriority", + "docstrings": [], + "signature": "type roundingPriority = [\n | #auto\n | #lessPrecision\n | #morePrecision\n]" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.NumberFormat.trailingZeroDisplay", + "kind": "type", + "name": "trailingZeroDisplay", + "docstrings": [], + "signature": "type trailingZeroDisplay = [\n | #auto\n | #lessPrecision\n | #stripIfInteger\n]" + }, + { + "id": "Stdlib.Intl.NumberFormat.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n compactDisplay?: compactDisplay,\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n localeMatcher?: Stdlib__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?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n}" + }, + { + "id": "Stdlib.Intl.NumberFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "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?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n locale: string,\n notation: notation,\n numberingSystem: Stdlib__Intl__Common.numberingSystem,\n signDisplay: signDisplay,\n style: style,\n useGrouping: Grouping.t,\n}" + }, + { + "id": "Stdlib.Intl.NumberFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.NumberFormat.numberFormatPartType", + "kind": "type", + "name": "numberFormatPartType", + "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]" + }, + { + "id": "Stdlib.Intl.NumberFormat.numberFormatPart", + "kind": "type", + "name": "numberFormatPart", + "docstrings": [], + "signature": "type numberFormatPart = {\n \\\"type\": numberFormatPartType,\n value: string,\n}" + }, + { + "id": "Stdlib.Intl.NumberFormat.rangeSource", + "kind": "type", + "name": "rangeSource", + "docstrings": [], + "signature": "type rangeSource = [#endRange | #shared | #startRange]" + }, + { + "id": "Stdlib.Intl.NumberFormat.numberFormatRangePart", + "kind": "type", + "name": "numberFormatRangePart", + "docstrings": [], + "signature": "type numberFormatRangePart = {\n \\\"type\": numberFormatPartType,\n value: string,\n source: rangeSource,\n}" + }, + { + "id": "Stdlib.Intl.NumberFormat.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.NumberFormat.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.NumberFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.NumberFormat.format", + "kind": "value", + "name": "format", + "docstrings": [], + "signature": "let format: (t, float) => string" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatRange", + "kind": "value", + "name": "formatRange", + "docstrings": [], + "signature": "let formatRange: (t, ~start: float, ~end: float) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatToParts", + "kind": "value", + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, float) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatRangeToParts", + "kind": "value", + "name": "formatRangeToParts", + "docstrings": [], + "signature": "let formatRangeToParts: (\n t,\n ~start: float,\n ~end: float,\n) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatInt", + "kind": "value", + "name": "formatInt", + "docstrings": [], + "signature": "let formatInt: (t, int) => string" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatIntRange", + "kind": "value", + "name": "formatIntRange", + "docstrings": [], + "signature": "let formatIntRange: (t, ~start: int, ~end: int) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatIntToParts", + "kind": "value", + "name": "formatIntToParts", + "docstrings": [], + "signature": "let formatIntToParts: (t, int) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatIntRangeToParts", + "kind": "value", + "name": "formatIntRangeToParts", + "docstrings": [], + "signature": "let formatIntRangeToParts: (t, ~start: int, ~end: int) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatBigInt", + "kind": "value", + "name": "formatBigInt", + "docstrings": [], + "signature": "let formatBigInt: (t, bigint) => string" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatBigIntRange", + "kind": "value", + "name": "formatBigIntRange", + "docstrings": [], + "signature": "let formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatBigIntToParts", + "kind": "value", + "name": "formatBigIntToParts", + "docstrings": [], + "signature": "let formatBigIntToParts: (t, bigint) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatBigIntRangeToParts", + "kind": "value", + "name": "formatBigIntRangeToParts", + "docstrings": [], + "signature": "let formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatString", + "kind": "value", + "name": "formatString", + "docstrings": [], + "signature": "let formatString: (t, string) => string" + }, + { + "id": "Stdlib.Intl.NumberFormat.formatStringToParts", + "kind": "value", + "name": "formatStringToParts", + "docstrings": [], + "signature": "let formatStringToParts: (t, string) => array" + } + ] + }, + "stdlib/intl/locale": { + "id": "Stdlib.Intl.Locale", + "name": "Locale", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.Locale.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.Locale.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n baseName?: string,\n calendar?: Stdlib__Intl__Common.calendar,\n collation?: Stdlib__Intl__Common.collation,\n hourCycle?: [#h11 | #h12 | #h23 | #h24],\n caseFirst?: [#\"false\" | #lower | #upper],\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n numeric?: bool,\n language?: string,\n script?: string,\n region?: string,\n}" + }, + { + "id": "Stdlib.Intl.Locale.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (string, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.Locale.baseName", + "kind": "value", + "name": "baseName", + "docstrings": [], + "signature": "let baseName: t => string" + }, + { + "id": "Stdlib.Intl.Locale.calendar", + "kind": "value", + "name": "calendar", + "docstrings": [], + "signature": "let calendar: t => option" + }, + { + "id": "Stdlib.Intl.Locale.caseFirst", + "kind": "value", + "name": "caseFirst", + "docstrings": [], + "signature": "let caseFirst: t => option" + }, + { + "id": "Stdlib.Intl.Locale.collation", + "kind": "value", + "name": "collation", + "docstrings": [], + "signature": "let collation: t => option" + }, + { + "id": "Stdlib.Intl.Locale.hourCycle", + "kind": "value", + "name": "hourCycle", + "docstrings": [], + "signature": "let hourCycle: t => option" + }, + { + "id": "Stdlib.Intl.Locale.language", + "kind": "value", + "name": "language", + "docstrings": [], + "signature": "let language: t => string" + }, + { + "id": "Stdlib.Intl.Locale.numberingSystem", + "kind": "value", + "name": "numberingSystem", + "docstrings": [], + "signature": "let numberingSystem: t => option" + }, + { + "id": "Stdlib.Intl.Locale.numeric", + "kind": "value", + "name": "numeric", + "docstrings": [], + "signature": "let numeric: t => bool" + }, + { + "id": "Stdlib.Intl.Locale.region", + "kind": "value", + "name": "region", + "docstrings": [], + "signature": "let region: t => option" + }, + { + "id": "Stdlib.Intl.Locale.script", + "kind": "value", + "name": "script", + "docstrings": [], + "signature": "let script: t => option" + }, + { + "id": "Stdlib.Intl.Locale.maximize", + "kind": "value", + "name": "maximize", + "docstrings": [], + "signature": "let maximize: t => t" + }, + { + "id": "Stdlib.Intl.Locale.minimize", + "kind": "value", + "name": "minimize", + "docstrings": [], + "signature": "let minimize: t => t" + } + ] + }, + "stdlib/intl/listformat": { + "id": "Stdlib.Intl.ListFormat", + "name": "ListFormat", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.ListFormat.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.ListFormat.listType", + "kind": "type", + "name": "listType", + "docstrings": [], + "signature": "type listType = [#conjunction | #disjunction | #unit]" + }, + { + "id": "Stdlib.Intl.ListFormat.style", + "kind": "type", + "name": "style", + "docstrings": [], + "signature": "type style = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.Intl.ListFormat.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" + }, + { + "id": "Stdlib.Intl.ListFormat.listPartComponentType", + "kind": "type", + "name": "listPartComponentType", + "docstrings": [], + "signature": "type listPartComponentType = [#element | #literal]" + }, + { + "id": "Stdlib.Intl.ListFormat.listPart", + "kind": "type", + "name": "listPart", + "docstrings": [], + "signature": "type listPart = {\n \\\"type\": listPartComponentType,\n value: string,\n}" + }, + { + "id": "Stdlib.Intl.ListFormat.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n style: style,\n \\\"type\": listType,\n}" + }, + { + "id": "Stdlib.Intl.ListFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.ListFormat.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.ListFormat.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.ListFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.ListFormat.format", + "kind": "value", + "name": "format", + "docstrings": [], + "signature": "let format: (t, array) => string" + }, + { + "id": "Stdlib.Intl.ListFormat.formatToParts", + "kind": "value", + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, array) => array" + } + ] + }, + "stdlib/intl/datetimeformat": { + "id": "Stdlib.Intl.DateTimeFormat", + "name": "DateTimeFormat", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.DateTimeFormat.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.dateStyle", + "kind": "type", + "name": "dateStyle", + "docstrings": [], + "signature": "type dateStyle = [#full | #long | #medium | #short]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.timeStyle", + "kind": "type", + "name": "timeStyle", + "docstrings": [], + "signature": "type timeStyle = [#full | #long | #medium | #short]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.dayPeriod", + "kind": "type", + "name": "dayPeriod", + "docstrings": [], + "signature": "type dayPeriod = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.weekday", + "kind": "type", + "name": "weekday", + "docstrings": [], + "signature": "type weekday = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.era", + "kind": "type", + "name": "era", + "docstrings": [], + "signature": "type era = [#long | #narrow | #short]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.year", + "kind": "type", + "name": "year", + "docstrings": [], + "signature": "type year = [#\"2-digit\" | #numeric]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.month", + "kind": "type", + "name": "month", + "docstrings": [], + "signature": "type month = [\n | #\"2-digit\"\n | #long\n | #narrow\n | #numeric\n | #short\n]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.day", + "kind": "type", + "name": "day", + "docstrings": [], + "signature": "type day = [#\"2-digit\" | #numeric]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.hour", + "kind": "type", + "name": "hour", + "docstrings": [], + "signature": "type hour = [#\"2-digit\" | #numeric]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.minute", + "kind": "type", + "name": "minute", + "docstrings": [], + "signature": "type minute = [#\"2-digit\" | #numeric]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.second", + "kind": "type", + "name": "second", + "docstrings": [], + "signature": "type second = [#\"2-digit\" | #numeric]" + }, + { + "id": "Stdlib.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]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.hourCycle", + "kind": "type", + "name": "hourCycle", + "docstrings": [], + "signature": "type hourCycle = [#h11 | #h12 | #h23 | #h24]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.formatMatcher", + "kind": "type", + "name": "formatMatcher", + "docstrings": [], + "signature": "type formatMatcher = [#basic | #\"best fit\"]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.fractionalSecondDigits", + "kind": "type", + "name": "fractionalSecondDigits", + "docstrings": [], + "signature": "type fractionalSecondDigits = [#0 | #1 | #2 | #3]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n calendar?: Stdlib__Intl__Common.calendar,\n dayPeriod?: dayPeriod,\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n localeMatcher?: Stdlib__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": "Stdlib.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: Stdlib__Intl__Common.calendar,\n hour12: bool,\n hourCycle: hourCycle,\n locale: string,\n numberingSystem: Stdlib__Intl__Common.numberingSystem,\n timeZone: string,\n}" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.DateTimeFormat.dateTimePart", + "kind": "type", + "name": "dateTimePart", + "docstrings": [], + "signature": "type dateTimePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n}" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.dateTimeRangeSource", + "kind": "type", + "name": "dateTimeRangeSource", + "docstrings": [], + "signature": "type dateTimeRangeSource = [\n | #endRange\n | #shared\n | #startRange\n]" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.dateTimeRangePart", + "kind": "type", + "name": "dateTimeRangePart", + "docstrings": [], + "signature": "type dateTimeRangePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n source: dateTimeRangeSource,\n}" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.format", + "kind": "value", + "name": "format", + "docstrings": [], + "signature": "let format: (t, Stdlib__Date.t) => string" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.formatToParts", + "kind": "value", + "name": "formatToParts", + "docstrings": [], + "signature": "let formatToParts: (t, Stdlib__Date.t) => array" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.formatRange", + "kind": "value", + "name": "formatRange", + "docstrings": [], + "signature": "let formatRange: (\n t,\n ~startDate: Stdlib__Date.t,\n ~endDate: Stdlib__Date.t,\n) => string" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.formatRangeToParts", + "kind": "value", + "name": "formatRangeToParts", + "docstrings": [], + "signature": "let formatRangeToParts: (\n t,\n ~startDate: Stdlib__Date.t,\n ~endDate: Stdlib__Date.t,\n) => array" + } + ] + }, + "stdlib/intl/collator": { + "id": "Stdlib.Intl.Collator", + "name": "Collator", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.Collator.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.Collator.usage", + "kind": "type", + "name": "usage", + "docstrings": [], + "signature": "type usage = [#search | #sort]" + }, + { + "id": "Stdlib.Intl.Collator.sensitivity", + "kind": "type", + "name": "sensitivity", + "docstrings": [], + "signature": "type sensitivity = [#accent | #base | #case | #variant]" + }, + { + "id": "Stdlib.Intl.Collator.caseFirst", + "kind": "type", + "name": "caseFirst", + "docstrings": [], + "signature": "type caseFirst = [#\"false\" | #lower | #upper]" + }, + { + "id": "Stdlib.Intl.Collator.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n usage?: usage,\n sensitivity?: sensitivity,\n ignorePunctuation?: bool,\n numeric?: bool,\n caseFirst?: caseFirst,\n}" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.Collator.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.Collator.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.Collator.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.Collator.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.Collator.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (t, string, string) => int" + } + ] + }, + "stdlib/intl/common": { + "id": "Stdlib.Intl.Common", + "name": "Common", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.Common.localeMatcher", + "kind": "type", + "name": "localeMatcher", + "docstrings": [], + "signature": "type localeMatcher = [#\"best fit\" | #lookup]" + }, + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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]" + } + ] + }, + "stdlib/biguint64array/constants": { + "id": "Stdlib.BigUint64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/bigint64array/constants": { + "id": "Stdlib.BigInt64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/uint8clampedarray/constants": { + "id": "Stdlib.Uint8ClampedArray.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/uint32array/constants": { + "id": "Stdlib.Uint32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Uint32Array.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" + } + ] + }, + "stdlib/uint16array/constants": { + "id": "Stdlib.Uint16Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Uint16Array.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" + } + ] + }, + "stdlib/uint8array/constants": { + "id": "Stdlib.Uint8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Uint8Array.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" + } + ] + }, + "stdlib/int32array/constants": { + "id": "Stdlib.Int32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/int16array/constants": { + "id": "Stdlib.Int16Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/int8array/constants": { + "id": "Stdlib.Int8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/float64array/constants": { + "id": "Stdlib.Float64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/float32array/constants": { + "id": "Stdlib.Float32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/json/decode": { + "id": "Stdlib.JSON.Decode", + "name": "Decode", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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>" + } + ] + }, + "stdlib/json/encode": { + "id": "Stdlib.JSON.Encode", + "name": "Encode", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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: Stdlib__Dict.t => t" + }, + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/json/classify": { + "id": "Stdlib.JSON.Classify", + "name": "Classify", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JSON.Classify.t", + "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(Stdlib__Dict.t)\n | Array(array)" + }, + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/type/classify": { + "id": "Stdlib.Type.Classify", + "name": "Classify", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Type.Classify.function", + "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" + }, + { + "id": "Stdlib.Type.Classify.object", + "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" + }, + { + "id": "Stdlib.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(Stdlib__Symbol.t)\n | BigInt(bigint)" + }, + { + "id": "Stdlib.Type.Classify.classify", + "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" + } + ] + }, + "stdlib/regexp/result": { + "id": "Stdlib.RegExp.Result", + "name": "Result", + "docstrings": [], + "items": [ + { + "id": "Stdlib.RegExp.Result.t", + "kind": "type", + "name": "t", + "docstrings": ["Type representing the result of a `RegExp` execution."], + "signature": "type t = array>" + }, + { + "id": "Stdlib.RegExp.Result.fullMatch", + "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" + }, + { + "id": "Stdlib.RegExp.Result.matches", + "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" + }, + { + "id": "Stdlib.RegExp.Result.index", + "kind": "value", + "name": "index", + "docstrings": [], + "signature": "let index: t => int" + }, + { + "id": "Stdlib.RegExp.Result.input", + "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" + } + ] + }, + "stdlib/math/int": { + "id": "Stdlib.Math.Int", + "name": "Int", + "docstrings": ["Provide Math utilities for `int`"], + "items": [ + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.Math.Int.pow", + "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" + }, + { + "id": "Stdlib.Math.Int.sign", + "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" + }, + { + "id": "Stdlib.Math.Int.floor", + "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" + }, + { + "id": "Stdlib.Math.Int.ceil", + "kind": "value", + "name": "ceil", + "docstrings": [ + "ceil(v) returns the smallest `int` greater than or equal to the argument;\n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.ceil(3.7) == 4\n Math.Int.ceil(3.0) == 3\n Math.Int.ceil(-3.1) == -3\n ```" + ], + "signature": "let ceil: float => int" + }, + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/math/constants": { + "id": "Stdlib.Math.Constants", + "name": "Constants", + "docstrings": ["Mathematical Constants"], + "items": [ + { + "id": "Stdlib.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": "Stdlib.Math.Constants.ln2", + "kind": "value", + "name": "ln2", + "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 ```" + ], + "signature": "let ln2: float" + }, + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.Math.Constants.pi", + "kind": "value", + "name": "pi", + "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 ```" + ], + "signature": "let pi: float" + }, + { + "id": "Stdlib.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": "Stdlib.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" + } + ] + }, + "stdlib/int/constants": { + "id": "Stdlib.Int.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int.Constants.minValue", + "kind": "value", + "name": "minValue", + "docstrings": [ + "The smallest positive number represented in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.minValue)\n ```" + ], + "signature": "let minValue: int" + }, + { + "id": "Stdlib.Int.Constants.maxValue", + "kind": "value", + "name": "maxValue", + "docstrings": [ + "The largest positive number represented in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.maxValue)\n ```" + ], + "signature": "let maxValue: int" + } + ] + }, + "stdlib/float/constants": { + "id": "Stdlib.Float.Constants", + "name": "Constants", + "docstrings": ["Float constants."], + "items": [ + { + "id": "Stdlib.Float.Constants.nan", + "kind": "value", + "name": "nan", + "docstrings": [ + "The special value \"Not a Number\"\n See [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.nan\n ```" + ], + "signature": "let nan: float" + }, + { + "id": "Stdlib.Float.Constants.epsilon", + "kind": "value", + "name": "epsilon", + "docstrings": [ + "Represents the difference between 1 and the smallest floating point number greater than 1.\n See [`Number.EPSILON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.epsilon\n ```" + ], + "signature": "let epsilon: float" + }, + { + "id": "Stdlib.Float.Constants.positiveInfinity", + "kind": "value", + "name": "positiveInfinity", + "docstrings": [ + "The positive Infinity value\n See [`Number.POSITIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.positiveInfinity\n ```" + ], + "signature": "let positiveInfinity: float" + }, + { + "id": "Stdlib.Float.Constants.negativeInfinity", + "kind": "value", + "name": "negativeInfinity", + "docstrings": [ + "The negative Infinity value\n See [`Number.NEGATIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.negativeInfinity\n ```" + ], + "signature": "let negativeInfinity: float" + }, + { + "id": "Stdlib.Float.Constants.minValue", + "kind": "value", + "name": "minValue", + "docstrings": [ + "The smallest positive numeric value representable in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" + ], + "signature": "let minValue: float" + }, + { + "id": "Stdlib.Float.Constants.maxValue", + "kind": "value", + "name": "maxValue", + "docstrings": [ + "The maximum positive numeric value representable in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" + ], + "signature": "let maxValue: float" + } + ] + }, + "stdlib/error/urierror": { + "id": "Stdlib.Error.URIError", + "name": "URIError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.URIError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `URIError` with the provided `message`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/error/typeerror": { + "id": "Stdlib.Error.TypeError", + "name": "TypeError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.TypeError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `TypeError` with the provided `message`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/error/syntaxerror": { + "id": "Stdlib.Error.SyntaxError", + "name": "SyntaxError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.SyntaxError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `SyntaxError` with the provided `message`.\n\n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/error/referenceerror": { + "id": "Stdlib.Error.ReferenceError", + "name": "ReferenceError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.ReferenceError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `ReferenceError` with the provided `message`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/error/rangeerror": { + "id": "Stdlib.Error.RangeError", + "name": "RangeError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.RangeError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `RangeError` with the provided `message`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/error/evalerror": { + "id": "Stdlib.Error.EvalError", + "name": "EvalError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Error.EvalError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `EvalError` with the provided `message`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." + ], + "signature": "let make: string => t" + } + ] + }, + "stdlib/date/utc": { + "id": "Stdlib.Date.UTC", + "name": "UTC", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Date.UTC.makeWithYM", + "kind": "value", + "name": "makeWithYM", + "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.makeWithYM(~year=2023, ~month=0)\n // 1672531200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=11)\n // 1701388800000\n\n Date.UTC.makeWithYM(~year=2023, ~month=12)\n // 1704067200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=-1)\n // 1669852800000\n ```" + ], + "signature": "let makeWithYM: (~year: int, ~month: int) => msSinceEpoch" + }, + { + "id": "Stdlib.Date.UTC.makeWithYMD", + "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 ```" + ], + "signature": "let makeWithYMD: (~year: int, ~month: int, ~date: int) => msSinceEpoch" + }, + { + "id": "Stdlib.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 ```" + ], + "signature": "let makeWithYMDH: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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 ```" + ], + "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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 ```" + ], + "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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 ```" + ], + "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" + } + ] + }, + "stdlib/result": { + "id": "Stdlib.Result", + "name": "Result", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.Result.mapWithDefault", + "kind": "value", + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (result<'a, 'c>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" + }, + { + "id": "Stdlib.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": "Stdlib.Result.flatMap", + "kind": "value", + "name": "flatMap", + "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```" + ], + "signature": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" + }, + { + "id": "Stdlib.Result.getOr", + "kind": "value", + "name": "getOr", + "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```" + ], + "signature": "let getOr: (result<'a, 'b>, 'a) => 'a" + }, + { + "id": "Stdlib.Result.getWithDefault", + "kind": "value", + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (result<'a, 'b>, 'a) => 'a", + "deprecated": "Use getOr instead" + }, + { + "id": "Stdlib.Result.isOk", + "kind": "value", + "name": "isOk", + "docstrings": [ + "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." + ], + "signature": "let isOk: result<'a, 'b> => bool" + }, + { + "id": "Stdlib.Result.isError", + "kind": "value", + "name": "isError", + "docstrings": [ + "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." + ], + "signature": "let isError: result<'a, 'b> => bool" + }, + { + "id": "Stdlib.Result.equal", + "kind": "value", + "name": "equal", + "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```" + ], + "signature": "let equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.Result.compare", + "kind": "value", + "name": "compare", + "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```" + ], + "signature": "let compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Result.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (result<'a, 'b>, 'a => unit) => unit" + }, + { + "id": "Stdlib.Result.mapError", + "kind": "value", + "name": "mapError", + "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```" + ], + "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" + } + ] + }, + "stdlib/list": { + "id": "Stdlib.List", + "name": "List", + "docstrings": [], + "items": [ + { + "id": "Stdlib.List.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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```" + ], + "signature": "let get: (t<'a>, int) => option<'a>" + }, + { + "id": "Stdlib.List.getExn", + "kind": "value", + "name": "getExn", + "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." + ], + "signature": "let getExn: (t<'a>, int) => 'a" + }, + { + "id": "Stdlib.List.make", + "kind": "value", + "name": "make", + "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```" + ], + "signature": "let make: (~length: int, 'a) => t<'a>" + }, + { + "id": "Stdlib.List.fromInitializer", + "kind": "value", + "name": "fromInitializer", + "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```" + ], + "signature": "let fromInitializer: (~length: int, int => 'a) => t<'a>" + }, + { + "id": "Stdlib.List.toShuffled", + "kind": "value", + "name": "toShuffled", + "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```" + ], + "signature": "let toShuffled: t<'a> => t<'a>" + }, + { + "id": "Stdlib.List.drop", + "kind": "value", + "name": "drop", + "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```" + ], + "signature": "let drop: (t<'a>, int) => option>" + }, + { + "id": "Stdlib.List.take", + "kind": "value", + "name": "take", + "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```" + ], + "signature": "let take: (t<'a>, int) => option>" + }, + { + "id": "Stdlib.List.splitAt", + "kind": "value", + "name": "splitAt", + "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```" + ], + "signature": "let splitAt: (t<'a>, int) => option<(list<'a>, list<'a>)>" + }, + { + "id": "Stdlib.List.concat", + "kind": "value", + "name": "concat", + "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```" + ], + "signature": "let concat: (t<'a>, t<'a>) => t<'a>" + }, + { + "id": "Stdlib.List.concatMany", + "kind": "value", + "name": "concatMany", + "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```" + ], + "signature": "let concatMany: array> => t<'a>" + }, + { + "id": "Stdlib.List.reverseConcat", + "kind": "value", + "name": "reverseConcat", + "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```" + ], + "signature": "let reverseConcat: (t<'a>, t<'a>) => t<'a>" + }, + { + "id": "Stdlib.List.flat", + "kind": "value", + "name": "flat", + "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```" + ], + "signature": "let flat: t> => t<'a>" + }, + { + "id": "Stdlib.List.map", + "kind": "value", + "name": "map", + "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```" + ], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.List.zip", + "kind": "value", + "name": "zip", + "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```" + ], + "signature": "let zip: (t<'a>, t<'b>) => t<('a, 'b)>" + }, + { + "id": "Stdlib.List.zipBy", + "kind": "value", + "name": "zipBy", + "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```" + ], + "signature": "let zipBy: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + }, + { + "id": "Stdlib.List.mapWithIndex", + "kind": "value", + "name": "mapWithIndex", + "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```" + ], + "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" + }, + { + "id": "Stdlib.List.fromArray", + "kind": "value", + "name": "fromArray", + "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```" + ], + "signature": "let fromArray: array<'a> => t<'a>" + }, + { + "id": "Stdlib.List.toArray", + "kind": "value", + "name": "toArray", + "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```" + ], + "signature": "let toArray: t<'a> => array<'a>" + }, + { + "id": "Stdlib.List.reverse", + "kind": "value", + "name": "reverse", + "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```" + ], + "signature": "let reverse: t<'a> => t<'a>" + }, + { + "id": "Stdlib.List.mapReverse", + "kind": "value", + "name": "mapReverse", + "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```" + ], + "signature": "let mapReverse: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.List.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.List.forEachWithIndex", + "kind": "value", + "name": "forEachWithIndex", + "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```" + ], + "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + }, + { + "id": "Stdlib.List.reduce", + "kind": "value", + "name": "reduce", + "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```" + ], + "signature": "let reduce: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + }, + { + "id": "Stdlib.List.reduceWithIndex", + "kind": "value", + "name": "reduceWithIndex", + "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```" + ], + "signature": "let reduceWithIndex: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + }, + { + "id": "Stdlib.List.reduceReverse", + "kind": "value", + "name": "reduceReverse", + "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```" + ], + "signature": "let reduceReverse: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + }, + { + "id": "Stdlib.List.mapReverse2", + "kind": "value", + "name": "mapReverse2", + "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```" + ], + "signature": "let mapReverse2: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + }, + { + "id": "Stdlib.List.forEach2", + "kind": "value", + "name": "forEach2", + "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```" + ], + "signature": "let forEach2: (t<'a>, t<'b>, ('a, 'b) => 'c) => unit" + }, + { + "id": "Stdlib.List.reduce2", + "kind": "value", + "name": "reduce2", + "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```" + ], + "signature": "let reduce2: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" + }, + { + "id": "Stdlib.List.reduceReverse2", + "kind": "value", + "name": "reduceReverse2", + "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```" + ], + "signature": "let reduceReverse2: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" + }, + { + "id": "Stdlib.List.every", + "kind": "value", + "name": "every", + "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```" + ], + "signature": "let every: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.List.some", + "kind": "value", + "name": "some", + "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```" + ], + "signature": "let some: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.List.every2", + "kind": "value", + "name": "every2", + "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```" + ], + "signature": "let every2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.List.some2", + "kind": "value", + "name": "some2", + "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```" + ], + "signature": "let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.List.compareLength", + "kind": "value", + "name": "compareLength", + "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```" + ], + "signature": "let compareLength: (t<'a>, t<'a>) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.List.compare", + "kind": "value", + "name": "compare", + "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." + ], + "signature": "let compare: (\n t<'a>,\n t<'a>,\n ('a, 'a) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.List.equal", + "kind": "value", + "name": "equal", + "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```" + ], + "signature": "let equal: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + }, + { + "id": "Stdlib.List.has", + "kind": "value", + "name": "has", + "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```" + ], + "signature": "let has: (t<'a>, 'b, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.List.find", + "kind": "value", + "name": "find", + "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```" + ], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.List.filter", + "kind": "value", + "name": "filter", + "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```" + ], + "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + }, + { + "id": "Stdlib.List.filterWithIndex", + "kind": "value", + "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: (t<'a>, ('a, int) => bool) => t<'a>" + }, + { + "id": "Stdlib.List.filterMap", + "kind": "value", + "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: (t<'a>, 'a => option<'b>) => t<'b>" + }, + { + "id": "Stdlib.List.partition", + "kind": "value", + "name": "partition", + "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```" + ], + "signature": "let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" + }, + { + "id": "Stdlib.List.unzip", + "kind": "value", + "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: t<('a, 'b)> => (t<'a>, t<'b>)" + }, + { + "id": "Stdlib.List.getAssoc", + "kind": "value", + "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: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>" + }, + { + "id": "Stdlib.List.hasAssoc", + "kind": "value", + "name": "hasAssoc", + "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```" + ], + "signature": "let hasAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.List.removeAssoc", + "kind": "value", + "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: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>" + }, + { + "id": "Stdlib.List.setAssoc", + "kind": "value", + "name": "setAssoc", + "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." + ], + "signature": "let setAssoc: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>" + }, + { + "id": "Stdlib.List.sort", + "kind": "value", + "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: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => t<'a>" + } + ] + }, + "stdlib/option": { + "id": "Stdlib.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": "Stdlib.Option.filter", + "kind": "value", + "name": "filter", + "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```" + ], + "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.Option.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (option<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.Option.getExn", + "kind": "value", + "name": "getExn", + "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`" + ], + "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" + }, + { + "id": "Stdlib.Option.getUnsafe", + "kind": "value", + "name": "getUnsafe", + "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." + ], + "signature": "let getUnsafe: option<'a> => 'a" + }, + { + "id": "Stdlib.Option.mapOr", + "kind": "value", + "name": "mapOr", + "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```" + ], + "signature": "let mapOr: (option<'a>, 'b, 'a => 'b) => 'b" + }, + { + "id": "Stdlib.Option.mapWithDefault", + "kind": "value", + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" + }, + { + "id": "Stdlib.Option.map", + "kind": "value", + "name": "map", + "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```" + ], + "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" + }, + { + "id": "Stdlib.Option.flatMap", + "kind": "value", + "name": "flatMap", + "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```" + ], + "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" + }, + { + "id": "Stdlib.Option.getOr", + "kind": "value", + "name": "getOr", + "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```" + ], + "signature": "let getOr: (option<'a>, 'a) => 'a" + }, + { + "id": "Stdlib.Option.getWithDefault", + "kind": "value", + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (option<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" + }, + { + "id": "Stdlib.Option.orElse", + "kind": "value", + "name": "orElse", + "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```" + ], + "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" + }, + { + "id": "Stdlib.Option.isSome", + "kind": "value", + "name": "isSome", + "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```" + ], + "signature": "let isSome: option<'a> => bool" + }, + { + "id": "Stdlib.Option.isNone", + "kind": "value", + "name": "isNone", + "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```" + ], + "signature": "let isNone: option<'a> => bool" + }, + { + "id": "Stdlib.Option.equal", + "kind": "value", + "name": "equal", + "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```" + ], + "signature": "let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.Option.compare", + "kind": "value", + "name": "compare", + "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) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + } + ] + }, + "stdlib/exn": { + "id": "Stdlib.Exn", + "name": "Exn", + "docstrings": [], + "items": [] + }, + "stdlib/intl": { + "id": "Stdlib.Intl", + "name": "Intl", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.getCanonicalLocalesExn", + "kind": "value", + "name": "getCanonicalLocalesExn", + "docstrings": ["@throws RangeError"], + "signature": "let getCanonicalLocalesExn: string => array" + }, + { + "id": "Stdlib.Intl.getCanonicalLocalesManyExn", + "kind": "value", + "name": "getCanonicalLocalesManyExn", + "docstrings": ["@throws RangeError"], + "signature": "let getCanonicalLocalesManyExn: array => array" + }, + { + "id": "Stdlib.Intl.supportedValuesOfExn", + "kind": "value", + "name": "supportedValuesOfExn", + "docstrings": ["@throws RangeError"], + "signature": "let supportedValuesOfExn: string => array" + } + ] + }, + "stdlib/biguint64array": { + "id": "Stdlib.BigUint64Array", + "name": "BigUint64Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "type t = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + } + ] + }, + "stdlib/bigint64array": { + "id": "Stdlib.BigInt64Array", + "name": "BigInt64Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.BigInt64Array.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)" + ], + "signature": "type t = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.BigInt64Array.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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.BigInt64Array.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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.BigInt64Array.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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.BigInt64Array.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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.BigInt64Array.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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.BigInt64Array.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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.BigInt64Array.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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + } + ] + }, + "stdlib/uint8clampedarray": { + "id": "Stdlib.Uint8ClampedArray", + "name": "Uint8ClampedArray", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Uint8ClampedArray.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromArray", + "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" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromBuffer", + "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: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromBufferToEnd", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromBufferWithRange", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromLength", + "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" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterable", + "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" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", + "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" + } + ] + }, + "stdlib/uint32array": { + "id": "Stdlib.Uint32Array", + "name": "Uint32Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Uint32Array.fromArray", + "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" + }, + { + "id": "Stdlib.Uint32Array.fromBuffer", + "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: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Uint32Array.fromBufferToEnd", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Uint32Array.fromBufferWithRange", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Uint32Array.fromLength", + "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" + }, + { + "id": "Stdlib.Uint32Array.fromArrayLikeOrIterable", + "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" + }, + { + "id": "Stdlib.Uint32Array.fromArrayLikeOrIterableWithMap", + "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" + } + ] + }, + "stdlib/uint16array": { + "id": "Stdlib.Uint16Array", + "name": "Uint16Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Uint16Array.fromArray", + "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" + }, + { + "id": "Stdlib.Uint16Array.fromBuffer", + "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: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Uint16Array.fromBufferToEnd", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Uint16Array.fromBufferWithRange", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Uint16Array.fromLength", + "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" + }, + { + "id": "Stdlib.Uint16Array.fromArrayLikeOrIterable", + "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" + }, + { + "id": "Stdlib.Uint16Array.fromArrayLikeOrIterableWithMap", + "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" + } + ] + }, + "stdlib/uint8array": { + "id": "Stdlib.Uint8Array", + "name": "Uint8Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Uint8Array.fromArray", + "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" + }, + { + "id": "Stdlib.Uint8Array.fromBuffer", + "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: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Uint8Array.fromBufferToEnd", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Uint8Array.fromBufferWithRange", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Uint8Array.fromLength", + "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" + }, + { + "id": "Stdlib.Uint8Array.fromArrayLikeOrIterable", + "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" + }, + { + "id": "Stdlib.Uint8Array.fromArrayLikeOrIterableWithMap", + "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" + } + ] + }, + "stdlib/int32array": { + "id": "Stdlib.Int32Array", + "name": "Int32Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int32Array.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Int32Array.fromArray", + "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" + }, + { + "id": "Stdlib.Int32Array.fromBuffer", + "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: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Int32Array.fromBufferToEnd", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Int32Array.fromBufferWithRange", + "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Int32Array.fromLength", + "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" + }, + { + "id": "Stdlib.Int32Array.fromArrayLikeOrIterable", + "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" + }, + { + "id": "Stdlib.Int32Array.fromArrayLikeOrIterableWithMap", + "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" + } + ] + }, + "stdlib/int16array": { + "id": "Stdlib.Int16Array", + "name": "Int16Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int16Array.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)" + ], + "signature": "type t = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Int16Array.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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.Int16Array.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Int16Array.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Int16Array.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Int16Array.fromLength", + "kind": "value", + "name": "fromLength", + "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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.Int16Array.fromArrayLikeOrIterable", + "kind": "value", + "name": "fromArrayLikeOrIterable", + "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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.Int16Array.fromArrayLikeOrIterableWithMap", + "kind": "value", + "name": "fromArrayLikeOrIterableWithMap", + "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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "stdlib/int8array": { + "id": "Stdlib.Int8Array", + "name": "Int8Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int8Array.t", + "kind": "type", + "name": "t", + "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)" + ], + "signature": "type t = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Int8Array.fromArray", + "kind": "value", + "name": "fromArray", + "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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.Int8Array.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Int8Array.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Int8Array.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Int8Array.fromLength", + "kind": "value", + "name": "fromLength", + "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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.Int8Array.fromArrayLikeOrIterable", + "kind": "value", + "name": "fromArrayLikeOrIterable", + "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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.Int8Array.fromArrayLikeOrIterableWithMap", + "kind": "value", + "name": "fromArrayLikeOrIterableWithMap", + "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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + } + ] + }, + "stdlib/float64array": { + "id": "Stdlib.Float64Array", + "name": "Float64Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Float64Array.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 = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Float64Array.fromArray", + "kind": "value", + "name": "fromArray", + "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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.Float64Array.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Float64Array.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Float64Array.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Float64Array.fromLength", + "kind": "value", + "name": "fromLength", + "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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.Float64Array.fromArrayLikeOrIterable", + "kind": "value", + "name": "fromArrayLikeOrIterable", + "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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.Float64Array.fromArrayLikeOrIterableWithMap", + "kind": "value", + "name": "fromArrayLikeOrIterableWithMap", + "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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" + } + ] + }, + "stdlib/float32array": { + "id": "Stdlib.Float32Array", + "name": "Float32Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Float32Array.t", + "kind": "type", + "name": "t", + "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)" + ], + "signature": "type t = Stdlib__TypedArray.t" + }, + { + "id": "Stdlib.Float32Array.fromArray", + "kind": "value", + "name": "fromArray", + "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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.Float32Array.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "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." + ], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Float32Array.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "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." + ], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Float32Array.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "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." + ], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Float32Array.fromLength", + "kind": "value", + "name": "fromLength", + "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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.Float32Array.fromArrayLikeOrIterable", + "kind": "value", + "name": "fromArrayLikeOrIterable", + "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)" + ], + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, + { + "id": "Stdlib.Float32Array.fromArrayLikeOrIterableWithMap", + "kind": "value", + "name": "fromArrayLikeOrIterableWithMap", + "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)" + ], + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" + } + ] + }, + "stdlib/typedarray": { + "id": "Stdlib.TypedArray", + "name": "TypedArray", + "docstrings": [], + "items": [ + { + "id": "Stdlib.TypedArray.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a>" + }, + { + "id": "Stdlib.TypedArray.get", + "kind": "value", + "name": "get", + "docstrings": [], + "signature": "let get: (t<'a>, int) => option<'a>" + }, + { + "id": "Stdlib.TypedArray.set", + "kind": "value", + "name": "set", + "docstrings": [], + "signature": "let set: (t<'a>, int, 'a) => unit" + }, + { + "id": "Stdlib.TypedArray.buffer", + "kind": "value", + "name": "buffer", + "docstrings": [], + "signature": "let buffer: t<'a> => Stdlib__ArrayBuffer.t" + }, + { + "id": "Stdlib.TypedArray.byteLength", + "kind": "value", + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t<'a> => int" + }, + { + "id": "Stdlib.TypedArray.byteOffset", + "kind": "value", + "name": "byteOffset", + "docstrings": [], + "signature": "let byteOffset: t<'a> => int" + }, + { + "id": "Stdlib.TypedArray.setArray", + "kind": "value", + "name": "setArray", + "docstrings": [], + "signature": "let setArray: (t<'a>, array<'a>) => unit" + }, + { + "id": "Stdlib.TypedArray.setArrayFrom", + "kind": "value", + "name": "setArrayFrom", + "docstrings": [], + "signature": "let setArrayFrom: (t<'a>, array<'a>, int) => unit" + }, + { + "id": "Stdlib.TypedArray.length", + "kind": "value", + "name": "length", + "docstrings": [], + "signature": "let length: t<'a> => int" + }, + { + "id": "Stdlib.TypedArray.copyAllWithin", + "kind": "value", + "name": "copyAllWithin", + "docstrings": [], + "signature": "let copyAllWithin: (t<'a>, ~target: int) => array<'a>" + }, + { + "id": "Stdlib.TypedArray.copyWithinToEnd", + "kind": "value", + "name": "copyWithinToEnd", + "docstrings": [], + "signature": "let copyWithinToEnd: (t<'a>, ~target: int, ~start: int) => array<'a>" + }, + { + "id": "Stdlib.TypedArray.copyWithin", + "kind": "value", + "name": "copyWithin", + "docstrings": [], + "signature": "let copyWithin: (t<'a>, ~target: int, ~start: int, ~end: int) => array<'a>" + }, + { + "id": "Stdlib.TypedArray.fillAll", + "kind": "value", + "name": "fillAll", + "docstrings": [], + "signature": "let fillAll: (t<'a>, 'a) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.fillToEnd", + "kind": "value", + "name": "fillToEnd", + "docstrings": [], + "signature": "let fillToEnd: (t<'a>, 'a, ~start: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.fill", + "kind": "value", + "name": "fill", + "docstrings": [], + "signature": "let fill: (t<'a>, 'a, ~start: int, ~end: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.reverse", + "kind": "value", + "name": "reverse", + "docstrings": [], + "signature": "let reverse: t<'a> => unit" + }, + { + "id": "Stdlib.TypedArray.toReversed", + "kind": "value", + "name": "toReversed", + "docstrings": [], + "signature": "let toReversed: t<'a> => t<'a>" + }, + { + "id": "Stdlib.TypedArray.sort", + "kind": "value", + "name": "sort", + "docstrings": [], + "signature": "let sort: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => unit" + }, + { + "id": "Stdlib.TypedArray.toSorted", + "kind": "value", + "name": "toSorted", + "docstrings": [], + "signature": "let toSorted: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.with", + "kind": "value", + "name": "with", + "docstrings": [], + "signature": "let with: (t<'a>, int, 'a) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.includes", + "kind": "value", + "name": "includes", + "docstrings": [], + "signature": "let includes: (t<'a>, 'a) => bool" + }, + { + "id": "Stdlib.TypedArray.indexOf", + "kind": "value", + "name": "indexOf", + "docstrings": [], + "signature": "let indexOf: (t<'a>, 'a) => int" + }, + { + "id": "Stdlib.TypedArray.indexOfFrom", + "kind": "value", + "name": "indexOfFrom", + "docstrings": [], + "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" + }, + { + "id": "Stdlib.TypedArray.joinWith", + "kind": "value", + "name": "joinWith", + "docstrings": [], + "signature": "let joinWith: (t<'a>, string) => string" + }, + { + "id": "Stdlib.TypedArray.lastIndexOf", + "kind": "value", + "name": "lastIndexOf", + "docstrings": [], + "signature": "let lastIndexOf: (t<'a>, 'a) => int" + }, + { + "id": "Stdlib.TypedArray.lastIndexOfFrom", + "kind": "value", + "name": "lastIndexOfFrom", + "docstrings": [], + "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" + }, + { + "id": "Stdlib.TypedArray.slice", + "kind": "value", + "name": "slice", + "docstrings": [], + "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.sliceToEnd", + "kind": "value", + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.copy", + "kind": "value", + "name": "copy", + "docstrings": [], + "signature": "let copy: t<'a> => t<'a>" + }, + { + "id": "Stdlib.TypedArray.subarray", + "kind": "value", + "name": "subarray", + "docstrings": [], + "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.subarrayToEnd", + "kind": "value", + "name": "subarrayToEnd", + "docstrings": [], + "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.toString", + "kind": "value", + "name": "toString", + "docstrings": [], + "signature": "let toString: t<'a> => string" + }, + { + "id": "Stdlib.TypedArray.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [], + "signature": "let toLocaleString: t<'a> => string" + }, + { + "id": "Stdlib.TypedArray.every", + "kind": "value", + "name": "every", + "docstrings": [], + "signature": "let every: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.TypedArray.everyWithIndex", + "kind": "value", + "name": "everyWithIndex", + "docstrings": [], + "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" + }, + { + "id": "Stdlib.TypedArray.filter", + "kind": "value", + "name": "filter", + "docstrings": [], + "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.filterWithIndex", + "kind": "value", + "name": "filterWithIndex", + "docstrings": [], + "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.find", + "kind": "value", + "name": "find", + "docstrings": [], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.TypedArray.findWithIndex", + "kind": "value", + "name": "findWithIndex", + "docstrings": [], + "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" + }, + { + "id": "Stdlib.TypedArray.findIndex", + "kind": "value", + "name": "findIndex", + "docstrings": [], + "signature": "let findIndex: (t<'a>, 'a => bool) => int" + }, + { + "id": "Stdlib.TypedArray.findIndexWithIndex", + "kind": "value", + "name": "findIndexWithIndex", + "docstrings": [], + "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" + }, + { + "id": "Stdlib.TypedArray.forEach", + "kind": "value", + "name": "forEach", + "docstrings": [], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.TypedArray.forEachWithIndex", + "kind": "value", + "name": "forEachWithIndex", + "docstrings": [], + "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + }, + { + "id": "Stdlib.TypedArray.map", + "kind": "value", + "name": "map", + "docstrings": [], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.TypedArray.mapWithIndex", + "kind": "value", + "name": "mapWithIndex", + "docstrings": [], + "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" + }, + { + "id": "Stdlib.TypedArray.reduce", + "kind": "value", + "name": "reduce", + "docstrings": [], + "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + }, + { + "id": "Stdlib.TypedArray.reduceWithIndex", + "kind": "value", + "name": "reduceWithIndex", + "docstrings": [], + "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + }, + { + "id": "Stdlib.TypedArray.reduceRight", + "kind": "value", + "name": "reduceRight", + "docstrings": [], + "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + }, + { + "id": "Stdlib.TypedArray.reduceRightWithIndex", + "kind": "value", + "name": "reduceRightWithIndex", + "docstrings": [], + "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + }, + { + "id": "Stdlib.TypedArray.some", + "kind": "value", + "name": "some", + "docstrings": [], + "signature": "let some: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.TypedArray.someWithIndex", + "kind": "value", + "name": "someWithIndex", + "docstrings": [], + "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" + } + ] + }, + "stdlib/arraybuffer": { + "id": "Stdlib.ArrayBuffer", + "name": "ArrayBuffer", + "docstrings": [], + "items": [ + { + "id": "Stdlib.ArrayBuffer.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t = Js.TypedArray2.ArrayBuffer.t" + }, + { + "id": "Stdlib.ArrayBuffer.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: int => t" + }, + { + "id": "Stdlib.ArrayBuffer.byteLength", + "kind": "value", + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t => int" + }, + { + "id": "Stdlib.ArrayBuffer.slice", + "kind": "value", + "name": "slice", + "docstrings": [], + "signature": "let slice: (t, ~start: int, ~end: int) => t" + }, + { + "id": "Stdlib.ArrayBuffer.sliceToEnd", + "kind": "value", + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t, ~start: int) => t" + } + ] + }, + "stdlib/weakset": { + "id": "Stdlib.WeakSet", + "name": "WeakSet", + "docstrings": [], + "items": [ + { + "id": "Stdlib.WeakSet.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a> = Js.WeakSet.t<'a>" + }, + { + "id": "Stdlib.WeakSet.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'a>" + }, + { + "id": "Stdlib.WeakSet.add", + "kind": "value", + "name": "add", + "docstrings": [], + "signature": "let add: (t<'a>, 'a) => t<'a>" + }, + { + "id": "Stdlib.WeakSet.delete", + "kind": "value", + "name": "delete", + "docstrings": [], + "signature": "let delete: (t<'a>, 'a) => bool" + }, + { + "id": "Stdlib.WeakSet.has", + "kind": "value", + "name": "has", + "docstrings": [], + "signature": "let has: (t<'a>, 'a) => bool" + } + ] + }, + "stdlib/set": { + "id": "Stdlib.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": "Stdlib.Set.t", + "kind": "type", + "name": "t", + "docstrings": ["Type representing an instance of `Set`."], + "signature": "type t<'a> = Js.Set.t<'a>" + }, + { + "id": "Stdlib.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": "Stdlib.Set.fromArray", + "kind": "value", + "name": "fromArray", + "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```" + ], + "signature": "let fromArray: array<'a> => t<'a>" + }, + { + "id": "Stdlib.Set.fromIterator", + "kind": "value", + "name": "fromIterator", + "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```" + ], + "signature": "let fromIterator: Stdlib__Iterator.t<'a> => t<'a>" + }, + { + "id": "Stdlib.Set.size", + "kind": "value", + "name": "size", + "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```" + ], + "signature": "let size: t<'a> => int" + }, + { + "id": "Stdlib.Set.clear", + "kind": "value", + "name": "clear", + "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```" + ], + "signature": "let clear: t<'a> => unit" + }, + { + "id": "Stdlib.Set.add", + "kind": "value", + "name": "add", + "docstrings": [ + "Adds a new value to the set.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\n```" + ], + "signature": "let add: (t<'a>, 'a) => unit" + }, + { + "id": "Stdlib.Set.delete", + "kind": "value", + "name": "delete", + "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```" + ], + "signature": "let delete: (t<'a>, 'a) => bool" + }, + { + "id": "Stdlib.Set.has", + "kind": "value", + "name": "has", + "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```" + ], + "signature": "let has: (t<'a>, 'a) => bool" + }, + { + "id": "Stdlib.Set.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.Set.values", + "kind": "value", + "name": "values", + "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```" + ], + "signature": "let values: t<'a> => Stdlib__Iterator.t<'a>" + } + ] + }, + "stdlib/weakmap": { + "id": "Stdlib.WeakMap", + "name": "WeakMap", + "docstrings": [], + "items": [ + { + "id": "Stdlib.WeakMap.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'k, 'v> = Js.WeakMap.t<'k, 'v>" + }, + { + "id": "Stdlib.WeakMap.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'k, 'v>" + }, + { + "id": "Stdlib.WeakMap.get", + "kind": "value", + "name": "get", + "docstrings": [], + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + }, + { + "id": "Stdlib.WeakMap.has", + "kind": "value", + "name": "has", + "docstrings": [], + "signature": "let has: (t<'k, 'v>, 'k) => bool" + }, + { + "id": "Stdlib.WeakMap.set", + "kind": "value", + "name": "set", + "docstrings": [], + "signature": "let set: (t<'k, 'v>, 'k, 'v) => t<'k, 'v>" + }, + { + "id": "Stdlib.WeakMap.delete", + "kind": "value", + "name": "delete", + "docstrings": [], + "signature": "let delete: (t<'k, 'v>, 'k) => bool" + } + ] + }, + "stdlib/map": { + "id": "Stdlib.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": "Stdlib.Map.t", + "kind": "type", + "name": "t", + "docstrings": ["Type representing an instance of `Map`."], + "signature": "type t<'k, 'v> = Js.Map.t<'k, 'v>" + }, + { + "id": "Stdlib.Map.make", + "kind": "value", + "name": "make", + "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`." + ], + "signature": "let make: unit => t<'k, 'v>" + }, + { + "id": "Stdlib.Map.fromArray", + "kind": "value", + "name": "fromArray", + "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```" + ], + "signature": "let fromArray: array<('k, 'v)> => t<'k, 'v>" + }, + { + "id": "Stdlib.Map.fromIterator", + "kind": "value", + "name": "fromIterator", + "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```" + ], + "signature": "let fromIterator: Stdlib__Iterator.t<('k, 'v)> => t<'k, 'v>" + }, + { + "id": "Stdlib.Map.size", + "kind": "value", + "name": "size", + "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```" + ], + "signature": "let size: t<'k, 'v> => int" + }, + { + "id": "Stdlib.Map.clear", + "kind": "value", + "name": "clear", + "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```" + ], + "signature": "let clear: t<'k, 'v> => unit" + }, + { + "id": "Stdlib.Map.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (t<'k, 'v>, 'v => unit) => unit" + }, + { + "id": "Stdlib.Map.forEachWithKey", + "kind": "value", + "name": "forEachWithKey", + "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```" + ], + "signature": "let forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" + }, + { + "id": "Stdlib.Map.get", + "kind": "value", + "name": "get", + "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```" + ], + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + }, + { + "id": "Stdlib.Map.has", + "kind": "value", + "name": "has", + "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```" + ], + "signature": "let has: (t<'k, 'v>, 'k) => bool" + }, + { + "id": "Stdlib.Map.set", + "kind": "value", + "name": "set", + "docstrings": [ + "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 set: (t<'k, 'v>, 'k, 'v) => unit" + }, + { + "id": "Stdlib.Map.delete", + "kind": "value", + "name": "delete", + "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```" + ], + "signature": "let delete: (t<'k, 'v>, 'k) => bool" + }, + { + "id": "Stdlib.Map.keys", + "kind": "value", + "name": "keys", + "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```" + ], + "signature": "let keys: t<'k, 'v> => Stdlib__Iterator.t<'k>" + }, + { + "id": "Stdlib.Map.values", + "kind": "value", + "name": "values", + "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```" + ], + "signature": "let values: t<'k, 'v> => Stdlib__Iterator.t<'v>" + }, + { + "id": "Stdlib.Map.entries", + "kind": "value", + "name": "entries", + "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```" + ], + "signature": "let entries: t<'k, 'v> => Stdlib__Iterator.t<('k, 'v)>" + } + ] + }, + "stdlib/asynciterator": { + "id": "Stdlib.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": "Stdlib.AsyncIterator.t", + "kind": "type", + "name": "t", + "docstrings": ["The type representing an async iterator."], + "signature": "type t<'a>" + }, + { + "id": "Stdlib.AsyncIterator.value", + "kind": "type", + "name": "value", + "docstrings": [], + "signature": "type value<'a> = {done: bool, value: option<'a>}" + }, + { + "id": "Stdlib.AsyncIterator.next", + "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>" + }, + { + "id": "Stdlib.AsyncIterator.forEach", + "kind": "value", + "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```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```" + ], + "signature": "let forEach: (t<'a>, option<'a> => unit) => promise" + } + ] + }, + "stdlib/iterator": { + "id": "Stdlib.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": "Stdlib.Iterator.t", + "kind": "type", + "name": "t", + "docstrings": ["The type representing an iterator."], + "signature": "type t<'a>" + }, + { + "id": "Stdlib.Iterator.value", + "kind": "type", + "name": "value", + "docstrings": ["The current value of an iterator."], + "signature": "type value<'a> = {done: bool, value: option<'a>}" + }, + { + "id": "Stdlib.Iterator.next", + "kind": "value", + "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```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```" + ], + "signature": "let next: t<'a> => value<'a>" + }, + { + "id": "Stdlib.Iterator.toArray", + "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>" + }, + { + "id": "Stdlib.Iterator.toArrayWithMapper", + "kind": "value", + "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": "Stdlib.Iterator.forEach", + "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" + } + ] + }, + "stdlib/json": { + "id": "Stdlib.JSON", + "name": "JSON", + "docstrings": ["Functions for interacting with JSON."], + "items": [ + { + "id": "Stdlib.JSON.t", + "kind": "type", + "name": "t", + "docstrings": ["A type representing a JSON object."], + "signature": "type t = Js.Json.t =\n | Boolean(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Stdlib__Dict.t)\n | Array(array)" + }, + { + "id": "Stdlib.JSON.replacer", + "kind": "type", + "name": "replacer", + "docstrings": [], + "signature": "type replacer =\n | Keys(array)\n | Replacer((string, t) => t)" + }, + { + "id": "Stdlib.JSON.parseExn", + "kind": "value", + "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": "Stdlib.JSON.parseExnWithReviver", + "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" + }, + { + "id": "Stdlib.JSON.stringify", + "kind": "value", + "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": "Stdlib.JSON.stringifyWithIndent", + "kind": "value", + "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": "Stdlib.JSON.stringifyWithReplacer", + "kind": "value", + "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": "Stdlib.JSON.stringifyWithReplacerAndIndent", + "kind": "value", + "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": "Stdlib.JSON.stringifyWithFilter", + "kind": "value", + "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": "Stdlib.JSON.stringifyWithFilterAndIndent", + "kind": "value", + "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": "Stdlib.JSON.stringifyAny", + "kind": "value", + "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```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." + ], + "signature": "let stringifyAny: ('a, ~replacer: replacer=?, ~space: int=?) => option" + }, + { + "id": "Stdlib.JSON.stringifyAnyWithIndent", + "kind": "value", + "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```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." + ], + "signature": "let stringifyAnyWithIndent: ('a, int) => option", + "deprecated": "Use `stringifyAny` with optional parameter instead" + }, + { + "id": "Stdlib.JSON.stringifyAnyWithReplacer", + "kind": "value", + "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\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." + ], + "signature": "let stringifyAnyWithReplacer: ('a, (string, t) => t) => option", + "deprecated": "Use `stringifyAny` with optional parameter instead" + }, + { + "id": "Stdlib.JSON.stringifyAnyWithReplacerAndIndent", + "kind": "value", + "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```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." + ], + "signature": "let stringifyAnyWithReplacerAndIndent: ('a, (string, t) => t, int) => option", + "deprecated": "Use `stringifyAny` with optional parameters instead" + }, + { + "id": "Stdlib.JSON.stringifyAnyWithFilter", + "kind": "value", + "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```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." + ], + "signature": "let stringifyAnyWithFilter: ('a, array) => string", + "deprecated": "Use `stringifyAny` with optional parameter instead" + }, + { + "id": "Stdlib.JSON.stringifyAnyWithFilterAndIndent", + "kind": "value", + "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```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." + ], + "signature": "let stringifyAnyWithFilterAndIndent: ('a, array, int) => string", + "deprecated": "Use `stringifyAny` with optional parameters instead" + } + ] + }, + "stdlib/type": { + "id": "Stdlib.Type", + "name": "Type", + "docstrings": [ + "Utilities for classifying the type of JavaScript values at runtime." + ], + "items": [ + { + "id": "Stdlib.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": "Stdlib.Type.typeof", + "kind": "value", + "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" + } + ] + }, + "stdlib/symbol": { + "id": "Stdlib.Symbol", + "name": "Symbol", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Symbol.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t = Js.Types.symbol" + }, + { + "id": "Stdlib.Symbol.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.Symbol.getFor", + "kind": "value", + "name": "getFor", + "docstrings": [], + "signature": "let getFor: string => t" + }, + { + "id": "Stdlib.Symbol.keyFor", + "kind": "value", + "name": "keyFor", + "docstrings": [], + "signature": "let keyFor: t => option" + }, + { + "id": "Stdlib.Symbol.asyncIterator", + "kind": "value", + "name": "asyncIterator", + "docstrings": [], + "signature": "let asyncIterator: t" + }, + { + "id": "Stdlib.Symbol.hasInstance", + "kind": "value", + "name": "hasInstance", + "docstrings": [], + "signature": "let hasInstance: t" + }, + { + "id": "Stdlib.Symbol.isConcatSpreadable", + "kind": "value", + "name": "isConcatSpreadable", + "docstrings": [], + "signature": "let isConcatSpreadable: t" + }, + { + "id": "Stdlib.Symbol.iterator", + "kind": "value", + "name": "iterator", + "docstrings": [], + "signature": "let iterator: t" + }, + { + "id": "Stdlib.Symbol.match", + "kind": "value", + "name": "match", + "docstrings": [], + "signature": "let match: t" + }, + { + "id": "Stdlib.Symbol.matchAll", + "kind": "value", + "name": "matchAll", + "docstrings": [], + "signature": "let matchAll: t" + }, + { + "id": "Stdlib.Symbol.replace", + "kind": "value", + "name": "replace", + "docstrings": [], + "signature": "let replace: t" + }, + { + "id": "Stdlib.Symbol.search", + "kind": "value", + "name": "search", + "docstrings": [], + "signature": "let search: t" + }, + { + "id": "Stdlib.Symbol.species", + "kind": "value", + "name": "species", + "docstrings": [], + "signature": "let species: t" + }, + { + "id": "Stdlib.Symbol.split", + "kind": "value", + "name": "split", + "docstrings": [], + "signature": "let split: t" + }, + { + "id": "Stdlib.Symbol.toPrimitive", + "kind": "value", + "name": "toPrimitive", + "docstrings": [], + "signature": "let toPrimitive: t" + }, + { + "id": "Stdlib.Symbol.toStringTag", + "kind": "value", + "name": "toStringTag", + "docstrings": [], + "signature": "let toStringTag: t" + }, + { + "id": "Stdlib.Symbol.unscopables", + "kind": "value", + "name": "unscopables", + "docstrings": [], + "signature": "let unscopables: t" + } + ] + }, + "stdlib/string": { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.String.fromCharCodeMany", + "kind": "value", + "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": "Stdlib.String.fromCodePoint", + "kind": "value", + "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": "Stdlib.String.fromCodePointMany", + "kind": "value", + "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": "Stdlib.String.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (string, string) => bool" + }, + { + "id": "Stdlib.String.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (string, string) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.String.length", + "kind": "value", + "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": "Stdlib.String.get", + "kind": "value", + "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": "Stdlib.String.getUnsafe", + "kind": "value", + "name": "getUnsafe", + "docstrings": [ + "`getUnsafe(str, index)` returns an `string` at the given `index` number.\n\nThis is _unsafe_, meaning it will return `undefined` value if `index` does not exist in `string`.\n\nUse `String.getUnsafe` only when you are sure the `index` exists.\n## Examples\n\n```rescript\nString.getUnsafe(\"ReScript\", 0) == \"R\"\nString.getUnsafe(\"Hello\", 4) == \"o\"\n```" + ], + "signature": "let getUnsafe: (string, int) => string" + }, + { + "id": "Stdlib.String.charAt", + "kind": "value", + "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": "Stdlib.String.charCodeAt", + "kind": "value", + "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": "Stdlib.String.codePointAt", + "kind": "value", + "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": "Stdlib.String.concat", + "kind": "value", + "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": "Stdlib.String.concatMany", + "kind": "value", + "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": "Stdlib.String.endsWith", + "kind": "value", + "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": "Stdlib.String.endsWithFrom", + "kind": "value", + "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": "Stdlib.String.includes", + "kind": "value", + "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": "Stdlib.String.includesFrom", + "kind": "value", + "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": "Stdlib.String.indexOf", + "kind": "value", + "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": "Stdlib.String.indexOfOpt", + "kind": "value", + "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": "Stdlib.String.indexOfFrom", + "kind": "value", + "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": "Stdlib.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": "Stdlib.String.lastIndexOfOpt", + "kind": "value", + "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": "Stdlib.String.lastIndexOfFrom", + "kind": "value", + "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": "Stdlib.String.match", + "kind": "value", + "name": "match", + "docstrings": [ + "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\nthere is a match, the return value is `Some(array)` where the array contains:\n- The entire matched string\n- Any capture groups if the regexp had parentheses\nFor regular expressions with the g modifier, a matched expression returns\n`Some(array)` with all the matched substrings and no capture groups.\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) on MDN.\n\n## Examples\n\n```rescript\nString.match(\"The better bats\", %re(\"/b[aeiou]t/\")) == Some([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, Stdlib__RegExp.t) => option" + }, + { + "id": "Stdlib.String.normalize", + "kind": "value", + "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 = \"\\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```" + ], + "signature": "let normalize: string => string" + }, + { + "id": "Stdlib.String.normalizeForm", + "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]" + }, + { + "id": "Stdlib.String.normalizeByForm", + "kind": "value", + "name": "normalizeByForm", + "docstrings": [], + "signature": "let normalizeByForm: (string, normalizeForm) => string" + }, + { + "id": "Stdlib.String.repeat", + "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" + }, + { + "id": "Stdlib.String.replace", + "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" + }, + { + "id": "Stdlib.String.replaceRegExp", + "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, Stdlib__RegExp.t, string) => string" + }, + { + "id": "Stdlib.String.replaceAll", + "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" + }, + { + "id": "Stdlib.String.replaceAllRegExp", + "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, Stdlib__RegExp.t, string) => string" + }, + { + "id": "Stdlib.String.unsafeReplaceRegExpBy0", + "kind": "value", + "name": "unsafeReplaceRegExpBy0", + "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```" + ], + "signature": "let unsafeReplaceRegExpBy0: (\n string,\n Stdlib__RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" + }, + { + "id": "Stdlib.String.unsafeReplaceRegExpBy1", + "kind": "value", + "name": "unsafeReplaceRegExpBy1", + "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```" + ], + "signature": "let unsafeReplaceRegExpBy1: (\n string,\n Stdlib__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + }, + { + "id": "Stdlib.String.unsafeReplaceRegExpBy2", + "kind": "value", + "name": "unsafeReplaceRegExpBy2", + "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```" + ], + "signature": "let unsafeReplaceRegExpBy2: (\n string,\n Stdlib__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + }, + { + "id": "Stdlib.String.unsafeReplaceRegExpBy3", + "kind": "value", + "name": "unsafeReplaceRegExpBy3", + "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." + ], + "signature": "let unsafeReplaceRegExpBy3: (\n string,\n Stdlib__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": "Stdlib.String.search", + "kind": "value", + "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, Stdlib__RegExp.t) => int" + }, + { + "id": "Stdlib.String.searchOpt", + "kind": "value", + "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, Stdlib__RegExp.t) => option" + }, + { + "id": "Stdlib.String.slice", + "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" + }, + { + "id": "Stdlib.String.sliceToEnd", + "kind": "value", + "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": "Stdlib.String.split", + "kind": "value", + "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": "Stdlib.String.splitAtMost", + "kind": "value", + "name": "splitAtMost", + "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```" + ], + "signature": "let splitAtMost: (string, string, ~limit: int) => array" + }, + { + "id": "Stdlib.String.splitByRegExp", + "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, Stdlib__RegExp.t) => array>" + }, + { + "id": "Stdlib.String.splitByRegExpAtMost", + "kind": "value", + "name": "splitByRegExpAtMost", + "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```" + ], + "signature": "let splitByRegExpAtMost: (\n string,\n Stdlib__RegExp.t,\n ~limit: int,\n) => array>" + }, + { + "id": "Stdlib.String.startsWith", + "kind": "value", + "name": "startsWith", + "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```" + ], + "signature": "let startsWith: (string, string) => bool" + }, + { + "id": "Stdlib.String.startsWithFrom", + "kind": "value", + "name": "startsWithFrom", + "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```" + ], + "signature": "let startsWithFrom: (string, string, int) => bool" + }, + { + "id": "Stdlib.String.substring", + "kind": "value", + "name": "substring", + "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```" + ], + "signature": "let substring: (string, ~start: int, ~end: int) => string" + }, + { + "id": "Stdlib.String.substringToEnd", + "kind": "value", + "name": "substringToEnd", + "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```" + ], + "signature": "let substringToEnd: (string, ~start: int) => string" + }, + { + "id": "Stdlib.String.toLowerCase", + "kind": "value", + "name": "toLowerCase", + "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```" + ], + "signature": "let toLowerCase: string => string" + }, + { + "id": "Stdlib.String.toLocaleLowerCase", + "kind": "value", + "name": "toLocaleLowerCase", + "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." + ], + "signature": "let toLocaleLowerCase: string => string" + }, + { + "id": "Stdlib.String.toUpperCase", + "kind": "value", + "name": "toUpperCase", + "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```" + ], + "signature": "let toUpperCase: string => string" + }, + { + "id": "Stdlib.String.toLocaleUpperCase", + "kind": "value", + "name": "toLocaleUpperCase", + "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." + ], + "signature": "let toLocaleUpperCase: string => string" + }, + { + "id": "Stdlib.String.trim", + "kind": "value", + "name": "trim", + "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```" + ], + "signature": "let trim: string => string" + }, + { + "id": "Stdlib.String.trimStart", + "kind": "value", + "name": "trimStart", + "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```" + ], + "signature": "let trimStart: string => string" + }, + { + "id": "Stdlib.String.trimEnd", + "kind": "value", + "name": "trimEnd", + "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```" + ], + "signature": "let trimEnd: string => string" + }, + { + "id": "Stdlib.String.padStart", + "kind": "value", + "name": "padStart", + "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```" + ], + "signature": "let padStart: (string, int, string) => string" + }, + { + "id": "Stdlib.String.padEnd", + "kind": "value", + "name": "padEnd", + "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```" + ], + "signature": "let padEnd: (string, int, string) => string" + }, + { + "id": "Stdlib.String.getSymbol", + "kind": "value", + "name": "getSymbol", + "docstrings": [], + "signature": "let getSymbol: (string, Stdlib__Symbol.t) => option<'a>" + }, + { + "id": "Stdlib.String.getSymbolUnsafe", + "kind": "value", + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: (string, Stdlib__Symbol.t) => 'a" + }, + { + "id": "Stdlib.String.setSymbol", + "kind": "value", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: (string, Stdlib__Symbol.t, 'a) => unit" + }, + { + "id": "Stdlib.String.localeCompare", + "kind": "value", + "name": "localeCompare", + "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```" + ], + "signature": "let localeCompare: (string, string) => float" + } + ] + }, + "stdlib/regexp": { + "id": "Stdlib.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": [ + { + "id": "Stdlib.RegExp.t", + "kind": "type", + "name": "t", + "docstrings": ["Type representing an instantiated `RegExp`."], + "signature": "type t = Js.Re.t" + }, + { + "id": "Stdlib.RegExp.fromString", + "kind": "value", + "name": "fromString", + "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```" + ], + "signature": "let fromString: string => t" + }, + { + "id": "Stdlib.RegExp.fromStringWithFlags", + "kind": "value", + "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": "Stdlib.RegExp.test", + "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" + }, + { + "id": "Stdlib.RegExp.exec", + "kind": "value", + "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": "Stdlib.RegExp.lastIndex", + "kind": "value", + "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": "Stdlib.RegExp.setLastIndex", + "kind": "value", + "name": "setLastIndex", + "docstrings": [ + "`setLastIndex(regexp, index)` set the index the next match will start from.\n\nSee [`RegExp.lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\nlet someStr = \"Many words here.\"\n\nregexp->RegExp.setLastIndex(4)\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `10` to the console\n```" + ], + "signature": "let setLastIndex: (t, int) => unit" + }, + { + "id": "Stdlib.RegExp.ignoreCase", + "kind": "value", + "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": "Stdlib.RegExp.global", + "kind": "value", + "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": "Stdlib.RegExp.multiline", + "kind": "value", + "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": "Stdlib.RegExp.source", + "kind": "value", + "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": "Stdlib.RegExp.sticky", + "kind": "value", + "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": "Stdlib.RegExp.unicode", + "kind": "value", + "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" + } + ] + }, + "stdlib/promise": { + "id": "Stdlib.Promise", + "name": "Promise", + "docstrings": [ + "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." + ], + "items": [ + { + "id": "Stdlib.Promise.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a> = promise<'a>" + }, + { + "id": "Stdlib.Promise.resolve", + "kind": "value", + "name": "resolve", + "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```" + ], + "signature": "let resolve: 'a => t<'a>" + }, + { + "id": "Stdlib.Promise.reject", + "kind": "value", + "name": "reject", + "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```" + ], + "signature": "let reject: exn => t<'a>" + }, + { + "id": "Stdlib.Promise.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```" + ], + "signature": "let make: (('a => unit, 'e => unit) => unit) => t<'a>" + }, + { + "id": "Stdlib.Promise.promiseAndResolvers", + "kind": "type", + "name": "promiseAndResolvers", + "docstrings": [], + "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" + }, + { + "id": "Stdlib.Promise.withResolvers", + "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>" + }, + { + "id": "Stdlib.Promise.catch", + "kind": "value", + "name": "catch", + "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." + ], + "signature": "let catch: (t<'a>, exn => t<'a>) => t<'a>" + }, + { + "id": "Stdlib.Promise.then", + "kind": "value", + "name": "then", + "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```" + ], + "signature": "let then: (t<'a>, 'a => t<'b>) => t<'b>" + }, + { + "id": "Stdlib.Promise.thenResolve", + "kind": "value", + "name": "thenResolve", + "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." + ], + "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.Promise.finally", + "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>" + }, + { + "id": "Stdlib.Promise.race", + "kind": "value", + "name": "race", + "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```" + ], + "signature": "let race: array> => t<'a>" + }, + { + "id": "Stdlib.Promise.any", + "kind": "value", + "name": "any", + "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```" + ], + "signature": "let any: array> => t<'a>" + }, + { + "id": "Stdlib.Promise.all", + "kind": "value", + "name": "all", + "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```" + ], + "signature": "let all: array> => t>" + }, + { + "id": "Stdlib.Promise.all2", + "kind": "value", + "name": "all2", + "docstrings": [ + "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" + ], + "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" + }, + { + "id": "Stdlib.Promise.all3", + "kind": "value", + "name": "all3", + "docstrings": [ + "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" + ], + "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" + }, + { + "id": "Stdlib.Promise.all4", + "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)>" + }, + { + "id": "Stdlib.Promise.all5", + "kind": "value", + "name": "all5", + "docstrings": [ + "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" + ], + "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" + }, + { + "id": "Stdlib.Promise.all6", + "kind": "value", + "name": "all6", + "docstrings": [ + "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\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)>" + }, + { + "id": "Stdlib.Promise.settledResult", + "kind": "type", + "name": "settledResult", + "docstrings": [], + "signature": "type settledResult<'a> =\n | Fulfilled({value: 'a})\n | Rejected({reason: exn})" + }, + { + "id": "Stdlib.Promise.allSettled", + "kind": "value", + "name": "allSettled", + "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```" + ], + "signature": "let allSettled: array> => t>>" + }, + { + "id": "Stdlib.Promise.allSettled2", + "kind": "value", + "name": "allSettled2", + "docstrings": [ + "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" + ], + "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" + }, + { + "id": "Stdlib.Promise.allSettled3", + "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>" + }, + { + "id": "Stdlib.Promise.allSettled4", + "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>" + }, + { + "id": "Stdlib.Promise.allSettled5", + "kind": "value", + "name": "allSettled5", + "docstrings": [ + "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" + ], + "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": "Stdlib.Promise.allSettled6", + "kind": "value", + "name": "allSettled6", + "docstrings": [ + "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\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>" + }, + { + "id": "Stdlib.Promise.done", + "kind": "value", + "name": "done", + "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." + ], + "signature": "let done: promise<'a> => unit" + } + ] + }, + "stdlib/ordering": { + "id": "Stdlib.Ordering", + "name": "Ordering", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Ordering.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t = float" + }, + { + "id": "Stdlib.Ordering.less", + "kind": "value", + "name": "less", + "docstrings": [], + "signature": "let less: float" + }, + { + "id": "Stdlib.Ordering.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: float" + }, + { + "id": "Stdlib.Ordering.greater", + "kind": "value", + "name": "greater", + "docstrings": [], + "signature": "let greater: float" + }, + { + "id": "Stdlib.Ordering.isLess", + "kind": "value", + "name": "isLess", + "docstrings": [], + "signature": "let isLess: float => bool" + }, + { + "id": "Stdlib.Ordering.isEqual", + "kind": "value", + "name": "isEqual", + "docstrings": [], + "signature": "let isEqual: float => bool" + }, + { + "id": "Stdlib.Ordering.isGreater", + "kind": "value", + "name": "isGreater", + "docstrings": [], + "signature": "let isGreater: float => bool" + }, + { + "id": "Stdlib.Ordering.invert", + "kind": "value", + "name": "invert", + "docstrings": [], + "signature": "let invert: float => float" + }, + { + "id": "Stdlib.Ordering.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [], + "signature": "let fromInt: int => float" + } + ] + }, + "stdlib/object": { + "id": "Stdlib.Object", + "name": "Object", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Object.make", + "kind": "value", + "name": "make", + "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```" + ], + "signature": "let make: unit => {..}" + }, + { + "id": "Stdlib.Object.is", + "kind": "value", + "name": "is", + "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```" + ], + "signature": "let is: ('a, 'a) => bool" + }, + { + "id": "Stdlib.Object.create", + "kind": "value", + "name": "create", + "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```" + ], + "signature": "let create: {..} => {..}" + }, + { + "id": "Stdlib.Object.createWithProperties", + "kind": "value", + "name": "createWithProperties", + "docstrings": [], + "signature": "let createWithProperties: ({..}, {..}) => {..}" + }, + { + "id": "Stdlib.Object.createWithNull", + "kind": "value", + "name": "createWithNull", + "docstrings": [], + "signature": "let createWithNull: unit => {..}" + }, + { + "id": "Stdlib.Object.createWithNullAndProperties", + "kind": "value", + "name": "createWithNullAndProperties", + "docstrings": [], + "signature": "let createWithNullAndProperties: {..} => {..}" + }, + { + "id": "Stdlib.Object.assign", + "kind": "value", + "name": "assign", + "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```" + ], + "signature": "let assign: ({..}, {..}) => {..}" + }, + { + "id": "Stdlib.Object.assignMany", + "kind": "value", + "name": "assignMany", + "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)." + ], + "signature": "let assignMany: ({..}, array<{..}>) => {..}" + }, + { + "id": "Stdlib.Object.copy", + "kind": "value", + "name": "copy", + "docstrings": [], + "signature": "let copy: ({..} as 'a) => 'a" + }, + { + "id": "Stdlib.Object.get", + "kind": "value", + "name": "get", + "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```" + ], + "signature": "let get: ({..}, string) => option<'a>" + }, + { + "id": "Stdlib.Object.getSymbol", + "kind": "value", + "name": "getSymbol", + "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```" + ], + "signature": "let getSymbol: ({..}, Stdlib__Symbol.t) => option<'a>" + }, + { + "id": "Stdlib.Object.getSymbolUnsafe", + "kind": "value", + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: ({..}, Stdlib__Symbol.t) => 'a" + }, + { + "id": "Stdlib.Object.set", + "kind": "value", + "name": "set", + "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```" + ], + "signature": "let set: ({..}, string, 'a) => unit" + }, + { + "id": "Stdlib.Object.setSymbol", + "kind": "value", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: ({..}, Stdlib__Symbol.t, 'a) => unit" + }, + { + "id": "Stdlib.Object.keysToArray", + "kind": "value", + "name": "keysToArray", + "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```" + ], + "signature": "let keysToArray: {..} => array" + }, + { + "id": "Stdlib.Object.hasOwnProperty", + "kind": "value", + "name": "hasOwnProperty", + "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```" + ], + "signature": "let hasOwnProperty: ({..}, string) => bool" + }, + { + "id": "Stdlib.Object.seal", + "kind": "value", + "name": "seal", + "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```" + ], + "signature": "let seal: ({..} as 'a) => 'a" + }, + { + "id": "Stdlib.Object.preventExtensions", + "kind": "value", + "name": "preventExtensions", + "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```" + ], + "signature": "let preventExtensions: ({..} as 'a) => 'a" + }, + { + "id": "Stdlib.Object.freeze", + "kind": "value", + "name": "freeze", + "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```" + ], + "signature": "let freeze: ({..} as 'a) => 'a" + }, + { + "id": "Stdlib.Object.isSealed", + "kind": "value", + "name": "isSealed", + "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 ```" + ], + "signature": "let isSealed: 'a => bool" + }, + { + "id": "Stdlib.Object.isFrozen", + "kind": "value", + "name": "isFrozen", + "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 ```" + ], + "signature": "let isFrozen: 'a => bool" + }, + { + "id": "Stdlib.Object.isExtensible", + "kind": "value", + "name": "isExtensible", + "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```" + ], + "signature": "let isExtensible: 'a => bool" + } + ] + }, + "stdlib/nullable": { + "id": "Stdlib.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": [ + { + "id": "Stdlib.Nullable.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing a nullable value.\nA nullable value can be the value `'a`, `null` or `undefined`." + ], + "signature": "type t<'a> = Js.Nullable.t<'a> =\n | Value('a)\n | Null\n | Undefined" + }, + { + "id": "Stdlib.Nullable.null", + "kind": "value", + "name": "null", + "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```" + ], + "signature": "let null: t<'a>" + }, + { + "id": "Stdlib.Nullable.undefined", + "kind": "value", + "name": "undefined", + "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```" + ], + "signature": "let undefined: t<'a>" + }, + { + "id": "Stdlib.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": "Stdlib.Nullable.make", + "kind": "value", + "name": "make", + "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```" + ], + "signature": "let make: 'a => t<'a>" + }, + { + "id": "Stdlib.Nullable.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.Nullable.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Nullable.toOption", + "kind": "value", + "name": "toOption", + "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```" + ], + "signature": "let toOption: t<'a> => option<'a>" + }, + { + "id": "Stdlib.Nullable.fromOption", + "kind": "value", + "name": "fromOption", + "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```" + ], + "signature": "let fromOption: option<'a> => t<'a>" + }, + { + "id": "Stdlib.Nullable.getOr", + "kind": "value", + "name": "getOr", + "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```" + ], + "signature": "let getOr: (t<'a>, 'a) => 'a" + }, + { + "id": "Stdlib.Nullable.getWithDefault", + "kind": "value", + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" + }, + { + "id": "Stdlib.Nullable.getExn", + "kind": "value", + "name": "getExn", + "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`" + ], + "signature": "let getExn: t<'a> => 'a" + }, + { + "id": "Stdlib.Nullable.getUnsafe", + "kind": "value", + "name": "getUnsafe", + "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`." + ], + "signature": "let getUnsafe: t<'a> => 'a" + }, + { + "id": "Stdlib.Nullable.forEach", + "kind": "value", + "name": "forEach", + "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```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.Nullable.map", + "kind": "value", + "name": "map", + "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```" + ], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.Nullable.mapOr", + "kind": "value", + "name": "mapOr", + "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```" + ], + "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" + }, + { + "id": "Stdlib.Nullable.mapWithDefault", + "kind": "value", + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" + }, + { + "id": "Stdlib.Nullable.flatMap", + "kind": "value", + "name": "flatMap", + "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```" + ], + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" + } + ] + }, + "stdlib/null": { + "id": "Stdlib.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": "Stdlib.Null.t", + "kind": "type", + "name": "t", + "docstrings": [ + "A type representing a value that can be either `'a` or `null`." + ], + "signature": "type t<'a> = Js.Null.t<'a> = Value('a) | Null" + }, + { + "id": "Stdlib.Null.asNullable", + "kind": "value", + "name": "asNullable", + "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```" + ], + "signature": "let asNullable: t<'a> => Stdlib__Nullable.t<'a>" + }, + { + "id": "Stdlib.Null.null", + "kind": "value", + "name": "null", + "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```" + ], + "signature": "let null: t<'a>" + }, + { + "id": "Stdlib.Null.make", + "kind": "value", + "name": "make", + "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```" + ], + "signature": "let make: 'a => t<'a>" + }, + { + "id": "Stdlib.Null.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.Null.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Null.toOption", + "kind": "value", + "name": "toOption", + "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```" + ], + "signature": "let toOption: t<'a> => option<'a>" + }, + { + "id": "Stdlib.Null.fromOption", + "kind": "value", + "name": "fromOption", + "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```" + ], + "signature": "let fromOption: option<'a> => t<'a>" + }, + { + "id": "Stdlib.Null.getOr", + "kind": "value", + "name": "getOr", + "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```" + ], + "signature": "let getOr: (t<'a>, 'a) => 'a" + }, + { + "id": "Stdlib.Null.getWithDefault", + "kind": "value", + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" + }, + { + "id": "Stdlib.Null.getExn", + "kind": "value", + "name": "getExn", + "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`," + ], + "signature": "let getExn: t<'a> => 'a" + }, + { + "id": "Stdlib.Null.getUnsafe", + "kind": "value", + "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": "Stdlib.Null.forEach", + "kind": "value", + "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": "Stdlib.Null.map", + "kind": "value", + "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": "Stdlib.Null.mapOr", + "kind": "value", + "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": "Stdlib.Null.mapWithDefault", + "kind": "value", + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" + }, + { + "id": "Stdlib.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>" + } + ] + }, + "stdlib/math": { + "id": "Stdlib.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": "Stdlib.Math.abs", + "kind": "value", + "name": "abs", + "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```" + ], + "signature": "let abs: float => float" + }, + { + "id": "Stdlib.Math.acos", + "kind": "value", + "name": "acos", + "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```" + ], + "signature": "let acos: float => float" + }, + { + "id": "Stdlib.Math.acosh", + "kind": "value", + "name": "acosh", + "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```" + ], + "signature": "let acosh: float => float" + }, + { + "id": "Stdlib.Math.asin", + "kind": "value", + "name": "asin", + "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```" + ], + "signature": "let asin: float => float" + }, + { + "id": "Stdlib.Math.asinh", + "kind": "value", + "name": "asinh", + "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```" + ], + "signature": "let asinh: float => float" + }, + { + "id": "Stdlib.Math.atan", + "kind": "value", + "name": "atan", + "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```" + ], + "signature": "let atan: float => float" + }, + { + "id": "Stdlib.Math.atanh", + "kind": "value", + "name": "atanh", + "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```" + ], + "signature": "let atanh: float => float" + }, + { + "id": "Stdlib.Math.atan2", + "kind": "value", + "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": "Stdlib.Math.cbrt", + "kind": "value", + "name": "cbrt", + "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```" + ], + "signature": "let cbrt: float => float" + }, + { + "id": "Stdlib.Math.ceil", + "kind": "value", + "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": "Stdlib.Math.cos", + "kind": "value", + "name": "cos", + "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```" + ], + "signature": "let cos: float => float" + }, + { + "id": "Stdlib.Math.cosh", + "kind": "value", + "name": "cosh", + "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```" + ], + "signature": "let cosh: float => float" + }, + { + "id": "Stdlib.Math.exp", + "kind": "value", + "name": "exp", + "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```" + ], + "signature": "let exp: float => float" + }, + { + "id": "Stdlib.Math.expm1", + "kind": "value", + "name": "expm1", + "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```" + ], + "signature": "let expm1: float => float" + }, + { + "id": "Stdlib.Math.floor", + "kind": "value", + "name": "floor", + "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```" + ], + "signature": "let floor: float => float" + }, + { + "id": "Stdlib.Math.fround", + "kind": "value", + "name": "fround", + "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```" + ], + "signature": "let fround: float => float" + }, + { + "id": "Stdlib.Math.hypot", + "kind": "value", + "name": "hypot", + "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```" + ], + "signature": "let hypot: (float, float) => float" + }, + { + "id": "Stdlib.Math.hypotMany", + "kind": "value", + "name": "hypotMany", + "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```" + ], + "signature": "let hypotMany: array => float" + }, + { + "id": "Stdlib.Math.log", + "kind": "value", + "name": "log", + "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```" + ], + "signature": "let log: float => float" + }, + { + "id": "Stdlib.Math.log1p", + "kind": "value", + "name": "log1p", + "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```" + ], + "signature": "let log1p: float => float" + }, + { + "id": "Stdlib.Math.log10", + "kind": "value", + "name": "log10", + "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```" + ], + "signature": "let log10: float => float" + }, + { + "id": "Stdlib.Math.log2", + "kind": "value", + "name": "log2", + "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```" + ], + "signature": "let log2: float => float" + }, + { + "id": "Stdlib.Math.min", + "kind": "value", + "name": "min", + "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```" + ], + "signature": "let min: (float, float) => float" + }, + { + "id": "Stdlib.Math.minMany", + "kind": "value", + "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": "Stdlib.Math.max", + "kind": "value", + "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": "Stdlib.Math.maxMany", + "kind": "value", + "name": "maxMany", + "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```" + ], + "signature": "let maxMany: array => float" + }, + { + "id": "Stdlib.Math.pow", + "kind": "value", + "name": "pow", + "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```" + ], + "signature": "let pow: (float, ~exp: float) => float" + }, + { + "id": "Stdlib.Math.random", + "kind": "value", + "name": "random", + "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```" + ], + "signature": "let random: unit => float" + }, + { + "id": "Stdlib.Math.round", + "kind": "value", + "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": "Stdlib.Math.sign", + "kind": "value", + "name": "sign", + "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```" + ], + "signature": "let sign: float => float" + }, + { + "id": "Stdlib.Math.sin", + "kind": "value", + "name": "sin", + "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```" + ], + "signature": "let sin: float => float" + }, + { + "id": "Stdlib.Math.sinh", + "kind": "value", + "name": "sinh", + "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```" + ], + "signature": "let sinh: float => float" + }, + { + "id": "Stdlib.Math.sqrt", + "kind": "value", + "name": "sqrt", + "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```" + ], + "signature": "let sqrt: float => float" + }, + { + "id": "Stdlib.Math.tan", + "kind": "value", + "name": "tan", + "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```" + ], + "signature": "let tan: float => float" + }, + { + "id": "Stdlib.Math.tanh", + "kind": "value", + "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": "Stdlib.Math.trunc", + "kind": "value", + "name": "trunc", + "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```" + ], + "signature": "let trunc: float => float" + } + ] + }, + "stdlib/bigint": { + "id": "Stdlib.BigInt", + "name": "BigInt", + "docstrings": [], + "items": [ + { + "id": "Stdlib.BigInt.asIntN", + "kind": "value", + "name": "asIntN", + "docstrings": [], + "signature": "let asIntN: (~width: int, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.asUintN", + "kind": "value", + "name": "asUintN", + "docstrings": [], + "signature": "let asUintN: (~width: int, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [], + "signature": "let fromString: string => bigint" + }, + { + "id": "Stdlib.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\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```" + ], + "signature": "let fromStringExn: string => bigint" + }, + { + "id": "Stdlib.BigInt.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [], + "signature": "let fromInt: int => bigint" + }, + { + "id": "Stdlib.BigInt.fromFloat", + "kind": "value", + "name": "fromFloat", + "docstrings": [], + "signature": "let fromFloat: float => bigint" + }, + { + "id": "Stdlib.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\n/* prints \"123\" */\nJs.BigInt.toString(123n)->Js.log\n```" + ], + "signature": "let toString: (bigint, ~radix: int=?) => string" + }, + { + "id": "Stdlib.BigInt.toStringWithRadix", + "kind": "value", + "name": "toStringWithRadix", + "docstrings": [], + "signature": "let toStringWithRadix: (bigint, ~radix: int) => string", + "deprecated": "Use `toString` with `~radix` instead" + }, + { + "id": "Stdlib.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\n/* prints \"123\" */\nJs.BigInt.toString(123n)->Js.log\n```" + ], + "signature": "let toLocaleString: bigint => string" + }, + { + "id": "Stdlib.BigInt.toFloat", + "kind": "value", + "name": "toFloat", + "docstrings": [], + "signature": "let toFloat: bigint => float" + }, + { + "id": "Stdlib.BigInt.toInt", + "kind": "value", + "name": "toInt", + "docstrings": [], + "signature": "let toInt: bigint => int" + }, + { + "id": "Stdlib.BigInt.+", + "kind": "value", + "name": "+", + "docstrings": [], + "signature": "let +: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.-", + "kind": "value", + "name": "-", + "docstrings": [], + "signature": "let -: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.*", + "kind": "value", + "name": "*", + "docstrings": [], + "signature": "let *: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt./", + "kind": "value", + "name": "/", + "docstrings": [], + "signature": "let /: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.~-", + "kind": "value", + "name": "~-", + "docstrings": [], + "signature": "let ~-: bigint => bigint" + }, + { + "id": "Stdlib.BigInt.~+", + "kind": "value", + "name": "~+", + "docstrings": [], + "signature": "let ~+: bigint => bigint" + }, + { + "id": "Stdlib.BigInt.**", + "kind": "value", + "name": "**", + "docstrings": [], + "signature": "let **: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.add", + "kind": "value", + "name": "add", + "docstrings": [], + "signature": "let add: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.sub", + "kind": "value", + "name": "sub", + "docstrings": [], + "signature": "let sub: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.mul", + "kind": "value", + "name": "mul", + "docstrings": [], + "signature": "let mul: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.div", + "kind": "value", + "name": "div", + "docstrings": [], + "signature": "let div: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.mod", + "kind": "value", + "name": "mod", + "docstrings": [], + "signature": "let mod: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.land", + "kind": "value", + "name": "land", + "docstrings": [], + "signature": "let land: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.lor", + "kind": "value", + "name": "lor", + "docstrings": [], + "signature": "let lor: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.lxor", + "kind": "value", + "name": "lxor", + "docstrings": [], + "signature": "let lxor: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.lsl", + "kind": "value", + "name": "lsl", + "docstrings": [], + "signature": "let lsl: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.asr", + "kind": "value", + "name": "asr", + "docstrings": [], + "signature": "let asr: (bigint, bigint) => bigint" + }, + { + "id": "Stdlib.BigInt.lnot", + "kind": "value", + "name": "lnot", + "docstrings": [], + "signature": "let lnot: bigint => bigint" + } + ] + }, + "stdlib/int": { + "id": "Stdlib.Int", + "name": "Int", + "docstrings": [ + "Functions for interacting with JavaScript Number.\nSee: [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)." + ], + "items": [ + { + "id": "Stdlib.Int.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (int, int) => bool" + }, + { + "id": "Stdlib.Int.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (int, int) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Int.toExponential", + "kind": "value", + "name": "toExponential", + "docstrings": [ + "`toExponential(n, ~digits=?)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point. See [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential)\n\n## Examples\n\n```rescript\nInt.toExponential(1000) // \"1e+3\"\nInt.toExponential(-1000) // \"-1e+3\"\nInt.toExponential(77, ~digits=2) // \"7.70e+1\"\nInt.toExponential(5678, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." + ], + "signature": "let toExponential: (int, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Int.toExponentialWithPrecision", + "kind": "value", + "name": "toExponentialWithPrecision", + "docstrings": [ + "`toExponential(n, ~digits)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point. See [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential)\non MDN.\n\n## Examples\n\n```rescript\nInt.toExponentialWithPrecision(77, ~digits=2) // \"7.70e+1\"\nInt.toExponentialWithPrecision(5678, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." + ], + "signature": "let toExponentialWithPrecision: (int, ~digits: int) => string", + "deprecated": "Use `toExponential` instead" + }, + { + "id": "Stdlib.Int.toFixed", + "kind": "value", + "name": "toFixed", + "docstrings": [ + "`toFixed(n, ~digits=?)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point. See [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)\non MDN.\n\n## Examples\n\n```rescript\nInt.toFixed(123456) // \"123456.00\"\nInt.toFixed(10) // \"10.00\"\nInt.toFixed(300, ~digits=4) // \"300.0000\"\nInt.toFixed(300, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." + ], + "signature": "let toFixed: (int, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Int.toFixedWithPrecision", + "kind": "value", + "name": "toFixedWithPrecision", + "docstrings": [ + "`toFixedWithPrecision(n, ~digits)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point. See [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)\non MDN.\n\n## Examples\n\n```rescript\nInt.toFixedWithPrecision(300, ~digits=4) // \"300.0000\"\nInt.toFixedWithPrecision(300, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." + ], + "signature": "let toFixedWithPrecision: (int, ~digits: int) => string", + "deprecated": "Use `toFixed` instead" + }, + { + "id": "Stdlib.Int.toPrecision", + "kind": "value", + "name": "toPrecision", + "docstrings": [ + "`toPrecision(n, ~digits=?)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits. See [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nInt.toPrecision(100) // \"100\"\nInt.toPrecision(1) // \"1\"\nInt.toPrecision(100, ~digits=2) // \"1.0e+2\"\nInt.toPrecision(1, ~digits=2) // \"1.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." + ], + "signature": "let toPrecision: (int, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Int.toPrecisionWithPrecision", + "kind": "value", + "name": "toPrecisionWithPrecision", + "docstrings": [ + "`toPrecisionWithPrecision(n, ~digits)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits. See [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nInt.toPrecisionWithPrecision(100, ~digits=2) // \"1.0e+2\"\nInt.toPrecisionWithPrecision(1, ~digits=2) // \"1.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." + ], + "signature": "let toPrecisionWithPrecision: (int, ~digits: int) => string", + "deprecated": "Use `toPrecision` instead" + }, + { + "id": "Stdlib.Int.toString", + "kind": "value", + "name": "toString", + "docstrings": [ + "`toString(n, ~radix=?)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString)\non MDN.\n\n## Examples\n\n```rescript\nInt.toString(1000) // \"1000\"\nInt.toString(-1000) // \"-1000\"\nInt.toString(6, ~radix=2) // \"110\"\nInt.toString(373592855, ~radix=16) // \"16449317\"\nInt.toString(123456, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." + ], + "signature": "let toString: (int, ~radix: int=?) => string" + }, + { + "id": "Stdlib.Int.toStringWithRadix", + "kind": "value", + "name": "toStringWithRadix", + "docstrings": [ + "`toStringWithRadix(n, ~radix)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString)\non MDN.\n\n## Examples\n\n```rescript\nInt.toStringWithRadix(6, ~radix=2) // \"110\"\nInt.toStringWithRadix(373592855, ~radix=16) // \"16449317\"\nInt.toStringWithRadix(123456, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." + ], + "signature": "let toStringWithRadix: (int, ~radix: int) => string", + "deprecated": "Use `toString` instead" + }, + { + "id": "Stdlib.Int.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [ + "`toLocaleString(n)` return a `string` with language-sensitive representing the\ngiven value. See [`Number.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) on MDN.\n\n## Examples\n\n```rescript\n// If the application uses English as the default language\nInt.toLocaleString(1000) // \"1,000\"\n\n// If the application uses Portuguese Brazil as the default language\nInt.toLocaleString(1000) // \"1.000\"\n```" + ], + "signature": "let toLocaleString: int => string" + }, + { + "id": "Stdlib.Int.toFloat", + "kind": "value", + "name": "toFloat", + "docstrings": [ + "`toFloat(n)` return a `float` representing the given value.\n\n## Examples\n\n```rescript\nInt.toFloat(100) == 100.0\nInt.toFloat(2) == 2.0\n```" + ], + "signature": "let toFloat: int => float" + }, + { + "id": "Stdlib.Int.fromFloat", + "kind": "value", + "name": "fromFloat", + "docstrings": [ + "`fromFloat(n)` return an `int` representing the given value. The conversion is\ndone by truncating the decimal part.\n\n## Examples\n\n```rescript\nInt.fromFloat(2.0) == 2\nInt.fromFloat(1.999) == 1\nInt.fromFloat(1.5) == 1\nInt.fromFloat(0.9999) == 0\n```" + ], + "signature": "let fromFloat: float => int" + }, + { + "id": "Stdlib.Int.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [ + "`fromString(str, ~radix=?)` return an `option` representing the given value\n`str`. `~radix` specifies the radix base to use for the formatted number.\n\n## Examples\n\n```rescript\nInt.fromString(\"0\") == Some(0)\nInt.fromString(\"NaN\") == None\nInt.fromString(\"6\", ~radix=2) == None\n```" + ], + "signature": "let fromString: (string, ~radix: int=?) => option" + }, + { + "id": "Stdlib.Int.mod", + "kind": "value", + "name": "mod", + "docstrings": [ + "`mod(n1, n2)` calculates the modulo (remainder after division) of two integers.\n\n## Examples\n\n```rescript\nInt.mod(7, 4) == 3\n```" + ], + "signature": "let mod: (int, int) => int" + }, + { + "id": "Stdlib.Int.rangeOptions", + "kind": "type", + "name": "rangeOptions", + "docstrings": ["The options for `range`."], + "signature": "type rangeOptions = {step?: int, inclusive?: bool}" + }, + { + "id": "Stdlib.Int.range", + "kind": "value", + "name": "range", + "docstrings": [ + "`range(start, end, ~options=?)` returns an int array of the sequence of integers in the\nrange `[start, end)`. That is, including `start` but excluding `end`.\n\nIf `step` is not set and `start < end`, the sequence will be increasing in steps of 1.\n\nIf `step` is not set and `start > end`, the sequence will be decreasing in steps of -1.\n\nIf `step` is set, the sequence will increase or decrease by that amount for each\nstep. If `start < end` and `step` is negative, or vice versa, an empty array is\nreturned since the sequence would otherwise never reach or exceed the end value\nand hence be infinite. If `step` is `0` and `start !=` end, a `RangeError` is\nraised as the sequence would never reach or exceed the end value and hence be\ninfinite.\n\nIf `inclusive` is set to `true`, the sequence will include `end` if `step` is\nset such that the sequence includes it.\n\n## Examples\n\n```rescript\nInt.range(3, 6) == [3, 4, 5]\nInt.range(-3, -1) == [-3, -2]\nInt.range(3, 1) == [3, 2]\nInt.range(3, 7, ~options={step: 2}) == [3, 5]\nInt.range(3, 7, ~options={step: 2, inclusive: true}) == [3, 5, 7]\nInt.range(3, 6, ~options={step: -2}) // RangeError\n```\n\n## Exceptions\n\n- Raises `RangeError` if `step == 0 && start != end`." + ], + "signature": "let range: (int, int, ~options: rangeOptions=?) => array" + }, + { + "id": "Stdlib.Int.rangeWithOptions", + "kind": "value", + "name": "rangeWithOptions", + "docstrings": [ + "`rangeWithOptions(start, end, options)` is like `range`, but with `step` and\n`inclusive` options configurable.\n\nIf `step` is set, the sequence will increase or decrease by that amount for each\nstep. If `start < end` and `step` is negative, or vice versa, an empty array is\nreturned since the sequence would otherwise never reach or exceed the end value\nand hence be infinite. If `step` is `0` and `start !=` end, a `RangeError` is\nraised as the sequence would never reach or exceed the end value and hence be\ninfinite.\n\nIf `inclusive` is set to `true`, the sequence will include `end` if `step` is\nset such that the sequence includes it.\n\n## Examples\n\n```rescript\nInt.rangeWithOptions(3, 7, {step: 2}) == [3, 5]\nInt.rangeWithOptions(3, 7, {step: 2, inclusive: true}) == [3, 5, 7]\nInt.rangeWithOptions(3, 6, {step: -2}) // RangeError\n```\n\n## Exceptions\n\n- Raises `RangeError` if `step == 0 && start != end`." + ], + "signature": "let rangeWithOptions: (int, int, rangeOptions) => array", + "deprecated": "Use `range` instead" + }, + { + "id": "Stdlib.Int.clamp", + "kind": "value", + "name": "clamp", + "docstrings": [ + "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nInt.clamp(42) == 42\nInt.clamp(42, ~min=50) == 50\nInt.clamp(42, ~max=40) == 40\nInt.clamp(42, ~min=50, ~max=40) == 50\n```" + ], + "signature": "let clamp: (~min: int=?, ~max: int=?, int) => int" + } + ] + }, + "stdlib/float": { + "id": "Stdlib.Float", + "name": "Float", + "docstrings": ["Functions for interacting with float."], + "items": [ + { + "id": "Stdlib.Float.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (float, float) => bool" + }, + { + "id": "Stdlib.Float.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (float, float) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Float.isNaN", + "kind": "value", + "name": "isNaN", + "docstrings": [ + "`isNaN(v)` tests if the given `v` is `NaN`.\nSee [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n## Examples\n\n```rescript\nFloat.isNaN(3.0) // false\nFloat.isNaN(Float.Constants.nan) // true\n```" + ], + "signature": "let isNaN: float => bool" + }, + { + "id": "Stdlib.Float.isFinite", + "kind": "value", + "name": "isFinite", + "docstrings": [ + "`isFinite(v)` tests if the given `v` is finite.\nSee [`isFinite`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) on MDN.\n\n## Examples\n\n```rescript\nFloat.isFinite(1.0) // true\nFloat.isFinite(Float.Constants.nan) // false\nFloat.isFinite(Float.Constants.positiveInfinity) // false\n```" + ], + "signature": "let isFinite: float => bool" + }, + { + "id": "Stdlib.Float.parseFloat", + "kind": "value", + "name": "parseFloat", + "docstrings": [ + "`parseFloat(v)` parse the given `v` and returns a float. Leading whitespace in\n`v` is ignored. Returns `NaN` if `v` can't be parsed. Use [`fromString`] to\nensure it returns a valid float and not `NaN`.\nSee [`parseFloat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseFloat(\"1.0\") // 1.0\nFloat.parseFloat(\" 3.14 \") // 3.14\nFloat.parseFloat(\"3.0\") // 3.0\nFloat.parseFloat(\"3.14some non-digit characters\") // 3.14\nFloat.parseFloat(\"error\")->Float.isNaN // true\n```" + ], + "signature": "let parseFloat: string => float" + }, + { + "id": "Stdlib.Float.parseInt", + "kind": "value", + "name": "parseInt", + "docstrings": [ + "`parseInt(v, ~radix=?)` parse the given `v` and returns a float. Leading\nwhitespace in this argument `v`is ignored. `radix` specifies the radix base to\nuse for the formatted number. The value must be in the range [2, 36] (inclusive).\nReturns `NaN` if `v` can't be parsed and `radix` is smaller than 2 or bigger\nthan 36.\nSee [`parseInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseInt(\"1.0\") // 1.0\nFloat.parseInt(\" 3.14 \") // 3.0\nFloat.parseInt(3) // 3.0\nFloat.parseInt(\"3.14some non-digit characters\") // 3.0\nFloat.parseInt(\"error\")->Float.isNaN // true\nFloat.parseInt(\"10.0\", ~radix=2) // 2.0\nFloat.parseInt(\"15 * 3\", ~radix=10) // 15.0\nFloat.parseInt(\"12\", ~radix=13) // 15.0\nFloat.parseInt(\"17\", ~radix=40)->Float.isNaN // true\n```" + ], + "signature": "let parseInt: ('a, ~radix: int=?) => float" + }, + { + "id": "Stdlib.Float.parseIntWithRadix", + "kind": "value", + "name": "parseIntWithRadix", + "docstrings": [ + "`parseIntWithRadix(v, ~radix)` parse the given `v` and returns a float. Leading\nwhitespace in this argument `v`is ignored. `radix` specifies the radix base to\nuse for the formatted number. The value must be in the range [2, 36] (inclusive).\nReturns `NaN` if `v` can't be parsed and `radix` is smaller than 2 or bigger\nthan 36.\nSee [`parseInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseIntWithRadix(\"10.0\", ~radix=2) // 2.0\nFloat.parseIntWithRadix(\"15 * 3\", ~radix=10) // 15.0\nFloat.parseIntWithRadix(\"12\", ~radix=13) // 15.0\nFloat.parseIntWithRadix(\"17\", ~radix=40)->Float.isNaN // true\n```" + ], + "signature": "let parseIntWithRadix: ('a, ~radix: int) => float", + "deprecated": "Use `parseInt` instead" + }, + { + "id": "Stdlib.Float.toExponential", + "kind": "value", + "name": "toExponential", + "docstrings": [ + "`toExponential(v, ~digits=?)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point.\nSee [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) on MDN.\n\n## Examples\n\n```rescript\nFloat.toExponential(1000.0) // \"1e+3\"\nFloat.toExponential(-1000.0) // \"-1e+3\"\nFloat.toExponential(77.0, ~digits=2) // \"7.70e+1\"\nFloat.toExponential(5678.0, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." + ], + "signature": "let toExponential: (float, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Float.toExponentialWithPrecision", + "kind": "value", + "name": "toExponentialWithPrecision", + "docstrings": [ + "`toExponential(v, ~digits)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point.\nSee [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) on MDN.\n\n## Examples\n\n```rescript\nFloat.toExponentialWithPrecision(77.0, ~digits=2) // \"7.70e+1\"\nFloat.toExponentialWithPrecision(5678.0, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." + ], + "signature": "let toExponentialWithPrecision: (float, ~digits: int) => string", + "deprecated": "Use `toExponential` instead" + }, + { + "id": "Stdlib.Float.toFixed", + "kind": "value", + "name": "toFixed", + "docstrings": [ + "`toFixed(v, ~digits=?)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point.\nSee [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) on MDN.\n\n## Examples\n\n```rescript\nFloat.toFixed(123456.0) // \"123456.00\"\nFloat.toFixed(10.0) // \"10.00\"\nFloat.toFixed(300.0, ~digits=4) // \"300.0000\"\nFloat.toFixed(300.0, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." + ], + "signature": "let toFixed: (float, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Float.toFixedWithPrecision", + "kind": "value", + "name": "toFixedWithPrecision", + "docstrings": [ + "`toFixedWithPrecision(v, ~digits)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point.\nSee [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) on MDN.\n\n## Examples\n\n```rescript\nFloat.toFixedWithPrecision(300.0, ~digits=4) // \"300.0000\"\nFloat.toFixedWithPrecision(300.0, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." + ], + "signature": "let toFixedWithPrecision: (float, ~digits: int) => string", + "deprecated": "Use `toFixed` instead" + }, + { + "id": "Stdlib.Float.toPrecision", + "kind": "value", + "name": "toPrecision", + "docstrings": [ + "`toPrecision(v, ~digits=?)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits.\nSee [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nFloat.toPrecision(100.0) // \"100\"\nFloat.toPrecision(1.0) // \"1\"\nFloat.toPrecision(100.0, ~digits=2) // \"1.0e+2\"\nFloat.toPrecision(1.0, ~digits=1) // \"1\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." + ], + "signature": "let toPrecision: (float, ~digits: int=?) => string" + }, + { + "id": "Stdlib.Float.toPrecisionWithPrecision", + "kind": "value", + "name": "toPrecisionWithPrecision", + "docstrings": [ + "`toPrecisionWithPrecision(v, ~digits)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits.\nSee [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nFloat.toPrecisionWithPrecision(100.0, ~digits=2) // \"1.0e+2\"\nFloat.toPrecisionWithPrecision(1.0, ~digits=1) // \"1\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." + ], + "signature": "let toPrecisionWithPrecision: (float, ~digits: int) => string", + "deprecated": "Use `toPrecision` instead" + }, + { + "id": "Stdlib.Float.toString", + "kind": "value", + "name": "toString", + "docstrings": [ + "`toString(v)` return a `string` representing the given value.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\nFloat.toString(1000.0) // \"1000\"\nFloat.toString(-1000.0) // \"-1000\"\n```" + ], + "signature": "let toString: (float, ~radix: int=?) => string" + }, + { + "id": "Stdlib.Float.toStringWithRadix", + "kind": "value", + "name": "toStringWithRadix", + "docstrings": [ + "`toStringWithRadix(v, ~radix)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\nFloat.toStringWithRadix(6.0, ~radix=2) // \"110\"\nFloat.toStringWithRadix(3735928559.0, ~radix=16) // \"deadbeef\"\nFloat.toStringWithRadix(123456.0, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." + ], + "signature": "let toStringWithRadix: (float, ~radix: int) => string", + "deprecated": "Use `toString` with `~radix` instead" + }, + { + "id": "Stdlib.Float.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [ + "`toLocaleString(v)` return a `string` with language-sensitive representing the\ngiven value.\nSee [`Number.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) on MDN.\n\n## Examples\n\n```rescript\n// If the application uses English as the default language\nFloat.toLocaleString(1000.0) // \"1,000\"\n\n// If the application uses Portuguese Brazil as the default language\nFloat.toLocaleString(1000.0) // \"1.000\"\n```" + ], + "signature": "let toLocaleString: float => string" + }, + { + "id": "Stdlib.Float.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [ + "`fromString(str)` return an `option` representing the given value `str`.\n\n## Examples\n\n```rescript\nFloat.fromString(\"0\") == Some(0.0)\nFloat.fromString(\"NaN\") == None\nFloat.fromString(\"6\") == Some(6.0)\n```" + ], + "signature": "let fromString: string => option" + }, + { + "id": "Stdlib.Float.toInt", + "kind": "value", + "name": "toInt", + "docstrings": [ + "`toInt(v)` returns an int to given float `v`.\n\n## Examples\n\n```rescript\nFloat.toInt(2.0) == 2\nFloat.toInt(1.0) == 1\nFloat.toInt(1.1) == 1\nFloat.toInt(1.6) == 1\n```" + ], + "signature": "let toInt: float => int" + }, + { + "id": "Stdlib.Float.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [ + "`fromInt(v)` returns a float to given int `v`.\n\n## Examples\n\n```rescript\nFloat.fromInt(2) == 2.0\nFloat.fromInt(1) == 1.0\n```" + ], + "signature": "let fromInt: int => float" + }, + { + "id": "Stdlib.Float.mod", + "kind": "value", + "name": "mod", + "docstrings": [ + "`mod(n1, n2)` calculates the modulo (remainder after division) of two floats.\n\n## Examples\n\n```rescript\nFloat.mod(7.0, 4.0) == 3.0\n```" + ], + "signature": "let mod: (float, float) => float" + }, + { + "id": "Stdlib.Float.clamp", + "kind": "value", + "name": "clamp", + "docstrings": [ + "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nFloat.clamp(4.2) == 4.2\nFloat.clamp(4.2, ~min=4.3) == 4.3\nFloat.clamp(4.2, ~max=4.1) == 4.1\nFloat.clamp(4.2, ~min=4.3, ~max=4.1) == 4.3\n```" + ], + "signature": "let clamp: (~min: float=?, ~max: float=?, float) => float" + } + ] + }, + "stdlib/error": { + "id": "Stdlib.Error", + "name": "Error", + "docstrings": [ + "Functions for working with JavaScript exceptions.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) on MDN." + ], + "items": [ + { + "id": "Stdlib.Error.t", + "kind": "type", + "name": "t", + "docstrings": ["Represents a JavaScript exception."], + "signature": "type t = Js.Exn.t" + }, + { + "id": "Stdlib.Error.fromException", + "kind": "value", + "name": "fromException", + "docstrings": [], + "signature": "let fromException: exn => option" + }, + { + "id": "Stdlib.Error.toException", + "kind": "value", + "name": "toException", + "docstrings": [ + "Turns an `Error.t` into an `exn`.\n\n## Examples\n```rescript\nlet error = Error.make(\"Something went wrong.\")\n\nlet asExn = error->Error.toException // `asExn` is now type `exn`\n```" + ], + "signature": "let toException: t => exn" + }, + { + "id": "Stdlib.Error.stack", + "kind": "value", + "name": "stack", + "docstrings": [ + "`stack(error)` retrieves the `stack` property of the error, if it exists. The stack is a list of what functions were called, and what files they are defined in, prior to the error happening.\n\nSee [`Error.prototype.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"error\")\nConsole.log(error->Error.stack) // Logs `stack` if it exists on `someError`\n```" + ], + "signature": "let stack: t => option" + }, + { + "id": "Stdlib.Error.message", + "kind": "value", + "name": "message", + "docstrings": [ + "`message(error)` retrieves the `message` property of the error, if it exists.\n\nSee [`Error.prototype.message`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\n```" + ], + "signature": "let message: t => option" + }, + { + "id": "Stdlib.Error.name", + "kind": "value", + "name": "name", + "docstrings": [ + "`name(error)` retrieves the `name` property of the error, if it exists.\n\nSee [`Error.prototype.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.name) // Logs \"SyntaxError\" to the console\n```" + ], + "signature": "let name: t => option" + }, + { + "id": "Stdlib.Error.fileName", + "kind": "value", + "name": "fileName", + "docstrings": [ + "`fileName(error)` retrieves the `fileName` property of the error, if it exists.\n\nSee [`Error.prototype.fileName`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName) on MDN." + ], + "signature": "let fileName: t => option" + }, + { + "id": "Stdlib.Error.make", + "kind": "value", + "name": "make", + "docstrings": [ + "`make(message)` creates a new error, setting its `message` to the provided value.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\nConsole.log(error->Error.name) // Logs \"Error\" to the console, because this is a regular error\n```" + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.Error.raise", + "kind": "value", + "name": "raise", + "docstrings": [ + "Raises (throws in JavaScript language) the provided `Error.t`, which will stop execution.\n\n## Examples\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->Error.raise\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```" + ], + "signature": "let raise: t => 'a" + }, + { + "id": "Stdlib.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```rescript\nError.panic(\"Uh oh. This was unexpected!\")\n```" + ], + "signature": "let panic: string => 'a" + } + ] + }, + "stdlib/dict": { + "id": "Stdlib.Dict", + "name": "Dict", + "docstrings": [ + "A mutable dictionary with string keys.\n\nCompiles to a regular JavaScript object." + ], + "items": [ + { + "id": "Stdlib.Dict.t", + "kind": "type", + "name": "t", + "docstrings": ["Type representing a dictionary of value `'a`."], + "signature": "type t<'a> = Js.Dict.t<'a>" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let getUnsafe: (t<'a>, string) => 'a" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let get: (t<'a>, string) => option<'a>" + }, + { + "id": "Stdlib.Dict.set", + "kind": "value", + "name": "set", + "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" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let delete: (t<'a>, string) => unit" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let make: unit => t<'a>" + }, + { + "id": "Stdlib.Dict.fromArray", + "kind": "value", + "name": "fromArray", + "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>" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let fromIterator: Stdlib__Iterator.t<(string, 'a)> => t<'a>" + }, + { + "id": "Stdlib.Dict.toArray", + "kind": "value", + "name": "toArray", + "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)>" + }, + { + "id": "Stdlib.Dict.keysToArray", + "kind": "value", + "name": "keysToArray", + "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" + }, + { + "id": "Stdlib.Dict.valuesToArray", + "kind": "value", + "name": "valuesToArray", + "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>" + }, + { + "id": "Stdlib.Dict.assign", + "kind": "value", + "name": "assign", + "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>" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let copy: t<'a> => t<'a>" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let forEachWithKey: (t<'a>, ('a, string) => unit) => unit" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let mapValues: (t<'a>, 'a => 'b) => t<'b>" + } + ] + }, + "stdlib/date": { + "id": "Stdlib.Date", + "name": "Date", + "docstrings": ["Functions for interacting with JavaScript Dates."], + "items": [ + { + "id": "Stdlib.Date.t", + "kind": "type", + "name": "t", + "docstrings": ["A type representing a JavaScript date."], + "signature": "type t = Js.Date.t" + }, + { + "id": "Stdlib.Date.msSinceEpoch", + "kind": "type", + "name": "msSinceEpoch", + "docstrings": [ + "Time, in milliseconds, since / until the UNIX epoch (January 1, 1970 00:00:00 UTC).\nPositive numbers represent dates after, negative numbers dates before epoch." + ], + "signature": "type msSinceEpoch = float" + }, + { + "id": "Stdlib.Date.localeOptions", + "kind": "type", + "name": "localeOptions", + "docstrings": [ + "A type representing date time format options.\n\nNote: There are some properties missing:\n- fractionalSecondDigits\n- dayPeriod\n- calendar\n- numberingSystem\n- localeMatcher\n- timeZone\n- hour12\n- hourCycle\n- formatMatcher\n\nSee full spec at https://tc39.es/ecma402/#datetimeformat-objects" + ], + "signature": "type localeOptions = {\n dateStyle?: [#full | #long | #medium | #short],\n timeStyle?: [#full | #long | #medium | #short],\n weekday?: [#long | #narrow | #short],\n era?: [#long | #narrow | #short],\n year?: [#\"2-digit\" | #numeric],\n month?: [\n | #\"2-digit\"\n | #long\n | #narrow\n | #numeric\n | #short\n ],\n day?: [#\"2-digit\" | #numeric],\n hour?: [#\"2-digit\" | #numeric],\n minute?: [#\"2-digit\" | #numeric],\n second?: [#\"2-digit\" | #numeric],\n timeZoneName?: [#long | #short],\n}" + }, + { + "id": "Stdlib.Date.make", + "kind": "value", + "name": "make", + "docstrings": [ + "`make()`\n\nCreates a date object with the current date time as value.\n\n## Examples\n```rescript\nDate.make()\n```" + ], + "signature": "let make: unit => t" + }, + { + "id": "Stdlib.Date.fromString", + "kind": "value", + "name": "fromString", + "docstrings": [ + "`fromString(dateTimeString)`\n\nCreates a date object from given date time string.\nThe string has to be in the ISO 8601 format YYYY-MM-DDTHH:mm:ss.sssZ (https://tc39.es/ecma262/#sec-date-time-string-format).\n\nInvalid date time strings will create invalid dates.\nYou can use the result like any valid date, but many functions like `toString` will return \"Invalid Date\" or functions like `Date.getTime` will return NaN.\n\n## Examples\n```rescript\nDate.fromString(\"2023\") // 2023-01-01T00:00:00.000Z\n\nDate.fromString(\"2023-02-20\") // 2023-02-20T00:00:00.000Z\n\nDate.fromString(\"2023-02-20T16:40:00.00Z\") // 2023-02-20T16:40:00.000Z\n\nDate.fromString(\"\") // Invalid Date\n\nDate.fromString(\"\")->Date.getTime // NaN\n```" + ], + "signature": "let fromString: string => t" + }, + { + "id": "Stdlib.Date.fromTime", + "kind": "value", + "name": "fromTime", + "docstrings": [ + "`fromTime(msSinceEpoch)`\n\nCreates a date object from the given time in milliseconds since / until UNIX epoch (January 1, 1970 00:00:00 UTC).\nPositive numbers create dates after epoch, negative numbers create dates before epoch.\n\n## Examples\n```rescript\nDate.fromTime(0.0)\n// 1970-01-01T00:00:00.000Z\n\nDate.fromTime(-86_400_000.0)\n// 1969-12-31T00:00:00.000Z\n\nDate.fromTime(86_400_000.0)\n// 1970-01-02T00:00:00.000Z\n```" + ], + "signature": "let fromTime: msSinceEpoch => t" + }, + { + "id": "Stdlib.Date.makeWithYM", + "kind": "value", + "name": "makeWithYM", + "docstrings": [ + "Creates a date object with the given year and 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.makeWithYM(~year=2023, ~month=0)\n// 2023-01-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=11)\n// 2023-12-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=12)\n// 2024-01-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=-1)\n// 2022-12-01T00: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 makeWithYM: (~year: int, ~month: int) => t" + }, + { + "id": "Stdlib.Date.makeWithYMD", + "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```" + ], + "signature": "let makeWithYMD: (~year: int, ~month: int, ~date: int) => t" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let makeWithYMDH: (~year: int, ~month: int, ~date: int, ~hours: int) => t" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n) => t" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => t" + }, + { + "id": "Stdlib.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```" + ], + "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" + }, + { + "id": "Stdlib.Date.now", + "kind": "value", + "name": "now", + "docstrings": [ + "`now()`\n\nReturns the time, in milliseconds, between UNIX epoch (January 1, 1970 00:00:00 UTC) and the current date time." + ], + "signature": "let now: unit => msSinceEpoch" + }, + { + "id": "Stdlib.Date.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (t, t) => bool" + }, + { + "id": "Stdlib.Date.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (t, t) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Date.getTime", + "kind": "value", + "name": "getTime", + "docstrings": [ + "`getTime(date)`\n\nReturns the time, in milliseconds, between UNIX epoch (January 1, 1970 00:00:00 UTC) and the current date time.\nInvalid dates will return NaN.\nDates before epoch will return negative numbers.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20\")->Date.getTime\n// 1676851200000\n```" + ], + "signature": "let getTime: t => msSinceEpoch" + }, + { + "id": "Stdlib.Date.getTimezoneOffset", + "kind": "value", + "name": "getTimezoneOffset", + "docstrings": [ + "`getTimezoneOffset(date)`\n\nReturns the time in minutes between the UTC time and the locale time.\nThe timezone of the given date doesn't matter.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01\")->Date.getTimezoneOffset\n// -60 with local time zone = Europe/Berlin\n\nDate.fromString(\"2023-06-01\")->Date.getTimezoneOffset\n// -120 with local time zone = Europe/Berlin\n```" + ], + "signature": "let getTimezoneOffset: t => int" + }, + { + "id": "Stdlib.Date.getFullYear", + "kind": "value", + "name": "getFullYear", + "docstrings": [ + "`getFullYear(date)`\n\nReturns the year of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20\")->Date.getFullYear\n// 2023\n```" + ], + "signature": "let getFullYear: t => int" + }, + { + "id": "Stdlib.Date.getMonth", + "kind": "value", + "name": "getMonth", + "docstrings": [ + "`getMonth(date)`\n\nReturns the month (0-indexed) of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01\")->Date.getMonth\n// 0\n```" + ], + "signature": "let getMonth: t => int" + }, + { + "id": "Stdlib.Date.getDate", + "kind": "value", + "name": "getDate", + "docstrings": [ + "`getDate(date)`\n\nReturns the date (day of month) of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getDate\n// 20\n```" + ], + "signature": "let getDate: t => int" + }, + { + "id": "Stdlib.Date.getHours", + "kind": "value", + "name": "getHours", + "docstrings": [ + "`getHours(date)`\n\nReturns the hours of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getHours\n// 16\n```" + ], + "signature": "let getHours: t => int" + }, + { + "id": "Stdlib.Date.getMinutes", + "kind": "value", + "name": "getMinutes", + "docstrings": [ + "`getMinutes(date)`\n\nReturns the minutes of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getMinutes\n// 40\n```" + ], + "signature": "let getMinutes: t => int" + }, + { + "id": "Stdlib.Date.getSeconds", + "kind": "value", + "name": "getSeconds", + "docstrings": [ + "`getSeconds(date)`\n\nReturns the seconds of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getSeconds\n// 0\n```" + ], + "signature": "let getSeconds: t => int" + }, + { + "id": "Stdlib.Date.getMilliseconds", + "kind": "value", + "name": "getMilliseconds", + "docstrings": [ + "`getMilliseconds(date)`\n\nReturns the milliseconds of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getMilliseconds\n// 0\n```" + ], + "signature": "let getMilliseconds: t => int" + }, + { + "id": "Stdlib.Date.getDay", + "kind": "value", + "name": "getDay", + "docstrings": [ + "`getDay(date)`\n\nReturns the day of week of a given date (according to local time).\n0 = Sunday, 1 = Monday, ... 6 = Saturday\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getDay\n// 1\n```" + ], + "signature": "let getDay: t => int" + }, + { + "id": "Stdlib.Date.setFullYear", + "kind": "value", + "name": "setFullYear", + "docstrings": [ + "`setFullYear(date, year)`\n\nSets the year 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.setFullYear(2024)\n```" + ], + "signature": "let setFullYear: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setFullYearM", + "kind": "value", + "name": "setFullYearM", + "docstrings": [ + "`setFullYearM(date, ~year, ~month)`\n\nSets the year and 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.setFullYearM(~year=2024, ~month=0)\n```" + ], + "signature": "let setFullYearM: (t, ~year: int, ~month: int) => unit" + }, + { + "id": "Stdlib.Date.setFullYearMD", + "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```" + ], + "signature": "let setFullYearMD: (t, ~year: int, ~month: int, ~date: int) => unit" + }, + { + "id": "Stdlib.Date.setMonth", + "kind": "value", + "name": "setMonth", + "docstrings": [ + "`setMonth(date, month)`\n\nSets the 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.setMonth(0)\n```" + ], + "signature": "let setMonth: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setDate", + "kind": "value", + "name": "setDate", + "docstrings": [ + "`setDate(date, day)`\n\nSets the 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.setDate(1)\n```" + ], + "signature": "let setDate: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setHours", + "kind": "value", + "name": "setHours", + "docstrings": [ + "`setHours(date, hours)`\n\nSets the hours 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.setHours(0)\n```" + ], + "signature": "let setHours: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setHoursM", + "kind": "value", + "name": "setHoursM", + "docstrings": [ + "`setHoursM(date, ~hours, ~minutes)`\n\nSets the hours and minutes 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.setHoursM(~hours=0, ~minutes=0)\n```" + ], + "signature": "let setHoursM: (t, ~hours: int, ~minutes: int) => unit" + }, + { + "id": "Stdlib.Date.setHoursMS", + "kind": "value", + "name": "setHoursMS", + "docstrings": [ + "`setHoursMS(date, ~hours, ~minutes, ~seconds)`\n\nSets the hours, minutes and seconds 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.setHoursMS(~hours=0, ~minutes=0, ~seconds=0)\n```" + ], + "signature": "let setHoursMS: (t, ~hours: int, ~minutes: int, ~seconds: int) => unit" + }, + { + "id": "Stdlib.Date.setHoursMSMs", + "kind": "value", + "name": "setHoursMSMs", + "docstrings": [ + "`setHoursMSMs(date, ~hours, ~minutes, ~seconds, ~milliseconds)`\n\nSets the hours, minutes, seconds and milliseconds 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.setHoursMSMs(~hours=0, ~minutes=0, ~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setHoursMSMs: (\n t,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" + }, + { + "id": "Stdlib.Date.setMinutes", + "kind": "value", + "name": "setMinutes", + "docstrings": [ + "`setMinutes(date, minutes)`\n\nSets the minutes 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.setMinutes(0)\n```" + ], + "signature": "let setMinutes: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setMinutesS", + "kind": "value", + "name": "setMinutesS", + "docstrings": [ + "`setMinutesS(date, ~minutes, ~seconds)`\n\nSets the minutes and seconds 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.setMinutesS(~minutes=0, ~seconds=0)\n```" + ], + "signature": "let setMinutesS: (t, ~minutes: int, ~seconds: int) => unit" + }, + { + "id": "Stdlib.Date.setMinutesSMs", + "kind": "value", + "name": "setMinutesSMs", + "docstrings": [ + "`setMinutesSMs(date, ~minutes, ~seconds, ~milliseconds)`\n\nSets the minutes, seconds and milliseconds 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.setMinutesSMs(~minutes=0, ~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setMinutesSMs: (\n t,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" + }, + { + "id": "Stdlib.Date.setSeconds", + "kind": "value", + "name": "setSeconds", + "docstrings": [ + "`setSeconds(date, seconds)`\n\nSets the seconds 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.setSeconds(0)\n```" + ], + "signature": "let setSeconds: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setSecondsMs", + "kind": "value", + "name": "setSecondsMs", + "docstrings": [ + "`setSecondsMs(date, ~seconds, ~milliseconds)`\n\nSets the seconds and milliseconds 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.setSecondsMs(~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setSecondsMs: (t, ~seconds: int, ~milliseconds: int) => unit" + }, + { + "id": "Stdlib.Date.setMilliseconds", + "kind": "value", + "name": "setMilliseconds", + "docstrings": [ + "`setMilliseconds(date, milliseconds)`\n\nSets the milliseconds 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.setMilliseconds(0)\n```" + ], + "signature": "let setMilliseconds: (t, int) => unit" + }, + { + "id": "Stdlib.Date.getUTCFullYear", + "kind": "value", + "name": "getUTCFullYear", + "docstrings": [ + "`getUTCFullYear(date)`\n\nReturns the year of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCFullYear // 2022\n```" + ], + "signature": "let getUTCFullYear: t => int" + }, + { + "id": "Stdlib.Date.getUTCMonth", + "kind": "value", + "name": "getUTCMonth", + "docstrings": [ + "`getUTCMonth(date)`\n\nReturns the month of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMonth // 11\n```" + ], + "signature": "let getUTCMonth: t => int" + }, + { + "id": "Stdlib.Date.getUTCDate", + "kind": "value", + "name": "getUTCDate", + "docstrings": [ + "`getUTCDate(date)`\n\nReturns the date (day of month) of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCDate // 31\n```" + ], + "signature": "let getUTCDate: t => int" + }, + { + "id": "Stdlib.Date.getUTCHours", + "kind": "value", + "name": "getUTCHours", + "docstrings": [ + "`getUTCHours(date)`\n\nReturns the hours of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCHours // 23\n```" + ], + "signature": "let getUTCHours: t => int" + }, + { + "id": "Stdlib.Date.getUTCMinutes", + "kind": "value", + "name": "getUTCMinutes", + "docstrings": [ + "`getUTCMinutes(date)`\n\nReturns the minutes of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMinutes // 0\n```" + ], + "signature": "let getUTCMinutes: t => int" + }, + { + "id": "Stdlib.Date.getUTCSeconds", + "kind": "value", + "name": "getUTCSeconds", + "docstrings": [ + "`getUTCSeconds(date)`\n\nReturns the seconds of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCSeconds // 0\n```" + ], + "signature": "let getUTCSeconds: t => int" + }, + { + "id": "Stdlib.Date.getUTCMilliseconds", + "kind": "value", + "name": "getUTCMilliseconds", + "docstrings": [ + "`getUTCMilliseconds(date)`\n\nReturns the milliseconds of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMilliseconds // 0\n```" + ], + "signature": "let getUTCMilliseconds: t => int" + }, + { + "id": "Stdlib.Date.getUTCDay", + "kind": "value", + "name": "getUTCDay", + "docstrings": [ + "`getUTCDay(date)`\n\nReturns the day (day of week) of a given date (according to UTC time).\n0 = Sunday, 1 = Monday, ... 6 = Saturday\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCDay // 6\n```" + ], + "signature": "let getUTCDay: t => int" + }, + { + "id": "Stdlib.Date.setUTCFullYear", + "kind": "value", + "name": "setUTCFullYear", + "docstrings": [ + "`setUTCFullYear(date, year)`\n\nSets the year 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.setUTCFullYear(2024)\n```" + ], + "signature": "let setUTCFullYear: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCFullYearM", + "kind": "value", + "name": "setUTCFullYearM", + "docstrings": [ + "`setUTCFullYearM(date, ~year, ~month)`\n\nSets the year and 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.setUTCFullYearM(~year=2024, ~month=0)\n```" + ], + "signature": "let setUTCFullYearM: (t, ~year: int, ~month: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCFullYearMD", + "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```" + ], + "signature": "let setUTCFullYearMD: (t, ~year: int, ~month: int, ~date: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCMonth", + "kind": "value", + "name": "setUTCMonth", + "docstrings": [ + "`setUTCMonth(date, month)`\n\nSets the 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.setUTCMonth(0)\n```" + ], + "signature": "let setUTCMonth: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCDate", + "kind": "value", + "name": "setUTCDate", + "docstrings": [ + "`setDate(date, day)`\n\nSets the 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.setUTCDate(1)\n```" + ], + "signature": "let setUTCDate: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCHours", + "kind": "value", + "name": "setUTCHours", + "docstrings": [ + "`setUTCHours(date, hours)`\n\nSets the hours 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.setUTCHours(0)\n```" + ], + "signature": "let setUTCHours: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCHoursM", + "kind": "value", + "name": "setUTCHoursM", + "docstrings": [ + "`setHoursM(date, ~hours, ~minutes)`\n\nSets the hours and minutes 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.setUTCHoursM(~hours=0, ~minutes=0)\n```" + ], + "signature": "let setUTCHoursM: (t, ~hours: int, ~minutes: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCHoursMS", + "kind": "value", + "name": "setUTCHoursMS", + "docstrings": [ + "`setUTCHoursMS(date, ~hours, ~minutes, ~seconds)`\n\nSets the hours, minutes and seconds 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.setUTCHoursMS(~hours=0, ~minutes=0, ~seconds=0)\n```" + ], + "signature": "let setUTCHoursMS: (t, ~hours: int, ~minutes: int, ~seconds: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCHoursMSMs", + "kind": "value", + "name": "setUTCHoursMSMs", + "docstrings": [ + "`setUTCHoursMSMs(date, ~hours, ~minutes, ~seconds, ~milliseconds)`\n\nSets the hours, minutes, seconds and milliseconds 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.setUTCHoursMSMs(~hours=0, ~minutes=0, ~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setUTCHoursMSMs: (\n t,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" + }, + { + "id": "Stdlib.Date.setUTCMinutes", + "kind": "value", + "name": "setUTCMinutes", + "docstrings": [ + "`setUTCMinutes(date, minutes)`\n\nSets the minutes 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.setUTCMinutes(0)\n```" + ], + "signature": "let setUTCMinutes: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCMinutesS", + "kind": "value", + "name": "setUTCMinutesS", + "docstrings": [ + "`setUTCMinutesS(date, ~minutes, ~seconds)`\n\nSets the minutes and seconds 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.setUTCMinutesS(~minutes=0, ~seconds=0)\n```" + ], + "signature": "let setUTCMinutesS: (t, ~minutes: int, ~seconds: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCMinutesSMs", + "kind": "value", + "name": "setUTCMinutesSMs", + "docstrings": [ + "`setUTCMinutesSMs(date, ~minutes, ~seconds, ~milliseconds)`\n\nSets the minutes, seconds and milliseconds 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.setUTCMinutesSMs(~minutes=0, ~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setUTCMinutesSMs: (\n t,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" + }, + { + "id": "Stdlib.Date.setUTCSeconds", + "kind": "value", + "name": "setUTCSeconds", + "docstrings": [ + "`setUTCSeconds(date, seconds)`\n\nSets the seconds 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.setUTCSeconds(0)\n```" + ], + "signature": "let setUTCSeconds: (t, int) => unit" + }, + { + "id": "Stdlib.Date.setUTCSecondsMs", + "kind": "value", + "name": "setUTCSecondsMs", + "docstrings": [ + "`setUTCSecondsMs(date, ~seconds, ~milliseconds)`\n\nSets the seconds and milliseconds 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.setUTCSecondsMs(~seconds=0, ~milliseconds=0)\n```" + ], + "signature": "let setUTCSecondsMs: (t, ~seconds: int, ~milliseconds: int) => unit" + }, + { + "id": "Stdlib.Date.setUTCMilliseconds", + "kind": "value", + "name": "setUTCMilliseconds", + "docstrings": [ + "`setUTCMilliseconds(date, milliseconds)`\n\nSets the milliseconds 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.setUTCMilliseconds(0)\n```" + ], + "signature": "let setUTCMilliseconds: (t, int) => unit" + }, + { + "id": "Stdlib.Date.toDateString", + "kind": "value", + "name": "toDateString", + "docstrings": [ + "`toDateString(date)`\n\nConverts a JavaScript date to a standard date string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleDateString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toDateString->Console.log\n// Sun Jan 01 2023\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toDateString->Console.log\n// Sat Dec 31 2022\n```" + ], + "signature": "let toDateString: t => string" + }, + { + "id": "Stdlib.Date.toString", + "kind": "value", + "name": "toString", + "docstrings": [ + "`toString(date)`\n\nConverts a JavaScript date to a standard date time string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toString->Console.log\n// Sun Jan 01 2023 00:00:00 GMT+0100 (Central European Standard Time)\n\nDate.fromString(\"2023-06-01T00:00:00.00+01:00\")->Date.toString->Console.log\n// Thu Jun 01 2023 01:00:00 GMT+0200 (Central European Summer Time)\n```" + ], + "signature": "let toString: t => string" + }, + { + "id": "Stdlib.Date.toTimeString", + "kind": "value", + "name": "toTimeString", + "docstrings": [ + "`toTimeString(date)`\n\nConverts a JavaScript date to a standard time string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleStimeString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toTimeString->Console.log\n// 00:00:00 GMT+0100 (Central European Standard Time)\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toTimeString->Console.log\n// 17:00:00 GMT+0100 (Central European Standard Time)\n```" + ], + "signature": "let toTimeString: t => string" + }, + { + "id": "Stdlib.Date.toLocaleDateString", + "kind": "value", + "name": "toLocaleDateString", + "docstrings": [ + "`toLocaleDateString(date)`\n\nConverts a JavaScript date to a localized date string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateString->Console.log\n// 2/19/2023\n```" + ], + "signature": "let toLocaleDateString: t => string" + }, + { + "id": "Stdlib.Date.toLocaleDateStringWithLocale", + "kind": "value", + "name": "toLocaleDateStringWithLocale", + "docstrings": [ + "`toLocaleDateStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized date string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateStringWithLocale(\"en-US\")->Console.log\n// 2/19/2023\n```" + ], + "signature": "let toLocaleDateStringWithLocale: (t, string) => string" + }, + { + "id": "Stdlib.Date.toLocaleDateStringWithLocaleAndOptions", + "kind": "value", + "name": "toLocaleDateStringWithLocaleAndOptions", + "docstrings": [ + "`toLocaleDateStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized date string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"en-US\", { dateStyle: #long })->Console.log\n// February 19, 2023\n\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"de\", { hour: #\"2-digit\", minute: #\"2-digit\" })->Console.log\n// 19.2.2023, 15:40\n\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"de\", { year: #numeric })->Console.log\n// 2023\n```" + ], + "signature": "let toLocaleDateStringWithLocaleAndOptions: (t, string, localeOptions) => string" + }, + { + "id": "Stdlib.Date.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [ + "`toLocaleString(date)`\n\nConverts a JavaScript date to a localized date-time string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleString->Console.log\n// 2/19/2023, 3:40:00 PM\n```" + ], + "signature": "let toLocaleString: t => string" + }, + { + "id": "Stdlib.Date.toLocaleStringWithLocale", + "kind": "value", + "name": "toLocaleStringWithLocale", + "docstrings": [ + "`toLocaleStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized date-time string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleStringWithLocale(\"en-US\")->Console.log\n// 2/19/2023, 3:40:00 PM\n```" + ], + "signature": "let toLocaleStringWithLocale: (t, string) => string" + }, + { + "id": "Stdlib.Date.toLocaleStringWithLocaleAndOptions", + "kind": "value", + "name": "toLocaleStringWithLocaleAndOptions", + "docstrings": [ + "`toLocaleStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized date-time string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleStringWithLocaleAndOptions(\"en\", { dateStyle: #short, timeStyle: #short })->Console.log\n// 2/19/23, 3:40 PM\n\nDate.make()->Date.toLocaleStringWithLocaleAndOptions(\"en\", { era: #long, year: #numeric, month: #\"2-digit\", day: #\"2-digit\", hour: #numeric, timeZoneName: #short })->Console.log\n// 02/19/2023 Anno Domini, 3 PM GMT+1\n```" + ], + "signature": "let toLocaleStringWithLocaleAndOptions: (t, string, localeOptions) => string" + }, + { + "id": "Stdlib.Date.toLocaleTimeString", + "kind": "value", + "name": "toLocaleTimeString", + "docstrings": [ + "`toLocaleTimeString(date)`\n\nConverts a JavaScript date to a localized time string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeString->Console.log\n// 3:40:00 PM\n```" + ], + "signature": "let toLocaleTimeString: t => string" + }, + { + "id": "Stdlib.Date.toLocaleTimeStringWithLocale", + "kind": "value", + "name": "toLocaleTimeStringWithLocale", + "docstrings": [ + "`toLocaleTimeStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized time string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeStringWithLocale(\"en-US\")->Console.log\n// 3:40:00 PM\n```" + ], + "signature": "let toLocaleTimeStringWithLocale: (t, string) => string" + }, + { + "id": "Stdlib.Date.toLocaleTimeStringWithLocaleAndOptions", + "kind": "value", + "name": "toLocaleTimeStringWithLocaleAndOptions", + "docstrings": [ + "`toLocaleTimeStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized time string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeStringWithLocaleAndOptions(\"en-US\", { timeStyle: #long })->Console.log\n// 3:40:00 PM GMT+1\n\nDate.make()->Date.toLocaleTimeStringWithLocaleAndOptions(\"de\", { hour: #\"2-digit\", minute: #\"2-digit\" })->Console.log\n// 15:40\n```" + ], + "signature": "let toLocaleTimeStringWithLocaleAndOptions: (t, string, localeOptions) => string" + }, + { + "id": "Stdlib.Date.toISOString", + "kind": "value", + "name": "toISOString", + "docstrings": [ + "`toISOString(date)`\n\nConverts a JavaScript date to a ISO 8601 string (YYYY-MM-DDTHH:mm:ss.sssZ). The date will be mapped to the UTC time.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toISOString->Console.log\n// 2023-01-01T00:00:00.000Z\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toISOString->Console.log\n// 2022-12-31T16:00:00.000Z\n```" + ], + "signature": "let toISOString: t => string" + }, + { + "id": "Stdlib.Date.toUTCString", + "kind": "value", + "name": "toUTCString", + "docstrings": [ + "`toUTCString(date)`\n\nConverts a JavaScript date to date time string. The date will be mapped to the UTC time.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toUTCString->Console.log\n// Sun, 01 Jan 2023 00:00:00 GMT\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toUTCString->Console.log\n// Sat, 31 Dec 2022 16:00:00 GMT\n```" + ], + "signature": "let toUTCString: t => string" + }, + { + "id": "Stdlib.Date.toJSON", + "kind": "value", + "name": "toJSON", + "docstrings": [ + "`toJSON(date)`\n\nConverts a JavaScript date to a string.\nIf the date is valid, the function will return the same result as `Date.toISOString`.\nInvalid dates will return `None`.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toJSON\n// Some(\"2023-01-01T00:00:00.000Z\")\n\nDate.fromString(\"\")->Date.toJSON\n// None\n```" + ], + "signature": "let toJSON: t => option" + } + ] + }, + "stdlib/dataview": { + "id": "Stdlib.DataView", + "name": "DataView", + "docstrings": [], + "items": [ + { + "id": "Stdlib.DataView.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.DataView.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "docstrings": [], + "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + }, + { + "id": "Stdlib.DataView.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "docstrings": [], + "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.DataView.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "docstrings": [], + "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.DataView.buffer", + "kind": "value", + "name": "buffer", + "docstrings": [], + "signature": "let buffer: t => Stdlib__ArrayBuffer.t" + }, + { + "id": "Stdlib.DataView.byteLength", + "kind": "value", + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t => int" + }, + { + "id": "Stdlib.DataView.byteOffset", + "kind": "value", + "name": "byteOffset", + "docstrings": [], + "signature": "let byteOffset: t => int" + }, + { + "id": "Stdlib.DataView.getInt8", + "kind": "value", + "name": "getInt8", + "docstrings": [], + "signature": "let getInt8: t => int" + }, + { + "id": "Stdlib.DataView.getUint8", + "kind": "value", + "name": "getUint8", + "docstrings": [], + "signature": "let getUint8: t => int" + }, + { + "id": "Stdlib.DataView.getInt16", + "kind": "value", + "name": "getInt16", + "docstrings": [], + "signature": "let getInt16: t => int" + }, + { + "id": "Stdlib.DataView.getUint16", + "kind": "value", + "name": "getUint16", + "docstrings": [], + "signature": "let getUint16: t => int" + }, + { + "id": "Stdlib.DataView.getInt32", + "kind": "value", + "name": "getInt32", + "docstrings": [], + "signature": "let getInt32: t => int" + }, + { + "id": "Stdlib.DataView.getUint32", + "kind": "value", + "name": "getUint32", + "docstrings": [], + "signature": "let getUint32: t => int" + }, + { + "id": "Stdlib.DataView.getFloat32", + "kind": "value", + "name": "getFloat32", + "docstrings": [], + "signature": "let getFloat32: t => float" + }, + { + "id": "Stdlib.DataView.getFloat64", + "kind": "value", + "name": "getFloat64", + "docstrings": [], + "signature": "let getFloat64: t => float" + }, + { + "id": "Stdlib.DataView.getBigInt64", + "kind": "value", + "name": "getBigInt64", + "docstrings": [], + "signature": "let getBigInt64: t => bigint" + }, + { + "id": "Stdlib.DataView.getBigUint64", + "kind": "value", + "name": "getBigUint64", + "docstrings": [], + "signature": "let getBigUint64: t => bigint" + }, + { + "id": "Stdlib.DataView.setInt8", + "kind": "value", + "name": "setInt8", + "docstrings": [], + "signature": "let setInt8: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint8", + "kind": "value", + "name": "setUint8", + "docstrings": [], + "signature": "let setUint8: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setInt16", + "kind": "value", + "name": "setInt16", + "docstrings": [], + "signature": "let setInt16: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint16", + "kind": "value", + "name": "setUint16", + "docstrings": [], + "signature": "let setUint16: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setInt32", + "kind": "value", + "name": "setInt32", + "docstrings": [], + "signature": "let setInt32: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint32", + "kind": "value", + "name": "setUint32", + "docstrings": [], + "signature": "let setUint32: (t, int) => unit" + }, + { + "id": "Stdlib.DataView.setFloat32", + "kind": "value", + "name": "setFloat32", + "docstrings": [], + "signature": "let setFloat32: (t, float) => unit" + }, + { + "id": "Stdlib.DataView.setFloat64", + "kind": "value", + "name": "setFloat64", + "docstrings": [], + "signature": "let setFloat64: (t, float) => unit" + }, + { + "id": "Stdlib.DataView.setBigInt64", + "kind": "value", + "name": "setBigInt64", + "docstrings": [], + "signature": "let setBigInt64: (t, bigint) => unit" + }, + { + "id": "Stdlib.DataView.setBigUint64", + "kind": "value", + "name": "setBigUint64", + "docstrings": [], + "signature": "let setBigUint64: (t, bigint) => unit" + } + ] + }, + "stdlib/console": { + "id": "Stdlib.Console", + "name": "Console", + "docstrings": [ + "Functions for interacting with JavaScript console.\n\nSee: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console)." + ], + "items": [ + { + "id": "Stdlib.Console.assert_", + "kind": "value", + "name": "assert_", + "docstrings": [ + "`assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`.\n\nSee [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert)\non MDN.\n\n## Examples\n\n```rescript\nConsole.assert_(false, \"Hello World!\")\nConsole.assert_(42 == 42, \"The answer\")\n```" + ], + "signature": "let assert_: (bool, 'a) => unit" + }, + { + "id": "Stdlib.Console.assert2", + "kind": "value", + "name": "assert2", + "docstrings": [ + "`assert2(v1, v2)`. Like `assert_`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.assert2(false, \"Hello\", \"World\")\nConsole.assert2(42 == 42, [1, 2, 3], '4')\n```" + ], + "signature": "let assert2: (bool, 'a, 'b) => unit" + }, + { + "id": "Stdlib.Console.assert3", + "kind": "value", + "name": "assert3", + "docstrings": [ + "`assert3(v1, v2, v3)`. Like `assert_`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.assert3(false, \"Hello\", \"World\", \"ReScript\")\nConsole.assert3(42 == 42, \"One\", 2, #3)\n```" + ], + "signature": "let assert3: (bool, 'a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.assert4", + "kind": "value", + "name": "assert4", + "docstrings": [ + "`assert4(v1, v2, v3, v4)`. Like `assert_`, but with four arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert4(false, \"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.assert4(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + ], + "signature": "let assert4: (bool, 'a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.assert5", + "kind": "value", + "name": "assert5", + "docstrings": [ + "`assert5(v1, v2, v3, v4, v5)`. Like `assert_`, but with five arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert5(false, \"Hello\", \"World\", \"JS\", '!', '!')\nConsole.assert5(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.assert6", + "kind": "value", + "name": "assert6", + "docstrings": [ + "`assert6(v1, v2)`. Like `assert_`, but with six arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert6(false, \"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.assert6(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.assertMany", + "kind": "value", + "name": "assertMany", + "docstrings": [ + "`assertMany(assertion, arr)`. Like `assert_`, but variadic.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assertMany(false, [\"Hello\", \"World\"])\nConsole.assertMany(value == 42, [1, 2, 3])\n```" + ], + "signature": "let assertMany: (bool, array<'a>) => unit" + }, + { + "id": "Stdlib.Console.clear", + "kind": "value", + "name": "clear", + "docstrings": [ + "`clear()` clears the console, if allowed.\n\nSee [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear)\non MDN.\n\n## Examples\n\n```rescript\nConsole.clear()\n```" + ], + "signature": "let clear: unit => unit" + }, + { + "id": "Stdlib.Console.count", + "kind": "value", + "name": "count", + "docstrings": [ + "`count(label)` prints to the console the number of times it's been called with the given label.\n\nSee [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count)\non MDN.\n\n## Examples\n\n```rescript\nConsole.count(\"rescript\")\n```" + ], + "signature": "let count: string => unit" + }, + { + "id": "Stdlib.Console.countReset", + "kind": "value", + "name": "countReset", + "docstrings": [ + "`countReset(label)` resets the count for the given label to 0.\n\nSee [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset)\non MDN.\n\n## Examples\n\n```rescript\nConsole.countReset(\"rescript\")\n```" + ], + "signature": "let countReset: string => unit" + }, + { + "id": "Stdlib.Console.debug", + "kind": "value", + "name": "debug", + "docstrings": [ + "`debug(value)` print a debug message to console.\n\nSee [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug)\non MDN.\n\n## Examples\n\n```rescript\nConsole.debug(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.debug(obj)\n```" + ], + "signature": "let debug: 'a => unit" + }, + { + "id": "Stdlib.Console.debug2", + "kind": "value", + "name": "debug2", + "docstrings": [ + "`debug2(v1, v2)`. Like `debug`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.debug2(\"Hello\", \"World\")\nConsole.debug2([1, 2, 3], '4')\n```" + ], + "signature": "let debug2: ('a, 'b) => unit" + }, + { + "id": "Stdlib.Console.debug3", + "kind": "value", + "name": "debug3", + "docstrings": [ + "`debug3(v1, v2, v3)`. Like `debug`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.debug3(\"Hello\", \"World\", \"ReScript\")\nConsole.debug3(\"One\", 2, #3)\n```" + ], + "signature": "let debug3: ('a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.debug4", + "kind": "value", + "name": "debug4", + "docstrings": [ + "`debug4(v1, v2, v3, v4)`. Like `debug`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.debug4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.debug4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + ], + "signature": "let debug4: ('a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.debug5", + "kind": "value", + "name": "debug5", + "docstrings": [ + "`debug5(v1, v2, v3, v4, v5)`. Like `debug`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.debug5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.debug5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let debug5: ('a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.debug6", + "kind": "value", + "name": "debug6", + "docstrings": [ + "`debug6(v1, v2, v3, v4, v5, v6)`. Like `debug`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.debug6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.debug6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.debugMany", + "kind": "value", + "name": "debugMany", + "docstrings": [ + "`debugMany(arr)`. Like `debug`, but variadic.\n\n## Examples\n\n```rescript\nConsole.debugMany([\"Hello\", \"World\"])\nConsole.debugMany([1, 2, 3])\n```" + ], + "signature": "let debugMany: array<'a> => unit" + }, + { + "id": "Stdlib.Console.dir", + "kind": "value", + "name": "dir", + "docstrings": [ + "`dir(object)` displays an interactive view of the object in the console.\n\nSee [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir)\non MDN.\n\n## Examples\n\n```rescript\nConsole.dir({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" + ], + "signature": "let dir: 'a => unit" + }, + { + "id": "Stdlib.Console.dirxml", + "kind": "value", + "name": "dirxml", + "docstrings": [ + "`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console.\n\nSee [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml)\non MDN." + ], + "signature": "let dirxml: 'a => unit" + }, + { + "id": "Stdlib.Console.error", + "kind": "value", + "name": "error", + "docstrings": [ + "`error(value)` prints an error message to console.\n\nSee [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\non MDN.\n\n## Examples\n\n```rescript\nConsole.error(\"error message\")\nConsole.error((\"error\", \"invalid value\"))\n```" + ], + "signature": "let error: 'a => unit" + }, + { + "id": "Stdlib.Console.error2", + "kind": "value", + "name": "error2", + "docstrings": [ + "`error(v1, v2)`. Like `error`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.error2(\"Error\", \"here\")\nConsole.error2((\"log\", \"error\"), \"message\")\n```" + ], + "signature": "let error2: ('a, 'b) => unit" + }, + { + "id": "Stdlib.Console.error3", + "kind": "value", + "name": "error3", + "docstrings": [ + "`error3(v1, v2, v3)`. Like `error`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.error3(\"Hello\", \"World\", \"!!!\")\nConsole.error3(#first, #second, #third)\n```" + ], + "signature": "let error3: ('a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.error4", + "kind": "value", + "name": "error4", + "docstrings": [ + "`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.error4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.error4(#first, #second, #third, (\"fourth\"))\n```" + ], + "signature": "let error4: ('a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.error5", + "kind": "value", + "name": "error5", + "docstrings": [ + "`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.error5('e', 'r', 'r', 'o', 'r')\nConsole.error5(1, #second, #third, (\"fourth\"), 'c')\n```" + ], + "signature": "let error5: ('a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.error6", + "kind": "value", + "name": "error6", + "docstrings": [ + "`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.error6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.error6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.group", + "kind": "value", + "name": "group", + "docstrings": [ + "`group(label)` creates a new \"group\" level with the given label.\n\nSee [`console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group)\non MDN.\n\n## Example\n\n```rescript\nConsole.group(\"first group\")\nConsole.group(\"second group\")\nConsole.log(\"a message on the second level\")\nConsole.groupEnd()\nConsole.log(\"a message message on the first level\")\nConsole.groupEnd()\n```" + ], + "signature": "let group: string => unit" + }, + { + "id": "Stdlib.Console.groupCollapsed", + "kind": "value", + "name": "groupCollapsed", + "docstrings": [ + "`groupCollapsed(label)`. Like `group` but collapses the group initially.\n\nSee [`console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed)\non MDN." + ], + "signature": "let groupCollapsed: string => unit" + }, + { + "id": "Stdlib.Console.groupEnd", + "kind": "value", + "name": "groupEnd", + "docstrings": [ + "`groupEnd()` ends the current group.\n\nSee [`console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd)\non MDN." + ], + "signature": "let groupEnd: unit => unit" + }, + { + "id": "Stdlib.Console.errorMany", + "kind": "value", + "name": "errorMany", + "docstrings": [ + "`errorMany(arr)`. Like `error`, but variadic.\n\n## Examples\n\n```rescript\nConsole.errorMany([\"Hello\", \"World\"])\nConsole.errorMany([1, 2, 3])\n```" + ], + "signature": "let errorMany: array<'a> => unit" + }, + { + "id": "Stdlib.Console.info", + "kind": "value", + "name": "info", + "docstrings": [ + "`info(value)` print an informational message to console.\n\nSee [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info)\non MDN.\n\n## Examples\n\n```rescript\nConsole.info(\"Information\")\nConsole.info((\"Hello\", \"JS\"))\n```" + ], + "signature": "let info: 'a => unit" + }, + { + "id": "Stdlib.Console.info2", + "kind": "value", + "name": "info2", + "docstrings": [ + "`info2(v1, v2)`. Like `info`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.info2(\"Info\", \"failed to download\")\nConsole.info2(#info, {\"name\": \"ReScript\"})\n```" + ], + "signature": "let info2: ('a, 'b) => unit" + }, + { + "id": "Stdlib.Console.info3", + "kind": "value", + "name": "info3", + "docstrings": [ + "`info3(v1, v2, v3)`. Like `info`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.info3(\"Hello\", \"World\", \"ReScript\")\nConsole.info3([1, 2, 3], #4, #5)\n```" + ], + "signature": "let info3: ('a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.info4", + "kind": "value", + "name": "info4", + "docstrings": [ + "`info4(v1, v2, v3, v4)`. Like `info`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.info4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.info4([1, 2, 3], #4, #5, #lastinfo)\n```" + ], + "signature": "let info4: ('a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.info5", + "kind": "value", + "name": "info5", + "docstrings": [ + "`info5(v1, v2, v3, v4, v5)`. Like `info`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.info5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.info5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let info5: ('a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.info6", + "kind": "value", + "name": "info6", + "docstrings": [ + "`info6(v1, v2, v3, v4, v5, v6)`. Like `info`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.info6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.info6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.infoMany", + "kind": "value", + "name": "infoMany", + "docstrings": [ + "`infoMany(arr)`. Like `info`, but variadic.\n\n## Examples\n\n```rescript\nConsole.infoMany([\"Hello\", \"World\"])\nConsole.infoMany([1, 2, 3])\n```" + ], + "signature": "let infoMany: array<'a> => unit" + }, + { + "id": "Stdlib.Console.log", + "kind": "value", + "name": "log", + "docstrings": [ + "`log(value)` print a message to console.\n\nSee [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log)\non MDN.\n\n## Examples\n\n```rescript\nConsole.log(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.log(obj)\n```" + ], + "signature": "let log: 'a => unit" + }, + { + "id": "Stdlib.Console.log2", + "kind": "value", + "name": "log2", + "docstrings": [ + "`log2(v1, v2)`. Like `log`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.log2(\"Hello\", \"World\")\nConsole.log2([1, 2, 3], '4')\n```" + ], + "signature": "let log2: ('a, 'b) => unit" + }, + { + "id": "Stdlib.Console.log3", + "kind": "value", + "name": "log3", + "docstrings": [ + "`log3(v1, v2, v3)`. Like `log`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.log3(\"Hello\", \"World\", \"ReScript\")\nConsole.log3(\"One\", 2, #3)\n```" + ], + "signature": "let log3: ('a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.log4", + "kind": "value", + "name": "log4", + "docstrings": [ + "`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.log4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.log4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + ], + "signature": "let log4: ('a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.log5", + "kind": "value", + "name": "log5", + "docstrings": [ + "`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.log5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.log5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let log5: ('a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.log6", + "kind": "value", + "name": "log6", + "docstrings": [ + "`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.log6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.log6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.logMany", + "kind": "value", + "name": "logMany", + "docstrings": [ + "`logMany(arr)`. Like `log`, but variadic.\n\n## Examples\n\n```rescript\nConsole.logMany([\"Hello\", \"World\"])\nConsole.logMany([1, 2, 3])\n```" + ], + "signature": "let logMany: array<'a> => unit" + }, + { + "id": "Stdlib.Console.table", + "kind": "value", + "name": "table", + "docstrings": [ + "`table(object)` displays an tabular view of the object in the console.\n\nSee [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table)\non MDN.\n\n## Examples\n\n```rescript\nConsole.table({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" + ], + "signature": "let table: 'a => unit" + }, + { + "id": "Stdlib.Console.time", + "kind": "value", + "name": "time", + "docstrings": [ + "`time(label)` creates a timer to measure how long an operation takes. `label`\nmust be a unique name. Call `console.timeEnd` with the same `label` to print\noutput time.\n\nSee [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" + ], + "signature": "let time: string => unit" + }, + { + "id": "Stdlib.Console.timeEnd", + "kind": "value", + "name": "timeEnd", + "docstrings": [ + "`timeEnd(label)` stops a timer created by `time`.\n\nSee [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" + ], + "signature": "let timeEnd: string => unit" + }, + { + "id": "Stdlib.Console.timeLog", + "kind": "value", + "name": "timeLog", + "docstrings": [ + "`timeLog(label)` prints the current elapsed time of the given timer to the console.\n\nSee [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" + ], + "signature": "let timeLog: string => unit" + }, + { + "id": "Stdlib.Console.trace", + "kind": "value", + "name": "trace", + "docstrings": [ + "`trace()` print a stack trace to console.\n\nSee [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace)\non MDN.\n\n## Examples\n\n```rescript\nlet main = () => {\n Console.trace()\n}\nmain()\n// In the console, the following trace will be displayed:\n// main\n// \n```" + ], + "signature": "let trace: unit => unit" + }, + { + "id": "Stdlib.Console.warn", + "kind": "value", + "name": "warn", + "docstrings": [ + "`warn(value)` print a warning message to console.\n\nSee [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn)\non MDN.\n\n## Examples\n\n```rescript\nConsole.warn(\"Warning\")\nConsole.warn((\"Warning\", \"invalid number\"))\n```" + ], + "signature": "let warn: 'a => unit" + }, + { + "id": "Stdlib.Console.warn2", + "kind": "value", + "name": "warn2", + "docstrings": [ + "`warn2(v1, v2)`. Like `warn`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.warn2(\"Hello\", \"World\")\nConsole.warn2([1, 2, 3], 4)\n```" + ], + "signature": "let warn2: ('a, 'b) => unit" + }, + { + "id": "Stdlib.Console.warn3", + "kind": "value", + "name": "warn3", + "docstrings": [ + "`warn3(v1, v2, v3)`. Like `warn`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.warn3(\"Hello\", \"World\", \"ReScript\")\nConsole.warn3([1, 2, 3], #4, #5)\n```" + ], + "signature": "let warn3: ('a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.warn4", + "kind": "value", + "name": "warn4", + "docstrings": [ + "`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.warn4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.warn4(#first, #second, #third, (\"fourth\"))\n```" + ], + "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.warn5", + "kind": "value", + "name": "warn5", + "docstrings": [ + "`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.warn5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.warn5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let warn5: ('a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.warn6", + "kind": "value", + "name": "warn6", + "docstrings": [ + "`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.warn6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.warn6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.warnMany", + "kind": "value", + "name": "warnMany", + "docstrings": [ + "`warnMany(arr)`. Like `warn`, but variadic.\n\n## Examples\n\n```rescript\nConsole.warnMany([\"Hello\", \"World\"])\nConsole.warnMany([1, 2, 3])\n```" + ], + "signature": "let warnMany: array<'a> => unit" + } + ] + }, + "stdlib/array": { + "id": "Stdlib.Array", + "name": "Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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 ```" + ], + "signature": "let fromIterator: Stdlib__Iterator.t<'a> => array<'a>" + }, + { + "id": "Stdlib.Array.fromArrayLike", + "kind": "value", + "name": "fromArrayLike", + "docstrings": [], + "signature": "let fromArrayLike: Js.Array2.array_like<'a> => array<'a>" + }, + { + "id": "Stdlib.Array.fromArrayLikeWithMap", + "kind": "value", + "name": "fromArrayLikeWithMap", + "docstrings": [], + "signature": "let fromArrayLikeWithMap: (Js.Array2.array_like<'a>, 'a => 'b) => array<'b>" + }, + { + "id": "Stdlib.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 ```" + ], + "signature": "let make: (~length: int, 'a) => array<'a>" + }, + { + "id": "Stdlib.Array.fromInitializer", + "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 ```" + ], + "signature": "let fromInitializer: (~length: int, int => 'a) => array<'a>" + }, + { + "id": "Stdlib.Array.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (array<'a>, array<'a>, ('a, 'a) => bool) => bool" + }, + { + "id": "Stdlib.Array.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + }, + { + "id": "Stdlib.Array.isArray", + "kind": "value", + "name": "isArray", + "docstrings": [], + "signature": "let isArray: 'a => bool" + }, + { + "id": "Stdlib.Array.length", + "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```" + ], + "signature": "let length: array<'a> => int" + }, + { + "id": "Stdlib.Array.copyAllWithin", + "kind": "value", + "name": "copyAllWithin", + "docstrings": [], + "signature": "let copyAllWithin: (array<'a>, ~target: int) => array<'a>" + }, + { + "id": "Stdlib.Array.copyWithinToEnd", + "kind": "value", + "name": "copyWithinToEnd", + "docstrings": [], + "signature": "let copyWithinToEnd: (array<'a>, ~target: int, ~start: int) => array<'a>" + }, + { + "id": "Stdlib.Array.copyWithin", + "kind": "value", + "name": "copyWithin", + "docstrings": [], + "signature": "let copyWithin: (\n array<'a>,\n ~target: int,\n ~start: int,\n ~end: int,\n) => array<'a>" + }, + { + "id": "Stdlib.Array.fillAll", + "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```" + ], + "signature": "let fillAll: (array<'a>, 'a) => unit" + }, + { + "id": "Stdlib.Array.fillToEnd", + "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```" + ], + "signature": "let fillToEnd: (array<'a>, 'a, ~start: int) => unit" + }, + { + "id": "Stdlib.Array.fill", + "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```" + ], + "signature": "let fill: (array<'a>, 'a, ~start: int, ~end: int) => unit" + }, + { + "id": "Stdlib.Array.pop", + "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```" + ], + "signature": "let pop: array<'a> => option<'a>" + }, + { + "id": "Stdlib.Array.push", + "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```" + ], + "signature": "let push: (array<'a>, 'a) => unit" + }, + { + "id": "Stdlib.Array.pushMany", + "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```" + ], + "signature": "let pushMany: (array<'a>, array<'a>) => unit" + }, + { + "id": "Stdlib.Array.reverse", + "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```" + ], + "signature": "let reverse: array<'a> => unit" + }, + { + "id": "Stdlib.Array.shift", + "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```" + ], + "signature": "let shift: array<'a> => option<'a>" + }, + { + "id": "Stdlib.Array.toSorted", + "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```" + ], + "signature": "let toSorted: (array<'a>, ('a, 'a) => Stdlib__Ordering.t) => array<'a>" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let sort: (array<'a>, ('a, 'a) => Stdlib__Ordering.t) => unit" + }, + { + "id": "Stdlib.Array.splice", + "kind": "value", + "name": "splice", + "docstrings": [], + "signature": "let splice: (\n array<'a>,\n ~start: int,\n ~remove: int,\n ~insert: array<'a>,\n) => unit" + }, + { + "id": "Stdlib.Array.toSpliced", + "kind": "value", + "name": "toSpliced", + "docstrings": [], + "signature": "let toSpliced: (\n array<'a>,\n ~start: int,\n ~remove: int,\n ~insert: array<'a>,\n) => array<'a>" + }, + { + "id": "Stdlib.Array.with", + "kind": "value", + "name": "with", + "docstrings": [], + "signature": "let with: (array<'a>, int, 'a) => array<'a>" + }, + { + "id": "Stdlib.Array.unshift", + "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```" + ], + "signature": "let unshift: (array<'a>, 'a) => unit" + }, + { + "id": "Stdlib.Array.unshiftMany", + "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```" + ], + "signature": "let unshiftMany: (array<'a>, array<'a>) => unit" + }, + { + "id": "Stdlib.Array.concat", + "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```" + ], + "signature": "let concat: (array<'a>, array<'a>) => array<'a>" + }, + { + "id": "Stdlib.Array.concatMany", + "kind": "value", + "name": "concatMany", + "docstrings": [ + "`concatMany(array1, arrays)` concatenates array1 with several other 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\"]\nlet array3 = [\"wehoo\"]\n\nlet someArray = array1->Array.concatMany([array2, array3])\n\nConsole.log(someArray) // [\"hi\", \"hello\", \"yay\", \"wehoo\"]\n```" + ], + "signature": "let concatMany: (array<'a>, array>) => array<'a>" + }, + { + "id": "Stdlib.Array.flat", + "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```" + ], + "signature": "let flat: array> => array<'a>" + }, + { + "id": "Stdlib.Array.includes", + "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```" + ], + "signature": "let includes: (array<'a>, 'a) => bool" + }, + { + "id": "Stdlib.Array.indexOf", + "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```" + ], + "signature": "let indexOf: (array<'a>, 'a) => int" + }, + { + "id": "Stdlib.Array.indexOfOpt", + "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```" + ], + "signature": "let indexOfOpt: (array<'a>, 'a) => option" + }, + { + "id": "Stdlib.Array.indexOfFrom", + "kind": "value", + "name": "indexOfFrom", + "docstrings": [], + "signature": "let indexOfFrom: (array<'a>, 'a, int) => int" + }, + { + "id": "Stdlib.Array.join", + "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```" + ], + "signature": "let join: (array, string) => string" + }, + { + "id": "Stdlib.Array.joinWith", + "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```" + ], + "signature": "let joinWith: (array, string) => string", + "deprecated": "Use `join` instead" + }, + { + "id": "Stdlib.Array.joinUnsafe", + "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```" + ], + "signature": "let joinUnsafe: (array<'a>, string) => string" + }, + { + "id": "Stdlib.Array.joinWithUnsafe", + "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```" + ], + "signature": "let joinWithUnsafe: (array<'a>, string) => string", + "deprecated": "Use `joinUnsafe` instead" + }, + { + "id": "Stdlib.Array.lastIndexOf", + "kind": "value", + "name": "lastIndexOf", + "docstrings": [], + "signature": "let lastIndexOf: (array<'a>, 'a) => int" + }, + { + "id": "Stdlib.Array.lastIndexOfOpt", + "kind": "value", + "name": "lastIndexOfOpt", + "docstrings": [], + "signature": "let lastIndexOfOpt: (array<'a>, 'a) => option" + }, + { + "id": "Stdlib.Array.lastIndexOfFrom", + "kind": "value", + "name": "lastIndexOfFrom", + "docstrings": [], + "signature": "let lastIndexOfFrom: (array<'a>, 'a, int) => int" + }, + { + "id": "Stdlib.Array.slice", + "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```" + ], + "signature": "let slice: (array<'a>, ~start: int, ~end: int) => array<'a>" + }, + { + "id": "Stdlib.Array.sliceToEnd", + "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```" + ], + "signature": "let sliceToEnd: (array<'a>, ~start: int) => array<'a>" + }, + { + "id": "Stdlib.Array.copy", + "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```" + ], + "signature": "let copy: array<'a> => array<'a>" + }, + { + "id": "Stdlib.Array.toString", + "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```" + ], + "signature": "let toString: array<'a> => string" + }, + { + "id": "Stdlib.Array.toLocaleString", + "kind": "value", + "name": "toLocaleString", + "docstrings": [], + "signature": "let toLocaleString: array<'a> => string" + }, + { + "id": "Stdlib.Array.every", + "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```" + ], + "signature": "let every: (array<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.Array.everyWithIndex", + "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```" + ], + "signature": "let everyWithIndex: (array<'a>, ('a, int) => bool) => bool" + }, + { + "id": "Stdlib.Array.filter", + "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```" + ], + "signature": "let filter: (array<'a>, 'a => bool) => array<'a>" + }, + { + "id": "Stdlib.Array.filterWithIndex", + "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```" + ], + "signature": "let filterWithIndex: (array<'a>, ('a, int) => bool) => array<'a>" + }, + { + "id": "Stdlib.Array.find", + "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```" + ], + "signature": "let find: (array<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.Array.findWithIndex", + "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```" + ], + "signature": "let findWithIndex: (array<'a>, ('a, int) => bool) => option<'a>" + }, + { + "id": "Stdlib.Array.findIndex", + "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```" + ], + "signature": "let findIndex: (array<'a>, 'a => bool) => int" + }, + { + "id": "Stdlib.Array.findIndexWithIndex", + "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```" + ], + "signature": "let findIndexWithIndex: (array<'a>, ('a, int) => bool) => int" + }, + { + "id": "Stdlib.Array.forEach", + "kind": "value", + "name": "forEach", + "docstrings": [ + "`forEach(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.forEach(item => {\n Console.log(item)\n})\n```" + ], + "signature": "let forEach: (array<'a>, 'a => unit) => unit" + }, + { + "id": "Stdlib.Array.forEachWithIndex", + "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```" + ], + "signature": "let forEachWithIndex: (array<'a>, ('a, int) => unit) => unit" + }, + { + "id": "Stdlib.Array.map", + "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```" + ], + "signature": "let map: (array<'a>, 'a => 'b) => array<'b>" + }, + { + "id": "Stdlib.Array.mapWithIndex", + "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```" + ], + "signature": "let mapWithIndex: (array<'a>, ('a, int) => 'b) => array<'b>" + }, + { + "id": "Stdlib.Array.reduce", + "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 ```" + ], + "signature": "let reduce: (array<'a>, 'b, ('b, 'a) => 'b) => 'b" + }, + { + "id": "Stdlib.Array.reduceWithIndex", + "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 ```" + ], + "signature": "let reduceWithIndex: (array<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + }, + { + "id": "Stdlib.Array.reduceRight", + "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 ```" + ], + "signature": "let reduceRight: (array<'a>, 'b, ('b, 'a) => 'b) => 'b" + }, + { + "id": "Stdlib.Array.reduceRightWithIndex", + "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 ```" + ], + "signature": "let reduceRightWithIndex: (array<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + }, + { + "id": "Stdlib.Array.some", + "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```" + ], + "signature": "let some: (array<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.Array.someWithIndex", + "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```" + ], + "signature": "let someWithIndex: (array<'a>, ('a, int) => bool) => bool" + }, + { + "id": "Stdlib.Array.get", + "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```" + ], + "signature": "let get: (array<'a>, int) => option<'a>" + }, + { + "id": "Stdlib.Array.set", + "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```" + ], + "signature": "let set: (array<'a>, int, 'a) => unit" + }, + { + "id": "Stdlib.Array.getSymbol", + "kind": "value", + "name": "getSymbol", + "docstrings": [], + "signature": "let getSymbol: (array<'a>, Stdlib__Symbol.t) => option<'b>" + }, + { + "id": "Stdlib.Array.getSymbolUnsafe", + "kind": "value", + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: (array<'a>, Stdlib__Symbol.t) => 'b" + }, + { + "id": "Stdlib.Array.setSymbol", + "kind": "value", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: (array<'a>, Stdlib__Symbol.t, 'b) => unit" + }, + { + "id": "Stdlib.Array.getUnsafe", + "kind": "value", + "name": "getUnsafe", + "docstrings": [ + "`getUnsafe(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.getUnsafe` only when you are sure the `index` exists (i.e. when using for-loop).\n\n## Examples\n```rescript\nlet array = [1, 2, 3]\nfor index in 0 to array->Array.length - 1 {\n let value = array->Array.getUnsafe(index)\n Console.log(value)\n}\n```" + ], + "signature": "let getUnsafe: (array<'a>, int) => 'a" + }, + { + "id": "Stdlib.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```" + ], + "signature": "let setUnsafe: (array<'a>, int, 'a) => unit" + }, + { + "id": "Stdlib.Array.findIndexOpt", + "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```" + ], + "signature": "let findIndexOpt: (array<'a>, 'a => bool) => option" + }, + { + "id": "Stdlib.Array.toReversed", + "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```" + ], + "signature": "let toReversed: array<'a> => array<'a>" + }, + { + "id": "Stdlib.Array.filterMap", + "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```" + ], + "signature": "let filterMap: (array<'a>, 'a => option<'b>) => array<'b>" + }, + { + "id": "Stdlib.Array.keepSome", + "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 ```" + ], + "signature": "let keepSome: array> => array<'a>" + }, + { + "id": "Stdlib.Array.toShuffled", + "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```" + ], + "signature": "let toShuffled: array<'a> => array<'a>" + }, + { + "id": "Stdlib.Array.shuffle", + "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```" + ], + "signature": "let shuffle: array<'a> => unit" + }, + { + "id": "Stdlib.Array.flatMap", + "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```" + ], + "signature": "let flatMap: (array<'a>, 'a => array<'b>) => array<'b>" + }, + { + "id": "Stdlib.Array.flatMapWithIndex", + "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```" + ], + "signature": "let flatMapWithIndex: (array<'a>, ('a, int) => array<'b>) => array<'b>" + }, + { + "id": "Stdlib.Array.findMap", + "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 ```" + ], + "signature": "let findMap: (array<'a>, 'a => option<'b>) => option<'b>" + }, + { + "id": "Stdlib.Array.at", + "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 ```" + ], + "signature": "let at: (array<'a>, int) => option<'a>" + }, + { + "id": "Stdlib.Array.last", + "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```" + ], + "signature": "let last: array<'a> => option<'a>" + } + ] + } +} diff --git a/pages/docs/manual/v12.0.0/api.mdx b/pages/docs/manual/v12.0.0/api.mdx index 0fa1a42a2..b1030fcba 100644 --- a/pages/docs/manual/v12.0.0/api.mdx +++ b/pages/docs/manual/v12.0.0/api.mdx @@ -1,14 +1,20 @@ # Overview -## ReScript Core +## Stdlib -[Core](api/core) is ReScript's new standard library. It replaces the complete `Js` module as well as some of the more frequently used modules from `Belt` and is recommended to use with uncurried mode. +[Stdlib](api/stdlib) is ReScript's new standard library. It replaces the complete `Js` module as well as some of the more frequently used modules from `Belt` and is recommended to use with uncurried mode. -In ReScript 11, it is shipped as a separate npm package `@rescript/core` that is added to your project as per the [installation instructions](/docs/manual/next/installation). In future ReScript versions, it will be included with the `rescript` npm package itself. +In ReScript 11, it was shipped as a separate npm package `@rescript/core`. + +Since Rescript 12, it is now included with the `rescript` npm package itself. ## Additional Libraries ReScript ships with these two additional modules in its standard library: -- [Belt](api/belt): immutable collections and extra helpers not available in [Core](api/core). -- [Dom](api/dom): Dom related types and modules. Contains our standardized types used by various userland DOM bindings. \ No newline at end of file +- [Belt](api/belt): immutable collections and extra helpers not available in JavaScript / [Stdlib](api/stdlib). +- [Dom](api/dom): Dom related types and modules. Contains our standardized types used by various userland DOM bindings. + +## Legacy Modules + +The [Js](api/js) module is superseded by [Stdlib](api/stdlib). diff --git a/src/ApiDocs.res b/src/ApiDocs.res index c3be8314b..39c127788 100644 --- a/src/ApiDocs.res +++ b/src/ApiDocs.res @@ -148,7 +148,7 @@ module SidebarTree = { }} | false => -
  • +
  • {node.name->React.string} diff --git a/src/layouts/ApiOverviewLayout.res b/src/layouts/ApiOverviewLayout.res index f24b183cc..ebfc2087e 100644 --- a/src/layouts/ApiOverviewLayout.res +++ b/src/layouts/ApiOverviewLayout.res @@ -5,7 +5,11 @@ let makeCategories: string => array = version => [ name: "", items: [ {name: "Overview", href: `/docs/manual/${version}/api`}, - {name: "Core", href: `/docs/manual/${version}/api/core`}, + if version >= "v12.0.0" { + {name: "Stdlib", href: `/docs/manual/${version}/api/stdlib`} + } else { + {name: "Core", href: `/docs/manual/${version}/api/core`} + }, ], }, { From 403b2e359d38548a7213a5e17f814afe756a3b3e Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 12:43:18 +0200 Subject: [PATCH 03/10] fix doc generation for v12 --- data/api/v12.0.0/belt.json | 388 +- data/api/v12.0.0/core.json | 10498 ------------------------------- data/api/v12.0.0/js.json | 5646 +++++------------ data/api/v12.0.0/stdlib.json | 9656 ++++++++++++++++------------ data/api/v12.0.0/toc_tree.json | 2 +- scripts/gendocs.res | 48 +- src/bindings/Node.res | 3 +- 7 files changed, 7593 insertions(+), 18648 deletions(-) delete mode 100644 data/api/v12.0.0/core.json diff --git a/data/api/v12.0.0/belt.json b/data/api/v12.0.0/belt.json index 1ddfea26c..ba0eb1e34 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## 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 `rescript.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": [] }, @@ -2168,7 +2168,7 @@ "kind": "value", "name": "findFirstBy", "docstrings": [ - "`findFirstBy(m, p)` uses function `f` to find the first key value pair to\nmatch predicate `p`.\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.Map.Dict.fromArray([(4, \"4\"), (1, \"1\"), (2, \"2\"), (3, \"3\")], ~cmp=IntCmp.cmp)\n\nBelt.Map.Dict.findFirstBy(s0, (k, _) => k == 4) == Some((4, \"4\"))\n```" + "`findFirstBy(m, p)` uses function `f` to find the first key value pair to\nmatch predicate `p`.\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.Map.Dict.fromArray([(4, \"4\"), (1, \"1\"), (2, \"2\"), (3, \"3\")], ~cmp=IntCmp.cmp)\n\nassertEqual(Belt.Map.Dict.findFirstBy(s0, (k, _) => k == 4), Some((4, \"4\")))\n```" ], "signature": "let findFirstBy: (t<'k, 'v, 'id>, ('k, 'v) => bool) => option<('k, 'v)>" }, @@ -3432,7 +3432,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "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.Dict.fromArray([1, 3, 2, 4], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.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.Dict.fromArray([1, 3, 2, 4], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.toArray, [1, 2, 3, 4])\n```" ], "signature": "let fromArray: (array<'value>, ~cmp: cmp<'value, 'id>) => t<'value, 'id>" }, @@ -3450,7 +3450,7 @@ "kind": "value", "name": "isEmpty", "docstrings": [ - "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.Dict.fromArray([], ~cmp=IntCmp.cmp)\nlet notEmpty = Belt.Set.Dict.fromArray([1], ~cmp=IntCmp.cmp)\n\nBelt.Set.Dict.isEmpty(empty) /* true */\nBelt.Set.Dict.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.Dict.fromArray([], ~cmp=IntCmp.cmp)\nlet notEmpty = Belt.Set.Dict.fromArray([1], ~cmp=IntCmp.cmp)\n\nassertEqual(Belt.Set.Dict.isEmpty(empty), true)\nassertEqual(Belt.Set.Dict.isEmpty(notEmpty), false)\n```" ], "signature": "let isEmpty: t<'a, 'b> => bool" }, @@ -3459,7 +3459,7 @@ "kind": "value", "name": "has", "docstrings": [ - "Checks if an element exists in 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 set = Belt.Set.Dict.fromArray([1, 4, 2, 5], ~cmp=IntCmp.cmp)\n\nset->Belt.Set.Dict.has(3, ~cmp=IntCmp.cmp) /* false */\nset->Belt.Set.Dict.has(1, ~cmp=IntCmp.cmp) /* true */\n```" + "Checks if an element exists in 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 set = Belt.Set.Dict.fromArray([1, 4, 2, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(set->Belt.Set.Dict.has(3, ~cmp=IntCmp.cmp), false)\nassertEqual(set->Belt.Set.Dict.has(1, ~cmp=IntCmp.cmp), true)\n```" ], "signature": "let has: (t<'value, 'id>, 'value, ~cmp: cmp<'value, 'id>) => bool" }, @@ -3468,7 +3468,7 @@ "kind": "value", "name": "add", "docstrings": [ - "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.Dict.empty\nlet s1 = s0->Belt.Set.Dict.add(1, ~cmp=IntCmp.cmp)\nlet s2 = s1->Belt.Set.Dict.add(2, ~cmp=IntCmp.cmp)\nlet s3 = s2->Belt.Set.Dict.add(2, ~cmp=IntCmp.cmp)\ns0->Belt.Set.Dict.toArray /* [] */\ns1->Belt.Set.Dict.toArray /* [1] */\ns2->Belt.Set.Dict.toArray /* [1, 2] */\ns3->Belt.Set.Dict.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.Dict.empty\nlet s1 = s0->Belt.Set.Dict.add(1, ~cmp=IntCmp.cmp)\nlet s2 = s1->Belt.Set.Dict.add(2, ~cmp=IntCmp.cmp)\nlet s3 = s2->Belt.Set.Dict.add(2, ~cmp=IntCmp.cmp)\nassertEqual(s0->Belt.Set.Dict.toArray, [])\nassertEqual(s1->Belt.Set.Dict.toArray, [1])\nassertEqual(s2->Belt.Set.Dict.toArray, [1, 2])\nassertEqual(s3->Belt.Set.Dict.toArray, [1, 2])\nassertEqual(s2, s3)\n```" ], "signature": "let add: (\n t<'value, 'id>,\n 'value,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3477,7 +3477,7 @@ "kind": "value", "name": "mergeMany", "docstrings": [ - "Adds each element of array to set. Unlike [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.Dict.empty\n\nlet newSet = set->Belt.Set.Dict.mergeMany([5, 4, 3, 2, 1], ~cmp=IntCmp.cmp)\nnewSet->Belt.Set.Dict.toArray /* [1, 2, 3, 4, 5] */\n```" + "Adds each element of array to set. Unlike [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.Dict.empty\n\nlet newSet = set->Belt.Set.Dict.mergeMany([5, 4, 3, 2, 1], ~cmp=IntCmp.cmp)\nassertEqual(newSet->Belt.Set.Dict.toArray, [1, 2, 3, 4, 5])\n```" ], "signature": "let mergeMany: (\n t<'value, 'id>,\n array<'value>,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3486,7 +3486,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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.Dict.fromArray([2, 3, 1, 4, 5], ~cmp=IntCmp.cmp)\nlet s1 = s0->Belt.Set.Dict.remove(1, ~cmp=IntCmp.cmp)\nlet s2 = s1->Belt.Set.Dict.remove(3, ~cmp=IntCmp.cmp)\nlet s3 = s2->Belt.Set.Dict.remove(3, ~cmp=IntCmp.cmp)\n\ns1->Belt.Set.Dict.toArray /* [2,3,4,5] */\ns2->Belt.Set.Dict.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.Dict.fromArray([2, 3, 1, 4, 5], ~cmp=IntCmp.cmp)\nlet s1 = s0->Belt.Set.Dict.remove(1, ~cmp=IntCmp.cmp)\nlet s2 = s1->Belt.Set.Dict.remove(3, ~cmp=IntCmp.cmp)\nlet s3 = s2->Belt.Set.Dict.remove(3, ~cmp=IntCmp.cmp)\n\nassertEqual(s1->Belt.Set.Dict.toArray, [2,3,4,5])\nassertEqual(s2->Belt.Set.Dict.toArray, [2,4,5])\nassertEqual(s2, s3)\n```" ], "signature": "let remove: (\n t<'value, 'id>,\n 'value,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3495,7 +3495,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 any values in array not 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.Dict.fromArray([1, 2, 3, 4], ~cmp=IntCmp.cmp)\n\nlet newSet = set->Belt.Set.Dict.removeMany([5, 4, 3, 2, 1], ~cmp=IntCmp.cmp)\nnewSet->Belt.Set.Dict.toArray /* [] */\n```" + "Removes each element of array from set. Unlike [remove](#remove), the reference of return value might be changed even if any values in array not 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.Dict.fromArray([1, 2, 3, 4], ~cmp=IntCmp.cmp)\n\nlet newSet = set->Belt.Set.Dict.removeMany([5, 4, 3, 2, 1], ~cmp=IntCmp.cmp)\nassertEqual(newSet->Belt.Set.Dict.toArray, [])\n```" ], "signature": "let removeMany: (\n t<'value, 'id>,\n array<'value>,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3504,7 +3504,7 @@ "kind": "value", "name": "union", "docstrings": [ - "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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet union = Belt.Set.Dict.union(s0, s1, ~cmp=IntCmp.cmp)\nunion->Belt.Set.Dict.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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet union = Belt.Set.Dict.union(s0, s1, ~cmp=IntCmp.cmp)\nassertEqual(union->Belt.Set.Dict.toArray, [1,2,3,4,5,6])\n```" ], "signature": "let union: (\n t<'value, 'id>,\n t<'value, 'id>,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3513,7 +3513,7 @@ "kind": "value", "name": "intersect", "docstrings": [ - "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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet intersect = Belt.Set.Dict.intersect(s0, s1, ~cmp=IntCmp.cmp)\nintersect->Belt.Set.Dict.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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet intersect = Belt.Set.Dict.intersect(s0, s1, ~cmp=IntCmp.cmp)\nassertEqual(intersect->Belt.Set.Dict.toArray, [2,3,5])\n```" ], "signature": "let intersect: (\n t<'value, 'id>,\n t<'value, 'id>,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3522,7 +3522,7 @@ "kind": "value", "name": "diff", "docstrings": [ - "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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\n\nlet diff1 = Belt.Set.Dict.diff(s0, s1, ~cmp=IntCmp.cmp)\nlet diff2 = Belt.Set.Dict.diff(s1, s0, ~cmp=IntCmp.cmp)\n\ndiff1->Belt.Set.Dict.toArray /* [6] */\ndiff2->Belt.Set.Dict.toArray /* [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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\n\nlet diff1 = Belt.Set.Dict.diff(s0, s1, ~cmp=IntCmp.cmp)\nlet diff2 = Belt.Set.Dict.diff(s1, s0, ~cmp=IntCmp.cmp)\n\nassertEqual(diff1->Belt.Set.Dict.toArray, [6])\nassertEqual(diff2->Belt.Set.Dict.toArray, [1,4])\n```" ], "signature": "let diff: (\n t<'value, 'id>,\n t<'value, 'id>,\n ~cmp: cmp<'value, 'id>,\n) => t<'value, 'id>" }, @@ -3531,7 +3531,7 @@ "kind": "value", "name": "subset", "docstrings": [ - "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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet s2 = Belt.Set.Dict.intersect(s0, s1, ~cmp=IntCmp.cmp)\nBelt.Set.Dict.subset(s2, s0, ~cmp=IntCmp.cmp) /* true */\nBelt.Set.Dict.subset(s2, s1, ~cmp=IntCmp.cmp) /* true */\nBelt.Set.Dict.subset(s1, s0, ~cmp=IntCmp.cmp) /* 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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([5, 2, 3, 1, 5, 4], ~cmp=IntCmp.cmp)\nlet s2 = Belt.Set.Dict.intersect(s0, s1, ~cmp=IntCmp.cmp)\nassertEqual(Belt.Set.Dict.subset(s2, s0, ~cmp=IntCmp.cmp), true)\nassertEqual(Belt.Set.Dict.subset(s2, s1, ~cmp=IntCmp.cmp), true)\nassertEqual(Belt.Set.Dict.subset(s1, s0, ~cmp=IntCmp.cmp), false)\n```" ], "signature": "let subset: (\n t<'value, 'id>,\n t<'value, 'id>,\n ~cmp: cmp<'value, 'id>,\n) => bool" }, @@ -3549,7 +3549,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "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.Dict.fromArray([5, 2, 3], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 5], ~cmp=IntCmp.cmp)\n\nBelt.Set.Dict.eq(s0, s1, ~cmp=IntCmp.cmp) /* 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.Dict.fromArray([5, 2, 3], ~cmp=IntCmp.cmp)\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(Belt.Set.Dict.eq(s0, s1, ~cmp=IntCmp.cmp), true)\n```" ], "signature": "let eq: (\n t<'value, 'id>,\n t<'value, 'id>,\n ~cmp: cmp<'value, 'id>,\n) => bool" }, @@ -3568,7 +3568,7 @@ "kind": "value", "name": "forEach", "docstrings": [ - "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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet acc = ref(list{})\ns0->Belt.Set.Dict.forEach(x => acc := Belt.List.add(acc.contents, x))\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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nlet acc = ref(list{})\ns0->Belt.Set.Dict.forEach(x => acc := Belt.List.add(acc.contents, x))\nassertEqual(acc.contents, list{6, 5, 3, 2})\n```" ], "signature": "let forEach: (t<'value, 'id>, 'value => unit) => unit" }, @@ -3585,7 +3585,7 @@ "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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\ns0->Belt.Set.Dict.reduce(list{}, (acc, element) => acc->Belt.List.add(element)) /* [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.Dict.fromArray([5, 2, 3, 5, 6], ~cmp=IntCmp.cmp)\nassertEqual(\n s0->Belt.Set.Dict.reduce(list{}, (acc, element) => acc->Belt.List.add(element)),\n list{6, 5, 3, 2}\n)\n```" ], "signature": "let reduce: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" }, @@ -3602,7 +3602,7 @@ "kind": "value", "name": "every", "docstrings": [ - "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.Dict.fromArray([2, 4, 6, 8], ~cmp=IntCmp.cmp)\ns0->Belt.Set.Dict.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.Dict.fromArray([2, 4, 6, 8], ~cmp=IntCmp.cmp)\nassertEqual(s0->Belt.Set.Dict.every(isEven), true)\n```" ], "signature": "let every: (t<'value, 'id>, 'value => bool) => bool" }, @@ -3619,7 +3619,7 @@ "kind": "value", "name": "some", "docstrings": [ - "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.Dict.fromArray([1, 2, 4, 6, 8], ~cmp=IntCmp.cmp)\ns0->Belt.Set.Dict.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.Dict.fromArray([1, 2, 4, 6, 8], ~cmp=IntCmp.cmp)\nassertEqual(s0->Belt.Set.Dict.some(isOdd), true)\n```" ], "signature": "let some: (t<'value, 'id>, 'value => bool) => bool" }, @@ -3636,7 +3636,7 @@ "kind": "value", "name": "keep", "docstrings": [ - "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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\nlet s1 = s0->Belt.Set.Dict.keep(isEven)\n\ns1->Belt.Set.Dict.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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\nlet s1 = s0->Belt.Set.Dict.keep(isEven)\n\nassertEqual(s1->Belt.Set.Dict.toArray, [2,4])\n```" ], "signature": "let keep: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" }, @@ -3653,7 +3653,7 @@ "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\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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\nlet (s1, s2) = s0->Belt.Set.Dict.partition(isOdd)\n\ns1->Belt.Set.Dict.toArray /* [1,3,5] */\ns2->Belt.Set.Dict.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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\nlet (s1, s2) = s0->Belt.Set.Dict.partition(isOdd)\n\nassertEqual(s1->Belt.Set.Dict.toArray, [1,3,5])\nassertEqual(s2->Belt.Set.Dict.toArray, [2,4])\n```" ], "signature": "let partition: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" }, @@ -3662,7 +3662,7 @@ "kind": "value", "name": "size", "docstrings": [ - "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.Dict.fromArray([1, 2, 3, 4], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.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.Dict.fromArray([1, 2, 3, 4], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.size, 4)\n```" ], "signature": "let size: t<'value, 'id> => int" }, @@ -3671,7 +3671,7 @@ "kind": "value", "name": "toList", "docstrings": [ - "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.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.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.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.toList, list{1, 2, 3, 5})\n```" ], "signature": "let toList: t<'value, 'id> => list<'value>" }, @@ -3680,7 +3680,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "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.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.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.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.toArray, [1,2,3,5])\n```" ], "signature": "let toArray: t<'value, 'id> => array<'value>" }, @@ -3689,7 +3689,7 @@ "kind": "value", "name": "minimum", "docstrings": [ - "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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.minimum /* None */\ns1->Belt.Set.Dict.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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.minimum, None)\nassertEqual(s1->Belt.Set.Dict.minimum, Some(1))\n```" ], "signature": "let minimum: t<'value, 'id> => option<'value>" }, @@ -3698,7 +3698,7 @@ "kind": "value", "name": "minUndefined", "docstrings": [ - "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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.minUndefined /* undefined */\ns1->Belt.Set.Dict.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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.minUndefined, Js.undefined)\nassertEqual(s1->Belt.Set.Dict.minUndefined, Js.Undefined.return(1))\n```" ], "signature": "let minUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -3707,7 +3707,7 @@ "kind": "value", "name": "maximum", "docstrings": [ - "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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.maximum /* None */\ns1->Belt.Set.Dict.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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.maximum, None)\nassertEqual(s1->Belt.Set.Dict.maximum, Some(5))\n```" ], "signature": "let maximum: t<'value, 'id> => option<'value>" }, @@ -3716,7 +3716,7 @@ "kind": "value", "name": "maxUndefined", "docstrings": [ - "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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.maxUndefined /* undefined */\ns1->Belt.Set.Dict.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.Dict.empty\nlet s1 = Belt.Set.Dict.fromArray([3, 2, 1, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.maxUndefined, Js.undefined)\nassertEqual(s1->Belt.Set.Dict.maxUndefined, Js.Undefined.return(5))\n```" ], "signature": "let maxUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -3725,7 +3725,7 @@ "kind": "value", "name": "get", "docstrings": [ - "Returns the reference of the value which is equivalent to value using the comparator\nspecifiecd 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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\n\ns0->Belt.Set.Dict.get(3, ~cmp=IntCmp.cmp) /* Some(3) */\ns0->Belt.Set.Dict.get(20, ~cmp=IntCmp.cmp) /* None */\n```" + "Returns the reference of the value which is equivalent to value using the comparator\nspecifiecd 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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\n\nassertEqual(s0->Belt.Set.Dict.get(3, ~cmp=IntCmp.cmp), Some(3))\nassertEqual(s0->Belt.Set.Dict.get(20, ~cmp=IntCmp.cmp), None)\n```" ], "signature": "let get: (\n t<'value, 'id>,\n 'value,\n ~cmp: cmp<'value, 'id>,\n) => option<'value>" }, @@ -3752,7 +3752,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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.Set.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\n\nlet ((smaller, larger), present) = s0->Belt.Set.Dict.split(3, ~cmp=IntCmp.cmp)\n\npresent /* true */\nsmaller->Belt.Set.Dict.toArray /* [1,2] */\nlarger->Belt.Set.Dict.toArray /* [4,5] */\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.Dict.fromArray([1, 2, 3, 4, 5], ~cmp=IntCmp.cmp)\n\nlet ((smaller, larger), present) = s0->Belt.Set.Dict.split(3, ~cmp=IntCmp.cmp)\n\nassertEqual(present, true)\nassertEqual(smaller->Belt.Set.Dict.toArray, [1,2])\nassertEqual(larger->Belt.Set.Dict.toArray, [4,5])\n```" ], "signature": "let split: (\n t<'value, 'id>,\n 'value,\n ~cmp: cmp<'value, 'id>,\n) => ((t<'value, 'id>, t<'value, 'id>), bool)" }, @@ -4746,7 +4746,7 @@ "kind": "value", "name": "toInt", "docstrings": [ - "Converts a given `float` to an `int`.\n\n## Examples\n\n```rescript\nJs.log(Belt.Float.toInt(1.0) === 1) /* true */\n```" + "Converts a given `float` to an `int`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Float.toInt(1.0), 1)\n```" ], "signature": "let toInt: float => int" }, @@ -4755,7 +4755,7 @@ "kind": "value", "name": "fromInt", "docstrings": [ - "Converts a given `int` to a `float`.\n\n## Examples\n\n```rescript\nJs.log(Belt.Float.fromInt(1) === 1.0) /* true */\n```" + "Converts a given `int` to a `float`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Float.fromInt(1), 1.0)\n```" ], "signature": "let fromInt: int => float" }, @@ -4764,7 +4764,7 @@ "kind": "value", "name": "fromString", "docstrings": [ - "Converts a given `string` to a `float`. Returns `Some(float)` when the input is a number, `None` otherwise.\n\n## Examples\n\n```rescript\nJs.log(Belt.Float.fromString(\"1.0\") === Some(1.0)) /* true */\n```" + "Converts a given `string` to a `float`. Returns `Some(float)` when the input is a number, `None` otherwise.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Float.fromString(\"1.0\"), Some(1.0))\n```" ], "signature": "let fromString: string => option" }, @@ -4773,7 +4773,7 @@ "kind": "value", "name": "toString", "docstrings": [ - "Converts a given `float` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n## Examples\n\n```rescript\nJs.log(Belt.Float.toString(1.0) === \"1.0\") /* true */\n```" + "Converts a given `float` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Float.toString(1.0), \"1\")\n```" ], "signature": "let toString: float => string" }, @@ -4934,7 +4934,7 @@ "kind": "value", "name": "mapWithDefault", "docstrings": [ - "`mapWithDefault(res, default, f)`: When res is `Ok(n)`, returns `f(n)`,\notherwise `default`.\n\n## Examples\n\n```rescript\nlet ok = Belt.Result.Ok(42)\nBelt.Result.mapWithDefault(ok, 0, (x) => x / 2) == 21\n\nlet error = Belt.Result.Error(\"Invalid data\")\nBelt.Result.mapWithDefault(error, 0, (x) => x / 2) == 0\n```" + "`mapWithDefault(res, default, f)`: When res is `Ok(n)`, returns `f(n)`,\notherwise `default`.\n\n## Examples\n\n```rescript\nlet ok = Belt.Result.Ok(42)\nassertEqual(Belt.Result.mapWithDefault(ok, 0, (x) => x / 2), 21)\n\nlet error = Belt.Result.Error(\"Invalid data\")\nassertEqual(Belt.Result.mapWithDefault(error, 0, (x) => x / 2), 0)\n```" ], "signature": "let mapWithDefault: (t<'a, 'c>, 'b, 'a => 'b) => 'b" }, @@ -4951,7 +4951,7 @@ "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(Belt.Int.toFloat(x))\n\nBelt.Result.map(Ok(64), f) == Ok(8.0)\n\nBelt.Result.map(Error(\"Invalid data\"), f) == Error(\"Invalid data\")\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(Belt.Int.toFloat(x))\n\nassertEqual(Belt.Result.map(Ok(64), f), Ok(8.0))\n\nassertEqual(Belt.Result.map(Error(\"Invalid data\"), f), Error(\"Invalid data\"))\n```" ], "signature": "let map: (t<'a, 'c>, 'a => 'b) => t<'b, 'c>" }, @@ -4968,7 +4968,7 @@ "kind": "value", "name": "flatMap", "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`Belt.Result`.\n\n## Examples\n\n```rescript\nlet recip = (x) =>\n if (x !== 0.0) {\n Belt.Result.Ok(1.0 /. x)\n } else {\n Belt.Result.Error(\"Divide by zero\")\n }\n\nBelt.Result.flatMap(Ok(2.0), recip) == Ok(0.5)\n\nBelt.Result.flatMap(Ok(0.0), recip) == Error(\"Divide by zero\")\n\nBelt.Result.flatMap(Error(\"Already bad\"), recip) == Error(\"Already bad\")\n```" + "`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`Belt.Result`.\n\n## Examples\n\n```rescript\nlet recip = (x) =>\n if (x !== 0.0) {\n Belt.Result.Ok(1.0 /. x)\n } else {\n Belt.Result.Error(\"Divide by zero\")\n }\n\nassertEqual(Belt.Result.flatMap(Ok(2.0), recip), Ok(0.5))\n\nassertEqual(Belt.Result.flatMap(Ok(0.0), recip), Error(\"Divide by zero\"))\n\nassertEqual(Belt.Result.flatMap(Error(\"Already bad\"), recip), Error(\"Already bad\"))\n```" ], "signature": "let flatMap: (t<'a, 'c>, 'a => t<'b, 'c>) => t<'b, 'c>" }, @@ -4977,7 +4977,7 @@ "kind": "value", "name": "getWithDefault", "docstrings": [ - "`getWithDefault(res, defaultValue)`: If `res` is `Ok(n)`, returns `n`,\notherwise `default`\n\n## Examples\n\n```rescript\nBelt.Result.getWithDefault(Ok(42), 0) == 42\n\nBelt.Result.getWithDefault(Error(\"Invalid Data\"), 0) == 0\n```" + "`getWithDefault(res, defaultValue)`: If `res` is `Ok(n)`, returns `n`,\notherwise `default`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Result.getWithDefault(Ok(42), 0), 42)\n\nassertEqual(Belt.Result.getWithDefault(Error(\"Invalid Data\"), 0), 0)\n```" ], "signature": "let getWithDefault: (t<'a, 'b>, 'a) => 'a" }, @@ -5012,7 +5012,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "`eq(res1, res2, f)`: Determine if two `Belt.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 = Belt.Result.Ok(42)\n\nlet good2 = Belt.Result.Ok(32)\n\nlet bad1 = Belt.Result.Error(\"invalid\")\n\nlet bad2 = Belt.Result.Error(\"really invalid\")\n\nlet mod10equal = (a, b) => mod(a, 10) === mod(b, 10)\n\nBelt.Result.eq(good1, good2, mod10equal) == true\n\nBelt.Result.eq(good1, bad1, mod10equal) == false\n\nBelt.Result.eq(bad2, good2, mod10equal) == false\n\nBelt.Result.eq(bad1, bad2, mod10equal) == true\n```" + "`eq(res1, res2, f)`: Determine if two `Belt.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 = Belt.Result.Ok(42)\n\nlet good2 = Belt.Result.Ok(32)\n\nlet bad1 = Belt.Result.Error(\"invalid\")\n\nlet bad2 = Belt.Result.Error(\"really invalid\")\n\nlet mod10equal = (a, b) => mod(a, 10) === mod(b, 10)\n\nassertEqual(Belt.Result.eq(good1, good2, mod10equal), true)\n\nassertEqual(Belt.Result.eq(good1, bad1, mod10equal), false)\n\nassertEqual(Belt.Result.eq(bad2, good2, mod10equal), false)\n\nassertEqual(Belt.Result.eq(bad1, bad2, mod10equal), true)\n```" ], "signature": "let eq: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool" }, @@ -5029,7 +5029,7 @@ "kind": "value", "name": "cmp", "docstrings": [ - "`cmp(res1, res2, f)`: Compare two `Belt.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 = Belt.Result.Ok(59)\n\nlet good2 = Belt.Result.Ok(37)\n\nlet bad1 = Belt.Result.Error(\"invalid\")\n\nlet bad2 = Belt.Result.Error(\"really invalid\")\n\nlet mod10cmp = (a, b) => Pervasives.compare(mod(a, 10), mod(b, 10))\n\nBelt.Result.cmp(Ok(39), Ok(57), mod10cmp) == 1\n\nBelt.Result.cmp(Ok(57), Ok(39), mod10cmp) == (-1)\n\nBelt.Result.cmp(Ok(39), Error(\"y\"), mod10cmp) == 1\n\nBelt.Result.cmp(Error(\"x\"), Ok(57), mod10cmp) == (-1)\n\nBelt.Result.cmp(Error(\"x\"), Error(\"y\"), mod10cmp) == 0\n```" + "`cmp(res1, res2, f)`: Compare two `Belt.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 = Belt.Result.Ok(59)\n\nlet good2 = Belt.Result.Ok(37)\n\nlet bad1 = Belt.Result.Error(\"invalid\")\n\nlet bad2 = Belt.Result.Error(\"really invalid\")\n\nlet mod10cmp = (a, b) => Pervasives.compare(mod(a, 10), mod(b, 10))\n\nassertEqual(Belt.Result.cmp(Ok(39), Ok(57), mod10cmp), 1)\n\nassertEqual(Belt.Result.cmp(Ok(57), Ok(39), mod10cmp), (-1))\n\nassertEqual(Belt.Result.cmp(Ok(39), Error(\"y\"), mod10cmp), 1)\n\nassertEqual(Belt.Result.cmp(Error(\"x\"), Ok(57), mod10cmp), (-1))\n\nassertEqual(Belt.Result.cmp(Error(\"x\"), Error(\"y\"), mod10cmp), 0)\n```" ], "signature": "let cmp: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int" } @@ -5058,7 +5058,7 @@ "kind": "value", "name": "keep", "docstrings": [ - "If `optionValue` is `Some(value)` and `p(value) = true`, it returns `Some(value)`; otherwise returns `None`\n\n## Examples\n\n```rescript\nBelt.Option.keep(Some(10), x => x > 5) /* returns `Some(10)` */\nBelt.Option.keep(Some(4), x => x > 5) /* returns `None` */\nBelt.Option.keep(None, x => x > 5) /* returns `None` */\n```" + "If `optionValue` is `Some(value)` and `p(value) = true`, it returns `Some(value)`; otherwise returns `None`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.keep(Some(10), x => x > 5), Some(10))\nassertEqual(Belt.Option.keep(Some(4), x => x > 5), None)\nassertEqual(Belt.Option.keep(None, x => x > 5), None)\n```" ], "signature": "let keep: (option<'a>, 'a => bool) => option<'a>" }, @@ -5114,7 +5114,7 @@ "kind": "value", "name": "mapWithDefault", "docstrings": [ - "If `optionValue` is of `Some(value)`,\nthis function returns that value applied with `f`, in other words `f(value)`.\n\nIf `optionValue` is `None`, the default is returned.\n\n## Examples\n\n```rescript\nlet someValue = Some(3)\nsomeValue->Belt.Option.mapWithDefault(0, x => x + 5) /* 8 */\n\nlet noneValue = None\nnoneValue->Belt.Option.mapWithDefault(0, x => x + 5) /* 0 */\n```" + "If `optionValue` is of `Some(value)`,\nthis function returns that value applied with `f`, in other words `f(value)`.\n\nIf `optionValue` is `None`, the default is returned.\n\n## Examples\n\n```rescript\nlet someValue = Some(3)\nassertEqual(someValue->Belt.Option.mapWithDefault(0, x => x + 5), 8)\n\nlet noneValue = None\nassertEqual(noneValue->Belt.Option.mapWithDefault(0, x => x + 5), 0)\n```" ], "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b" }, @@ -5133,7 +5133,7 @@ "kind": "value", "name": "map", "docstrings": [ - "If `optionValue` is `Some(value)` this returns `f(value)`, otherwise it returns `None`.\n\n## Examples\n\n```rescript\nBelt.Option.map(Some(3), x => x * x) /* Some(9) */\n\nBelt.Option.map(None, x => x * x) /* None */\n```" + "If `optionValue` is `Some(value)` this returns `f(value)`, otherwise it returns `None`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.map(Some(3), x => x * x), Some(9))\n\nassertEqual(Belt.Option.map(None, x => x * x), None)\n```" ], "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" }, @@ -5152,7 +5152,7 @@ "kind": "value", "name": "flatMap", "docstrings": [ - "If `optionValue` is `Some(value)`, returns `f(value)`, otherwise returns\n`None`.
    \nThe function `f` must have a return type of `option<'b>`.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Some(value + 1)\n } else {\n None\n }\n\nBelt.Option.flatMap(Some(2), addIfAboveOne) /* Some(3) */\n\nBelt.Option.flatMap(Some(-4), addIfAboveOne) /* None */\n\nBelt.Option.flatMap(None, addIfAboveOne) /* None */\n```" + "If `optionValue` is `Some(value)`, returns `f(value)`, otherwise returns\n`None`.
    \nThe function `f` must have a return type of `option<'b>`.\n\n## Examples\n\n```rescript\nlet addIfAboveOne = value =>\n if (value > 1) {\n Some(value + 1)\n } else {\n None\n }\n\nassertEqual(Belt.Option.flatMap(Some(2), addIfAboveOne), Some(3))\n\nassertEqual(Belt.Option.flatMap(Some(-4), addIfAboveOne), None)\n\nassertEqual(Belt.Option.flatMap(None, addIfAboveOne), None)\n```" ], "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" }, @@ -5161,7 +5161,7 @@ "kind": "value", "name": "getWithDefault", "docstrings": [ - "If `optionalValue` is `Some(value)`, returns `value`, otherwise default.\n\n## Examples\n\n```rescript\nBelt.Option.getWithDefault(None, \"Banana\") /* Banana */\n\nBelt.Option.getWithDefault(Some(\"Apple\"), \"Banana\") /* Apple */\n```\n\n```rescript\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Belt.Option.getWithDefault(\"Anonymous\")\n\nSome(\"Jane\")->greet /* \"Greetings Jane\" */\n\nNone->greet /* \"Greetings Anonymous\" */\n```" + "If `optionalValue` is `Some(value)`, returns `value`, otherwise default.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.getWithDefault(None, \"Banana\"), \"Banana\")\n\nassertEqual(Belt.Option.getWithDefault(Some(\"Apple\"), \"Banana\"), \"Apple\")\n```\n\n```rescript\nlet greet = (firstName: option) =>\n \"Greetings \" ++ firstName->Belt.Option.getWithDefault(\"Anonymous\")\n\nassertEqual(Some(\"Jane\")->greet, \"Greetings Jane\")\n\nassertEqual(None->greet, \"Greetings Anonymous\")\n```" ], "signature": "let getWithDefault: (option<'a>, 'a) => 'a" }, @@ -5170,7 +5170,7 @@ "kind": "value", "name": "orElse", "docstrings": [ - "`orElse(optionalValue, otherOptional)` if `optionalValue` is `Some(value)`,\nreturns `Some(value)`, otherwise `otherOptional`\n\n## Examples\n\n```rescript\nBelt.Option.orElse(Some(1812), Some(1066)) == Some(1812)\nBelt.Option.orElse(None, Some(1066)) == Some(1066)\nBelt.Option.orElse(None, None) == None\n```" + "`orElse(optionalValue, otherOptional)` if `optionalValue` is `Some(value)`,\nreturns `Some(value)`, otherwise `otherOptional`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.orElse(Some(1812), Some(1066)), Some(1812))\nassertEqual(Belt.Option.orElse(None, Some(1066)), Some(1066))\nassertEqual(Belt.Option.orElse(None, None), None)\n```" ], "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" }, @@ -5179,7 +5179,7 @@ "kind": "value", "name": "isSome", "docstrings": [ - "Returns `true` if the argument is `Some(value)`, `false` otherwise.\n\n## Examples\n\n```rescript\nBelt.Option.isSome(None) /* false */\n\nBelt.Option.isSome(Some(1)) /* true */\n```" + "Returns `true` if the argument is `Some(value)`, `false` otherwise.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.isSome(None), false)\n\nassertEqual(Belt.Option.isSome(Some(1)), true)\n```" ], "signature": "let isSome: option<'a> => bool" }, @@ -5188,7 +5188,7 @@ "kind": "value", "name": "isNone", "docstrings": [ - "Returns `true` if the argument is `None`, `false` otherwise.\n\n## Examples\n\n```rescript\nBelt.Option.isNone(None) /* true */\n\nBelt.Option.isNone(Some(1)) /* false */\n```" + "Returns `true` if the argument is `None`, `false` otherwise.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Option.isNone(None), true)\n\nassertEqual(Belt.Option.isNone(Some(1)), false)\n```" ], "signature": "let isNone: option<'a> => bool" }, @@ -5207,7 +5207,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "Evaluates two optional values for equality with respect to a predicate\nfunction. If both `optValue1` and `optValue2` are `None`, returns `true`.\nIf one of the arguments is `Some(value)` and the other is `None`, returns\n`false`.\n\nIf arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`predicate(value1, value2)`; the predicate function must return a bool.\n\n## Examples\n\n```rescript\nlet clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\nopen Belt.Option\n\neq(Some(3), Some(15), clockEqual) /* true */\n\neq(Some(3), None, clockEqual) /* false */\n\neq(None, Some(3), clockEqual) /* false */\n\neq(None, None, clockEqual) /* true */\n```" + "Evaluates two optional values for equality with respect to a predicate\nfunction. If both `optValue1` and `optValue2` are `None`, returns `true`.\nIf one of the arguments is `Some(value)` and the other is `None`, returns\n`false`.\n\nIf arguments are `Some(value1)` and `Some(value2)`, returns the result of\n`predicate(value1, value2)`; the predicate function must return a bool.\n\n## Examples\n\n```rescript\nlet clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\nopen Belt.Option\n\nassertEqual(eq(Some(3), Some(15), clockEqual), true)\n\nassertEqual(eq(Some(3), None, clockEqual), false)\n\nassertEqual(eq(None, Some(3), clockEqual), false)\n\nassertEqual(eq(None, None, clockEqual), true)\n```" ], "signature": "let eq: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" }, @@ -5226,7 +5226,7 @@ "kind": "value", "name": "cmp", "docstrings": [ - "`cmp(optValue1, optValue2, comparisonFunction)` compares two optional values\nwith respect to given `comparisonFunction`.\n\nIf both `optValue1` and `optValue2` are `None`, it returns `0`.\n\nIf the first argument is `Some(value1)` and the second is `None`, returns `1`\n(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`comparisonFunction(value1, value2)`; comparisonFunction takes two arguments\nand returns `-1` if the first argument is less than the second, `0` if the\narguments are equal, and `1` if the first argument is greater than the second.\n\n## Examples\n\n```rescript\nlet clockCompare = (a, b) => compare(mod(a, 12), mod(b, 12))\n\nopen Belt.Option\n\ncmp(Some(3), Some(15), clockCompare) /* 0 */\n\ncmp(Some(3), Some(14), clockCompare) /* 1 */\n\ncmp(Some(2), Some(15), clockCompare) /* (-1) */\n\ncmp(None, Some(15), clockCompare) /* (-1) */\n\ncmp(Some(14), None, clockCompare) /* 1 */\n\ncmp(None, None, clockCompare) /* 0 */\n```" + "`cmp(optValue1, optValue2, comparisonFunction)` compares two optional values\nwith respect to given `comparisonFunction`.\n\nIf both `optValue1` and `optValue2` are `None`, it returns `0`.\n\nIf the first argument is `Some(value1)` and the second is `None`, returns `1`\n(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`comparisonFunction(value1, value2)`; comparisonFunction takes two arguments\nand returns `-1` if the first argument is less than the second, `0` if the\narguments are equal, and `1` if the first argument is greater than the second.\n\n## Examples\n\n```rescript\nlet clockCompare = (a, b) => compare(mod(a, 12), mod(b, 12))\n\nopen Belt.Option\n\nassertEqual(cmp(Some(3), Some(15), clockCompare), 0)\n\nassertEqual(cmp(Some(3), Some(14), clockCompare), 1)\n\nassertEqual(cmp(Some(2), Some(15), clockCompare), (-1))\n\nassertEqual(cmp(None, Some(15), clockCompare), (-1))\n\nassertEqual(cmp(Some(14), None, clockCompare), 1)\n\nassertEqual(cmp(None, None, clockCompare), 0)\n```" ], "signature": "let cmp: (option<'a>, option<'b>, ('a, 'b) => int) => int" } @@ -5272,7 +5272,7 @@ "kind": "value", "name": "clear", "docstrings": [ - "Clears a hash table.\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 hMap = Belt.HashMap.fromArray([(1, \"1\")], ~id=module(IntHash))\nBelt.HashMap.clear(hMap)\nBelt.HashMap.isEmpty(hMap) == true\n```" + "Clears a hash table.\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 hMap = Belt.HashMap.fromArray([(1, \"1\")], ~id=module(IntHash))\nBelt.HashMap.clear(hMap)\nassertEqual(Belt.HashMap.isEmpty(hMap), true)\n```" ], "signature": "let clear: t<'key, 'value, 'id> => unit" }, @@ -5281,7 +5281,7 @@ "kind": "value", "name": "isEmpty", "docstrings": [ - "`isEmpty(m)` checks whether a hash map is empty.\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\nBelt.HashMap.isEmpty(Belt.HashMap.fromArray([(1, \"1\")], ~id=module(IntHash))) == false\n```" + "`isEmpty(m)` checks whether a hash map is empty.\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\nassertEqual(Belt.HashMap.isEmpty(Belt.HashMap.fromArray([(1, \"1\")], ~id=module(IntHash))), false)\n```" ], "signature": "let isEmpty: t<'a, 'b, 'c> => bool" }, @@ -5290,7 +5290,7 @@ "kind": "value", "name": "set", "docstrings": [ - "`set(hMap, k, v)` if `k` does not exist, add the binding `k,v`, otherwise, update the old value with the new `v`.\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.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntHash))\n\nBelt.HashMap.set(s0, 2, \"3\")\n\nBelt.HashMap.valuesToArray(s0) == [\"1\", \"3\", \"3\"]\n```" + "`set(hMap, k, v)` if `k` does not exist, add the binding `k,v`, otherwise, update the old value with the new `v`.\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.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntHash))\n\nBelt.HashMap.set(s0, 2, \"3\")\n\nassertEqual(Belt.HashMap.valuesToArray(s0), [\"1\", \"3\", \"3\"])\n```" ], "signature": "let set: (t<'key, 'value, 'id>, 'key, 'value) => unit" }, @@ -5299,7 +5299,7 @@ "kind": "value", "name": "copy", "docstrings": [ - "Creates copy of a hash map.\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.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntHash))\nlet s1 = Belt.HashMap.copy(s0)\n\nBelt.HashMap.set(s0, 2, \"3\")\n\nBelt.HashMap.get(s0, 2) != Belt.HashMap.get(s1, 2)\n```" + "Creates copy of a hash map.\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.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntHash))\nlet s1 = Belt.HashMap.copy(s0)\n\nBelt.HashMap.set(s0, 2, \"3\")\n\nassertEqual(Belt.HashMap.get(s0, 2) != Belt.HashMap.get(s1, 2), true)\n```" ], "signature": "let copy: t<'key, 'value, 'id> => t<'key, 'value, 'id>" }, @@ -5308,7 +5308,7 @@ "kind": "value", "name": "get", "docstrings": [ - "Returns value bound under specific key. If values not exist returns `None`.\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\")\n\nBelt.HashMap.get(s0, 1) == Some(\"value1\")\nBelt.HashMap.get(s0, 2) == None\n```" + "Returns value bound under specific key. If values not exist returns `None`.\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\")\n\nassertEqual(Belt.HashMap.get(s0, 1), Some(\"value1\"))\nassertEqual(Belt.HashMap.get(s0, 2), None)\n```" ], "signature": "let get: (t<'key, 'value, 'id>, 'key) => option<'value>" }, @@ -5317,7 +5317,7 @@ "kind": "value", "name": "has", "docstrings": [ - "Checks if `x` is bound in `tbl`.\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\")\n\nBelt.HashMap.has(s0, 1) == true\nBelt.HashMap.has(s0, 2) == false\n```" + "Checks if `x` is bound in `tbl`.\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\")\n\nassertEqual(Belt.HashMap.has(s0, 1), true)\nassertEqual(Belt.HashMap.has(s0, 2), false)\n```" ], "signature": "let has: (t<'key, 'value, 'id>, 'key) => bool" }, @@ -5326,7 +5326,7 @@ "kind": "value", "name": "remove", "docstrings": [ - "If bound exists, removes it from the hash map.\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.remove(s0, 1)\nBelt.HashMap.has(s0, 1) == false\n```" + "If bound exists, removes it from the hash map.\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.remove(s0, 1)\nassertEqual(Belt.HashMap.has(s0, 1), false)\n```" ], "signature": "let remove: (t<'key, 'value, 'id>, 'key) => unit" }, @@ -5390,7 +5390,7 @@ "kind": "value", "name": "size", "docstrings": [ - "`size(tbl)` returns the number of bindings in `tbl`. It takes constant time.\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.size(s0) == 2\n```" + "`size(tbl)` returns the number of bindings in `tbl`. It takes constant time.\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\nassertEqual(Belt.HashMap.size(s0), 2)\n```" ], "signature": "let size: t<'a, 'b, 'c> => int" }, @@ -5399,7 +5399,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "Returns array of key value pairs.\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.toArray(s0) == [(1, \"value1\"), (2, \"value2\")]\n```" + "Returns array of key value pairs.\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\nassertEqual(Belt.HashMap.toArray(s0), [(1, \"value1\"), (2, \"value2\")])\n```" ], "signature": "let toArray: t<'key, 'value, 'id> => array<('key, 'value)>" }, @@ -5408,7 +5408,7 @@ "kind": "value", "name": "keysToArray", "docstrings": [ - "Returns array of keys.\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.keysToArray(s0) == [1, 2]\n```" + "Returns array of keys.\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\nassertEqual(Belt.HashMap.keysToArray(s0), [1, 2])\n```" ], "signature": "let keysToArray: t<'key, 'a, 'b> => array<'key>" }, @@ -5417,7 +5417,7 @@ "kind": "value", "name": "valuesToArray", "docstrings": [ - "Returns array of values.\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.valuesToArray(s0) == [\"value1\", \"value2\"]\n```" + "Returns array of values.\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\nassertEqual(Belt.HashMap.valuesToArray(s0), [\"value1\", \"value2\"])\n```" ], "signature": "let valuesToArray: t<'a, 'value, 'b> => array<'value>" }, @@ -5426,7 +5426,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "Creates new hash map from array of pairs.\n\nReturns array of values.\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.fromArray([(1, \"value1\"), (2, \"value2\")], ~id=module(IntHash))\nBelt.HashMap.toArray(s0) == [(1, \"value1\"), (2, \"value2\")]\n```" + "Creates new hash map from array of pairs.\n\nReturns array of values.\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.fromArray([(1, \"value1\"), (2, \"value2\")], ~id=module(IntHash))\nassertEqual(Belt.HashMap.toArray(s0), [(1, \"value1\"), (2, \"value2\")])\n```" ], "signature": "let fromArray: (\n array<('key, 'value)>,\n ~id: id<'key, 'id>,\n) => t<'key, 'value, 'id>" }, @@ -6019,7 +6019,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "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.MutableSet.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.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.MutableSet.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.toArray, [1, 2, 3, 4])\n```" ], "signature": "let fromArray: (array<'value>, ~id: id<'value, 'id>) => t<'value, 'id>" }, @@ -6037,7 +6037,7 @@ "kind": "value", "name": "copy", "docstrings": [ - "Returns copy of a 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.MutableSet.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\nlet copied = s0->Belt.MutableSet.copy\ncopied->Belt.MutableSet.toArray /* [1, 2, 3, 4] */\n```" + "Returns copy of a 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.MutableSet.fromArray([1, 3, 2, 4], ~id=module(IntCmp))\n\nlet copied = s0->Belt.MutableSet.copy\nassertEqual(copied->Belt.MutableSet.toArray, [1, 2, 3, 4])\n```" ], "signature": "let copy: t<'value, 'id> => t<'value, 'id>" }, @@ -6046,7 +6046,7 @@ "kind": "value", "name": "isEmpty", "docstrings": [ - "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.MutableSet.fromArray([], ~id=module(IntCmp))\nlet notEmpty = Belt.MutableSet.fromArray([1], ~id=module(IntCmp))\n\nBelt.MutableSet.isEmpty(empty) /* true */\nBelt.MutableSet.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.MutableSet.fromArray([], ~id=module(IntCmp))\nlet notEmpty = Belt.MutableSet.fromArray([1], ~id=module(IntCmp))\n\nassertEqual(Belt.MutableSet.isEmpty(empty), true)\nassertEqual(Belt.MutableSet.isEmpty(notEmpty), false)\n```" ], "signature": "let isEmpty: t<'a, 'b> => bool" }, @@ -6055,7 +6055,7 @@ "kind": "value", "name": "has", "docstrings": [ - "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.MutableSet.fromArray([1, 4, 2, 5], ~id=module(IntCmp))\n\nset->Belt.MutableSet.has(3) /* false */\nset->Belt.MutableSet.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.MutableSet.fromArray([1, 4, 2, 5], ~id=module(IntCmp))\n\nassertEqual(set->Belt.MutableSet.has(3), false)\nassertEqual(set->Belt.MutableSet.has(1), true)\n```" ], "signature": "let has: (t<'value, 'id>, 'value) => bool" }, @@ -6064,7 +6064,7 @@ "kind": "value", "name": "add", "docstrings": [ - "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.MutableSet.make(~id=module(IntCmp))\ns0->Belt.MutableSet.add(1)\ns0->Belt.MutableSet.add(2)\ns0->Belt.MutableSet.add(2)\n\ns0->Belt.MutableSet.toArray /* [1, 2] */\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.MutableSet.make(~id=module(IntCmp))\ns0->Belt.MutableSet.add(1)\ns0->Belt.MutableSet.add(2)\ns0->Belt.MutableSet.add(2)\n\nassertEqual(s0->Belt.MutableSet.toArray, [1, 2])\n```" ], "signature": "let add: (t<'value, 'id>, 'value) => unit" }, @@ -6080,7 +6080,7 @@ "kind": "value", "name": "mergeMany", "docstrings": [ - "Adds each element of array to 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.MutableSet.make(~id=module(IntCmp))\n\nset->Belt.MutableSet.mergeMany([5, 4, 3, 2, 1])\nset->Belt.MutableSet.toArray /* [1, 2, 3, 4, 5] */\n```" + "Adds each element of array to 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.MutableSet.make(~id=module(IntCmp))\n\nset->Belt.MutableSet.mergeMany([5, 4, 3, 2, 1])\nassertEqual(set->Belt.MutableSet.toArray, [1, 2, 3, 4, 5])\n```" ], "signature": "let mergeMany: (t<'value, 'id>, array<'value>) => unit" }, @@ -6089,7 +6089,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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.MutableSet.fromArray([2, 3, 1, 4, 5], ~id=module(IntCmp))\ns0->Belt.MutableSet.remove(1)\ns0->Belt.MutableSet.remove(3)\ns0->Belt.MutableSet.remove(3)\n\ns0->Belt.MutableSet.toArray /* [2,4,5] */\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.MutableSet.fromArray([2, 3, 1, 4, 5], ~id=module(IntCmp))\ns0->Belt.MutableSet.remove(1)\ns0->Belt.MutableSet.remove(3)\ns0->Belt.MutableSet.remove(3)\n\nassertEqual(s0->Belt.MutableSet.toArray, [2,4,5])\n```" ], "signature": "let remove: (t<'value, 'id>, 'value) => unit" }, @@ -6105,7 +6105,7 @@ "kind": "value", "name": "removeMany", "docstrings": [ - "Removes each element of array from 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.MutableSet.fromArray([1, 2, 3, 4], ~id=module(IntCmp))\n\nset->Belt.MutableSet.removeMany([5, 4, 3, 2, 1])\nset->Belt.MutableSet.toArray /* [] */\n```" + "Removes each element of array from 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.MutableSet.fromArray([1, 2, 3, 4], ~id=module(IntCmp))\n\nset->Belt.MutableSet.removeMany([5, 4, 3, 2, 1])\nassertEqual(set->Belt.MutableSet.toArray, [])\n```" ], "signature": "let removeMany: (t<'value, 'id>, array<'value>) => unit" }, @@ -6114,7 +6114,7 @@ "kind": "value", "name": "union", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet union = Belt.MutableSet.union(s0, s1)\nunion->Belt.MutableSet.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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet union = Belt.MutableSet.union(s0, s1)\nassertEqual(union->Belt.MutableSet.toArray, [1,2,3,4,5,6])\n```" ], "signature": "let union: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6123,7 +6123,7 @@ "kind": "value", "name": "intersect", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet intersect = Belt.MutableSet.intersect(s0, s1)\nintersect->Belt.MutableSet.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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet intersect = Belt.MutableSet.intersect(s0, s1)\nassertEqual(intersect->Belt.MutableSet.toArray, [2,3,5])\n```" ], "signature": "let intersect: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6132,7 +6132,7 @@ "kind": "value", "name": "diff", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nBelt.MutableSet.toArray(Belt.MutableSet.diff(s0, s1)) /* [6] */\nBelt.MutableSet.toArray(Belt.MutableSet.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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nassertEqual(Belt.MutableSet.toArray(Belt.MutableSet.diff(s0, s1)), [6])\nassertEqual(Belt.MutableSet.toArray(Belt.MutableSet.diff(s1, s0)), [1,4])\n```" ], "signature": "let diff: (t<'value, 'id>, t<'value, 'id>) => t<'value, 'id>" }, @@ -6141,7 +6141,7 @@ "kind": "value", "name": "subset", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet s2 = Belt.MutableSet.intersect(s0, s1)\nBelt.MutableSet.subset(s2, s0) /* true */\nBelt.MutableSet.subset(s2, s1) /* true */\nBelt.MutableSet.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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([5, 2, 3, 1, 5, 4], ~id=module(IntCmp))\nlet s2 = Belt.MutableSet.intersect(s0, s1)\nassertEqual(Belt.MutableSet.subset(s2, s0), true)\nassertEqual(Belt.MutableSet.subset(s2, s1), true)\nassertEqual(Belt.MutableSet.subset(s1, s0), false)\n```" ], "signature": "let subset: (t<'value, 'id>, t<'value, 'id>) => bool" }, @@ -6159,7 +6159,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 5], ~id=module(IntCmp))\n\nBelt.MutableSet.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.MutableSet.fromArray([5, 2, 3], ~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 5], ~id=module(IntCmp))\n\nassertEqual(Belt.MutableSet.eq(s0, s1), true)\n```" ], "signature": "let eq: (t<'value, 'id>, t<'value, 'id>) => bool" }, @@ -6178,7 +6178,7 @@ "kind": "value", "name": "forEach", "docstrings": [ - "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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet acc = ref(list{})\ns0->Belt.MutableSet.forEach(x => acc := Belt.List.add(acc.contents, x))\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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nlet acc = ref(list{})\ns0->Belt.MutableSet.forEach(x => acc := Belt.List.add(acc.contents, x))\nassertEqual(acc.contents, list{6, 5, 3, 2})\n```" ], "signature": "let forEach: (t<'value, 'id>, 'value => unit) => unit" }, @@ -6195,7 +6195,7 @@ "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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\ns0->Belt.MutableSet.reduce(list{}, (acc, element) => acc->Belt.List.add(element)) /* [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.MutableSet.fromArray([5, 2, 3, 5, 6], ~id=module(IntCmp))\nassertEqual(\n s0->Belt.MutableSet.reduce(list{}, (acc, element) => acc->Belt.List.add(element)),\n list{6, 5, 3, 2}\n)\n```" ], "signature": "let reduce: (t<'value, 'id>, 'a, ('a, 'value) => 'a) => 'a" }, @@ -6212,7 +6212,7 @@ "kind": "value", "name": "every", "docstrings": [ - "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.MutableSet.fromArray([2, 4, 6, 8], ~id=module(IntCmp))\ns0->Belt.MutableSet.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.MutableSet.fromArray([2, 4, 6, 8], ~id=module(IntCmp))\nassertEqual(s0->Belt.MutableSet.every(isEven), true)\n```" ], "signature": "let every: (t<'value, 'id>, 'value => bool) => bool" }, @@ -6229,7 +6229,7 @@ "kind": "value", "name": "some", "docstrings": [ - "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.MutableSet.fromArray([1, 2, 4, 6, 8], ~id=module(IntCmp))\ns0->Belt.MutableSet.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.MutableSet.fromArray([1, 2, 4, 6, 8], ~id=module(IntCmp))\nassertEqual(s0->Belt.MutableSet.some(isOdd), true)\n```" ], "signature": "let some: (t<'value, 'id>, 'value => bool) => bool" }, @@ -6246,7 +6246,7 @@ "kind": "value", "name": "keep", "docstrings": [ - "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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\nlet s1 = s0->Belt.MutableSet.keep(isEven)\n\ns1->Belt.MutableSet.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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\nlet s1 = s0->Belt.MutableSet.keep(isEven)\n\nassertEqual(s1->Belt.MutableSet.toArray, [2, 4])\n```" ], "signature": "let keep: (t<'value, 'id>, 'value => bool) => t<'value, 'id>" }, @@ -6263,7 +6263,7 @@ "kind": "value", "name": "partition", "docstrings": [ - "## 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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\nlet (s1, s2) = s0->Belt.MutableSet.partition(isOdd)\n\ns1->Belt.MutableSet.toArray /* [1,3,5] */\ns2->Belt.MutableSet.toArray /* [2,4] */\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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\nlet (s1, s2) = s0->Belt.MutableSet.partition(isOdd)\n\nassertEqual(s1->Belt.MutableSet.toArray, [1,3,5])\nassertEqual(s2->Belt.MutableSet.toArray, [2,4])\n```" ], "signature": "let partition: (\n t<'value, 'id>,\n 'value => bool,\n) => (t<'value, 'id>, t<'value, 'id>)" }, @@ -6272,7 +6272,7 @@ "kind": "value", "name": "size", "docstrings": [ - "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.MutableSet.fromArray([1, 2, 3, 4], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.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.MutableSet.fromArray([1, 2, 3, 4], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.size, 4)\n```" ], "signature": "let size: t<'value, 'id> => int" }, @@ -6281,7 +6281,7 @@ "kind": "value", "name": "toList", "docstrings": [ - "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.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.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.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.toList, list{1, 2, 3, 5})\n```" ], "signature": "let toList: t<'value, 'id> => list<'value>" }, @@ -6290,7 +6290,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "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.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.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.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.toArray, [1,2,3,5])\n```" ], "signature": "let toArray: t<'value, 'id> => array<'value>" }, @@ -6299,7 +6299,7 @@ "kind": "value", "name": "minimum", "docstrings": [ - "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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.minimum /* None */\ns1->Belt.MutableSet.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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.minimum, None)\nassertEqual(s1->Belt.MutableSet.minimum, Some(1))\n```" ], "signature": "let minimum: t<'value, 'id> => option<'value>" }, @@ -6308,7 +6308,7 @@ "kind": "value", "name": "minUndefined", "docstrings": [ - "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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.minUndefined /* undefined */\ns1->Belt.MutableSet.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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.minUndefined, Js.undefined)\nassertEqual(s1->Belt.MutableSet.minUndefined, Js.Undefined.return(1))\n```" ], "signature": "let minUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -6317,7 +6317,7 @@ "kind": "value", "name": "maximum", "docstrings": [ - "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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.maximum /* None */\ns1->Belt.MutableSet.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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.maximum, None)\nassertEqual(s1->Belt.MutableSet.maximum, Some(5))\n```" ], "signature": "let maximum: t<'value, 'id> => option<'value>" }, @@ -6326,7 +6326,7 @@ "kind": "value", "name": "maxUndefined", "docstrings": [ - "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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.maxUndefined /* undefined */\ns1->Belt.MutableSet.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.MutableSet.make(~id=module(IntCmp))\nlet s1 = Belt.MutableSet.fromArray([3, 2, 1, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.maxUndefined, Js.undefined)\nassertEqual(s1->Belt.MutableSet.maxUndefined, Js.Undefined.return(5))\n```" ], "signature": "let maxUndefined: t<'value, 'id> => Js.undefined<'value>" }, @@ -6335,7 +6335,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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\n\ns0->Belt.MutableSet.get(3) /* Some(3) */\ns0->Belt.MutableSet.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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\n\nassertEqual(s0->Belt.MutableSet.get(3), Some(3))\nassertEqual(s0->Belt.MutableSet.get(20), None)\n```" ], "signature": "let get: (t<'value, 'id>, 'value) => option<'value>" }, @@ -6362,7 +6362,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\nmodule IntCmp = Belt.Id.MakeComparable({\n type t = int\n let cmp = Pervasives.compare\n})\n\nlet s0 = Belt.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\n\nlet ((smaller, larger), present) = s0->Belt.MutableSet.split(3)\n\npresent /* true */\nsmaller->Belt.MutableSet.toArray /* [1,2] */\nlarger->Belt.MutableSet.toArray /* [4,5] */\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.MutableSet.fromArray([1, 2, 3, 4, 5], ~id=module(IntCmp))\n\nlet ((smaller, larger), present) = s0->Belt.MutableSet.split(3)\n\nassertEqual(present, true)\nassertEqual(smaller->Belt.MutableSet.toArray, [1,2])\nassertEqual(larger->Belt.MutableSet.toArray, [4,5])\n```" ], "signature": "let split: (\n t<'value, 'id>,\n 'value,\n) => ((t<'value, 'id>, t<'value, 'id>), bool)" }, @@ -6417,7 +6417,7 @@ "kind": "value", "name": "isEmpty", "docstrings": [ - "`isEmpty(m)` checks whether a map m is empty.\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\nBelt.Map.isEmpty(Belt.Map.fromArray([(1, \"1\")], ~id=module(IntCmp))) == false\n```" + "`isEmpty(m)` checks whether a map m is empty.\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\nassertEqual(Belt.Map.isEmpty(Belt.Map.fromArray([(1, \"1\")], ~id=module(IntCmp))), false)\n```" ], "signature": "let isEmpty: t<'a, 'b, 'c> => bool" }, @@ -6426,7 +6426,7 @@ "kind": "value", "name": "has", "docstrings": [ - "`has(m, k)` checks whether `m` has the key `k`.\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\nBelt.Map.has(Belt.Map.fromArray([(1, \"1\")], ~id=module(IntCmp)), 1) == true\n```" + "`has(m, k)` checks whether `m` has the key `k`.\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\nassertEqual(Belt.Map.has(Belt.Map.fromArray([(1, \"1\")], ~id=module(IntCmp)), 1), true)\n```" ], "signature": "let has: (t<'k, 'v, 'id>, 'k) => bool" }, @@ -6494,7 +6494,7 @@ "kind": "value", "name": "forEach", "docstrings": [ - "`forEach(m, f)` applies `f` to all bindings in map `m`. `f` receives the\n`'k` as first argument, and the associated value as second argument. The\nbindings are passed to `f` in increasing order with respect to the ordering\nover the type of the keys.\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\nlet acc = ref(list{})\n\nBelt.Map.forEach(s0, (k, v) => acc := list{(k, v), ...acc.contents})\n\nacc.contents == list{(4, \"4\"), (3, \"3\"), (2, \"2\"), (1, \"1\")}\n```" + "`forEach(m, f)` applies `f` to all bindings in map `m`. `f` receives the\n`'k` as first argument, and the associated value as second argument. The\nbindings are passed to `f` in increasing order with respect to the ordering\nover the type of the keys.\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, \"3\")])\n\nlet acc = ref(list{})\n\nBelt.Map.forEach(s0, (k, v) => acc := list{(k, v), ...acc.contents})\n\nassertEqual(acc.contents, list{(4, \"4\"), (3, \"3\"), (2, \"2\"), (1, \"1\")})\n```" ], "signature": "let forEach: (t<'k, 'v, 'id>, ('k, 'v) => unit) => unit" }, @@ -6511,7 +6511,7 @@ "kind": "value", "name": "reduce", "docstrings": [ - "`reduce(m, a, f)` computes `(f(kN, dN) ... (f(k1, d1, a))...)`, where `k1\n... kN` are the keys of all bindings in m (in increasing order), and `d1\n... dN` are the associated data.\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, \"3\")])\n\nBelt.Map.reduce(s0, list{}, (acc, k, v) => list{\n (k, v),\n ...acc,\n}) /* [(4, \"4\"), (3, \"3\"), (2, \"2\"), (1, \"1\"), 0] */\n```" + "`reduce(m, a, f)` computes `(f(kN, dN) ... (f(k1, d1, a))...)`, where `k1\n... kN` are the keys of all bindings in m (in increasing order), and `d1\n... dN` are the associated data.\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, \"3\")])\n\nassertEqual(\n Belt.Map.reduce(s0, list{}, (acc, k, v) => list{\n (k, v),\n ...acc,\n }),\n list{(4, \"4\"), (3, \"3\"), (2, \"2\"), (1, \"1\")}\n)\n```" ], "signature": "let reduce: (t<'k, 'v, 'id>, 'acc, ('acc, 'k, 'v) => 'acc) => 'acc" }, @@ -6554,7 +6554,7 @@ "kind": "value", "name": "size", "docstrings": [ - "`size(s)`\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\nBelt.Map.size(Belt.Map.fromArray([(2, \"2\"), (2, \"1\"), (3, \"3\")], ~id=module(IntCmp))) == 2\n```" + "`size(s)`\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\nassertEqual(\n Belt.Map.size(Belt.Map.fromArray([(2, \"2\"), (2, \"1\"), (3, \"3\")], ~id=module(IntCmp))),\n 2\n)\n```" ], "signature": "let size: t<'k, 'v, 'id> => int" }, @@ -6563,7 +6563,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "`toArray(s)`\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\nBelt.Map.toArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))) == [\n (1, \"1\"),\n (2, \"2\"),\n (3, \"3\"),\n ]\n```" + "`toArray(s)`\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\nassertEqual(\n Belt.Map.toArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))),\n [\n (1, \"1\"),\n (2, \"2\"),\n (3, \"3\"),\n ]\n)\n```" ], "signature": "let toArray: t<'k, 'v, 'id> => array<('k, 'v)>" }, @@ -6581,7 +6581,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "`fromArray(kvs, ~id);`\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\nBelt.Map.toArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))) == [\n (1, \"1\"),\n (2, \"2\"),\n (3, \"3\"),\n ]\n```" + "`fromArray(kvs, ~id);`\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\nassertEqual(\n Belt.Map.toArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))),\n [\n (1, \"1\"),\n (2, \"2\"),\n (3, \"3\"),\n ]\n)\n```" ], "signature": "let fromArray: (array<('k, 'v)>, ~id: id<'k, 'id>) => t<'k, 'v, 'id>" }, @@ -6590,7 +6590,7 @@ "kind": "value", "name": "keysToArray", "docstrings": [ - "`keysToArray(s);`\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\nBelt.Map.keysToArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))) == [\n 1,\n 2,\n 3,\n ]\n```" + "`keysToArray(s);`\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\nassertEqual(\n Belt.Map.keysToArray(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))),\n [1, 2, 3]\n)\n```" ], "signature": "let keysToArray: t<'k, 'v, 'id> => array<'k>" }, @@ -6599,7 +6599,7 @@ "kind": "value", "name": "valuesToArray", "docstrings": [ - "`valuesToArray(s);`\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\nBelt.Map.valuesToArray(\n Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)),\n) == [\"1\", \"2\", \"3\"]\n```" + "`valuesToArray(s);`\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\nassertEqual(\n Belt.Map.valuesToArray(\n Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)),\n ),\n [\"1\", \"2\", \"3\"]\n)\n```" ], "signature": "let valuesToArray: t<'k, 'v, 'id> => array<'v>" }, @@ -6680,7 +6680,7 @@ "kind": "value", "name": "get", "docstrings": [ - "`get(s, k)`\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\nBelt.Map.get(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)), 2) ==\n Some(\"2\")\n\nBelt.Map.get(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)), 2) == None\n```" + "`get(s, k)`\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\nassertEqual(\n Belt.Map.get(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)), 2),\n Some(\"2\")\n)\n\nassertEqual(\n Belt.Map.get(Belt.Map.fromArray([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp)), 4),\n None\n)\n```" ], "signature": "let get: (t<'k, 'v, 'id>, 'k) => option<'v>" }, @@ -6716,7 +6716,7 @@ "kind": "value", "name": "remove", "docstrings": [ - "`remove(m, x)` when `x` is not in `m`, `m` is returned reference unchanged.\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([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))\n\nlet s1 = Belt.Map.remove(s0, 1)\n\nlet s2 = Belt.Map.remove(s1, 1)\n\ns1 === s2\n\nBelt.Map.keysToArray(s1) == [2, 3]\n```" + "`remove(m, x)` when `x` is not in `m`, `m` is returned reference unchanged.\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([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))\n\nlet s1 = Belt.Map.remove(s0, 1)\n\nlet s2 = Belt.Map.remove(s1, 1)\n\nassertEqual(s1, s2)\n\nassertEqual(Belt.Map.keysToArray(s1), [2, 3])\n```" ], "signature": "let remove: (t<'k, 'v, 'id>, 'k) => t<'k, 'v, 'id>" }, @@ -6734,7 +6734,7 @@ "kind": "value", "name": "set", "docstrings": [ - "`set(m, x, y)` returns a map containing the same bindings as `m`, with a\nnew binding of `x` to `y`. If `x` was already bound in `m`, its previous\nbinding disappears.\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([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))\n\nlet s1 = Belt.Map.set(s0, 2, \"3\")\n\nBelt.Map.valuesToArray(s1) == [\"1\", \"3\", \"3\"]\n```" + "`set(m, x, y)` returns a map containing the same bindings as `m`, with a\nnew binding of `x` to `y`. If `x` was already bound in `m`, its previous\nbinding disappears.\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([(2, \"2\"), (1, \"1\"), (3, \"3\")], ~id=module(IntCmp))\n\nlet s1 = Belt.Map.set(s0, 2, \"3\")\n\nassertEqual(Belt.Map.valuesToArray(s1), [\"1\", \"3\", \"3\"])\n```" ], "signature": "let set: (t<'k, 'v, 'id>, 'k, 'v) => t<'k, 'v, 'id>" }, @@ -7336,7 +7336,7 @@ "kind": "value", "name": "every", "docstrings": [ - "`every(start, finish, p)` equivalent to `Belt.Array.every(Belt.Array.range(start, finish), p)`\n## Examples\n\n```rescript\nBelt.Range.every(0, 4, (i) => i < 5) /* true */\n\nBelt.Range.every(0, 4, (i) => i < 4) /* false */\n```" + "`every(start, finish, p)` equivalent to `Belt.Array.every(Belt.Array.range(start, finish), p)`\n## Examples\n\n```rescript\nassertEqual(Belt.Range.every(0, 4, (i) => i < 5), true)\n\nassertEqual(Belt.Range.every(0, 4, (i) => i < 4), false)\n```" ], "signature": "let every: (int, int, int => bool) => bool" }, @@ -7353,7 +7353,7 @@ "kind": "value", "name": "everyBy", "docstrings": [ - "`everyBy(start, finish, ~step, p)`. See `Belt.Array.rangeBy`, equivalent to\n`Belt.Array.every(Belt.Array.rangeBy(start, finish, ~step), p)`\n\n## Examples\n\n```rescript\nBelt.Range.everyBy(0, 4, ~step=1, (i) => mod(i, 2) === 0) /* false */\n\nBelt.Range.everyBy(0, 4, ~step=2, (i) => mod(i, 2) === 0) /* true */\n```" + "`everyBy(start, finish, ~step, p)`. See `Belt.Array.rangeBy`, equivalent to\n`Belt.Array.every(Belt.Array.rangeBy(start, finish, ~step), p)`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Range.everyBy(0, 4, ~step=1, (i) => mod(i, 2) === 0), false)\n\nassertEqual(Belt.Range.everyBy(0, 4, ~step=2, (i) => mod(i, 2) === 0), true)\n```" ], "signature": "let everyBy: (int, int, ~step: int, int => bool) => bool" }, @@ -7370,7 +7370,7 @@ "kind": "value", "name": "some", "docstrings": [ - "`some(start, finish, p)` equivalent to `Belt.Array.some(Belt.Array.range(start, finish), p)`\n\n## Examples\n\n```rescript\nBelt.Range.some(0, 4, (i) => i > 5) /* false */\n\nBelt.Range.some(0, 4, (i) => i > 2) /* true */\n```" + "`some(start, finish, p)` equivalent to `Belt.Array.some(Belt.Array.range(start, finish), p)`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Range.some(0, 4, (i) => i > 5), false)\n\nassertEqual(Belt.Range.some(0, 4, (i) => i > 2), true)\n```" ], "signature": "let some: (int, int, int => bool) => bool" }, @@ -7387,7 +7387,7 @@ "kind": "value", "name": "someBy", "docstrings": [ - "`someBy(start, finish, ~step, p)` See `Belt.Array.rangeBy`, equivalent to\n`Belt.Array.some(Belt.Array.rangeBy(start, finish, ~step), p)`\n\n## Examples\n\n```rescript\nBelt.Range.someBy(1, 5, ~step=2, (i) => mod(i, 2) === 0) /* false */\nBelt.Range.someBy(0, 4, ~step=2, (i) => mod(i, 2) === 0) /* true */\n```" + "`someBy(start, finish, ~step, p)` See `Belt.Array.rangeBy`, equivalent to\n`Belt.Array.some(Belt.Array.rangeBy(start, finish, ~step), p)`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Range.someBy(1, 5, ~step=2, (i) => mod(i, 2) === 0), false)\nassertEqual(Belt.Range.someBy(0, 4, ~step=2, (i) => mod(i, 2) === 0), true)\n```" ], "signature": "let someBy: (int, int, ~step: int, int => bool) => bool" } @@ -7415,7 +7415,7 @@ "kind": "value", "name": "length", "docstrings": [ - "Returns the length of a list.\n\n## Examples\n\n```rescript\nBelt.List.length(list{1, 2, 3}) // 3\n```" + "Returns the length of a list.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.length(list{1, 2, 3}), 3)\n```" ], "signature": "let length: t<'a> => int" }, @@ -7433,7 +7433,7 @@ "kind": "value", "name": "head", "docstrings": [ - "Returns `Some(value)` where `value` is the first element in the list, or\n`None` if `someList` is an empty list.\n\n## Examples\n\n```rescript\nBelt.List.head(list{}) // None\nBelt.List.head(list{1, 2, 3}) // Some(1)\n```" + "Returns `Some(value)` where `value` is the first element in the list, or\n`None` if `someList` is an empty list.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.head(list{}), None)\nassertEqual(Belt.List.head(list{1, 2, 3}), Some(1))\n```" ], "signature": "let head: t<'a> => option<'a>" }, @@ -7451,7 +7451,7 @@ "kind": "value", "name": "tail", "docstrings": [ - "Returns `None` if `someList` is empty, otherwise it returns `Some(tail)`\nwhere `tail` is everything except the first element of `someList`.\n\n## Examples\n\n```rescript\nBelt.List.tail(list{1, 2, 3}) // Some(list{2, 3})\n\nBelt.List.tail(list{}) // None\n```" + "Returns `None` if `someList` is empty, otherwise it returns `Some(tail)`\nwhere `tail` is everything except the first element of `someList`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.tail(list{1, 2, 3}), Some(list{2, 3}))\n\nassertEqual(Belt.List.tail(list{}), None)\n```" ], "signature": "let tail: t<'a> => option>" }, @@ -7469,7 +7469,7 @@ "kind": "value", "name": "add", "docstrings": [ - "Adds `value` to the beginning of `someList`.\n\n## Examples\n\n```rescript\nBelt.List.add(list{2, 3}, 1) // list{1, 2, 3}\n\nBelt.List.add(list{\"World\", \"!\"}, \"Hello\") // list{\"Hello\", \"World\", \"!\"}\n```" + "Adds `value` to the beginning of `someList`.\n\n## Examples\n\n```rescript\nBelt.List.add(list{2, 3}, 1) // list{1, 2, 3}\n\nassertEqual(Belt.List.add(list{\"World\", \"!\"}, \"Hello\"), list{\"Hello\", \"World\", \"!\"})\n```" ], "signature": "let add: (t<'a>, 'a) => t<'a>" }, @@ -7478,7 +7478,7 @@ "kind": "value", "name": "get", "docstrings": [ - "Return the nth element in `someList`, or `None` if `index` is larger than the\nlength.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc->Belt.List.get(1) // Some(\"B\")\n\nabc->Belt.List.get(4) // None\n```" + "Return the nth element in `someList`, or `None` if `index` is larger than the\nlength.\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nassertEqual(abc->Belt.List.get(1), Some(\"B\"))\n\nassertEqual(abc->Belt.List.get(4), None)\n```" ], "signature": "let get: (t<'a>, int) => option<'a>" }, @@ -7496,7 +7496,7 @@ "kind": "value", "name": "make", "docstrings": [ - "Returns a list of length `numItems` with each element filled with value `v`. Returns an empty list if `numItems` is negative.\n\n## Examples\n\n```rescript\nBelt.List.make(3, 1) // list{1, 1, 1}\n```" + "Returns a list of length `numItems` with each element filled with value `v`. Returns an empty list if `numItems` is negative.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.make(3, 1), list{1, 1, 1})\n```" ], "signature": "let make: (int, 'a) => t<'a>" }, @@ -7515,7 +7515,7 @@ "kind": "value", "name": "makeBy", "docstrings": [ - "Return a list of length `numItems` with element `i` initialized with `f(i)`.\nReturns an empty list if `numItems` is negative.\n\n## Examples\n\n```rescript\nBelt.List.makeBy(5, i => i) // list{0, 1, 2, 3, 4}\n\nBelt.List.makeBy(5, i => i * i) // list{0, 1, 4, 9, 16}\n```" + "Return a list of length `numItems` with element `i` initialized with `f(i)`.\nReturns an empty list if `numItems` is negative.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.makeBy(5, i => i), list{0, 1, 2, 3, 4})\n\nassertEqual(Belt.List.makeBy(5, i => i * i), list{0, 1, 4, 9, 16})\n```" ], "signature": "let makeBy: (int, int => 'a) => t<'a>" }, @@ -7533,7 +7533,7 @@ "kind": "value", "name": "drop", "docstrings": [ - "Return a new list, dropping the first `n` elements. Returns `None` if `someList` has fewer than `n` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->Belt.List.drop(2) // Some(list{3})\n\nlist{1, 2, 3}->Belt.List.drop(3) // Some(list{})\n\nlist{1, 2, 3}->Belt.List.drop(4) // None\n```" + "Return a new list, dropping the first `n` elements. Returns `None` if `someList` has fewer than `n` elements.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3}->Belt.List.drop(2), Some(list{3}))\n\nassertEqual(list{1, 2, 3}->Belt.List.drop(3), Some(list{}))\n\nassertEqual(list{1, 2, 3}->Belt.List.drop(4), None)\n```" ], "signature": "let drop: (t<'a>, int) => option>" }, @@ -7542,7 +7542,7 @@ "kind": "value", "name": "take", "docstrings": [ - "Returns a list with the first `n` elements from `someList`, or `None` if `someList` has fewer than `n` elements.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->Belt.List.take(1) // Some(list{1})\n\nlist{1, 2, 3}->Belt.List.take(2) // Some(list{1, 2})\n\nlist{1, 2, 3}->Belt.List.take(4) // None\n```" + "Returns a list with the first `n` elements from `someList`, or `None` if `someList` has fewer than `n` elements.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3}->Belt.List.take(1), Some(list{1}))\n\nassertEqual(list{1, 2, 3}->Belt.List.take(2), Some(list{1, 2}))\n\nassertEqual(list{1, 2, 3}->Belt.List.take(4), None)\n```" ], "signature": "let take: (t<'a>, int) => option>" }, @@ -7551,7 +7551,7 @@ "kind": "value", "name": "splitAt", "docstrings": [ - "Split the list `someList` at `index`. Returns `None` when the length of `someList` is less than `index`.\n\n## Examples\n\n```rescript\nlist{\"Hello\", \"World\"}->Belt.List.splitAt(1) // Some((list{\"Hello\"}, list{\"World\"}))\n\nlist{0, 1, 2, 3, 4}->Belt.List.splitAt(2) // Some((list{0, 1}, list{2, 3, 4}))\n```" + "Split the list `someList` at `index`. Returns `None` when the length of `someList` is less than `index`.\n\n## Examples\n\n```rescript\nassertEqual(list{\"Hello\", \"World\"}->Belt.List.splitAt(1), Some((list{\"Hello\"}, list{\"World\"})))\n\nassertEqual(list{0, 1, 2, 3, 4}->Belt.List.splitAt(2), Some((list{0, 1}, list{2, 3, 4})))\n```" ], "signature": "let splitAt: (t<'a>, int) => option<(list<'a>, list<'a>)>" }, @@ -7560,7 +7560,7 @@ "kind": "value", "name": "concat", "docstrings": [ - "Returns the list obtained by adding `secondList` after `firstList`.\n\n## Examples\n\n```rescript\nBelt.List.concat(list{1, 2, 3}, list{4, 5}) // list{1, 2, 3, 4, 5}\n```" + "Returns the list obtained by adding `secondList` after `firstList`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.concat(list{1, 2, 3}, list{4, 5}), list{1, 2, 3, 4, 5})\n```" ], "signature": "let concat: (t<'a>, t<'a>) => t<'a>" }, @@ -7569,7 +7569,7 @@ "kind": "value", "name": "concatMany", "docstrings": [ - "Returns the list obtained by concatenating all the lists in array `a`, in\norder.\n\n## Examples\n\n```rescript\nBelt.List.concatMany([list{1, 2, 3}, list{}, list{3}]) // list{1, 2, 3, 3}\n```" + "Returns the list obtained by concatenating all the lists in array `a`, in\norder.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.concatMany([list{1, 2, 3}, list{}, list{3}]), list{1, 2, 3, 3})\n```" ], "signature": "let concatMany: array> => t<'a>" }, @@ -7578,7 +7578,7 @@ "kind": "value", "name": "reverseConcat", "docstrings": [ - "Equivalent to writing: `concat(reverse(firstList, secondList)`\n\n## Examples\n\n```rescript\nBelt.List.reverseConcat(list{1, 2}, list{3, 4}) // list{2, 1, 3, 4}\n```" + "Equivalent to writing: `concat(reverse(firstList, secondList)`\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.reverseConcat(list{1, 2}, list{3, 4}), list{2, 1, 3, 4})\n```" ], "signature": "let reverseConcat: (t<'a>, t<'a>) => t<'a>" }, @@ -7587,7 +7587,7 @@ "kind": "value", "name": "flatten", "docstrings": [ - "Return the list obtained by concatenating all the lists in list `ls`, in order.\n\n## Examples\n\n```rescript\nBelt.List.flatten(list{list{1, 2, 3}, list{}, list{3}}) // list{1, 2, 3, 3}\n```" + "Return the list obtained by concatenating all the lists in list `ls`, in order.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.flatten(list{list{1, 2, 3}, list{}, list{3}}), list{1, 2, 3, 3})\n```" ], "signature": "let flatten: t> => t<'a>" }, @@ -7606,7 +7606,7 @@ "kind": "value", "name": "map", "docstrings": [ - "Returns a new list with `f` applied to each element of `someList`.\n\n## Examples\n\n```rescript\nlist{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n```" + "Returns a new list with `f` applied to each element of `someList`.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2}->Belt.List.map(x => x + 1), list{2, 3})\n```" ], "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, @@ -7615,7 +7615,7 @@ "kind": "value", "name": "zip", "docstrings": [ - "Returns a list of pairs from the two lists with the length of the shorter list.\n\n## Examples\n\n```rescript\nBelt.List.zip(list{1, 2}, list{3, 4, 5}) // list{(1, 3), (2, 4)}\n```" + "Returns a list of pairs from the two lists with the length of the shorter list.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.zip(list{1, 2}, list{3, 4, 5}), list{(1, 3), (2, 4)})\n```" ], "signature": "let zip: (t<'a>, t<'b>) => t<('a, 'b)>" }, @@ -7634,7 +7634,7 @@ "kind": "value", "name": "zipBy", "docstrings": [ - "See [Belt.List.zip](#zip)\n\n## Examples\n\n```rescript\nBelt.List.zipBy(list{1, 2, 3}, list{4, 5}, (a, b) => 2 * a + b) // list{6, 9}\n```" + "See [Belt.List.zip](#zip)\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.zipBy(list{1, 2, 3}, list{4, 5}, (a, b) => 2 * a + b), list{6, 9})\n```" ], "signature": "let zipBy: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" }, @@ -7653,7 +7653,7 @@ "kind": "value", "name": "mapWithIndex", "docstrings": [ - "Applies `f` to each element of `someList`.\nFunction `f` takes two arguments: the index starting from 0 and the element from `someList`, in that order.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->Belt.List.mapWithIndex((index, x) => index + x) // list{1, 3, 5}\n```" + "Applies `f` to each element of `someList`.\nFunction `f` takes two arguments: the index starting from 0 and the element from `someList`, in that order.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3}->Belt.List.mapWithIndex((index, x) => index + x), list{1, 3, 5})\n```" ], "signature": "let mapWithIndex: (t<'a>, (int, 'a) => 'b) => t<'b>" }, @@ -7662,7 +7662,7 @@ "kind": "value", "name": "fromArray", "docstrings": [ - "Converts the given array to a list.\n\n## Examples\n\n```rescript\nBelt.List.fromArray([1, 2, 3]) // list{1, 2, 3}\n```" + "Converts the given array to a list.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.fromArray([1, 2, 3]), list{1, 2, 3})\n```" ], "signature": "let fromArray: array<'a> => t<'a>" }, @@ -7671,7 +7671,7 @@ "kind": "value", "name": "toArray", "docstrings": [ - "Converts the given list to an array.\n\n## Examples\n\n```rescript\nBelt.List.toArray(list{1, 2, 3}) // [1, 2, 3]\n```" + "Converts the given list to an array.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.toArray(list{1, 2, 3}), [1, 2, 3])\n```" ], "signature": "let toArray: t<'a> => array<'a>" }, @@ -7680,7 +7680,7 @@ "kind": "value", "name": "reverse", "docstrings": [ - "Returns a new list whose elements are those of `someList` in reversed order.\n\n## Examples\n\n```rescript\nBelt.List.reverse(list{1, 2, 3}) /* list{3, 2, 1} */\n```" + "Returns a new list whose elements are those of `someList` in reversed order.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.reverse(list{1, 2, 3}), list{3, 2, 1})\n```" ], "signature": "let reverse: t<'a> => t<'a>" }, @@ -7756,7 +7756,7 @@ "kind": "value", "name": "reduce", "docstrings": [ - "Applies `f` to each element of `someList` from beginning to end. Function `f` has two parameters: the item from the list and an “accumulator”, which starts with a value of `initialValue`. reduce returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->Belt.List.reduce(0, (a, b) => a + b) /* 10 */\n\n/* same as */\n\nlist{1, 2, 3, 4}->Belt.List.reduce(0, (acc, item) => acc + item) /* 10 */\n```" + "Applies `f` to each element of `someList` from beginning to end. Function `f` has two parameters: the item from the list and an “accumulator”, which starts with a value of `initialValue`. reduce returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3, 4}->Belt.List.reduce(0, (a, b) => a + b), 10)\n\n/* same as */\n\nassertEqual(list{1, 2, 3, 4}->Belt.List.reduce(0, (acc, item) => acc + item), 10)\n```" ], "signature": "let reduce: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" }, @@ -7775,7 +7775,7 @@ "kind": "value", "name": "reduceWithIndex", "docstrings": [ - "Applies `f` to each element of `someList` from beginning to end. Function `f` has three parameters: the item from the list and an “accumulator”, which starts with a value of `initialValue` and the index of each element. `reduceWithIndex` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->Belt.List.reduceWithIndex(0, (acc, item, index) => acc + item + index) /* 16 */\n```" + "Applies `f` to each element of `someList` from beginning to end. Function `f` has three parameters: the item from the list and an “accumulator”, which starts with a value of `initialValue` and the index of each element. `reduceWithIndex` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nassertEqual(\n list{1, 2, 3, 4}->Belt.List.reduceWithIndex(0, (acc, item, index) => acc + item + index),\n 16\n)\n```" ], "signature": "let reduceWithIndex: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, @@ -7794,7 +7794,7 @@ "kind": "value", "name": "reduceReverse", "docstrings": [ - "Works like [reduce](#reduce), except that function `f` is applied to each\nitem of `someList` from the last back to the first.\n\n## Examples\n\n```rescript\nlist{1, 2, 3, 4}->Belt.List.reduceReverse(0, (a, b) => a + b) /* 10 */\n\nlist{1, 2, 3, 4}->Belt.List.reduceReverse(10, (a, b) => a - b) /* 0 */\n\nlist{1, 2, 3, 4}->Belt.List.reduceReverse(list{}, Belt.List.add) // list{1, 2, 3, 4}\n```" + "Works like [reduce](#reduce), except that function `f` is applied to each\nitem of `someList` from the last back to the first.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3, 4}->Belt.List.reduceReverse(0, (a, b) => a + b), 10)\n\nassertEqual(list{1, 2, 3, 4}->Belt.List.reduceReverse(10, (a, b) => a - b), 0)\n\nassertEqual(list{1, 2, 3, 4}->Belt.List.reduceReverse(list{}, Belt.List.add), list{1, 2, 3, 4})\n```" ], "signature": "let reduceReverse: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" }, @@ -7813,7 +7813,7 @@ "kind": "value", "name": "mapReverse2", "docstrings": [ - "Equivalent to: `zipBy(xs, ys, f)->reverse`\n\n## Examples\n\n```rescript\n\nBelt.List.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b) // list{4, 2}\n```" + "Equivalent to: `zipBy(xs, ys, f)->reverse`\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b), list{4, 2})\n```" ], "signature": "let mapReverse2: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" }, @@ -7851,7 +7851,7 @@ "kind": "value", "name": "reduce2", "docstrings": [ - "Applies `f` to each element of `firstList` and `secondList` from beginning to end. Stops with the shorter list. Function `f` has three parameters: an “accumulator” which starts with a value of `initialValue`, an item from `firstList`, and an item from `secondList`. `reduce2` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nBelt.List.reduce2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) /* 0 + (1 * 1 + 4) + (2 * 2 + 5) */\n```" + "Applies `f` to each element of `firstList` and `secondList` from beginning to end. Stops with the shorter list. Function `f` has three parameters: an “accumulator” which starts with a value of `initialValue`, an item from `firstList`, and an item from `secondList`. `reduce2` returns the final value of the accumulator.\n\n## Examples\n\n```rescript\nassertEqual(\n Belt.List.reduce2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y),\n 0 + (1 * 1 + 4) + (2 * 2 + 5)\n)\n```" ], "signature": "let reduce2: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" }, @@ -7870,7 +7870,7 @@ "kind": "value", "name": "reduceReverse2", "docstrings": [ - "Applies `f` to each element of `firstList` and `secondList` from end to\nbeginning. Stops with the shorter list. Function `f` has three parameters: an\n“accumulator” which starts with a value of init, an item from `firstList`,\nand an item from `secondList`. `reduce2` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nBelt.List.reduceReverse2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y) /* + (1 * 1 + 4) + (2 * 2 + 5) */\n```" + "Applies `f` to each element of `firstList` and `secondList` from end to\nbeginning. Stops with the shorter list. Function `f` has three parameters: an\n“accumulator” which starts with a value of init, an item from `firstList`,\nand an item from `secondList`. `reduce2` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nassertEqual(\n Belt.List.reduceReverse2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y),\n 0 + (1 * 1 + 4) + (2 * 2 + 5)\n)\n```" ], "signature": "let reduceReverse2: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" }, @@ -7889,7 +7889,7 @@ "kind": "value", "name": "every", "docstrings": [ - "Returns `true` if all elements satisfy `pred`, where `pred` is 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}->Belt.List.every(isBelow10) /* true */\n\nlist{1, 99, 8, 2}->Belt.List.every(isBelow10) /* false */\n```" + "Returns `true` if all elements satisfy `pred`, where `pred` is a predicate: a function taking an element and returning a bool.\n\n## Examples\n\n```rescript\nlet isBelow10 = value => value < 10\n\nassertEqual(list{1, 9, 8, 2}->Belt.List.every(isBelow10), true)\n\nassertEqual(list{1, 99, 8, 2}->Belt.List.every(isBelow10), false)\n```" ], "signature": "let every: (t<'a>, 'a => bool) => bool" }, @@ -7908,7 +7908,7 @@ "kind": "value", "name": "some", "docstrings": [ - "Returns `true` if at least _one_ of the elements in `someList` satisfies\n`pred`, where `pred` 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}->Belt.List.some(isAbove100) /* true */\n\nlist{1, 2, 3, 4}->Belt.List.some(isAbove100) /* false */\n```" + "Returns `true` if at least _one_ of the elements in `someList` satisfies\n`pred`, where `pred` is a predicate: a function taking an element and\nreturning a bool.\n\n## Examples\n\n```rescript\nlet isAbove100 = value => value > 100\n\nassertEqual(list{101, 1, 2, 3}->Belt.List.some(isAbove100), true)\n\nassertEqual(list{1, 2, 3, 4}->Belt.List.some(isAbove100), false)\n```" ], "signature": "let some: (t<'a>, 'a => bool) => bool" }, @@ -7927,7 +7927,7 @@ "kind": "value", "name": "every2", "docstrings": [ - "Returns `true` if predicate `pred(a, b)` is `true` for all pairs of elements\nup to the shorter length (i.e. `min(length(firstList), length(secondList))`)\n\n## Examples\n\n```rescript\nBelt.List.every2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) /* true */\n\nBelt.List.every2(list{}, list{1}, (a, b) => a > b) /* true */\n\nBelt.List.every2(list{2, 3}, list{1}, (a, b) => a > b) /* true */\n\nBelt.List.every2(list{0, 1}, list{5, 0}, (a, b) => a > b) /* false */\n```" + "Returns `true` if predicate `pred(a, b)` is `true` for all pairs of elements\nup to the shorter length (i.e. `min(length(firstList), length(secondList))`)\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.every2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b), true)\n\nassertEqual(Belt.List.every2(list{}, list{1}, (a, b) => a > b), true)\n\nassertEqual(Belt.List.every2(list{2, 3}, list{1}, (a, b) => a > b), true)\n\nassertEqual(Belt.List.every2(list{0, 1}, list{5, 0}, (a, b) => a > b), false)\n```" ], "signature": "let every2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" }, @@ -7946,7 +7946,7 @@ "kind": "value", "name": "some2", "docstrings": [ - "Returns `true` if predicate `pred(a, b)` is true for any pair of elements up\nto the shorter length (i.e. `min(length(firstList), length(secondList))`)\n\n## Examples\n\n```rescript\nBelt.List.some2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b) /* true */\n\nBelt.List.some2(list{}, list{1}, (a, b) => a > b) /* false */\n\nBelt.List.some2(list{2, 3}, list{1}, (a, b) => a > b) /* true */\n\nBelt.List.some2(list{0, 1}, list{5, 0}, (a, b) => a > b) /* true */\n```" + "Returns `true` if predicate `pred(a, b)` is true for any pair of elements up\nto the shorter length (i.e. `min(length(firstList), length(secondList))`)\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.some2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b), true)\n\nassertEqual(Belt.List.some2(list{}, list{1}, (a, b) => a > b), false)\n\nassertEqual(Belt.List.some2(list{2, 3}, list{1}, (a, b) => a > b), true)\n\nassertEqual(Belt.List.some2(list{0, 1}, list{5, 0}, (a, b) => a > b), true)\n```" ], "signature": "let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" }, @@ -7955,7 +7955,7 @@ "kind": "value", "name": "cmpByLength", "docstrings": [ - "Compare two lists solely by length. Returns `-1` if `length(firstList)` is\nless than `length(secondList)`, `0` if `length(firstList)` equals\n`length(secondList)`, and `1` if `length(firstList)` is greater than\n`length(secondList)`.\n\n## Examples\n\n```rescript\nBelt.List.cmpByLength(list{1, 2}, list{3, 4, 5, 6}) /* -1 */\n\nBelt.List.cmpByLength(list{1, 2, 3}, list{4, 5, 6}) /* = 0 */\n\nBelt.List.cmpByLength(list{1, 2, 3, 4}, list{5, 6}) /* = 1 */\n```" + "Compare two lists solely by length. Returns `-1` if `length(firstList)` is\nless than `length(secondList)`, `0` if `length(firstList)` equals\n`length(secondList)`, and `1` if `length(firstList)` is greater than\n`length(secondList)`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.cmpByLength(list{1, 2}, list{3, 4, 5, 6}), -1)\n\nassertEqual(Belt.List.cmpByLength(list{1, 2, 3}, list{4, 5, 6}), 0)\n\nassertEqual(Belt.List.cmpByLength(list{1, 2, 3, 4}, list{5, 6}), 1)\n```" ], "signature": "let cmpByLength: (t<'a>, t<'a>) => int" }, @@ -7974,7 +7974,7 @@ "kind": "value", "name": "cmp", "docstrings": [ - "Compare elements one by one `compareFn(a, b)`. `compareFn` returns a negative number if `a` is \"less than\" `b`, zero if `a` is \"equal to\" `b`, a positive number if `a` is \"greater than\" `b`.\n\nThe comparison returns the first non-zero result of `compareFn`, or zero if `compareFn` returns zero for all `a` and `b`.\n\nIf all items have compared equal, but `firstList` is exhausted first, return `-1`. (`firstList` is shorter).\nIf all items have compared equal, but `secondList` is exhausted first, return `1` (`firstList` is longer).\n\n## Examples\n\n```rescript\nBelt.List.cmp(list{3}, list{3, 7}, (a, b) => compare(a, b)) /* (-1) */\n\nBelt.List.cmp(list{5, 3}, list{5}, (a, b) => compare(a, b)) /* 1 */\n\nBelt.List.cmp(list{1, 3, 5}, list{1, 4, 2}, (a, b) => compare(a, b)) /* (-1) */\n\nBelt.List.cmp(list{1, 3, 5}, list{1, 2, 3}, (a, b) => compare(a, b)) /* 1 */\n\nBelt.List.cmp(list{1, 3, 5}, list{1, 3, 5}, (a, b) => 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." + "Compare elements one by one `compareFn(a, b)`. `compareFn` returns a negative number if `a` is \"less than\" `b`, zero if `a` is \"equal to\" `b`, a positive number if `a` is \"greater than\" `b`.\n\nThe comparison returns the first non-zero result of `compareFn`, or zero if `compareFn` returns zero for all `a` and `b`.\n\nIf all items have compared equal, but `firstList` is exhausted first, return `-1`. (`firstList` is shorter).\nIf all items have compared equal, but `secondList` is exhausted first, return `1` (`firstList` is longer).\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.cmp(list{3}, list{3, 7}, (a, b) => compare(a, b)), (-1))\n\nassertEqual(Belt.List.cmp(list{5, 3}, list{5}, (a, b) => compare(a, b)), 1)\n\nassertEqual(Belt.List.cmp(list{1, 3, 5}, list{1, 4, 2}, (a, b) => compare(a, b)), (-1))\n\nassertEqual(Belt.List.cmp(list{1, 3, 5}, list{1, 2, 3}, (a, b) => compare(a, b)), 1)\n\nassertEqual(Belt.List.cmp(list{1, 3, 5}, list{1, 3, 5}, (a, b) => 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 cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int" }, @@ -7993,7 +7993,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "Check equality of `firstList` and `secondList` using `eqElem` for equality on\nelements, where `eqElem` is a function that returns `true` if items `x` and\n`y` meet some criterion for equality, `false` otherwise. eq `false` if length\nof `firstList` and `secondList` are not the same.\n\n## Examples\n\n```rescript\nBelt.List.eq(list{1, 2, 3}, list{1, 2}, (a, b) => a == b) /* false */\n\nBelt.List.eq(list{1, 2}, list{1, 2}, (a, b) => a == b) /* true */\n\nBelt.List.eq(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)) /* true */\n```" + "Check equality of `firstList` and `secondList` using `eqElem` for equality on\nelements, where `eqElem` is a function that returns `true` if items `x` and\n`y` meet some criterion for equality, `false` otherwise. eq `false` if length\nof `firstList` and `secondList` are not the same.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.eq(list{1, 2, 3}, list{1, 2}, (a, b) => a == b), false)\n\nassertEqual(Belt.List.eq(list{1, 2}, list{1, 2}, (a, b) => a == b), true)\n\nassertEqual(Belt.List.eq(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)), true)\n```" ], "signature": "let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" }, @@ -8012,7 +8012,7 @@ "kind": "value", "name": "has", "docstrings": [ - "Returns `true` if the list contains at least one element for which\n`eqFunction(x)` returns true.\n\n## Examples\n\n```rescript\nlist{1, 2, 3}->Belt.List.has(2, (a, b) => a == b) /* true */\n\nlist{1, 2, 3}->Belt.List.has(4, (a, b) => a == b) /* false */\n\nlist{(-1), (-2), (-3)}->Belt.List.has(2, (a, b) => abs(a) == abs(b)) /* true */\n```" + "Returns `true` if the list contains at least one element for which\n`eqFunction(x)` returns true.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2, 3}->Belt.List.has(2, (a, b) => a == b), true)\n\nassertEqual(list{1, 2, 3}->Belt.List.has(4, (a, b) => a == b), false)\n\nassertEqual(list{(-1), (-2), (-3)}->Belt.List.has(2, (a, b) => abs(a) == abs(b)), true)\n```" ], "signature": "let has: (t<'a>, 'b, ('a, 'b) => bool) => bool" }, @@ -8031,7 +8031,7 @@ "kind": "value", "name": "getBy", "docstrings": [ - "Returns `Some(value)` for the first value in `someList` that satisfies the\npredicate function `pred`. Returns `None` if no element satisfies the function.\n\n## Examples\n\n```rescript\nBelt.List.getBy(list{1, 4, 3, 2}, x => x > 3) /* Some(4) */\n\nBelt.List.getBy(list{1, 4, 3, 2}, x => x > 4) /* None */\n```" + "Returns `Some(value)` for the first value in `someList` that satisfies the\npredicate function `pred`. Returns `None` if no element satisfies the function.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.getBy(list{1, 4, 3, 2}, x => x > 3), Some(4))\n\nassertEqual(Belt.List.getBy(list{1, 4, 3, 2}, x => x > 4), None)\n```" ], "signature": "let getBy: (t<'a>, 'a => bool) => option<'a>" }, @@ -8050,7 +8050,7 @@ "kind": "value", "name": "keep", "docstrings": [ - "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nBelt.List.keep(list{1, 2, 3, 4}, isEven) /* list{2, 4} */\n\nBelt.List.keep(list{None, Some(2), Some(3), None}, Belt.Option.isSome) /* list{Some(2), Some(3)} */\n```" + "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nassertEqual(Belt.List.keep(list{1, 2, 3, 4}, isEven), list{2, 4})\n\nassertEqual(Belt.List.keep(list{None, Some(2), Some(3), None}, Belt.Option.isSome), list{Some(2), Some(3)})\n```" ], "signature": "let keep: (t<'a>, 'a => bool) => t<'a>" }, @@ -8059,7 +8059,7 @@ "kind": "value", "name": "filter", "docstrings": [ - "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nBelt.List.filter(list{1, 2, 3, 4}, isEven) /* list{2, 4} */\n\nBelt.List.filter(list{None, Some(2), Some(3), None}, Belt.Option.isSome) /* list{Some(2), Some(3)} */\n```" + "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nassertEqual(Belt.List.filter(list{1, 2, 3, 4}, isEven), list{2, 4})\n\nassertEqual(Belt.List.filter(list{None, Some(2), Some(3), None}, Belt.Option.isSome), list{Some(2), Some(3)})\n```" ], "signature": "let filter: (t<'a>, 'a => bool) => t<'a>", "deprecated": "This function will soon be deprecated. Please, use `List.keep` instead." @@ -8079,7 +8079,7 @@ "kind": "value", "name": "keepWithIndex", "docstrings": [ - "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nBelt.List.keepWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)) /* list{1, 3} */\n```" + "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nassertEqual(Belt.List.keepWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)), list{1, 3})\n```" ], "signature": "let keepWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" }, @@ -8088,7 +8088,7 @@ "kind": "value", "name": "filterWithIndex", "docstrings": [ - "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nBelt.List.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)) /* list{1, 3} */\n```" + "Returns a list of all elements in `someList` which satisfy the predicate function `pred`.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nassertEqual(Belt.List.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)), list{1, 3})\n```" ], "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>", "deprecated": "This function will soon be deprecated. Please, use `List.keepWithIndex` \\\n instead." @@ -8108,7 +8108,7 @@ "kind": "value", "name": "keepMap", "docstrings": [ - "Applies `f` to each element of `someList`. If `f(x)` returns `Some(value)`, then `value` is _kept_ in the resulting list.\nIf `f(x)` returns `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->Belt.List.keepMap(x =>\n if (isEven(x)) {\n Some(x)\n } else {\n None\n }\n ) /* list{2, 4} */\n\nlist{Some(1), Some(2), None}->Belt.List.keepMap(x => x) /* list{1, 2} */\n```" + "Applies `f` to each element of `someList`. If `f(x)` returns `Some(value)`, then `value` is _kept_ in the resulting list.\nIf `f(x)` returns `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->Belt.List.keepMap(x =>\n if (isEven(x)) {\n Some(x)\n } else {\n None\n }\n ) /* list{2, 4} */\n\nassertEqual(list{Some(1), Some(2), None}->Belt.List.keepMap(x => x), list{1, 2})\n```" ], "signature": "let keepMap: (t<'a>, 'a => option<'b>) => t<'b>" }, @@ -8136,7 +8136,7 @@ "kind": "value", "name": "unzip", "docstrings": [ - "Takes a list of pairs and creates a pair of lists. The first list contains all the first items of the pairs; the second list contains all the second items.\n\n## Examples\n\n```rescript\nBelt.List.unzip(list{(1, 2), (3, 4)}) /* (list{1, 3}, list{2, 4}) */\n\nBelt.List.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```" + "Takes a list of pairs and creates a pair of lists. The first list contains all the first items of the pairs; the second list contains all the second items.\n\n## Examples\n\n```rescript\nassertEqual(Belt.List.unzip(list{(1, 2), (3, 4)}), (list{1, 3}, list{2, 4}))\n\nassertEqual(\n Belt.List.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)\n```" ], "signature": "let unzip: t<('a, 'b)> => (t<'a>, t<'b>)" }, @@ -8155,7 +8155,7 @@ "kind": "value", "name": "getAssoc", "docstrings": [ - "Return the second element of a pair in `someList` where the first element equals `k` as per the predicate function `eqFunction`, or `None` if not found.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.getAssoc(3, (a, b) => a == b) /* Some(\"c\") */\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->Belt.List.getAssoc(15, (k, item) => k /* 15 */ == item /* 9, 5, 22 */)\n/* Some(\"afternoon\") */\n```" + "Return the second element of a pair in `someList` where the first element equals `k` as per the predicate function `eqFunction`, or `None` if not found.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.getAssoc(3, (a, b) => a == b) /* Some(\"c\") */\n\nassertEqual(\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n ->Belt.List.getAssoc(15, (k, item) => k /* 15 */ == item /* 9, 5, 22 */),\n Some(\"afternoon\")\n)\n```" ], "signature": "let getAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>" }, @@ -8174,7 +8174,7 @@ "kind": "value", "name": "hasAssoc", "docstrings": [ - "Returns `true` if there is a pair in `someList` where the first element equals `k` as per the predicate function `eqFunction`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.hasAssoc(1, (a, b) => a == b) /* true */\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->Belt.List.hasAssoc(25, (k, item) => k /* 25 */ == item /* 9, 5, 22 */) /* false */\n```" + "Returns `true` if there is a pair in `someList` where the first element equals `k` as per the predicate function `eqFunction`.\n\n## Examples\n\n```rescript\nassertEqual(\n list{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.hasAssoc(1, (a, b) => a == b),\n true\n)\n\nassertEqual(\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}->Belt.List.hasAssoc(25, (k, item) => k /* 25 */ == item /* 9, 5, 22 */),\n false\n)\n```" ], "signature": "let hasAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool" }, @@ -8193,7 +8193,7 @@ "kind": "value", "name": "removeAssoc", "docstrings": [ - "Return a list after removing the first pair whose first value is `k` per the equality predicate `eqFunction`; if not found, return a new list identical to `someList`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.removeAssoc(1, (a, b) => a == b) /* list{(2, \"b\"), (3, \"c\")} */\n\nlist{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n->Belt.List.removeAssoc(9, (k, item) => k /* 9 */ == item /* 9, 5, 22 */)\n/* list{(15, \"afternoon\"), (22, \"night\")} */\n```" + "Return a list after removing the first pair whose first value is `k` per the equality predicate `eqFunction`; if not found, return a new list identical to `someList`.\n\n## Examples\n\n```rescript\nassertEqual(\n list{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.removeAssoc(1, (a, b) => a == b),\n list{(2, \"b\"), (3, \"c\")}\n)\n\nassertEqual(\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n ->Belt.List.removeAssoc(9, (k, item) => k /* 9 */ == item /* 9, 5, 22 */),\n list{(15, \"afternoon\"), (22, \"night\")}\n)\n```" ], "signature": "let removeAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>" }, @@ -8212,7 +8212,7 @@ "kind": "value", "name": "setAssoc", "docstrings": [ - "If `k` exists in `someList` by satisfying the `eqFunction` predicate, return a new list with the key and value replaced by the new `k` and `v`; otherwise, return a new list with the pair `k`, `v` added to the head of `someList`.\n\n## Examples\n\n```rescript\nlist{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.setAssoc(2, \"x\", (a, b) => a == b) /* list{(1, \"a\"), (2, \"x\"), (3, \"c\")} */\n\nlist{(1, \"a\"), (3, \"c\")}->Belt.List.setAssoc(2, \"b\", (a, b) => a == b) /* list{(2, \"b\"), (1, \"a\"), (3, \"c\")} */\n\nlist{(9, \"morning\"), (3, \"morning?!\"), (22, \"night\")}\n->Belt.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**\n\nIn the last example, since: `15 mod 12` equals `3 mod 12`\n\nBoth the key _and_ the value are replaced in the list." + "If `k` exists in `someList` by satisfying the `eqFunction` predicate, return a new list with the key and value replaced by the new `k` and `v`; otherwise, return a new list with the pair `k`, `v` added to the head of `someList`.\n\n## Examples\n\n```rescript\nassertEqual(\n list{(1, \"a\"), (2, \"b\"), (3, \"c\")}->Belt.List.setAssoc(2, \"x\", (a, b) => a == b),\n list{(1, \"a\"), (2, \"x\"), (3, \"c\")}\n)\n\nassertEqual(\n list{(1, \"a\"), (3, \"c\")}->Belt.List.setAssoc(2, \"b\", (a, b) => a == b),\n list{(2, \"b\"), (1, \"a\"), (3, \"c\")}\n)\n\nassertEqual(\n list{(9, \"morning\"), (3, \"morning?!\"), (22, \"night\")}\n ->Belt.List.setAssoc(15, \"afternoon\", (a, b) => mod(a, 12) == mod(b, 12)),\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n)\n```\n\n**Please note**\n\nIn the last example, since: `15 mod 12` equals `3 mod 12`\n\nBoth the key _and_ the value are replaced in the list." ], "signature": "let setAssoc: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>" }, @@ -8231,7 +8231,7 @@ "kind": "value", "name": "sort", "docstrings": [ - "Returns a sorted list.\n\n## Examples\n\n```rescript\nBelt.List.sort(list{5, 4, 9, 3, 7}, (a, b) => a - b) // list{3, 4, 5, 7, 9}\n```" + "Returns a sorted list.\n\n## Examples\n\n```rescript\nassertEqual(\n Belt.List.sort(list{5, 4, 9, 3, 7}, (a, b) => a - b),\n list{3, 4, 5, 7, 9}\n)\n```" ], "signature": "let sort: (t<'a>, ('a, 'a) => int) => t<'a>" } @@ -8586,7 +8586,7 @@ "kind": "value", "name": "strictlySortedLength", "docstrings": [ - "`strictlySortedLenght(xs, cmp);` return `+n` means increasing order `-n` means negative order\n\n## Examples\n\n```rescript\nBelt.SortArray.strictlySortedLength([1, 2, 3, 4, 3], (x, y) => x < y) == 4\n\nBelt.SortArray.strictlySortedLength([], (x, y) => x < y) == 0\n\nBelt.SortArray.strictlySortedLength([1], (x, y) => x < y) == 1\n\nBelt.SortArray.strictlySortedLength([4, 3, 2, 1], (x, y) => x < y) == -4\n```" + "`strictlySortedLenght(xs, cmp);` return `+n` means increasing order `-n` means negative order\n\n## Examples\n\n```rescript\nassertEqual(Belt.SortArray.strictlySortedLength([1, 2, 3, 4, 3], (x, y) => x < y), 4)\n\nassertEqual(Belt.SortArray.strictlySortedLength([], (x, y) => x < y), 0)\n\nassertEqual(Belt.SortArray.strictlySortedLength([1], (x, y) => x < y), 1)\n\nassertEqual(Belt.SortArray.strictlySortedLength([4, 3, 2, 1], (x, y) => x < y), -4)\n```" ], "signature": "let strictlySortedLength: (array<'a>, ('a, 'a) => bool) => int" }, @@ -8652,7 +8652,7 @@ "kind": "value", "name": "binarySearchBy", "docstrings": [ - "If value is not found and value is less than one or more elements in array, the\nnegative number returned is the bitwise complement of the index of the first\nelement that is larger than value.\n\nIf value is not found and value is greater\nthan all elements in array, the negative number returned is the bitwise\ncomplement of (the index of the last element plus 1)for example, if `key` is\nsmaller than all elements return `-1` since `lnot(-1) == 0` if `key` is larger\nthan all elements return `lnot(-1) == 0` since `lnot(- (len + 1)) == len`\n\n## Examples\n\n```rescript\nBelt.SortArray.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 33, Pervasives.compare) == 4\n\nlnot(Belt.SortArray.binarySearchBy([1, 3, 5, 7], 4, Pervasives.compare)) == 2\n```" + "If value is not found and value is less than one or more elements in array, the\nnegative number returned is the bitwise complement of the index of the first\nelement that is larger than value.\n\nIf value is not found and value is greater\nthan all elements in array, the negative number returned is the bitwise\ncomplement of (the index of the last element plus 1)for example, if `key` is\nsmaller than all elements return `-1` since `lnot(-1) == 0` if `key` is larger\nthan all elements return `lnot(-1) == 0` since `lnot(- (len + 1)) == len`\n\n## Examples\n\n```rescript\nassertEqual(Belt.SortArray.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 33, Pervasives.compare), 4)\n\nassertEqual(lnot(Belt.SortArray.binarySearchBy([1, 3, 5, 7], 4, Pervasives.compare)), 2)\n```" ], "signature": "let binarySearchBy: (array<'a>, 'a, ('a, 'a) => int) => int" }, @@ -8727,7 +8727,7 @@ "kind": "value", "name": "length", "docstrings": [ - "Return the size of the array\n\n## Examples\n\n```rescript\n// Returns 1\nBelt.Array.length([\"test\"])\n```" + "Return the size of the array\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.length([\"test\"]), 1)\n```" ], "signature": "let length: t<'a> => int" }, @@ -8745,7 +8745,7 @@ "kind": "value", "name": "get", "docstrings": [ - "If `i <= 0 <= length(arr)` returns `Some(value)` where `value` is the item at index `i`.\nIf `i` is out of range returns `None`.\n\n## Examples\n\n```rescript\nBelt.Array.get([\"a\", \"b\", \"c\"], 0) == Some(\"a\")\nBelt.Array.get([\"a\", \"b\", \"c\"], 3) == None\nBelt.Array.get([\"a\", \"b\", \"c\"], -1) == None\n```" + "If `i <= 0 <= length(arr)` returns `Some(value)` where `value` is the item at index `i`.\nIf `i` is out of range returns `None`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.get([\"a\", \"b\", \"c\"], 0), Some(\"a\"))\nassertEqual(Belt.Array.get([\"a\", \"b\", \"c\"], 3), None)\nassertEqual(Belt.Array.get([\"a\", \"b\", \"c\"], -1), None)\n```" ], "signature": "let get: (t<'a>, int) => option<'a>" }, @@ -8824,7 +8824,7 @@ "kind": "value", "name": "reverseInPlace", "docstrings": [ - "`reverseInPlace(arr)` reverses items in `arr` in place.\n\n## Examples\n\n```rescript\nlet arr = [10, 11, 12, 13, 14]\n\nlet () = Belt.Array.reverseInPlace(arr)\n\narr == [14, 13, 12, 11, 10]\n```" + "`reverseInPlace(arr)` reverses items in `arr` in place.\n\n## Examples\n\n```rescript\nlet arr = [10, 11, 12, 13, 14]\n\nlet () = Belt.Array.reverseInPlace(arr)\n\nassertEqual(arr, [14, 13, 12, 11, 10])\n```" ], "signature": "let reverseInPlace: t<'a> => unit" }, @@ -8833,7 +8833,7 @@ "kind": "value", "name": "reverse", "docstrings": [ - "`reverse(arr)` returns a fresh array with items in arr in reverse order.\n\n## Examples\n\n```rescript\nBelt.Array.reverse([10, 11, 12, 13, 14]) == [14, 13, 12, 11, 10]\n```" + "`reverse(arr)` returns a fresh array with items in arr in reverse order.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.reverse([10, 11, 12, 13, 14]), [14, 13, 12, 11, 10])\n```" ], "signature": "let reverse: t<'a> => t<'a>" }, @@ -8842,7 +8842,7 @@ "kind": "value", "name": "makeUninitialized", "docstrings": [ - "`makeUninitialized(n)` creates an array of length `n` filled with the undefined\nvalue. You must specify the type of data that will eventually fill the array.\n\n## Examples\n\n```rescript\nlet arr: array> = Belt.Array.makeUninitialized(5)\n\nBelt.Array.getExn(arr, 0) == Js.undefined\n```" + "`makeUninitialized(n)` creates an array of length `n` filled with the undefined\nvalue. You must specify the type of data that will eventually fill the array.\n\n## Examples\n\n```rescript\nlet arr: array> = Belt.Array.makeUninitialized(5)\n\nassertEqual(Belt.Array.getExn(arr, 0), Js.undefined)\n```" ], "signature": "let makeUninitialized: int => array>" }, @@ -8851,7 +8851,7 @@ "kind": "value", "name": "makeUninitializedUnsafe", "docstrings": [ - "**Unsafe**\n\n## Examples\n\n```rescript\nlet arr = Belt.Array.makeUninitializedUnsafe(5)\n\nJs.log(Belt.Array.getExn(arr, 0)) // undefined\n\nBelt.Array.setExn(arr, 0, \"example\")\n\nJs.log(Belt.Array.getExn(arr, 0) == \"example\")\n```" + "**Unsafe**\n\n## Examples\n\n```rescript\nlet arr = Belt.Array.makeUninitializedUnsafe(5)\n\nJs.log(Belt.Array.getExn(arr, 0)) // undefined\n\nBelt.Array.setExn(arr, 0, \"example\")\n\nassertEqual(Belt.Array.getExn(arr, 0), \"example\")\n```" ], "signature": "let makeUninitializedUnsafe: int => t<'a>" }, @@ -8869,7 +8869,7 @@ "kind": "value", "name": "range", "docstrings": [ - "`range(start, finish)` create an inclusive array.\n\n## Examples\n\n```rescript\nBelt.Array.range(0, 3) == [0, 1, 2, 3]\n\nBelt.Array.range(3, 0) == []\n\nBelt.Array.range(3, 3) == [3]\n```" + "`range(start, finish)` create an inclusive array.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.range(0, 3), [0, 1, 2, 3])\n\nassertEqual(Belt.Array.range(3, 0), [])\n\nassertEqual(Belt.Array.range(3, 3), [3])\n```" ], "signature": "let range: (int, int) => array" }, @@ -8878,7 +8878,7 @@ "kind": "value", "name": "rangeBy", "docstrings": [ - "`rangeBy(start, finish, ~step)` returns empty array when step is 0 or negative.\nIt also return an empty array when `start > finish`.\n\n## Examples\n\n```rescript\nBelt.Array.rangeBy(0, 10, ~step=3) == [0, 3, 6, 9]\n\nBelt.Array.rangeBy(0, 12, ~step=3) == [0, 3, 6, 9, 12]\n\nBelt.Array.rangeBy(33, 0, ~step=1) == []\n\nBelt.Array.rangeBy(33, 0, ~step=-1) == []\n\nBelt.Array.rangeBy(3, 12, ~step=-1) == []\n\nBelt.Array.rangeBy(3, 3, ~step=0) == []\n\nBelt.Array.rangeBy(3, 3, ~step=1) == [3]\n```" + "`rangeBy(start, finish, ~step)` returns empty array when step is 0 or negative.\nIt also return an empty array when `start > finish`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.rangeBy(0, 10, ~step=3), [0, 3, 6, 9])\n\nassertEqual(Belt.Array.rangeBy(0, 12, ~step=3), [0, 3, 6, 9, 12])\n\nassertEqual(Belt.Array.rangeBy(33, 0, ~step=1), [])\n\nassertEqual(Belt.Array.rangeBy(33, 0, ~step=-1), [])\n\nassertEqual(Belt.Array.rangeBy(3, 12, ~step=-1), [])\n\nassertEqual(Belt.Array.rangeBy(3, 3, ~step=0), [])\n\nassertEqual(Belt.Array.rangeBy(3, 3, ~step=1), [3])\n```" ], "signature": "let rangeBy: (int, int, ~step: int) => array" }, @@ -8895,7 +8895,7 @@ "kind": "value", "name": "makeBy", "docstrings": [ - "`makeBy(n, f)` return an empty array when n is negative return an array of size\nn populated by `f(i)` start from `0` to `n - 1`.\n\n## Examples\n\n```rescript\nBelt.Array.makeBy(5, (i) => i) == [0, 1, 2, 3, 4]\n\nBelt.Array.makeBy(5, (i) => i * i) == [0, 1, 4, 9, 16]\n```" + "`makeBy(n, f)` return an empty array when n is negative return an array of size\nn populated by `f(i)` start from `0` to `n - 1`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.makeBy(5, (i) => i), [0, 1, 2, 3, 4])\n\nassertEqual(Belt.Array.makeBy(5, (i) => i * i), [0, 1, 4, 9, 16])\n```" ], "signature": "let makeBy: (int, int => 'a) => t<'a>" }, @@ -8921,7 +8921,7 @@ "kind": "value", "name": "zip", "docstrings": [ - "`zip(a, b)` create an array of pairs from corresponding elements of a and b.\nStop with the shorter array.\n\n## Examples\n\n```rescript\nBelt.Array.zip([1, 2], [3, 4, 5]) == [(1, 3), (2, 4)]\n```" + "`zip(a, b)` create an array of pairs from corresponding elements of a and b.\nStop with the shorter array.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.zip([1, 2], [3, 4, 5]), [(1, 3), (2, 4)])\n```" ], "signature": "let zip: (t<'a>, array<'b>) => array<('a, 'b)>" }, @@ -8938,7 +8938,7 @@ "kind": "value", "name": "zipBy", "docstrings": [ - "`zipBy(xs, ys, f)` create an array by applying `f` to corresponding elements of\n`xs` and `ys`. Stops with shorter array.\n\nEquivalent to `map(zip(xs, ys), ((a, b)) => f(a, b))`\n\n## Examples\n\n```rescript\nBelt.Array.zipBy([1, 2, 3], [4, 5], (a, b) => 2 * a + b) == [6, 9]\n```" + "`zipBy(xs, ys, f)` create an array by applying `f` to corresponding elements of\n`xs` and `ys`. Stops with shorter array.\n\nEquivalent to `map(zip(xs, ys), ((a, b)) => f(a, b))`\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.zipBy([1, 2, 3], [4, 5], (a, b) => 2 * a + b), [6, 9])\n```" ], "signature": "let zipBy: (t<'a>, array<'b>, ('a, 'b) => 'c) => array<'c>" }, @@ -8947,7 +8947,7 @@ "kind": "value", "name": "unzip", "docstrings": [ - "`unzip(a)` takes an array of pairs and creates a pair of arrays. The first array\ncontains all the first items of the pairs; the second array contains all the\nsecond items.\n\n## Examples\n\n```rescript\nBelt.Array.unzip([(1, 2), (3, 4)]) == ([1, 3], [2, 4])\n\nBelt.Array.unzip([(1, 2), (3, 4), (5, 6), (7, 8)]) == ([1, 3, 5, 7], [2, 4, 6, 8])\n```" + "`unzip(a)` takes an array of pairs and creates a pair of arrays. The first array\ncontains all the first items of the pairs; the second array contains all the\nsecond items.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.unzip([(1, 2), (3, 4)]), ([1, 3], [2, 4]))\n\nassertEqual(Belt.Array.unzip([(1, 2), (3, 4), (5, 6), (7, 8)]), ([1, 3, 5, 7], [2, 4, 6, 8]))\n```" ], "signature": "let unzip: array<('a, 'b)> => (t<'a>, array<'b>)" }, @@ -8956,7 +8956,7 @@ "kind": "value", "name": "concat", "docstrings": [ - "`concat(xs, ys)` returns a fresh array containing the concatenation of the arrays\n`v1` and `v2`, so even if `v1` or `v2` is empty; it can not be shared.\n\n## Examples\n\n```rescript\nBelt.Array.concat([1, 2, 3], [4, 5]) == [1, 2, 3, 4, 5]\n\nBelt.Array.concat([], [\"a\", \"b\", \"c\"]) == [\"a\", \"b\", \"c\"]\n```" + "`concat(xs, ys)` returns a fresh array containing the concatenation of the arrays\n`v1` and `v2`, so even if `v1` or `v2` is empty; it can not be shared.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.concat([1, 2, 3], [4, 5]), [1, 2, 3, 4, 5])\n\nassertEqual(Belt.Array.concat([], [\"a\", \"b\", \"c\"]), [\"a\", \"b\", \"c\"])\n```" ], "signature": "let concat: (t<'a>, t<'a>) => t<'a>" }, @@ -8965,7 +8965,7 @@ "kind": "value", "name": "concatMany", "docstrings": [ - "`concatMany(xss)` returns a fresh array as the concatenation of `xss` (an array of arrays)\n\n## Examples\n\n```rescript\nBelt.Array.concatMany([[1, 2, 3], [4, 5, 6], [7, 8]]) == [1, 2, 3, 4, 5, 6, 7, 8]\n```" + "`concatMany(xss)` returns a fresh array as the concatenation of `xss` (an array of arrays)\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.concatMany([[1, 2, 3], [4, 5, 6], [7, 8]]), [1, 2, 3, 4, 5, 6, 7, 8])\n```" ], "signature": "let concatMany: array> => t<'a>" }, @@ -8974,7 +8974,7 @@ "kind": "value", "name": "slice", "docstrings": [ - "`slice(xs, offset, len)` creates a new array with the len elements of `xs`\nstarting at `offset` for `offset` can be negative;and is evaluated as\n`length(xs) - offset(slice, xs) - 1(1)` means get the last element as a\nsingleton array `slice(xs, ~-len, len)` will return a copy of the array if the\narray does not have enough data; `slice` extracts through the end of sequence.\n\nif `len` is negative; returns the empty array.\n\n## Examples\n\n```rescript\nBelt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=2, ~len=3) == [12, 13, 14]\n\nBelt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=-4, ~len=3) == [13, 14, 15]\n\nBelt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=4, ~len=9) == [14, 15, 16]\n```" + "`slice(xs, offset, len)` creates a new array with the len elements of `xs`\nstarting at `offset` for `offset` can be negative;and is evaluated as\n`length(xs) - offset(slice, xs) - 1(1)` means get the last element as a\nsingleton array `slice(xs, ~-len, len)` will return a copy of the array if the\narray does not have enough data; `slice` extracts through the end of sequence.\n\nif `len` is negative; returns the empty array.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=2, ~len=3), [12, 13, 14])\n\nassertEqual(Belt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=-4, ~len=3), [13, 14, 15])\n\nassertEqual(Belt.Array.slice([10, 11, 12, 13, 14, 15, 16], ~offset=4, ~len=9), [14, 15, 16])\n```" ], "signature": "let slice: (t<'a>, ~offset: int, ~len: int) => t<'a>" }, @@ -8983,7 +8983,7 @@ "kind": "value", "name": "sliceToEnd", "docstrings": [ - "`sliceToEnd(xs, offset)` creates a new array with the elements of `xs` starting\nat `offset`\n\n`offset` can be negative; and is evaluated as `length(xs) - offset(sliceToEnd, xs) - 1`\nmeans get the last element as a singleton array\n\n`sliceToEnd(xs, 0)` will return a copy of the array\n\n## Examples\n\n```rescript\nBelt.Array.sliceToEnd([10, 11, 12, 13, 14, 15, 16], 2) == [12, 13, 14, 15, 16]\n\nBelt.Array.sliceToEnd([10, 11, 12, 13, 14, 15, 16], -4) == [13, 14, 15, 16]\n```" + "`sliceToEnd(xs, offset)` creates a new array with the elements of `xs` starting\nat `offset`\n\n`offset` can be negative; and is evaluated as `length(xs) - offset(sliceToEnd, xs) - 1`\nmeans get the last element as a singleton array\n\n`sliceToEnd(xs, 0)` will return a copy of the array\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.sliceToEnd([10, 11, 12, 13, 14, 15, 16], 2), [12, 13, 14, 15, 16])\n\nassertEqual(Belt.Array.sliceToEnd([10, 11, 12, 13, 14, 15, 16], -4), [13, 14, 15, 16])\n```" ], "signature": "let sliceToEnd: (t<'a>, int) => t<'a>" }, @@ -9001,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]\n```" + "`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\nassertEqual(arr, [0, 1, 9, 9, 4])\n\nBelt.Array.fill(arr, ~offset=7, ~len=2, 8)\n\nassertEqual(arr, [0, 1, 9, 9, 4])\n```" ], "signature": "let fill: (t<'a>, ~offset: int, ~len: int, 'a) => unit" }, @@ -9010,7 +9010,7 @@ "kind": "value", "name": "blit", "docstrings": [ - "`blit(~src=v1, ~srcOffset=o1, ~dst=v2, ~dstOffset=o2, ~len)` copies `len` elements\nfrom array `v1`;starting at element number `o1`;to array `v2`, starting at element\nnumber `o2`. It works correctly even if `v1` and `v2` are the same array and the\nsource and destination chunks overlap.\n\n`offset` can be negative; `-1` means `len - 1`; if `len + offset` is still negative;it will be set as 0\n\nFor each of the examples;presume that `v1 == [10, 11, 12, 13, 14, 15, 16, 17]` and `v2 == [20, 21, 22, 23, 24, 25, 26, 27]`. The result shown is the content of the destination array.\n\n## Examples\n\n```rescript\nlet v1 = [10, 11, 12, 13, 14, 15, 16, 17]\nlet v2 = [20, 21, 22, 23, 24, 25, 26, 27]\n\nBelt.Array.blit(~src=v1, ~srcOffset=4, ~dst=v2, ~dstOffset=2, ~len=3)\nv2 == [20, 21, 14, 15, 16, 25, 26, 27]\n\nBelt.Array.blit(~src=v1, ~srcOffset=4, ~dst=v1, ~dstOffset=2, ~len=3)\nv1 == [10, 11, 14, 15, 16, 15, 16, 17]\n```" + "`blit(~src=v1, ~srcOffset=o1, ~dst=v2, ~dstOffset=o2, ~len)` copies `len` elements\nfrom array `v1`;starting at element number `o1`;to array `v2`, starting at element\nnumber `o2`. It works correctly even if `v1` and `v2` are the same array and the\nsource and destination chunks overlap.\n\n`offset` can be negative; `-1` means `len - 1`; if `len + offset` is still negative;it will be set as 0\n\nFor each of the examples;presume that `v1 == [10, 11, 12, 13, 14, 15, 16, 17]` and `v2 == [20, 21, 22, 23, 24, 25, 26, 27]`. The result shown is the content of the destination array.\n\n## Examples\n\n```rescript\nlet v1 = [10, 11, 12, 13, 14, 15, 16, 17]\nlet v2 = [20, 21, 22, 23, 24, 25, 26, 27]\n\nBelt.Array.blit(~src=v1, ~srcOffset=4, ~dst=v2, ~dstOffset=2, ~len=3)\nassertEqual(v2, [20, 21, 14, 15, 16, 25, 26, 27])\n\nBelt.Array.blit(~src=v1, ~srcOffset=4, ~dst=v1, ~dstOffset=2, ~len=3)\nassertEqual(v1, [10, 11, 14, 15, 16, 15, 16, 17])\n```" ], "signature": "let blit: (\n ~src: t<'a>,\n ~srcOffset: int,\n ~dst: t<'a>,\n ~dstOffset: int,\n ~len: int,\n) => unit" }, @@ -9036,7 +9036,7 @@ "kind": "value", "name": "forEach", "docstrings": [ - "`forEach(xs, f)`\n\nCall `f` on each element of `xs` from the beginning to end. `f` returns `unit`\nso no new array is created. Use `forEach` when you are primarily concerned with\nrepetitively creating side effects.\n\n## Examples\n\n```rescript\nBelt.Array.forEach([\"a\", \"b\", \"c\"], x => Js.log(\"Item: \" ++ x))\n\n/*\n prints:\n Item: a\n Item: b\n Item: c\n*/\nlet total = ref(0)\n\nBelt.Array.forEach([1, 2, 3, 4], x => total := total.contents + x)\n\ntotal.contents == 1 + 2 + 3 + 4\n```" + "`forEach(xs, f)`\n\nCall `f` on each element of `xs` from the beginning to end. `f` returns `unit`\nso no new array is created. Use `forEach` when you are primarily concerned with\nrepetitively creating side effects.\n\n## Examples\n\n```rescript\nBelt.Array.forEach([\"a\", \"b\", \"c\"], x => Js.log(\"Item: \" ++ x))\n\n/*\n prints:\n Item: a\n Item: b\n Item: c\n*/\nlet total = ref(0)\n\nBelt.Array.forEach([1, 2, 3, 4], x => total := total.contents + x)\n\nassertEqual(total.contents, 1 + 2 + 3 + 4)\n```" ], "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, @@ -9053,7 +9053,7 @@ "kind": "value", "name": "map", "docstrings": [ - "`map(xs, f)` returns a new array by calling `f` for each element of `xs` from\nthe beginning to end.\n\n## Examples\n\n```rescript\nBelt.Array.map([1, 2], (x) => x + 1) == [3, 4]\n```" + "`map(xs, f)` returns a new array by calling `f` for each element of `xs` from\nthe beginning to end.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.map([1, 2], (x) => x + 1), [2, 3])\n```" ], "signature": "let map: (t<'a>, 'a => 'b) => array<'b>" }, @@ -9070,7 +9070,7 @@ "kind": "value", "name": "flatMap", "docstrings": [ - "`flatMap(xs, f)` returns a new array by calling `f` for each element of `xs` from\nthe beginning to end, concatenating the results.\n\n## Examples\n\n```rescript\nBelt.Array.flatMap([1, 2], x => [x + 10, x + 20]) == [11, 21, 12, 22]\n```" + "`flatMap(xs, f)` returns a new array by calling `f` for each element of `xs` from\nthe beginning to end, concatenating the results.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.flatMap([1, 2], x => [x + 10, x + 20]), [11, 21, 12, 22])\n```" ], "signature": "let flatMap: (t<'a>, 'a => array<'b>) => array<'b>" }, @@ -9087,7 +9087,7 @@ "kind": "value", "name": "getBy", "docstrings": [ - "`getBy(xs, p)` returns `Some(value)` for the first value in `xs` that satisifies\nthe predicate function `p`; returns `None` if no element satisifies the function.\n\n## Examples\n\n```rescript\nBelt.Array.getBy([1, 4, 3, 2], (x) => mod(x, 2) == 0) == Some(4)\nBelt.Array.getBy([15, 13, 11], (x) => mod(x, 2) == 0) == None\n```" + "`getBy(xs, p)` returns `Some(value)` for the first value in `xs` that satisifies\nthe predicate function `p`; returns `None` if no element satisifies the function.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.getBy([1, 4, 3, 2], (x) => mod(x, 2) == 0), Some(4))\nassertEqual(Belt.Array.getBy([15, 13, 11], (x) => mod(x, 2) == 0), None)\n```" ], "signature": "let getBy: (t<'a>, 'a => bool) => option<'a>" }, @@ -9104,7 +9104,7 @@ "kind": "value", "name": "getIndexBy", "docstrings": [ - "`getIndexBy(xs, p)` returns `Some(index)` for the first value in `xs` that\nsatisifies the predicate function `p`; returns `None` if no element satisifies\nthe function.\n\n## Examples\n\n```rescript\nBelt.Array.getIndexBy([1, 4, 3, 2], (x) => mod(x, 2) == 0) == Some(1)\nBelt.Array.getIndexBy([15, 13, 11], (x) => mod(x, 2) == 0) == None\n```" + "`getIndexBy(xs, p)` returns `Some(index)` for the first value in `xs` that\nsatisifies the predicate function `p`; returns `None` if no element satisifies\nthe function.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.getIndexBy([1, 4, 3, 2], (x) => mod(x, 2) == 0), Some(1))\nassertEqual(Belt.Array.getIndexBy([15, 13, 11], (x) => mod(x, 2) == 0), None)\n```" ], "signature": "let getIndexBy: (t<'a>, 'a => bool) => option" }, @@ -9138,7 +9138,7 @@ "kind": "value", "name": "keepWithIndex", "docstrings": [ - "`keepWithIndex(xs, p)` returns a new array that keep all elements satisfy `p`.\n\n## Examples\n\n```rescript\nBelt.Array.keepWithIndex([1, 2, 3], (_x, i) => i == 1) == [2]\n```" + "`keepWithIndex(xs, p)` returns a new array that keep all elements satisfy `p`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.keepWithIndex([1, 2, 3], (_x, i) => i == 1), [2])\n```" ], "signature": "let keepWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" }, @@ -9155,7 +9155,7 @@ "kind": "value", "name": "keepMap", "docstrings": [ - "`keepMap(xs, p)` returns a new array that keep all elements that return a non\nNone applied `p`.\n\n## Examples\n\n```rescript\nBelt.Array.keepMap([1, 2, 3], x =>\n if mod(x, 2) == 0 {\n Some(x)\n } else {\n None\n }\n)\n== [2]\n```" + "`keepMap(xs, p)` returns a new array that keep all elements that return a non\nNone applied `p`.\n\n## Examples\n\n```rescript\nassertEqual(\n Belt.Array.keepMap([1, 2, 3], x =>\n if mod(x, 2) == 0 {\n Some(x)\n } else {\n None\n }\n ),\n [2]\n)\n```" ], "signature": "let keepMap: (t<'a>, 'a => option<'b>) => array<'b>" }, @@ -9172,7 +9172,7 @@ "kind": "value", "name": "forEachWithIndex", "docstrings": [ - "`forEachWithIndex(xs, f)` same as `Belt.Array.forEach`, except that `f` is\nsupplied two arguments: the index starting from 0 and the element from `xs`.\n\n## Examples\n\n```rescript\nBelt.Array.forEachWithIndex([\"a\", \"b\", \"c\"], (i, x) => Js.log(\"Item \" ++ Belt.Int.toString(i) ++ \" is \" ++ x))\n\n/*\n prints:\n Item 0 is a\n Item 1 is b\n Item 2 is cc\n*/\nlet total = ref(0)\n\nBelt.Array.forEachWithIndex([10, 11, 12, 13], (i, x) => total := total.contents + x + i)\n\ntotal.contents == 0 + 10 + 1 + 11 + 2 + 12 + 3 + 13\n```" + "`forEachWithIndex(xs, f)` same as `Belt.Array.forEach`, except that `f` is\nsupplied two arguments: the index starting from 0 and the element from `xs`.\n\n## Examples\n\n```rescript\nBelt.Array.forEachWithIndex([\"a\", \"b\", \"c\"], (i, x) => Js.log(\"Item \" ++ Belt.Int.toString(i) ++ \" is \" ++ x))\n\n/*\n prints:\n Item 0 is a\n Item 1 is b\n Item 2 is cc\n*/\nlet total = ref(0)\n\nBelt.Array.forEachWithIndex([10, 11, 12, 13], (i, x) => total := total.contents + x + i)\n\nassertEqual(total.contents, 0 + 10 + 1 + 11 + 2 + 12 + 3 + 13)\n```" ], "signature": "let forEachWithIndex: (t<'a>, (int, 'a) => unit) => unit" }, @@ -9189,7 +9189,7 @@ "kind": "value", "name": "mapWithIndex", "docstrings": [ - "`mapWithIndex(xs, f)` applies `f` to each element of `xs`. Function `f` takes\ntwo arguments: the index starting from 0 and the element from `xs`.\n\n## Examples\n\n```rescript\nBelt.Array.mapWithIndex([1, 2, 3], (i, x) => i + x) == [0 + 1, 1 + 2, 2 + 3]\n```" + "`mapWithIndex(xs, f)` applies `f` to each element of `xs`. Function `f` takes\ntwo arguments: the index starting from 0 and the element from `xs`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.mapWithIndex([1, 2, 3], (i, x) => i + x), [0 + 1, 1 + 2, 2 + 3])\n```" ], "signature": "let mapWithIndex: (t<'a>, (int, 'a) => 'b) => array<'b>" }, @@ -9206,7 +9206,7 @@ "kind": "value", "name": "partition", "docstrings": [ - "`partition(f, a)` split array into tuple of two arrays based on predicate `f`;\nfirst of tuple where predicate cause true, second where predicate cause false\n\n## Examples\n\n```rescript\nBelt.Array.partition([1, 2, 3, 4, 5], (x) => mod(x, 2) == 0) == ([2, 4], [1, 3, 5])\n\nBelt.Array.partition([1, 2, 3, 4, 5], (x) => mod(x, 2) != 0) == ([1, 3, 5], [2, 4])\n```" + "`partition(f, a)` split array into tuple of two arrays based on predicate `f`;\nfirst of tuple where predicate cause true, second where predicate cause false\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.partition([1, 2, 3, 4, 5], (x) => mod(x, 2) == 0), ([2, 4], [1, 3, 5]))\n\nassertEqual(Belt.Array.partition([1, 2, 3, 4, 5], (x) => mod(x, 2) != 0), ([1, 3, 5], [2, 4]))\n```" ], "signature": "let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" }, @@ -9223,7 +9223,7 @@ "kind": "value", "name": "reduce", "docstrings": [ - "`reduce(xs, init, f)` applies `f` to each element of `xs` from beginning to end.\nFunction `f` has two parameters: the item from the list and an “accumulator”;\nwhich starts with a value of `init`. `reduce` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nBelt.Array.reduce([2, 3, 4], 1, (a, b) => a + b) == 10\n\nBelt.Array.reduce([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b) == \"abcd\"\n```" + "`reduce(xs, init, f)` applies `f` to each element of `xs` from beginning to end.\nFunction `f` has two parameters: the item from the list and an “accumulator”;\nwhich starts with a value of `init`. `reduce` returns the final value of the\naccumulator.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.reduce([2, 3, 4], 1, (a, b) => a + b), 10)\n\nassertEqual(Belt.Array.reduce([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b), \"abcd\")\n```" ], "signature": "let reduce: (array<'b>, 'a, ('a, 'b) => 'a) => 'a" }, @@ -9240,7 +9240,7 @@ "kind": "value", "name": "reduceReverse", "docstrings": [ - "`reduceReverse(xs, init, f)` works like `Belt.Array.reduce` except that\nfunction `f` is applied to each item of `xs` from the last back to the first.\n\n## Examples\n\n```rescript\nBelt.Array.reduceReverse([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b) == \"dcba\"\n```" + "`reduceReverse(xs, init, f)` works like `Belt.Array.reduce` except that\nfunction `f` is applied to each item of `xs` from the last back to the first.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.reduceReverse([\"a\", \"b\", \"c\", \"d\"], \"\", (a, b) => a ++ b), \"dcba\")\n```" ], "signature": "let reduceReverse: (array<'b>, 'a, ('a, 'b) => 'a) => 'a" }, @@ -9257,7 +9257,7 @@ "kind": "value", "name": "reduceReverse2", "docstrings": [ - "`reduceReverse2(xs, ys, init, f)` reduces two arrays xs and ys;taking items\nstarting at `min(length(xs), length(ys))` down to and including zero.\n\n## Examples\n\n```rescript\nBelt.Array.reduceReverse2([1, 2, 3], [1, 2], 0, (acc, x, y) => acc + x + y) == 6\n```" + "`reduceReverse2(xs, ys, init, f)` reduces two arrays xs and ys;taking items\nstarting at `min(length(xs), length(ys))` down to and including zero.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.reduceReverse2([1, 2, 3], [1, 2], 0, (acc, x, y) => acc + x + y), 6)\n```" ], "signature": "let reduceReverse2: (t<'a>, array<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" }, @@ -9274,7 +9274,7 @@ "kind": "value", "name": "reduceWithIndex", "docstrings": [ - "Applies `f` to each element of `xs` from beginning to end. Function `f` has\nthree parameters: the item from the array and an “accumulator”, which starts \nwith a value of `init` and the index of each element. `reduceWithIndex` returns\nthe final value of the accumulator.\n\n## Examples\n\n```rescript\nBelt.Array.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i) == 16\n```" + "Applies `f` to each element of `xs` from beginning to end. Function `f` has\nthree parameters: the item from the array and an “accumulator”, which starts \nwith a value of `init` and the index of each element. `reduceWithIndex` returns\nthe final value of the accumulator.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.reduceWithIndex([1, 2, 3, 4], 0, (acc, x, i) => acc + x + i), 16)\n```" ], "signature": "let reduceWithIndex: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, @@ -9291,7 +9291,7 @@ "kind": "value", "name": "joinWith", "docstrings": [ - "`joinWith(xs, sep, toString)`\n\nConcatenates all the elements of `xs` converted to string with `toString`, each\nseparated by `sep`, the string given as the second argument, into a single string.\nIf the array has only one element, then that element will be returned without \nusing the separator. If the array is empty, the empty string will be returned.\n\n## Examples\n\n```rescript\nBelt.Array.joinWith([0, 1], \", \", Js.Int.toString) == \"0, 1\"\nBelt.Array.joinWith([], \" \", Js.Int.toString) == \"\"\nBelt.Array.joinWith([1], \" \", Js.Int.toString) == \"1\"\n```" + "`joinWith(xs, sep, toString)`\n\nConcatenates all the elements of `xs` converted to string with `toString`, each\nseparated by `sep`, the string given as the second argument, into a single string.\nIf the array has only one element, then that element will be returned without \nusing the separator. If the array is empty, the empty string will be returned.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.joinWith([0, 1], \", \", Js.Int.toString), \"0, 1\")\nassertEqual(Belt.Array.joinWith([], \" \", Js.Int.toString), \"\")\nassertEqual(Belt.Array.joinWith([1], \" \", Js.Int.toString), \"1\")\n```" ], "signature": "let joinWith: (t<'a>, string, 'a => string) => string" }, @@ -9308,7 +9308,7 @@ "kind": "value", "name": "some", "docstrings": [ - "`some(xs, p)` returns true if at least one of the elements in `xs` satifies `p`;\nwhere `p` is a predicate: a function taking an element and returning a `bool`.\n\n## Examples\n\n```rescript\nBelt.Array.some([2, 3, 4], (x) => mod(x, 2) == 1) == true\n\nBelt.Array.some([(-1), (-3), (-5)], (x) => x > 0) == false\n```" + "`some(xs, p)` returns true if at least one of the elements in `xs` satifies `p`;\nwhere `p` is a predicate: a function taking an element and returning a `bool`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.some([2, 3, 4], (x) => mod(x, 2) == 1), true)\n\nassertEqual(Belt.Array.some([(-1), (-3), (-5)], (x) => x > 0), false)\n```" ], "signature": "let some: (t<'a>, 'a => bool) => bool" }, @@ -9325,7 +9325,7 @@ "kind": "value", "name": "every", "docstrings": [ - "`every(xs, p)` returns `true` if all elements satisfy `p`; where `p` is a\npredicate: a function taking an element and returning a `bool`.\n\n## Examples\n\n```rescript\nBelt.Array.every([1, 3, 5], (x) => mod(x, 2) == 1) == true\n\nBelt.Array.every([1, (-3), 5], (x) => x > 0) == false\n```" + "`every(xs, p)` returns `true` if all elements satisfy `p`; where `p` is a\npredicate: a function taking an element and returning a `bool`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.every([1, 3, 5], (x) => mod(x, 2) == 1), true)\n\nassertEqual(Belt.Array.every([1, (-3), 5], (x) => x > 0), false)\n```" ], "signature": "let every: (t<'a>, 'a => bool) => bool" }, @@ -9342,7 +9342,7 @@ "kind": "value", "name": "every2", "docstrings": [ - "`every2(xs, ys, p)` returns true if `p(xi, yi)` is true for all pairs of\nelements up to the shorter length (i.e. `min(length(xs), length(ys))`)\n\n## Examples\n\n```rescript\nBelt.Array.every2([1, 2, 3], [0, 1], (a, b) => a > b) == true\n\nBelt.Array.every2([], [1], (x, y) => x > y) == true\n\nBelt.Array.every2([2, 3], [1], (x, y) => x > y) == true\n\nBelt.Array.every2([0, 1], [5, 0], (x, y) => x > y) == false\n```" + "`every2(xs, ys, p)` returns true if `p(xi, yi)` is true for all pairs of\nelements up to the shorter length (i.e. `min(length(xs), length(ys))`)\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.every2([1, 2, 3], [0, 1], (a, b) => a > b), true)\n\nassertEqual(Belt.Array.every2([], [1], (x, y) => x > y), true)\n\nassertEqual(Belt.Array.every2([2, 3], [1], (x, y) => x > y), true)\n\nassertEqual(Belt.Array.every2([0, 1], [5, 0], (x, y) => x > y), false)\n```" ], "signature": "let every2: (t<'a>, array<'b>, ('a, 'b) => bool) => bool" }, @@ -9359,7 +9359,7 @@ "kind": "value", "name": "some2", "docstrings": [ - "`some2(xs, ys, p)` returns true if `p(xi, yi)` is true for any pair of elements\nup to the shorter length (i.e. `min(length(xs), length(ys))`)\n\n## Examples\n\n```rescript\nBelt.Array.some2([0, 2], [1, 0, 3], (a, b) => a > b) == true\n\nBelt.Array.some2([], [1], (x, y) => x > y) == false\n\nBelt.Array.some2([2, 3], [1, 4], (x, y) => x > y) == true\n```" + "`some2(xs, ys, p)` returns true if `p(xi, yi)` is true for any pair of elements\nup to the shorter length (i.e. `min(length(xs), length(ys))`)\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.some2([0, 2], [1, 0, 3], (a, b) => a > b), true)\n\nassertEqual(Belt.Array.some2([], [1], (x, y) => x > y), false)\n\nassertEqual(Belt.Array.some2([2, 3], [1, 4], (x, y) => x > y), true)\n```" ], "signature": "let some2: (t<'a>, array<'b>, ('a, 'b) => bool) => bool" }, @@ -9376,7 +9376,7 @@ "kind": "value", "name": "cmp", "docstrings": [ - "`cmp(xs, ys, f)` compared by length if `length(xs) != length(ys)`; returning `-1`\nif `length(xs) < length(ys)` or 1 if `length(xs) > length(ys)`. Otherwise\ncompare one by one `f(x, y)`. `f` returns a negative number if `x` is “less than” `y`\nzero if `x` is “equal to” `y` a positive number if `x` is “greater than”\n`y`. The comparison returns the first non-zero result of `f`; or zero if `f`\nreturns zero for all `x` and `y`.\n\n## Examples\n\n```rescript\nBelt.Array.cmp([1, 3, 5], [1, 4, 2], (a, b) => compare(a, b)) == -1\n\nBelt.Array.cmp([1, 3, 5], [1, 2, 3], (a, b) => compare(a, b)) == 1\n\nBelt.Array.cmp([1, 3, 5], [1, 3, 5], (a, b) => compare(a, b)) == 0\n```" + "`cmp(xs, ys, f)` compared by length if `length(xs) != length(ys)`; returning `-1`\nif `length(xs) < length(ys)` or 1 if `length(xs) > length(ys)`. Otherwise\ncompare one by one `f(x, y)`. `f` returns a negative number if `x` is “less than” `y`\nzero if `x` is “equal to” `y` a positive number if `x` is “greater than”\n`y`. The comparison returns the first non-zero result of `f`; or zero if `f`\nreturns zero for all `x` and `y`.\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.cmp([1, 3, 5], [1, 4, 2], (a, b) => compare(a, b)), -1)\n\nassertEqual(Belt.Array.cmp([1, 3, 5], [1, 2, 3], (a, b) => compare(a, b)), 1)\n\nassertEqual(Belt.Array.cmp([1, 3, 5], [1, 3, 5], (a, b) => compare(a, b)), 0)\n```" ], "signature": "let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int" }, @@ -9393,7 +9393,7 @@ "kind": "value", "name": "eq", "docstrings": [ - "`eq(xs, ys)` return `false` if length is not the same otherwise compare items\none by one using `f(xi, yi)`; and return true if all results are true false otherwise\n\n## Examples\n\n```rescript\nBelt.Array.eq([1, 2, 3], [(-1), (-2), (-3)], (a, b) => abs(a) == abs(b)) == true\n```" + "`eq(xs, ys)` return `false` if length is not the same otherwise compare items\none by one using `f(xi, yi)`; and return true if all results are true false otherwise\n\n## Examples\n\n```rescript\nassertEqual(Belt.Array.eq([1, 2, 3], [(-1), (-2), (-3)], (a, b) => abs(a) == abs(b)), true)\n```" ], "signature": "let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" }, @@ -9402,7 +9402,7 @@ "kind": "value", "name": "truncateToLengthUnsafe", "docstrings": [ - "Unsafe `truncateToLengthUnsafe(xs, n)` sets length of array `xs` to `n`. If `n`\nis greater than the length of `xs`; the extra elements are set to `Js.Null_undefined.null`.\nIf `n` is less than zero; raises a `RangeError`.\n\n## Examples\n\n```rescript\nlet arr = [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n\nBelt.Array.truncateToLengthUnsafe(arr, 3)\n\narr == [\"ant\", \"bee\", \"cat\"]\n```" + "Unsafe `truncateToLengthUnsafe(xs, n)` sets length of array `xs` to `n`. If `n`\nis greater than the length of `xs`; the extra elements are set to `Js.Null_undefined.null`.\nIf `n` is less than zero; raises a `RangeError`.\n\n## Examples\n\n```rescript\nlet arr = [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n\nBelt.Array.truncateToLengthUnsafe(arr, 3)\n\nassertEqual(arr, [\"ant\", \"bee\", \"cat\"])\n```" ], "signature": "let truncateToLengthUnsafe: (t<'a>, int) => unit" }, diff --git a/data/api/v12.0.0/core.json b/data/api/v12.0.0/core.json deleted file mode 100644 index a5bc9ccf4..000000000 --- a/data/api/v12.0.0/core.json +++ /dev/null @@ -1,10498 +0,0 @@ -{ - "core": { - "id": "Core", - "name": "Core", - "docstrings": [], - "items": [ - { - "id": "Core.timeoutId", - "kind": "type", - "name": "timeoutId", - "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 = 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\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" - }, - { - "id": "Core.setTimeoutFloat", - "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\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" - }, - { - "id": "Core.clearTimeout", - "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\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" - }, - { - "id": "Core.intervalId", - "kind": "type", - "name": "intervalId", - "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 = 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\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" - }, - { - "id": "Core.setIntervalFloat", - "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\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" - }, - { - "id": "Core.clearInterval", - "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\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" - }, - { - "id": "Core.encodeURI", - "kind": "value", - "name": "encodeURI", - "docstrings": [ - "Encodes a URI by replacing characters in the provided string that aren't valid in a URL.\n\nThis is intended to operate on full URIs, so it encodes fewer characters than what `encodeURIComponent` does.\nIf you're looking to encode just parts of a URI, like a query parameter, prefer `encodeURIComponent`.\n\nSee [`encodeURI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI) on MDN.\n\n## Examples\n```rescript\nConsole.log(encodeURI(\"https://rescript-lang.org?array=[someValue]\"))\n// Logs \"https://rescript-lang.org?array=%5BsomeValue%5D\" to the console.\n```" - ], - "signature": "let encodeURI: string => string" - }, - { - "id": "Core.decodeURI", - "kind": "value", - "name": "decodeURI", - "docstrings": [ - "Decodes a previously encoded URI back to a regular string.\n\nThis is intended to operate on full URIs, so it decodes fewer characters than what `decodeURIComponent` does.\nIf you're looking to decode just parts of a URI, like a query parameter, prefer `decodeURIComponent`.\n\nSee [`decodeURI`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI) on MDN.\n\n## Examples\n```rescript\nConsole.log(decodeURI(\"https://rescript-lang.org?array=%5BsomeValue%5D\"))\n// Logs \"https://rescript-lang.org?array=[someValue]\" to the console.\n```" - ], - "signature": "let decodeURI: string => string" - }, - { - "id": "Core.encodeURIComponent", - "kind": "value", - "name": "encodeURIComponent", - "docstrings": [ - "Encodes a string so it can be used as part of a URI.\n\nSee [`encodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) on MDN.\n\n## Examples\n```rescript\nConsole.log(encodeURIComponent(\"array=[someValue]\"))\n// Logs \"array%3D%5BsomeValue%5D\" to the console.\n```" - ], - "signature": "let encodeURIComponent: string => string" - }, - { - "id": "Core.decodeURIComponent", - "kind": "value", - "name": "decodeURIComponent", - "docstrings": [ - "Decodes a previously URI encoded string back to its original form.\n\nSee [`decodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) on MDN.\n\n## Examples\n```rescript\nConsole.log(decodeURIComponent(\"array%3D%5BsomeValue%5D\"))\n// Logs \"array=[someValue]\" to the console.\n```" - ], - "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", - "deprecated": "Use rescript-webapi instead" - }, - { - "id": "Core.document", - "kind": "value", - "name": "document", - "docstrings": [], - "signature": "let document: Dom.document", - "deprecated": "Use rescript-webapi instead" - }, - { - "id": "Core.globalThis", - "kind": "value", - "name": "globalThis", - "docstrings": [], - "signature": "let globalThis: {..}" - }, - { - "id": "Core.import", - "kind": "value", - "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.panic", - "kind": "value", - "name": "panic", - "docstrings": [], - "signature": "let panic: string => 'a" - }, - { - "id": "Core.assertEqual", - "kind": "value", - "name": "assertEqual", - "docstrings": [ - "`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 assertEqual: ('a, 'a) => unit" - }, - { - "id": "Core.null", - "kind": "value", - "name": "null", - "docstrings": [], - "signature": "let null: nullable<'a>" - }, - { - "id": "Core.undefined", - "kind": "value", - "name": "undefined", - "docstrings": [], - "signature": "let undefined: nullable<'a>" - }, - { - "id": "Core.typeof", - "kind": "value", - "name": "typeof", - "docstrings": [], - "signature": "let typeof: 'a => Type.t" - } - ] - }, - "core/intl/numberformat/grouping": { - "id": "Core.Intl.NumberFormat.Grouping", - "name": "Grouping", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.NumberFormat.Grouping.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.NumberFormat.Grouping.parsed", - "kind": "type", - "name": "parsed", - "docstrings": [], - "signature": "type parsed = [#always | #auto | #bool(bool) | #min2]" - }, - { - "id": "Core.Intl.NumberFormat.Grouping.fromBool", - "kind": "value", - "name": "fromBool", - "docstrings": [], - "signature": "let fromBool: bool => t" - }, - { - "id": "Core.Intl.NumberFormat.Grouping.fromString", - "kind": "value", - "name": "fromString", - "docstrings": [], - "signature": "let fromString: [#always | #auto | #min2] => t" - }, - { - "id": "Core.Intl.NumberFormat.Grouping.parseJsValue", - "kind": "value", - "name": "parseJsValue", - "docstrings": [], - "signature": "let parseJsValue: 'a => option<[> #always | #auto | #bool(bool) | #min2]>" - } - ] - }, - "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": [ - { - "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.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.Uint32Array.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/uint16array/constants": { - "id": "Core.Uint16Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "id": "Core.Uint16Array.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/uint8array/constants": { - "id": "Core.Uint8Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "id": "Core.Uint8Array.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/int32array/constants": { - "id": "Core.Int32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "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.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.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.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.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.Type.Classify.function", - "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" - }, - { - "id": "Core.Type.Classify.object", - "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" - }, - { - "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(Symbol.t)\n | BigInt(bigint)" - }, - { - "id": "Core.Type.Classify.classify", - "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": [ - { - "id": "Core.RegExp.Result.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Type representing the result of a `RegExp` execution." - ], - "signature": "type t = array>" - }, - { - "id": "Core.RegExp.Result.fullMatch", - "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" - }, - { - "id": "Core.RegExp.Result.matches", - "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" - }, - { - "id": "Core.RegExp.Result.index", - "kind": "value", - "name": "index", - "docstrings": [], - "signature": "let index: t => int" - }, - { - "id": "Core.RegExp.Result.input", - "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" - } - ] - }, - "core/math/int": { - "id": "Core.Math.Int", - "name": "Int", - "docstrings": [ - "Provide Math utilities for `int`" - ], - "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.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.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.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.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.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.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.Math.Int.pow", - "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" - }, - { - "id": "Core.Math.Int.sign", - "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" - }, - { - "id": "Core.Math.Int.floor", - "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" - }, - { - "id": "Core.Math.Int.ceil", - "kind": "value", - "name": "ceil", - "docstrings": [ - "ceil(v) returns the smallest `int` greater than or equal to the argument;\n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n Math.Int.ceil(3.7) == 4\n Math.Int.ceil(3.0) == 3\n Math.Int.ceil(-3.1) == -3\n ```" - ], - "signature": "let ceil: float => int" - }, - { - "id": "Core.Math.Int.random", - "kind": "value", - "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/math/constants": { - "id": "Core.Math.Constants", - "name": "Constants", - "docstrings": [ - "Mathematical Constants" - ], - "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", - "kind": "value", - "name": "ln2", - "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 ```" - ], - "signature": "let ln2: float" - }, - { - "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.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.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.Math.Constants.pi", - "kind": "value", - "name": "pi", - "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 ```" - ], - "signature": "let pi: float" - }, - { - "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.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.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.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.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.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.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.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.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": "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 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", - "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": "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?: 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: 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.Segmenter.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.Segmenter.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.Segmenter.segment", - "kind": "value", - "name": "segment", - "docstrings": [], - "signature": "let segment: (t, string) => Intl_Segments.t" - } - ] - }, - "core/intl/relativetimeformat": { - "id": "Core.Intl.RelativeTimeFormat", - "name": "RelativeTimeFormat", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.RelativeTimeFormat.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "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.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.Intl.RelativeTimeFormat.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" - }, - { - "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n numeric: numeric,\n style: style,\n numberingSystem: string,\n}" - }, - { - "id": "Core.Intl.RelativeTimeFormat.relativeTimePartComponent", - "kind": "type", - "name": "relativeTimePartComponent", - "docstrings": [], - "signature": "type relativeTimePartComponent = [#integer | #literal]" - }, - { - "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": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.RelativeTimeFormat.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.RelativeTimeFormat.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.RelativeTimeFormat.format", - "kind": "value", - "name": "format", - "docstrings": [], - "signature": "let format: (t, int, timeUnit) => string" - }, - { - "id": "Core.Intl.RelativeTimeFormat.formatToParts", - "kind": "value", - "name": "formatToParts", - "docstrings": [], - "signature": "let formatToParts: (t, int, timeUnit) => array" - } - ] - }, - "core/intl/pluralrules": { - "id": "Core.Intl.PluralRules", - "name": "PluralRules", - "docstrings": [], - "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.Intl.PluralRules.options", - "kind": "type", - "name": "options", - "docstrings": [], - "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.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.Intl.PluralRules.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "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.PluralRules.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.PluralRules.make", - "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]" - }, - { - "id": "Core.Intl.PluralRules.select", - "kind": "value", - "name": "select", - "docstrings": [], - "signature": "let select: (t, float) => rule" - }, - { - "id": "Core.Intl.PluralRules.selectInt", - "kind": "value", - "name": "selectInt", - "docstrings": [], - "signature": "let selectInt: (t, int) => rule" - }, - { - "id": "Core.Intl.PluralRules.selectBigInt", - "kind": "value", - "name": "selectBigInt", - "docstrings": [], - "signature": "let selectBigInt: (t, bigint) => rule" - }, - { - "id": "Core.Intl.PluralRules.selectRange", - "kind": "value", - "name": "selectRange", - "docstrings": [], - "signature": "let selectRange: (t, ~start: float, ~end: float) => rule" - }, - { - "id": "Core.Intl.PluralRules.selectRangeInt", - "kind": "value", - "name": "selectRangeInt", - "docstrings": [], - "signature": "let selectRangeInt: (t, ~start: int, ~end: int) => rule" - }, - { - "id": "Core.Intl.PluralRules.selectRangeBigInt", - "kind": "value", - "name": "selectRangeBigInt", - "docstrings": [], - "signature": "let selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule" - } - ] - }, - "core/intl/numberformat": { - "id": "Core.Intl.NumberFormat", - "name": "NumberFormat", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.NumberFormat.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.NumberFormat.currency", - "kind": "type", - "name": "currency", - "docstrings": [ - "An ISO 4217 currency code. e.g. USD, EUR, CNY" - ], - "signature": "type currency = string" - }, - { - "id": "Core.Intl.NumberFormat.currencyDisplay", - "kind": "type", - "name": "currencyDisplay", - "docstrings": [], - "signature": "type currencyDisplay = [\n | #code\n | #name\n | #narrowSymbol\n | #symbol\n]" - }, - { - "id": "Core.Intl.NumberFormat.currencySign", - "kind": "type", - "name": "currencySign", - "docstrings": [], - "signature": "type currencySign = [#accounting | #standard]" - }, - { - "id": "Core.Intl.NumberFormat.notation", - "kind": "type", - "name": "notation", - "docstrings": [], - "signature": "type notation = [\n | #compact\n | #engineering\n | #scientific\n | #standard\n]" - }, - { - "id": "Core.Intl.NumberFormat.compactDisplay", - "kind": "type", - "name": "compactDisplay", - "docstrings": [ - "Used only when notation is #compact" - ], - "signature": "type compactDisplay = [#long | #short]" - }, - { - "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.Intl.NumberFormat.style", - "kind": "type", - "name": "style", - "docstrings": [], - "signature": "type style = [#currency | #decimal | #percent | #unit]" - }, - { - "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.NumberFormat.unitDisplay", - "kind": "type", - "name": "unitDisplay", - "docstrings": [ - "Only used when style is #unit" - ], - "signature": "type unitDisplay = [#long | #narrow | #short]" - }, - { - "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.Intl.NumberFormat.roundingPriority", - "kind": "type", - "name": "roundingPriority", - "docstrings": [], - "signature": "type roundingPriority = [\n | #auto\n | #lessPrecision\n | #morePrecision\n]" - }, - { - "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.Intl.NumberFormat.trailingZeroDisplay", - "kind": "type", - "name": "trailingZeroDisplay", - "docstrings": [], - "signature": "type trailingZeroDisplay = [\n | #auto\n | #lessPrecision\n | #stripIfInteger\n]" - }, - { - "id": "Core.Intl.NumberFormat.options", - "kind": "type", - "name": "options", - "docstrings": [], - "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.NumberFormat.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "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?: 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.NumberFormat.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.NumberFormat.numberFormatPartType", - "kind": "type", - "name": "numberFormatPartType", - "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]" - }, - { - "id": "Core.Intl.NumberFormat.numberFormatPart", - "kind": "type", - "name": "numberFormatPart", - "docstrings": [], - "signature": "type numberFormatPart = {\n \\\"type\": numberFormatPartType,\n value: string,\n}" - }, - { - "id": "Core.Intl.NumberFormat.rangeSource", - "kind": "type", - "name": "rangeSource", - "docstrings": [], - "signature": "type rangeSource = [#endRange | #shared | #startRange]" - }, - { - "id": "Core.Intl.NumberFormat.numberFormatRangePart", - "kind": "type", - "name": "numberFormatRangePart", - "docstrings": [], - "signature": "type numberFormatRangePart = {\n \\\"type\": numberFormatPartType,\n value: string,\n source: rangeSource,\n}" - }, - { - "id": "Core.Intl.NumberFormat.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.NumberFormat.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.NumberFormat.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.NumberFormat.format", - "kind": "value", - "name": "format", - "docstrings": [], - "signature": "let format: (t, float) => string" - }, - { - "id": "Core.Intl.NumberFormat.formatRange", - "kind": "value", - "name": "formatRange", - "docstrings": [], - "signature": "let formatRange: (t, ~start: float, ~end: float) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatToParts", - "kind": "value", - "name": "formatToParts", - "docstrings": [], - "signature": "let formatToParts: (t, float) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatRangeToParts", - "kind": "value", - "name": "formatRangeToParts", - "docstrings": [], - "signature": "let formatRangeToParts: (\n t,\n ~start: float,\n ~end: float,\n) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatInt", - "kind": "value", - "name": "formatInt", - "docstrings": [], - "signature": "let formatInt: (t, int) => string" - }, - { - "id": "Core.Intl.NumberFormat.formatIntRange", - "kind": "value", - "name": "formatIntRange", - "docstrings": [], - "signature": "let formatIntRange: (t, ~start: int, ~end: int) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatIntToParts", - "kind": "value", - "name": "formatIntToParts", - "docstrings": [], - "signature": "let formatIntToParts: (t, int) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatIntRangeToParts", - "kind": "value", - "name": "formatIntRangeToParts", - "docstrings": [], - "signature": "let formatIntRangeToParts: (t, ~start: int, ~end: int) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatBigInt", - "kind": "value", - "name": "formatBigInt", - "docstrings": [], - "signature": "let formatBigInt: (t, bigint) => string" - }, - { - "id": "Core.Intl.NumberFormat.formatBigIntRange", - "kind": "value", - "name": "formatBigIntRange", - "docstrings": [], - "signature": "let formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatBigIntToParts", - "kind": "value", - "name": "formatBigIntToParts", - "docstrings": [], - "signature": "let formatBigIntToParts: (t, bigint) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatBigIntRangeToParts", - "kind": "value", - "name": "formatBigIntRangeToParts", - "docstrings": [], - "signature": "let formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array" - }, - { - "id": "Core.Intl.NumberFormat.formatString", - "kind": "value", - "name": "formatString", - "docstrings": [], - "signature": "let formatString: (t, string) => string" - }, - { - "id": "Core.Intl.NumberFormat.formatStringToParts", - "kind": "value", - "name": "formatStringToParts", - "docstrings": [], - "signature": "let formatStringToParts: (t, string) => array" - } - ] - }, - "core/intl/locale": { - "id": "Core.Intl.Locale", - "name": "Locale", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.Locale.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.Locale.options", - "kind": "type", - "name": "options", - "docstrings": [], - "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.Locale.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (string, ~options: options=?) => t" - }, - { - "id": "Core.Intl.Locale.baseName", - "kind": "value", - "name": "baseName", - "docstrings": [], - "signature": "let baseName: t => string" - }, - { - "id": "Core.Intl.Locale.calendar", - "kind": "value", - "name": "calendar", - "docstrings": [], - "signature": "let calendar: t => option" - }, - { - "id": "Core.Intl.Locale.caseFirst", - "kind": "value", - "name": "caseFirst", - "docstrings": [], - "signature": "let caseFirst: t => option" - }, - { - "id": "Core.Intl.Locale.collation", - "kind": "value", - "name": "collation", - "docstrings": [], - "signature": "let collation: t => option" - }, - { - "id": "Core.Intl.Locale.hourCycle", - "kind": "value", - "name": "hourCycle", - "docstrings": [], - "signature": "let hourCycle: t => option" - }, - { - "id": "Core.Intl.Locale.language", - "kind": "value", - "name": "language", - "docstrings": [], - "signature": "let language: t => string" - }, - { - "id": "Core.Intl.Locale.numberingSystem", - "kind": "value", - "name": "numberingSystem", - "docstrings": [], - "signature": "let numberingSystem: t => option" - }, - { - "id": "Core.Intl.Locale.numeric", - "kind": "value", - "name": "numeric", - "docstrings": [], - "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/listformat": { - "id": "Core.Intl.ListFormat", - "name": "ListFormat", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.ListFormat.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.ListFormat.listType", - "kind": "type", - "name": "listType", - "docstrings": [], - "signature": "type listType = [#conjunction | #disjunction | #unit]" - }, - { - "id": "Core.Intl.ListFormat.style", - "kind": "type", - "name": "style", - "docstrings": [], - "signature": "type style = [#long | #narrow | #short]" - }, - { - "id": "Core.Intl.ListFormat.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" - }, - { - "id": "Core.Intl.ListFormat.listPartComponentType", - "kind": "type", - "name": "listPartComponentType", - "docstrings": [], - "signature": "type listPartComponentType = [#element | #literal]" - }, - { - "id": "Core.Intl.ListFormat.listPart", - "kind": "type", - "name": "listPart", - "docstrings": [], - "signature": "type listPart = {\n \\\"type\": listPartComponentType,\n value: string,\n}" - }, - { - "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.Intl.ListFormat.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.ListFormat.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.ListFormat.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.ListFormat.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.ListFormat.format", - "kind": "value", - "name": "format", - "docstrings": [], - "signature": "let format: (t, array) => string" - }, - { - "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", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "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", - "kind": "type", - "name": "weekday", - "docstrings": [], - "signature": "type weekday = [#long | #narrow | #short]" - }, - { - "id": "Core.Intl.DateTimeFormat.era", - "kind": "type", - "name": "era", - "docstrings": [], - "signature": "type era = [#long | #narrow | #short]" - }, - { - "id": "Core.Intl.DateTimeFormat.year", - "kind": "type", - "name": "year", - "docstrings": [], - "signature": "type year = [#\"2-digit\" | #numeric]" - }, - { - "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.Intl.DateTimeFormat.day", - "kind": "type", - "name": "day", - "docstrings": [], - "signature": "type day = [#\"2-digit\" | #numeric]" - }, - { - "id": "Core.Intl.DateTimeFormat.hour", - "kind": "type", - "name": "hour", - "docstrings": [], - "signature": "type hour = [#\"2-digit\" | #numeric]" - }, - { - "id": "Core.Intl.DateTimeFormat.minute", - "kind": "type", - "name": "minute", - "docstrings": [], - "signature": "type minute = [#\"2-digit\" | #numeric]" - }, - { - "id": "Core.Intl.DateTimeFormat.second", - "kind": "type", - "name": "second", - "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]" - }, - { - "id": "Core.Intl.DateTimeFormat.hourCycle", - "kind": "type", - "name": "hourCycle", - "docstrings": [], - "signature": "type hourCycle = [#h11 | #h12 | #h23 | #h24]" - }, - { - "id": "Core.Intl.DateTimeFormat.formatMatcher", - "kind": "type", - "name": "formatMatcher", - "docstrings": [], - "signature": "type formatMatcher = [#basic | #\"best fit\"]" - }, - { - "id": "Core.Intl.DateTimeFormat.fractionalSecondDigits", - "kind": "type", - "name": "fractionalSecondDigits", - "docstrings": [], - "signature": "type fractionalSecondDigits = [#0 | #1 | #2 | #3]" - }, - { - "id": "Core.Intl.DateTimeFormat.options", - "kind": "type", - "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.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.Intl.DateTimeFormat.supportedLocalesOptions", - "kind": "type", - "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.Intl.DateTimeFormat.dateTimeRangePart", - "kind": "type", - "name": "dateTimeRangePart", - "docstrings": [], - "signature": "type dateTimeRangePart = {\n \\\"type\": dateTimeComponent,\n value: string,\n source: dateTimeRangeSource,\n}" - }, - { - "id": "Core.Intl.DateTimeFormat.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.DateTimeFormat.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.DateTimeFormat.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.DateTimeFormat.format", - "kind": "value", - "name": "format", - "docstrings": [], - "signature": "let format: (t, Date.t) => string" - }, - { - "id": "Core.Intl.DateTimeFormat.formatToParts", - "kind": "value", - "name": "formatToParts", - "docstrings": [], - "signature": "let formatToParts: (t, Date.t) => array" - }, - { - "id": "Core.Intl.DateTimeFormat.formatRange", - "kind": "value", - "name": "formatRange", - "docstrings": [], - "signature": "let formatRange: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => string" - }, - { - "id": "Core.Intl.DateTimeFormat.formatRangeToParts", - "kind": "value", - "name": "formatRangeToParts", - "docstrings": [], - "signature": "let formatRangeToParts: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => array" - } - ] - }, - "core/intl/collator": { - "id": "Core.Intl.Collator", - "name": "Collator", - "docstrings": [], - "items": [ - { - "id": "Core.Intl.Collator.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.Intl.Collator.usage", - "kind": "type", - "name": "usage", - "docstrings": [], - "signature": "type usage = [#search | #sort]" - }, - { - "id": "Core.Intl.Collator.sensitivity", - "kind": "type", - "name": "sensitivity", - "docstrings": [], - "signature": "type sensitivity = [#accent | #base | #case | #variant]" - }, - { - "id": "Core.Intl.Collator.caseFirst", - "kind": "type", - "name": "caseFirst", - "docstrings": [], - "signature": "type caseFirst = [#\"false\" | #lower | #upper]" - }, - { - "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.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.Intl.Collator.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" - }, - { - "id": "Core.Intl.Collator.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" - }, - { - "id": "Core.Intl.Collator.supportedLocalesOf", - "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" - }, - { - "id": "Core.Intl.Collator.resolvedOptions", - "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, - { - "id": "Core.Intl.Collator.compare", - "kind": "value", - "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.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/int/bitwise": { - "id": "Core.Int.Bitwise", - "name": "Bitwise", - "docstrings": [], - "items": [ - { - "id": "Core.Int.Bitwise.land", - "kind": "value", - "name": "land", - "docstrings": [ - "`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 land: (int, int) => int" - }, - { - "id": "Core.Int.Bitwise.lor", - "kind": "value", - "name": "lor", - "docstrings": [ - "`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 lor: (int, int) => int" - }, - { - "id": "Core.Int.Bitwise.lxor", - "kind": "value", - "name": "lxor", - "docstrings": [ - "`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 lxor: (int, int) => int" - }, - { - "id": "Core.Int.Bitwise.lnot", - "kind": "value", - "name": "lnot", - "docstrings": [ - "`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 lnot: int => int" - }, - { - "id": "Core.Int.Bitwise.lsl", - "kind": "value", - "name": "lsl", - "docstrings": [ - "`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 lsl: (int, int) => int" - }, - { - "id": "Core.Int.Bitwise.lsr", - "kind": "value", - "name": "lsr", - "docstrings": [ - "`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 lsr: (int, int) => int" - }, - { - "id": "Core.Int.Bitwise.asr", - "kind": "value", - "name": "asr", - "docstrings": [ - "`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 asr: (int, int) => int" - } - ] - }, - "core/int/constants": { - "id": "Core.Int.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "id": "Core.Int.Constants.minValue", - "kind": "value", - "name": "minValue", - "docstrings": [ - "The smallest positive number represented in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.minValue)\n ```" - ], - "signature": "let minValue: int" - }, - { - "id": "Core.Int.Constants.maxValue", - "kind": "value", - "name": "maxValue", - "docstrings": [ - "The largest positive number represented in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.maxValue)\n ```" - ], - "signature": "let maxValue: int" - } - ] - }, - "core/float/constants": { - "id": "Core.Float.Constants", - "name": "Constants", - "docstrings": [ - "Float constants." - ], - "items": [ - { - "id": "Core.Float.Constants.nan", - "kind": "value", - "name": "nan", - "docstrings": [ - "The special value \"Not a Number\"\n See [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.nan\n ```" - ], - "signature": "let nan: float" - }, - { - "id": "Core.Float.Constants.epsilon", - "kind": "value", - "name": "epsilon", - "docstrings": [ - "Represents the difference between 1 and the smallest floating point number greater than 1.\n See [`Number.EPSILON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.epsilon\n ```" - ], - "signature": "let epsilon: float" - }, - { - "id": "Core.Float.Constants.positiveInfinity", - "kind": "value", - "name": "positiveInfinity", - "docstrings": [ - "The positive Infinity value\n See [`Number.POSITIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.positiveInfinity\n ```" - ], - "signature": "let positiveInfinity: float" - }, - { - "id": "Core.Float.Constants.negativeInfinity", - "kind": "value", - "name": "negativeInfinity", - "docstrings": [ - "The negative Infinity value\n See [`Number.NEGATIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.negativeInfinity\n ```" - ], - "signature": "let negativeInfinity: float" - }, - { - "id": "Core.Float.Constants.minValue", - "kind": "value", - "name": "minValue", - "docstrings": [ - "The smallest positive numeric value representable in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" - ], - "signature": "let minValue: float" - }, - { - "id": "Core.Float.Constants.maxValue", - "kind": "value", - "name": "maxValue", - "docstrings": [ - "The maximum positive numeric value representable in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" - ], - "signature": "let maxValue: float" - } - ] - }, - "core/error/urierror": { - "id": "Core.Error.URIError", - "name": "URIError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.URIError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `URIError` with the provided `message`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/error/typeerror": { - "id": "Core.Error.TypeError", - "name": "TypeError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.TypeError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `TypeError` with the provided `message`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/error/syntaxerror": { - "id": "Core.Error.SyntaxError", - "name": "SyntaxError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.SyntaxError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `SyntaxError` with the provided `message`.\n\n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/error/referenceerror": { - "id": "Core.Error.ReferenceError", - "name": "ReferenceError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.ReferenceError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `ReferenceError` with the provided `message`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/error/rangeerror": { - "id": "Core.Error.RangeError", - "name": "RangeError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.RangeError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `RangeError` with the provided `message`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/error/evalerror": { - "id": "Core.Error.EvalError", - "name": "EvalError", - "docstrings": [], - "items": [ - { - "id": "Core.Error.EvalError.make", - "kind": "value", - "name": "make", - "docstrings": [ - "Creates a new `EvalError` with the provided `message`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." - ], - "signature": "let make: string => t" - } - ] - }, - "core/date/utc": { - "id": "Core.Date.UTC", - "name": "UTC", - "docstrings": [], - "items": [ - { - "id": "Core.Date.UTC.makeWithYM", - "kind": "value", - "name": "makeWithYM", - "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.makeWithYM(~year=2023, ~month=0)\n // 1672531200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=11)\n // 1701388800000\n\n Date.UTC.makeWithYM(~year=2023, ~month=12)\n // 1704067200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=-1)\n // 1669852800000\n ```" - ], - "signature": "let makeWithYM: (~year: int, ~month: int) => msSinceEpoch" - }, - { - "id": "Core.Date.UTC.makeWithYMD", - "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, ~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, ~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, ~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 ~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, ~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 ~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, ~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 ~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, ~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 ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => msSinceEpoch" - } - ] - }, - "core/biguint64array": { - "id": "Core.BigUint64Array", - "name": "BigUint64Array", - "docstrings": [], - "items": [ - { - "id": "Core.BigUint64Array.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)" - ], - "signature": "type t = TypedArray.t" - }, - { - "id": "Core.BigUint64Array.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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.BigUint64Array.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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.BigUint64Array.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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.BigUint64Array.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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.BigUint64Array.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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.BigUint64Array.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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.BigUint64Array.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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" - } - ] - }, - "core/bigint64array": { - "id": "Core.BigInt64Array", - "name": "BigInt64Array", - "docstrings": [], - "items": [ - { - "id": "Core.BigInt64Array.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)" - ], - "signature": "type t = TypedArray.t" - }, - { - "id": "Core.BigInt64Array.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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.BigInt64Array.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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.BigInt64Array.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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.BigInt64Array.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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.BigInt64Array.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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.BigInt64Array.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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.BigInt64Array.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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" - } - ] - }, - "core/uint8clampedarray": { - "id": "Core.Uint8ClampedArray", - "name": "Uint8ClampedArray", - "docstrings": [], - "items": [ - { - "id": "Core.Uint8ClampedArray.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 = TypedArray.t" - }, - { - "id": "Core.Uint8ClampedArray.fromArray", - "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" - }, - { - "id": "Core.Uint8ClampedArray.fromBuffer", - "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: ArrayBuffer.t => t" - }, - { - "id": "Core.Uint8ClampedArray.fromBufferToEnd", - "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: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Uint8ClampedArray.fromBufferWithRange", - "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Uint8ClampedArray.fromLength", - "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" - }, - { - "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterable", - "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" - }, - { - "id": "Core.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", - "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 = TypedArray.t" - }, - { - "id": "Core.Uint32Array.fromArray", - "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" - }, - { - "id": "Core.Uint32Array.fromBuffer", - "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: ArrayBuffer.t => t" - }, - { - "id": "Core.Uint32Array.fromBufferToEnd", - "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: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Uint32Array.fromBufferWithRange", - "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Uint32Array.fromLength", - "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" - }, - { - "id": "Core.Uint32Array.fromArrayLikeOrIterable", - "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" - }, - { - "id": "Core.Uint32Array.fromArrayLikeOrIterableWithMap", - "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": [ - { - "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 = TypedArray.t" - }, - { - "id": "Core.Uint16Array.fromArray", - "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" - }, - { - "id": "Core.Uint16Array.fromBuffer", - "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: ArrayBuffer.t => t" - }, - { - "id": "Core.Uint16Array.fromBufferToEnd", - "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: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Uint16Array.fromBufferWithRange", - "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Uint16Array.fromLength", - "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" - }, - { - "id": "Core.Uint16Array.fromArrayLikeOrIterable", - "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" - }, - { - "id": "Core.Uint16Array.fromArrayLikeOrIterableWithMap", - "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": [ - { - "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 = TypedArray.t" - }, - { - "id": "Core.Uint8Array.fromArray", - "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" - }, - { - "id": "Core.Uint8Array.fromBuffer", - "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: ArrayBuffer.t => t" - }, - { - "id": "Core.Uint8Array.fromBufferToEnd", - "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: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Uint8Array.fromBufferWithRange", - "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Uint8Array.fromLength", - "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" - }, - { - "id": "Core.Uint8Array.fromArrayLikeOrIterable", - "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" - }, - { - "id": "Core.Uint8Array.fromArrayLikeOrIterableWithMap", - "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" - } - ] - }, - "core/int32array": { - "id": "Core.Int32Array", - "name": "Int32Array", - "docstrings": [], - "items": [ - { - "id": "Core.Int32Array.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 = TypedArray.t" - }, - { - "id": "Core.Int32Array.fromArray", - "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" - }, - { - "id": "Core.Int32Array.fromBuffer", - "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: ArrayBuffer.t => t" - }, - { - "id": "Core.Int32Array.fromBufferToEnd", - "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: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Int32Array.fromBufferWithRange", - "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Int32Array.fromLength", - "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" - }, - { - "id": "Core.Int32Array.fromArrayLikeOrIterable", - "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" - }, - { - "id": "Core.Int32Array.fromArrayLikeOrIterableWithMap", - "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" - } - ] - }, - "core/int16array": { - "id": "Core.Int16Array", - "name": "Int16Array", - "docstrings": [], - "items": [ - { - "id": "Core.Int16Array.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)" - ], - "signature": "type t = TypedArray.t" - }, - { - "id": "Core.Int16Array.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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.Int16Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.Int16Array.fromBufferToEnd", - "kind": "value", - "name": "fromBufferToEnd", - "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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Int16Array.fromBufferWithRange", - "kind": "value", - "name": "fromBufferWithRange", - "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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Int16Array.fromLength", - "kind": "value", - "name": "fromLength", - "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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.Int16Array.fromArrayLikeOrIterable", - "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.Int16Array.fromArrayLikeOrIterableWithMap", - "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/int8array": { - "id": "Core.Int8Array", - "name": "Int8Array", - "docstrings": [], - "items": [ - { - "id": "Core.Int8Array.t", - "kind": "type", - "name": "t", - "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)" - ], - "signature": "type t = TypedArray.t" - }, - { - "id": "Core.Int8Array.fromArray", - "kind": "value", - "name": "fromArray", - "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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.Int8Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.Int8Array.fromBufferToEnd", - "kind": "value", - "name": "fromBufferToEnd", - "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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Int8Array.fromBufferWithRange", - "kind": "value", - "name": "fromBufferWithRange", - "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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Int8Array.fromLength", - "kind": "value", - "name": "fromLength", - "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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.Int8Array.fromArrayLikeOrIterable", - "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.Int8Array.fromArrayLikeOrIterableWithMap", - "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "core/float64array": { - "id": "Core.Float64Array", - "name": "Float64Array", - "docstrings": [], - "items": [ - { - "id": "Core.Float64Array.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 = TypedArray.t" - }, - { - "id": "Core.Float64Array.fromArray", - "kind": "value", - "name": "fromArray", - "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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.Float64Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.Float64Array.fromBufferToEnd", - "kind": "value", - "name": "fromBufferToEnd", - "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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Float64Array.fromBufferWithRange", - "kind": "value", - "name": "fromBufferWithRange", - "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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Float64Array.fromLength", - "kind": "value", - "name": "fromLength", - "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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.Float64Array.fromArrayLikeOrIterable", - "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.Float64Array.fromArrayLikeOrIterableWithMap", - "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" - } - ] - }, - "core/float32array": { - "id": "Core.Float32Array", - "name": "Float32Array", - "docstrings": [], - "items": [ - { - "id": "Core.Float32Array.t", - "kind": "type", - "name": "t", - "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)" - ], - "signature": "type t = TypedArray.t" - }, - { - "id": "Core.Float32Array.fromArray", - "kind": "value", - "name": "fromArray", - "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)" - ], - "signature": "let fromArray: array => t" - }, - { - "id": "Core.Float32Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "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." - ], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.Float32Array.fromBufferToEnd", - "kind": "value", - "name": "fromBufferToEnd", - "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." - ], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.Float32Array.fromBufferWithRange", - "kind": "value", - "name": "fromBufferWithRange", - "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." - ], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.Float32Array.fromLength", - "kind": "value", - "name": "fromLength", - "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." - ], - "signature": "let fromLength: int => t" - }, - { - "id": "Core.Float32Array.fromArrayLikeOrIterable", - "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" - }, - { - "id": "Core.Float32Array.fromArrayLikeOrIterableWithMap", - "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" - } - ] - }, - "core/typedarray": { - "id": "Core.TypedArray", - "name": "TypedArray", - "docstrings": [], - "items": [ - { - "id": "Core.TypedArray.t", - "kind": "type", - "name": "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.TypedArray.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (t<'a>, 'a) => int" - }, - { - "id": "Core.TypedArray.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" - }, - { - "id": "Core.TypedArray.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (t<'a>, string) => string" - }, - { - "id": "Core.TypedArray.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (t<'a>, 'a) => int" - }, - { - "id": "Core.TypedArray.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" - }, - { - "id": "Core.TypedArray.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" - }, - { - "id": "Core.TypedArray.sliceToEnd", - "kind": "value", - "name": "sliceToEnd", - "docstrings": [], - "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" - }, - { - "id": "Core.TypedArray.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t<'a> => t<'a>" - }, - { - "id": "Core.TypedArray.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" - }, - { - "id": "Core.TypedArray.subarrayToEnd", - "kind": "value", - "name": "subarrayToEnd", - "docstrings": [], - "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" - }, - { - "id": "Core.TypedArray.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t<'a> => string" - }, - { - "id": "Core.TypedArray.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t<'a> => string" - }, - { - "id": "Core.TypedArray.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (t<'a>, 'a => bool) => bool" - }, - { - "id": "Core.TypedArray.everyWithIndex", - "kind": "value", - "name": "everyWithIndex", - "docstrings": [], - "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" - }, - { - "id": "Core.TypedArray.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" - }, - { - "id": "Core.TypedArray.filterWithIndex", - "kind": "value", - "name": "filterWithIndex", - "docstrings": [], - "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" - }, - { - "id": "Core.TypedArray.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (t<'a>, 'a => bool) => option<'a>" - }, - { - "id": "Core.TypedArray.findWithIndex", - "kind": "value", - "name": "findWithIndex", - "docstrings": [], - "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" - }, - { - "id": "Core.TypedArray.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (t<'a>, 'a => bool) => int" - }, - { - "id": "Core.TypedArray.findIndexWithIndex", - "kind": "value", - "name": "findIndexWithIndex", - "docstrings": [], - "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" - }, - { - "id": "Core.TypedArray.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" - }, - { - "id": "Core.TypedArray.forEachWithIndex", - "kind": "value", - "name": "forEachWithIndex", - "docstrings": [], - "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" - }, - { - "id": "Core.TypedArray.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" - }, - { - "id": "Core.TypedArray.mapWithIndex", - "kind": "value", - "name": "mapWithIndex", - "docstrings": [], - "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" - }, - { - "id": "Core.TypedArray.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" - }, - { - "id": "Core.TypedArray.reduceWithIndex", - "kind": "value", - "name": "reduceWithIndex", - "docstrings": [], - "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" - }, - { - "id": "Core.TypedArray.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" - }, - { - "id": "Core.TypedArray.reduceRightWithIndex", - "kind": "value", - "name": "reduceRightWithIndex", - "docstrings": [], - "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" - }, - { - "id": "Core.TypedArray.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (t<'a>, 'a => bool) => bool" - }, - { - "id": "Core.TypedArray.someWithIndex", - "kind": "value", - "name": "someWithIndex", - "docstrings": [], - "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" - } - ] - }, - "core/arraybuffer": { - "id": "Core.ArrayBuffer", - "name": "ArrayBuffer", - "docstrings": [], - "items": [ - { - "id": "Core.ArrayBuffer.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.ArrayBuffer.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: int => t" - }, - { - "id": "Core.ArrayBuffer.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Core.ArrayBuffer.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (t, ~start: int, ~end: int) => t" - }, - { - "id": "Core.ArrayBuffer.sliceToEnd", - "kind": "value", - "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.WeakSet.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: unit => t<'a>" - }, - { - "id": "Core.WeakSet.add", - "kind": "value", - "name": "add", - "docstrings": [], - "signature": "let add: (t<'a>, 'a) => t<'a>" - }, - { - "id": "Core.WeakSet.delete", - "kind": "value", - "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/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", - "docstrings": [ - "Type representing an instance of `Set`." - ], - "signature": "type t<'a>" - }, - { - "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": [ - "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<'a> => t<'a>" - }, - { - "id": "Core.Set.fromIterator", - "kind": "value", - "name": "fromIterator", - "docstrings": [ - "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 fromIterator: Iterator.t<'a> => t<'a>" - }, - { - "id": "Core.Set.size", - "kind": "value", - "name": "size", - "docstrings": [ - "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 size: t<'a> => int" - }, - { - "id": "Core.Set.clear", - "kind": "value", - "name": "clear", - "docstrings": [ - "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 clear: t<'a> => unit" - }, - { - "id": "Core.Set.add", - "kind": "value", - "name": "add", - "docstrings": [ - "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 add: (t<'a>, 'a) => unit" - }, - { - "id": "Core.Set.delete", - "kind": "value", - "name": "delete", - "docstrings": [ - "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 delete: (t<'a>, 'a) => bool" - }, - { - "id": "Core.Set.has", - "kind": "value", - "name": "has", - "docstrings": [ - "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 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.Set.values", - "kind": "value", - "name": "values", - "docstrings": [ - "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": "let values: t<'a> => Iterator.t<'a>" - }, - { - "id": "Core.Set.difference", - "kind": "value", - "name": "difference", - "docstrings": [ - "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 difference: (t<'a>, t<'a>) => t<'a>" - }, - { - "id": "Core.Set.symmetricDifference", - "kind": "value", - "name": "symmetricDifference", - "docstrings": [ - "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 symmetricDifference: (t<'a>, t<'a>) => t<'a>" - }, - { - "id": "Core.Set.intersection", - "kind": "value", - "name": "intersection", - "docstrings": [ - "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 intersection: (t<'a>, t<'a>) => t<'a>" - }, - { - "id": "Core.Set.isDisjointFrom", - "kind": "value", - "name": "isDisjointFrom", - "docstrings": [ - "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 isDisjointFrom: (t<'a>, t<'a>) => bool" - }, - { - "id": "Core.Set.isSubsetOf", - "kind": "value", - "name": "isSubsetOf", - "docstrings": [ - "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 isSubsetOf: (t<'a>, t<'a>) => bool" - }, - { - "id": "Core.Set.isSupersetOf", - "kind": "value", - "name": "isSupersetOf", - "docstrings": [ - "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 isSupersetOf: (t<'a>, t<'a>) => bool" - }, - { - "id": "Core.Set.union", - "kind": "value", - "name": "union", - "docstrings": [ - "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 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/weakmap": { - "id": "Core.WeakMap", - "name": "WeakMap", - "docstrings": [], - "items": [ - { - "id": "Core.WeakMap.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'k, 'v>" - }, - { - "id": "Core.WeakMap.make", - "kind": "value", - "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": [ - "Type representing an instance of `Map`." - ], - "signature": "type t<'k, 'v>" - }, - { - "id": "Core.Map.make", - "kind": "value", - "name": "make", - "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`." - ], - "signature": "let make: unit => t<'k, 'v>" - }, - { - "id": "Core.Map.fromArray", - "kind": "value", - "name": "fromArray", - "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```" - ], - "signature": "let fromArray: array<('k, 'v)> => t<'k, 'v>" - }, - { - "id": "Core.Map.fromIterator", - "kind": "value", - "name": "fromIterator", - "docstrings": [ - "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 fromIterator: Iterator.t<('k, 'v)> => t<'k, 'v>" - }, - { - "id": "Core.Map.size", - "kind": "value", - "name": "size", - "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```" - ], - "signature": "let size: t<'k, 'v> => int" - }, - { - "id": "Core.Map.clear", - "kind": "value", - "name": "clear", - "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```" - ], - "signature": "let clear: t<'k, 'v> => unit" - }, - { - "id": "Core.Map.forEach", - "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (t<'k, 'v>, 'v => unit) => unit" - }, - { - "id": "Core.Map.forEachWithKey", - "kind": "value", - "name": "forEachWithKey", - "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```" - ], - "signature": "let forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" - }, - { - "id": "Core.Map.get", - "kind": "value", - "name": "get", - "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```" - ], - "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" - }, - { - "id": "Core.Map.has", - "kind": "value", - "name": "has", - "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```" - ], - "signature": "let has: (t<'k, 'v>, 'k) => bool" - }, - { - "id": "Core.Map.set", - "kind": "value", - "name": "set", - "docstrings": [ - "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 set: (t<'k, 'v>, 'k, 'v) => unit" - }, - { - "id": "Core.Map.delete", - "kind": "value", - "name": "delete", - "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```" - ], - "signature": "let delete: (t<'k, 'v>, 'k) => bool" - }, - { - "id": "Core.Map.keys", - "kind": "value", - "name": "keys", - "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```" - ], - "signature": "let keys: t<'k, 'v> => Iterator.t<'k>" - }, - { - "id": "Core.Map.values", - "kind": "value", - "name": "values", - "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```" - ], - "signature": "let values: t<'k, 'v> => Iterator.t<'v>" - }, - { - "id": "Core.Map.entries", - "kind": "value", - "name": "entries", - "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```" - ], - "signature": "let entries: t<'k, 'v> => 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": [ - { - "id": "Core.AsyncIterator.t", - "kind": "type", - "name": "t", - "docstrings": [ - "The type representing an async iterator." - ], - "signature": "type t<'a>" - }, - { - "id": "Core.AsyncIterator.value", - "kind": "type", - "name": "value", - "docstrings": [], - "signature": "type value<'a> = {done: bool, value: option<'a>}" - }, - { - "id": "Core.AsyncIterator.make", - "kind": "value", - "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.AsyncIterator.value", - "kind": "value", - "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.AsyncIterator.done", - "kind": "value", - "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.AsyncIterator.next", - "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\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.AsyncIterator.forEach", - "kind": "value", - "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.Iterator.value", - "kind": "type", - "name": "value", - "docstrings": [ - "The current value of an iterator." - ], - "signature": "type value<'a> = {done: bool, value: option<'a>}" - }, - { - "id": "Core.Iterator.next", - "kind": "value", - "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.Iterator.toArray", - "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>" - }, - { - "id": "Core.Iterator.toArrayWithMapper", - "kind": "value", - "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.Iterator.forEach", - "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\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.Type.typeof", - "kind": "value", - "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": "type t" - }, - { - "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" - }, - { - "id": "Core.Symbol.isConcatSpreadable", - "kind": "value", - "name": "isConcatSpreadable", - "docstrings": [], - "signature": "let isConcatSpreadable: t" - }, - { - "id": "Core.Symbol.iterator", - "kind": "value", - "name": "iterator", - "docstrings": [], - "signature": "let iterator: t" - }, - { - "id": "Core.Symbol.match", - "kind": "value", - "name": "match", - "docstrings": [], - "signature": "let match: t" - }, - { - "id": "Core.Symbol.matchAll", - "kind": "value", - "name": "matchAll", - "docstrings": [], - "signature": "let matchAll: t" - }, - { - "id": "Core.Symbol.replace", - "kind": "value", - "name": "replace", - "docstrings": [], - "signature": "let replace: t" - }, - { - "id": "Core.Symbol.search", - "kind": "value", - "name": "search", - "docstrings": [], - "signature": "let search: t" - }, - { - "id": "Core.Symbol.species", - "kind": "value", - "name": "species", - "docstrings": [], - "signature": "let species: t" - }, - { - "id": "Core.Symbol.split", - "kind": "value", - "name": "split", - "docstrings": [], - "signature": "let split: t" - }, - { - "id": "Core.Symbol.toPrimitive", - "kind": "value", - "name": "toPrimitive", - "docstrings": [], - "signature": "let toPrimitive: t" - }, - { - "id": "Core.Symbol.toStringTag", - "kind": "value", - "name": "toStringTag", - "docstrings": [], - "signature": "let toStringTag: t" - }, - { - "id": "Core.Symbol.unscopables", - "kind": "value", - "name": "unscopables", - "docstrings": [], - "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.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.String.fromCharCodeMany", - "kind": "value", - "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.String.fromCodePoint", - "kind": "value", - "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.String.fromCodePointMany", - "kind": "value", - "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.String.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (string, string) => bool" - }, - { - "id": "Core.String.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (string, string) => Ordering.t" - }, - { - "id": "Core.String.length", - "kind": "value", - "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.String.get", - "kind": "value", - "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.String.getUnsafe", - "kind": "value", - "name": "getUnsafe", - "docstrings": [ - "`getUnsafe(str, index)` returns an `string` at the given `index` number.\n\nThis is _unsafe_, meaning it will return `undefined` value if `index` does not exist in `string`.\n\nUse `String.getUnsafe` only when you are sure the `index` exists.\n## Examples\n\n```rescript\nString.getUnsafe(\"ReScript\", 0) == \"R\"\nString.getUnsafe(\"Hello\", 4) == \"o\"\n```" - ], - "signature": "let getUnsafe: (string, int) => string" - }, - { - "id": "Core.String.charAt", - "kind": "value", - "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.String.charCodeAt", - "kind": "value", - "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.String.codePointAt", - "kind": "value", - "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.String.concat", - "kind": "value", - "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.String.concatMany", - "kind": "value", - "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.String.endsWith", - "kind": "value", - "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.String.endsWithFrom", - "kind": "value", - "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.String.includes", - "kind": "value", - "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.String.includesFrom", - "kind": "value", - "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.String.indexOf", - "kind": "value", - "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.String.indexOfOpt", - "kind": "value", - "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.String.indexOfFrom", - "kind": "value", - "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.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.String.lastIndexOfOpt", - "kind": "value", - "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.String.lastIndexOfFrom", - "kind": "value", - "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.String.match", - "kind": "value", - "name": "match", - "docstrings": [ - "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\nthere is a match, the return value is `Some(array)` where the array contains:\n- The entire matched string\n- Any capture groups if the regexp had parentheses\nFor regular expressions with the g modifier, a matched expression returns\n`Some(array)` with all the matched substrings and no capture groups.\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) on MDN.\n\n## Examples\n\n```rescript\nString.match(\"The better bats\", %re(\"/b[aeiou]t/\")) == Some([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.String.normalize", - "kind": "value", - "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.String.normalizeForm", - "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]" - }, - { - "id": "Core.String.normalizeByForm", - "kind": "value", - "name": "normalizeByForm", - "docstrings": [], - "signature": "let normalizeByForm: (string, normalizeForm) => string" - }, - { - "id": "Core.String.repeat", - "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" - }, - { - "id": "Core.String.replace", - "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" - }, - { - "id": "Core.String.replaceRegExp", - "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, RegExp.t, string) => string" - }, - { - "id": "Core.String.replaceAll", - "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" - }, - { - "id": "Core.String.replaceAllRegExp", - "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, RegExp.t, string) => string" - }, - { - "id": "Core.String.unsafeReplaceRegExpBy0", - "kind": "value", - "name": "unsafeReplaceRegExpBy0", - "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```" - ], - "signature": "let unsafeReplaceRegExpBy0: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string", - "deprecated": "Use `replaceRegExpBy0Unsafe` instead" - }, - { - "id": "Core.String.unsafeReplaceRegExpBy1", - "kind": "value", - "name": "unsafeReplaceRegExpBy1", - "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```" - ], - "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.String.unsafeReplaceRegExpBy2", - "kind": "value", - "name": "unsafeReplaceRegExpBy2", - "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```" - ], - "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.String.unsafeReplaceRegExpBy3", - "kind": "value", - "name": "unsafeReplaceRegExpBy3", - "docstrings": [ - "`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 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.String.replaceRegExpBy0Unsafe", - "kind": "value", - "name": "replaceRegExpBy0Unsafe", - "docstrings": [ - "`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 replaceRegExpBy0Unsafe: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" - }, - { - "id": "Core.String.replaceRegExpBy1Unsafe", - "kind": "value", - "name": "replaceRegExpBy1Unsafe", - "docstrings": [ - "`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 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.String.replaceRegExpBy2Unsafe", - "kind": "value", - "name": "replaceRegExpBy2Unsafe", - "docstrings": [ - "`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 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.String.replaceRegExpBy3Unsafe", - "kind": "value", - "name": "replaceRegExpBy3Unsafe", - "docstrings": [ - "`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 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.String.search", - "kind": "value", - "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.String.searchOpt", - "kind": "value", - "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.String.slice", - "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" - }, - { - "id": "Core.String.sliceToEnd", - "kind": "value", - "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.String.split", - "kind": "value", - "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.String.splitAtMost", - "kind": "value", - "name": "splitAtMost", - "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```" - ], - "signature": "let splitAtMost: (string, string, ~limit: int) => array" - }, - { - "id": "Core.String.splitByRegExp", - "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, RegExp.t) => array>" - }, - { - "id": "Core.String.splitByRegExpAtMost", - "kind": "value", - "name": "splitByRegExpAtMost", - "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```" - ], - "signature": "let splitByRegExpAtMost: (\n string,\n RegExp.t,\n ~limit: int,\n) => array>" - }, - { - "id": "Core.String.startsWith", - "kind": "value", - "name": "startsWith", - "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```" - ], - "signature": "let startsWith: (string, string) => bool" - }, - { - "id": "Core.String.startsWithFrom", - "kind": "value", - "name": "startsWithFrom", - "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```" - ], - "signature": "let startsWithFrom: (string, string, int) => bool" - }, - { - "id": "Core.String.substring", - "kind": "value", - "name": "substring", - "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```" - ], - "signature": "let substring: (string, ~start: int, ~end: int) => string" - }, - { - "id": "Core.String.substringToEnd", - "kind": "value", - "name": "substringToEnd", - "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```" - ], - "signature": "let substringToEnd: (string, ~start: int) => string" - }, - { - "id": "Core.String.toLowerCase", - "kind": "value", - "name": "toLowerCase", - "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```" - ], - "signature": "let toLowerCase: string => string" - }, - { - "id": "Core.String.toLocaleLowerCase", - "kind": "value", - "name": "toLocaleLowerCase", - "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." - ], - "signature": "let toLocaleLowerCase: string => string" - }, - { - "id": "Core.String.toUpperCase", - "kind": "value", - "name": "toUpperCase", - "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```" - ], - "signature": "let toUpperCase: string => string" - }, - { - "id": "Core.String.toLocaleUpperCase", - "kind": "value", - "name": "toLocaleUpperCase", - "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." - ], - "signature": "let toLocaleUpperCase: string => string" - }, - { - "id": "Core.String.trim", - "kind": "value", - "name": "trim", - "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```" - ], - "signature": "let trim: string => string" - }, - { - "id": "Core.String.trimStart", - "kind": "value", - "name": "trimStart", - "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```" - ], - "signature": "let trimStart: string => string" - }, - { - "id": "Core.String.trimEnd", - "kind": "value", - "name": "trimEnd", - "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```" - ], - "signature": "let trimEnd: string => string" - }, - { - "id": "Core.String.padStart", - "kind": "value", - "name": "padStart", - "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```" - ], - "signature": "let padStart: (string, int, string) => string" - }, - { - "id": "Core.String.padEnd", - "kind": "value", - "name": "padEnd", - "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```" - ], - "signature": "let padEnd: (string, int, string) => string" - }, - { - "id": "Core.String.getSymbol", - "kind": "value", - "name": "getSymbol", - "docstrings": [], - "signature": "let getSymbol: (string, Symbol.t) => option<'a>" - }, - { - "id": "Core.String.getSymbolUnsafe", - "kind": "value", - "name": "getSymbolUnsafe", - "docstrings": [], - "signature": "let getSymbolUnsafe: (string, Symbol.t) => 'a" - }, - { - "id": "Core.String.setSymbol", - "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: (string, Symbol.t, 'a) => unit" - }, - { - "id": "Core.String.localeCompare", - "kind": "value", - "name": "localeCompare", - "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```" - ], - "signature": "let localeCompare: (string, string) => float" - } - ] - }, - "core/result": { - "id": "Core.Result", - "name": "Result", - "docstrings": [], - "items": [ - { - "id": "Core.Result.t", - "kind": "type", - "name": "t", - "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": "type t<'res, 'err> = result<'res, 'err> =\n | Ok('res)\n | Error('err)" - }, - { - "id": "Core.Result.getExn", - "kind": "value", - "name": "getExn", - "docstrings": [ - "`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": "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", - "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```" - ], - "signature": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" - }, - { - "id": "Core.Result.getOr", - "kind": "value", - "name": "getOr", - "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```" - ], - "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" - }, - { - "id": "Core.Result.isOk", - "kind": "value", - "name": "isOk", - "docstrings": [ - "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." - ], - "signature": "let isOk: result<'a, 'b> => bool" - }, - { - "id": "Core.Result.isError", - "kind": "value", - "name": "isError", - "docstrings": [ - "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." - ], - "signature": "let isError: result<'a, 'b> => bool" - }, - { - "id": "Core.Result.equal", - "kind": "value", - "name": "equal", - "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```" - ], - "signature": "let equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.Result.compare", - "kind": "value", - "name": "compare", - "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```" - ], - "signature": "let compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.Result.forEach", - "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (result<'a, 'b>, 'a => unit) => unit" - }, - { - "id": "Core.Result.mapError", - "kind": "value", - "name": "mapError", - "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```" - ], - "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" - }, - { - "id": "Core.Result.all", - "kind": "value", - "name": "all", - "docstrings": [ - "`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 all: array> => result, 'b>" - }, - { - "id": "Core.Result.all2", - "kind": "value", - "name": "all2", - "docstrings": [ - "`all2((r1, r2))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all2: (\n (result<'r1, 'e>, result<'r2, 'e>),\n) => result<('r1, 'r2), 'e>" - }, - { - "id": "Core.Result.all3", - "kind": "value", - "name": "all3", - "docstrings": [ - "`all3((r1, r2, r3))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all3: (\n (result<'r1, 'e>, result<'r2, 'e>, result<'r3, 'e>),\n) => result<('r1, 'r2, 'r3), 'e>" - }, - { - "id": "Core.Result.all4", - "kind": "value", - "name": "all4", - "docstrings": [ - "`all4((r1, r2, r3, r4))`. Like `all()`, but with a fixed size tuple of 2" - ], - "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.Result.all5", - "kind": "value", - "name": "all5", - "docstrings": [ - "`all5((r1, r2, r3, r4, r5))`. Like `all()`, but with a fixed size tuple of 2" - ], - "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.Result.all6", - "kind": "value", - "name": "all6", - "docstrings": [ - "`all6((r1, r2, r3, r4, r5, r6))`. Like `all()`, but with a fixed size tuple of 2" - ], - "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/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": [ - { - "id": "Core.RegExp.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Type representing an instantiated `RegExp`." - ], - "signature": "type t" - }, - { - "id": "Core.RegExp.fromString", - "kind": "value", - "name": "fromString", - "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```" - ], - "signature": "let fromString: string => t" - }, - { - "id": "Core.RegExp.fromStringWithFlags", - "kind": "value", - "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.RegExp.test", - "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" - }, - { - "id": "Core.RegExp.exec", - "kind": "value", - "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.RegExp.lastIndex", - "kind": "value", - "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.RegExp.setLastIndex", - "kind": "value", - "name": "setLastIndex", - "docstrings": [ - "`setLastIndex(regexp, index)` set the index the next match will start from.\n\nSee [`RegExp.lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\nlet someStr = \"Many words here.\"\n\nregexp->RegExp.setLastIndex(4)\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `10` to the console\n```" - ], - "signature": "let setLastIndex: (t, int) => unit" - }, - { - "id": "Core.RegExp.ignoreCase", - "kind": "value", - "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.RegExp.global", - "kind": "value", - "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.RegExp.multiline", - "kind": "value", - "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.RegExp.source", - "kind": "value", - "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.RegExp.sticky", - "kind": "value", - "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.RegExp.unicode", - "kind": "value", - "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/promise": { - "id": "Core.Promise", - "name": "Promise", - "docstrings": [ - "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." - ], - "items": [ - { - "id": "Core.Promise.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a> = promise<'a>" - }, - { - "id": "Core.Promise.resolve", - "kind": "value", - "name": "resolve", - "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```" - ], - "signature": "let resolve: 'a => t<'a>" - }, - { - "id": "Core.Promise.reject", - "kind": "value", - "name": "reject", - "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\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 reject: exn => t<'a>" - }, - { - "id": "Core.Promise.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```" - ], - "signature": "let make: (('a => unit, 'e => unit) => unit) => t<'a>" - }, - { - "id": "Core.Promise.promiseAndResolvers", - "kind": "type", - "name": "promiseAndResolvers", - "docstrings": [], - "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" - }, - { - "id": "Core.Promise.withResolvers", - "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>" - }, - { - "id": "Core.Promise.catch", - "kind": "value", - "name": "catch", - "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." - ], - "signature": "let catch: (t<'a>, exn => t<'a>) => t<'a>" - }, - { - "id": "Core.Promise.then", - "kind": "value", - "name": "then", - "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```" - ], - "signature": "let then: (t<'a>, 'a => t<'b>) => t<'b>" - }, - { - "id": "Core.Promise.thenResolve", - "kind": "value", - "name": "thenResolve", - "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." - ], - "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" - }, - { - "id": "Core.Promise.finally", - "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>" - }, - { - "id": "Core.Promise.race", - "kind": "value", - "name": "race", - "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```" - ], - "signature": "let race: array> => t<'a>" - }, - { - "id": "Core.Promise.any", - "kind": "value", - "name": "any", - "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```" - ], - "signature": "let any: array> => t<'a>" - }, - { - "id": "Core.Promise.all", - "kind": "value", - "name": "all", - "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```" - ], - "signature": "let all: array> => t>" - }, - { - "id": "Core.Promise.all2", - "kind": "value", - "name": "all2", - "docstrings": [ - "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" - }, - { - "id": "Core.Promise.all3", - "kind": "value", - "name": "all3", - "docstrings": [ - "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" - ], - "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" - }, - { - "id": "Core.Promise.all4", - "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)>" - }, - { - "id": "Core.Promise.all5", - "kind": "value", - "name": "all5", - "docstrings": [ - "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" - ], - "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" - }, - { - "id": "Core.Promise.all6", - "kind": "value", - "name": "all6", - "docstrings": [ - "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\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)>" - }, - { - "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": "allSettled", - "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```" - ], - "signature": "let allSettled: array> => t>>" - }, - { - "id": "Core.Promise.allSettled2", - "kind": "value", - "name": "allSettled2", - "docstrings": [ - "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" - ], - "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" - }, - { - "id": "Core.Promise.allSettled3", - "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>" - }, - { - "id": "Core.Promise.allSettled4", - "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>" - }, - { - "id": "Core.Promise.allSettled5", - "kind": "value", - "name": "allSettled5", - "docstrings": [ - "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" - ], - "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.Promise.allSettled6", - "kind": "value", - "name": "allSettled6", - "docstrings": [ - "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\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>" - }, - { - "id": "Core.Promise.done", - "kind": "value", - "name": "done", - "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." - ], - "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" - }, - { - "id": "Core.Ordering.less", - "kind": "value", - "name": "less", - "docstrings": [], - "signature": "let less: float" - }, - { - "id": "Core.Ordering.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: float" - }, - { - "id": "Core.Ordering.greater", - "kind": "value", - "name": "greater", - "docstrings": [], - "signature": "let greater: float" - }, - { - "id": "Core.Ordering.isLess", - "kind": "value", - "name": "isLess", - "docstrings": [], - "signature": "let isLess: float => bool" - }, - { - "id": "Core.Ordering.isEqual", - "kind": "value", - "name": "isEqual", - "docstrings": [], - "signature": "let isEqual: float => bool" - }, - { - "id": "Core.Ordering.isGreater", - "kind": "value", - "name": "isGreater", - "docstrings": [], - "signature": "let isGreater: float => bool" - }, - { - "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": [ - "Type representing an option of type 'a." - ], - "signature": "type t<'a> = option<'a> = None | Some('a)" - }, - { - "id": "Core.Option.filter", - "kind": "value", - "name": "filter", - "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```" - ], - "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" - }, - { - "id": "Core.Option.forEach", - "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (option<'a>, 'a => unit) => unit" - }, - { - "id": "Core.Option.getExn", - "kind": "value", - "name": "getExn", - "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))->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 getExn: (option<'a>, ~message: string=?) => 'a" - }, - { - "id": "Core.Option.getUnsafe", - "kind": "value", - "name": "getUnsafe", - "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." - ], - "signature": "let getUnsafe: option<'a> => 'a" - }, - { - "id": "Core.Option.mapOr", - "kind": "value", - "name": "mapOr", - "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```" - ], - "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" - }, - { - "id": "Core.Option.map", - "kind": "value", - "name": "map", - "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```" - ], - "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" - }, - { - "id": "Core.Option.flatMap", - "kind": "value", - "name": "flatMap", - "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```" - ], - "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" - }, - { - "id": "Core.Option.getOr", - "kind": "value", - "name": "getOr", - "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```" - ], - "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" - }, - { - "id": "Core.Option.orElse", - "kind": "value", - "name": "orElse", - "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```" - ], - "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" - }, - { - "id": "Core.Option.isSome", - "kind": "value", - "name": "isSome", - "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```" - ], - "signature": "let isSome: option<'a> => bool" - }, - { - "id": "Core.Option.isNone", - "kind": "value", - "name": "isNone", - "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```" - ], - "signature": "let isNone: option<'a> => bool" - }, - { - "id": "Core.Option.equal", - "kind": "value", - "name": "equal", - "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```" - ], - "signature": "let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.Option.compare", - "kind": "value", - "name": "compare", - "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) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.Option.all", - "kind": "value", - "name": "all", - "docstrings": [ - "`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 all: array> => option>" - }, - { - "id": "Core.Option.all2", - "kind": "value", - "name": "all2", - "docstrings": [ - "`all2((o1, o2))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all2: ((option<'a>, option<'b>)) => option<('a, 'b)>" - }, - { - "id": "Core.Option.all3", - "kind": "value", - "name": "all3", - "docstrings": [ - "`all3((o1, o2, o3))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all3: (\n (option<'a>, option<'b>, option<'c>),\n) => option<('a, 'b, 'c)>" - }, - { - "id": "Core.Option.all4", - "kind": "value", - "name": "all4", - "docstrings": [ - "`all4((o1, o2, o3, o4))`. Like `all()`, but with a fixed size tuple of 2" - ], - "signature": "let all4: (\n (option<'a>, option<'b>, option<'c>, option<'d>),\n) => option<('a, 'b, 'c, 'd)>" - }, - { - "id": "Core.Option.all5", - "kind": "value", - "name": "all5", - "docstrings": [ - "`all5((o1, o2, o3, o4, o5))`. Like `all()`, but with a fixed size tuple of 2" - ], - "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.Option.all6", - "kind": "value", - "name": "all6", - "docstrings": [ - "`all6((o1, o2, o3, o4, o5, o6))`. Like `all()`, but with a fixed size tuple of 2" - ], - "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.Object.make", - "kind": "value", - "name": "make", - "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```" - ], - "signature": "let make: unit => {..}" - }, - { - "id": "Core.Object.is", - "kind": "value", - "name": "is", - "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```" - ], - "signature": "let is: ('a, 'a) => bool" - }, - { - "id": "Core.Object.create", - "kind": "value", - "name": "create", - "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```" - ], - "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: {..} => {..}" - }, - { - "id": "Core.Object.assign", - "kind": "value", - "name": "assign", - "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```" - ], - "signature": "let assign: ({..}, {..}) => {..}" - }, - { - "id": "Core.Object.assignMany", - "kind": "value", - "name": "assignMany", - "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)." - ], - "signature": "let assignMany: ({..}, array<{..}>) => {..}" - }, - { - "id": "Core.Object.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: ({..} as 'a) => 'a" - }, - { - "id": "Core.Object.get", - "kind": "value", - "name": "get", - "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```" - ], - "signature": "let get: ({..}, string) => option<'a>" - }, - { - "id": "Core.Object.getSymbol", - "kind": "value", - "name": "getSymbol", - "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```" - ], - "signature": "let getSymbol: ({..}, Symbol.t) => option<'a>" - }, - { - "id": "Core.Object.getSymbolUnsafe", - "kind": "value", - "name": "getSymbolUnsafe", - "docstrings": [], - "signature": "let getSymbolUnsafe: ({..}, Symbol.t) => 'a" - }, - { - "id": "Core.Object.set", - "kind": "value", - "name": "set", - "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```" - ], - "signature": "let set: ({..}, string, 'a) => unit" - }, - { - "id": "Core.Object.setSymbol", - "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: ({..}, Symbol.t, 'a) => unit" - }, - { - "id": "Core.Object.keysToArray", - "kind": "value", - "name": "keysToArray", - "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```" - ], - "signature": "let keysToArray: {..} => array" - }, - { - "id": "Core.Object.hasOwnProperty", - "kind": "value", - "name": "hasOwnProperty", - "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```" - ], - "signature": "let hasOwnProperty: ({..}, string) => bool" - }, - { - "id": "Core.Object.seal", - "kind": "value", - "name": "seal", - "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\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 seal: ({..} as 'a) => 'a" - }, - { - "id": "Core.Object.preventExtensions", - "kind": "value", - "name": "preventExtensions", - "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\ntry {\n obj->Object.set(\"c\", 3) // fails\n} catch {\n| Exn.Error(_) => assert(true)\n| _ => assert(false)\n}\n```" - ], - "signature": "let preventExtensions: ({..} as 'a) => 'a" - }, - { - "id": "Core.Object.freeze", - "kind": "value", - "name": "freeze", - "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\n\ntry {\n obj->Object.set(\"a\", 3) // fails\n} catch {\n| Exn.Error(_) => assert(true)\n| _ => assert(false)\n}\n```" - ], - "signature": "let freeze: ({..} as 'a) => 'a" - }, - { - "id": "Core.Object.isSealed", - "kind": "value", - "name": "isSealed", - "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 ```" - ], - "signature": "let isSealed: 'a => bool" - }, - { - "id": "Core.Object.isFrozen", - "kind": "value", - "name": "isFrozen", - "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 ```" - ], - "signature": "let isFrozen: 'a => bool" - }, - { - "id": "Core.Object.isExtensible", - "kind": "value", - "name": "isExtensible", - "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```" - ], - "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": [ - { - "id": "Core.Nullable.t", - "kind": "type", - "name": "t", - "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.Nullable.null", - "kind": "value", - "name": "null", - "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```" - ], - "signature": "let null: t<'a>" - }, - { - "id": "Core.Nullable.undefined", - "kind": "value", - "name": "undefined", - "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```" - ], - "signature": "let undefined: t<'a>" - }, - { - "id": "Core.Nullable.isNullable", - "kind": "value", - "name": "isNullable", - "docstrings": [ - "`isNullable(a)` returns `true` if `a` is null or undefined, `false` otherwise.\n\n## Examples\n\n```rescript\nlet myStr = \"Hello\"\nlet asNullable = myStr->Nullable.make\n\n// Can't do the below because we're now forced to check for nullability\n// myStr == asNullable\n\n// Check if asNullable is not null or undefined\nswitch asNullable->Nullable.isNullable {\n| true => assert(false)\n| false => assert(true)\n}\n```" - ], - "signature": "let isNullable: t<'a> => bool" - }, - { - "id": "Core.Nullable.make", - "kind": "value", - "name": "make", - "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```" - ], - "signature": "let make: 'a => t<'a>" - }, - { - "id": "Core.Nullable.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.Nullable.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.Nullable.toOption", - "kind": "value", - "name": "toOption", - "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```" - ], - "signature": "let toOption: t<'a> => option<'a>" - }, - { - "id": "Core.Nullable.fromOption", - "kind": "value", - "name": "fromOption", - "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```" - ], - "signature": "let fromOption: option<'a> => t<'a>" - }, - { - "id": "Core.Nullable.getOr", - "kind": "value", - "name": "getOr", - "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```" - ], - "signature": "let getOr: (t<'a>, 'a) => 'a" - }, - { - "id": "Core.Nullable.getWithDefault", - "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (t<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" - }, - { - "id": "Core.Nullable.getExn", - "kind": "value", - "name": "getExn", - "docstrings": [ - "`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 getExn: t<'a> => 'a" - }, - { - "id": "Core.Nullable.getUnsafe", - "kind": "value", - "name": "getUnsafe", - "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`." - ], - "signature": "let getUnsafe: t<'a> => 'a" - }, - { - "id": "Core.Nullable.forEach", - "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" - }, - { - "id": "Core.Nullable.map", - "kind": "value", - "name": "map", - "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```" - ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" - }, - { - "id": "Core.Nullable.mapOr", - "kind": "value", - "name": "mapOr", - "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```" - ], - "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" - }, - { - "id": "Core.Nullable.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" - }, - { - "id": "Core.Nullable.flatMap", - "kind": "value", - "name": "flatMap", - "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```" - ], - "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": "@unboxed\ntype t<'a> = null<'a> =\n | Value('a)\n | @as(null) Null" - }, - { - "id": "Core.Null.asNullable", - "kind": "value", - "name": "asNullable", - "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```" - ], - "signature": "let asNullable: t<'a> => Nullable.t<'a>" - }, - { - "id": "Core.Null.null", - "kind": "value", - "name": "null", - "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```" - ], - "signature": "let null: t<'a>" - }, - { - "id": "Core.Null.make", - "kind": "value", - "name": "make", - "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```" - ], - "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) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.Null.toOption", - "kind": "value", - "name": "toOption", - "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```" - ], - "signature": "let toOption: t<'a> => option<'a>" - }, - { - "id": "Core.Null.fromOption", - "kind": "value", - "name": "fromOption", - "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```" - ], - "signature": "let fromOption: option<'a> => t<'a>" - }, - { - "id": "Core.Null.getOr", - "kind": "value", - "name": "getOr", - "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```" - ], - "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" - }, - { - "id": "Core.Null.getExn", - "kind": "value", - "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.Null.getUnsafe", - "kind": "value", - "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.Null.forEach", - "kind": "value", - "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.Null.map", - "kind": "value", - "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.Null.mapOr", - "kind": "value", - "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.Null.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" - }, - { - "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", - "kind": "value", - "name": "abs", - "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```" - ], - "signature": "let abs: float => float" - }, - { - "id": "Core.Math.acos", - "kind": "value", - "name": "acos", - "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```" - ], - "signature": "let acos: float => float" - }, - { - "id": "Core.Math.acosh", - "kind": "value", - "name": "acosh", - "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```" - ], - "signature": "let acosh: float => float" - }, - { - "id": "Core.Math.asin", - "kind": "value", - "name": "asin", - "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```" - ], - "signature": "let asin: float => float" - }, - { - "id": "Core.Math.asinh", - "kind": "value", - "name": "asinh", - "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```" - ], - "signature": "let asinh: float => float" - }, - { - "id": "Core.Math.atan", - "kind": "value", - "name": "atan", - "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```" - ], - "signature": "let atan: float => float" - }, - { - "id": "Core.Math.atanh", - "kind": "value", - "name": "atanh", - "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```" - ], - "signature": "let atanh: float => float" - }, - { - "id": "Core.Math.atan2", - "kind": "value", - "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.Math.cbrt", - "kind": "value", - "name": "cbrt", - "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```" - ], - "signature": "let cbrt: float => float" - }, - { - "id": "Core.Math.ceil", - "kind": "value", - "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.Math.cos", - "kind": "value", - "name": "cos", - "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```" - ], - "signature": "let cos: float => float" - }, - { - "id": "Core.Math.cosh", - "kind": "value", - "name": "cosh", - "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```" - ], - "signature": "let cosh: float => float" - }, - { - "id": "Core.Math.exp", - "kind": "value", - "name": "exp", - "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```" - ], - "signature": "let exp: float => float" - }, - { - "id": "Core.Math.expm1", - "kind": "value", - "name": "expm1", - "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```" - ], - "signature": "let expm1: float => float" - }, - { - "id": "Core.Math.floor", - "kind": "value", - "name": "floor", - "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```" - ], - "signature": "let floor: float => float" - }, - { - "id": "Core.Math.fround", - "kind": "value", - "name": "fround", - "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```" - ], - "signature": "let fround: float => float" - }, - { - "id": "Core.Math.hypot", - "kind": "value", - "name": "hypot", - "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```" - ], - "signature": "let hypot: (float, float) => float" - }, - { - "id": "Core.Math.hypotMany", - "kind": "value", - "name": "hypotMany", - "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```" - ], - "signature": "let hypotMany: array => float" - }, - { - "id": "Core.Math.log", - "kind": "value", - "name": "log", - "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```" - ], - "signature": "let log: float => float" - }, - { - "id": "Core.Math.log1p", - "kind": "value", - "name": "log1p", - "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```" - ], - "signature": "let log1p: float => float" - }, - { - "id": "Core.Math.log10", - "kind": "value", - "name": "log10", - "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```" - ], - "signature": "let log10: float => float" - }, - { - "id": "Core.Math.log2", - "kind": "value", - "name": "log2", - "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```" - ], - "signature": "let log2: float => float" - }, - { - "id": "Core.Math.min", - "kind": "value", - "name": "min", - "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```" - ], - "signature": "let min: (float, float) => float" - }, - { - "id": "Core.Math.minMany", - "kind": "value", - "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.Math.max", - "kind": "value", - "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.Math.maxMany", - "kind": "value", - "name": "maxMany", - "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```" - ], - "signature": "let maxMany: array => float" - }, - { - "id": "Core.Math.pow", - "kind": "value", - "name": "pow", - "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```" - ], - "signature": "let pow: (float, ~exp: float) => float" - }, - { - "id": "Core.Math.random", - "kind": "value", - "name": "random", - "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```" - ], - "signature": "let random: unit => float" - }, - { - "id": "Core.Math.round", - "kind": "value", - "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.Math.sign", - "kind": "value", - "name": "sign", - "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```" - ], - "signature": "let sign: float => float" - }, - { - "id": "Core.Math.sin", - "kind": "value", - "name": "sin", - "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```" - ], - "signature": "let sin: float => float" - }, - { - "id": "Core.Math.sinh", - "kind": "value", - "name": "sinh", - "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```" - ], - "signature": "let sinh: float => float" - }, - { - "id": "Core.Math.sqrt", - "kind": "value", - "name": "sqrt", - "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```" - ], - "signature": "let sqrt: float => float" - }, - { - "id": "Core.Math.tan", - "kind": "value", - "name": "tan", - "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```" - ], - "signature": "let tan: float => float" - }, - { - "id": "Core.Math.tanh", - "kind": "value", - "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.Math.trunc", - "kind": "value", - "name": "trunc", - "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```" - ], - "signature": "let trunc: float => float" - } - ] - }, - "core/list": { - "id": "Core.List", - "name": "List", - "docstrings": [], - "items": [ - { - "id": "Core.List.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: list<'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: list<'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: list<'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})->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 headExn: list<'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: list<'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})->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 tailExn: list<'a> => list<'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: (list<'a>, 'a) => list<'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```" - ], - "signature": "let get: (list<'a>, int) => option<'a>" - }, - { - "id": "Core.List.getExn", - "kind": "value", - "name": "getExn", - "docstrings": [ - "`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 getExn: (list<'a>, int) => 'a" - }, - { - "id": "Core.List.make", - "kind": "value", - "name": "make", - "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```" - ], - "signature": "let make: (~length: int, 'a) => list<'a>" - }, - { - "id": "Core.List.fromInitializer", - "kind": "value", - "name": "fromInitializer", - "docstrings": [ - "`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 fromInitializer: (~length: int, int => 'a) => list<'a>" - }, - { - "id": "Core.List.shuffle", - "kind": "value", - "name": "shuffle", - "docstrings": [ - "`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 shuffle: list<'a> => list<'a>" - }, - { - "id": "Core.List.toShuffled", - "kind": "value", - "name": "toShuffled", - "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```" - ], - "signature": "let toShuffled: list<'a> => list<'a>", - "deprecated": "Use `shuffle` instead" - }, - { - "id": "Core.List.drop", - "kind": "value", - "name": "drop", - "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```" - ], - "signature": "let drop: (list<'a>, int) => option>" - }, - { - "id": "Core.List.take", - "kind": "value", - "name": "take", - "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```" - ], - "signature": "let take: (list<'a>, int) => option>" - }, - { - "id": "Core.List.splitAt", - "kind": "value", - "name": "splitAt", - "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```" - ], - "signature": "let splitAt: (list<'a>, int) => option<(list<'a>, list<'a>)>" - }, - { - "id": "Core.List.concat", - "kind": "value", - "name": "concat", - "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```" - ], - "signature": "let concat: (list<'a>, list<'a>) => list<'a>" - }, - { - "id": "Core.List.concatMany", - "kind": "value", - "name": "concatMany", - "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```" - ], - "signature": "let concatMany: array> => list<'a>" - }, - { - "id": "Core.List.reverseConcat", - "kind": "value", - "name": "reverseConcat", - "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```" - ], - "signature": "let reverseConcat: (list<'a>, list<'a>) => list<'a>" - }, - { - "id": "Core.List.flat", - "kind": "value", - "name": "flat", - "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```" - ], - "signature": "let flat: list> => list<'a>" - }, - { - "id": "Core.List.map", - "kind": "value", - "name": "map", - "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```" - ], - "signature": "let map: (list<'a>, 'a => 'b) => list<'b>" - }, - { - "id": "Core.List.zip", - "kind": "value", - "name": "zip", - "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```" - ], - "signature": "let zip: (list<'a>, list<'b>) => list<('a, 'b)>" - }, - { - "id": "Core.List.zipBy", - "kind": "value", - "name": "zipBy", - "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```" - ], - "signature": "let zipBy: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" - }, - { - "id": "Core.List.mapWithIndex", - "kind": "value", - "name": "mapWithIndex", - "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```" - ], - "signature": "let mapWithIndex: (list<'a>, ('a, int) => 'b) => list<'b>" - }, - { - "id": "Core.List.fromArray", - "kind": "value", - "name": "fromArray", - "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```" - ], - "signature": "let fromArray: array<'a> => list<'a>" - }, - { - "id": "Core.List.toArray", - "kind": "value", - "name": "toArray", - "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```" - ], - "signature": "let toArray: list<'a> => array<'a>" - }, - { - "id": "Core.List.reverse", - "kind": "value", - "name": "reverse", - "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```" - ], - "signature": "let reverse: list<'a> => list<'a>" - }, - { - "id": "Core.List.mapReverse", - "kind": "value", - "name": "mapReverse", - "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```" - ], - "signature": "let mapReverse: (list<'a>, 'a => 'b) => list<'b>" - }, - { - "id": "Core.List.forEach", - "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (list<'a>, 'a => unit) => unit" - }, - { - "id": "Core.List.forEachWithIndex", - "kind": "value", - "name": "forEachWithIndex", - "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```" - ], - "signature": "let forEachWithIndex: (list<'a>, ('a, int) => unit) => unit" - }, - { - "id": "Core.List.reduce", - "kind": "value", - "name": "reduce", - "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```" - ], - "signature": "let reduce: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" - }, - { - "id": "Core.List.reduceWithIndex", - "kind": "value", - "name": "reduceWithIndex", - "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```" - ], - "signature": "let reduceWithIndex: (list<'a>, 'b, ('b, 'a, int) => 'b) => 'b" - }, - { - "id": "Core.List.reduceReverse", - "kind": "value", - "name": "reduceReverse", - "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```" - ], - "signature": "let reduceReverse: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" - }, - { - "id": "Core.List.mapReverse2", - "kind": "value", - "name": "mapReverse2", - "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```" - ], - "signature": "let mapReverse2: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" - }, - { - "id": "Core.List.forEach2", - "kind": "value", - "name": "forEach2", - "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```" - ], - "signature": "let forEach2: (list<'a>, list<'b>, ('a, 'b) => 'c) => unit" - }, - { - "id": "Core.List.reduce2", - "kind": "value", - "name": "reduce2", - "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```" - ], - "signature": "let reduce2: (list<'b>, list<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" - }, - { - "id": "Core.List.reduceReverse2", - "kind": "value", - "name": "reduceReverse2", - "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```" - ], - "signature": "let reduceReverse2: (list<'a>, list<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" - }, - { - "id": "Core.List.every", - "kind": "value", - "name": "every", - "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```" - ], - "signature": "let every: (list<'a>, 'a => bool) => bool" - }, - { - "id": "Core.List.some", - "kind": "value", - "name": "some", - "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```" - ], - "signature": "let some: (list<'a>, 'a => bool) => bool" - }, - { - "id": "Core.List.every2", - "kind": "value", - "name": "every2", - "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```" - ], - "signature": "let every2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.List.some2", - "kind": "value", - "name": "some2", - "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```" - ], - "signature": "let some2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.List.compareLength", - "kind": "value", - "name": "compareLength", - "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```" - ], - "signature": "let compareLength: (list<'a>, list<'a>) => Ordering.t" - }, - { - "id": "Core.List.compare", - "kind": "value", - "name": "compare", - "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." - ], - "signature": "let compare: (\n list<'a>,\n list<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.List.equal", - "kind": "value", - "name": "equal", - "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```" - ], - "signature": "let equal: (list<'a>, list<'a>, ('a, 'a) => bool) => bool" - }, - { - "id": "Core.List.has", - "kind": "value", - "name": "has", - "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```" - ], - "signature": "let has: (list<'a>, 'b, ('a, 'b) => bool) => bool" - }, - { - "id": "Core.List.find", - "kind": "value", - "name": "find", - "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```" - ], - "signature": "let find: (list<'a>, 'a => bool) => option<'a>" - }, - { - "id": "Core.List.filter", - "kind": "value", - "name": "filter", - "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```" - ], - "signature": "let filter: (list<'a>, 'a => bool) => list<'a>" - }, - { - "id": "Core.List.filterWithIndex", - "kind": "value", - "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.List.filterMap", - "kind": "value", - "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.List.partition", - "kind": "value", - "name": "partition", - "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```" - ], - "signature": "let partition: (list<'a>, 'a => bool) => (list<'a>, list<'a>)" - }, - { - "id": "Core.List.unzip", - "kind": "value", - "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.List.getAssoc", - "kind": "value", - "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.List.hasAssoc", - "kind": "value", - "name": "hasAssoc", - "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```" - ], - "signature": "let hasAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => bool", - "deprecated": "Use a `Map` instead" - }, - { - "id": "Core.List.removeAssoc", - "kind": "value", - "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.List.setAssoc", - "kind": "value", - "name": "setAssoc", - "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." - ], - "signature": "let setAssoc: (list<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => list<('a, 'c)>", - "deprecated": "Use a `Map` instead" - }, - { - "id": "Core.List.sort", - "kind": "value", - "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.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.JSON.replacer", - "kind": "type", - "name": "replacer", - "docstrings": [], - "signature": "@unboxed\ntype replacer =\n | Keys(array)\n | Replacer((string, t) => t)" - }, - { - "id": "Core.JSON.parseExn", - "kind": "value", - "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.JSON.parseExnWithReviver", - "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" - }, - { - "id": "Core.JSON.stringify", - "kind": "value", - "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.JSON.stringifyWithIndent", - "kind": "value", - "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.JSON.stringifyWithReplacer", - "kind": "value", - "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.JSON.stringifyWithReplacerAndIndent", - "kind": "value", - "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.JSON.stringifyWithFilter", - "kind": "value", - "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.JSON.stringifyWithFilterAndIndent", - "kind": "value", - "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.JSON.stringifyAny", - "kind": "value", - "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.JSON.stringifyAnyWithIndent", - "kind": "value", - "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.JSON.stringifyAnyWithReplacer", - "kind": "value", - "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.JSON.stringifyAnyWithReplacerAndIndent", - "kind": "value", - "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.JSON.stringifyAnyWithFilter", - "kind": "value", - "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.JSON.stringifyAnyWithFilterAndIndent", - "kind": "value", - "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.Intl.getCanonicalLocalesExn", - "kind": "value", - "name": "getCanonicalLocalesExn", - "docstrings": [ - "@throws RangeError" - ], - "signature": "let getCanonicalLocalesExn: string => array" - }, - { - "id": "Core.Intl.getCanonicalLocalesManyExn", - "kind": "value", - "name": "getCanonicalLocalesManyExn", - "docstrings": [ - "@throws RangeError" - ], - "signature": "let getCanonicalLocalesManyExn: array => array" - }, - { - "id": "Core.Intl.supportedValuesOfExn", - "kind": "value", - "name": "supportedValuesOfExn", - "docstrings": [ - "@throws RangeError" - ], - "signature": "let supportedValuesOfExn: string => array" - } - ] - }, - "core/int": { - "id": "Core.Int", - "name": "Int", - "docstrings": [ - "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", - "name": "equal", - "docstrings": [], - "signature": "let equal: (int, int) => bool" - }, - { - "id": "Core.Int.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (int, int) => Ordering.t" - }, - { - "id": "Core.Int.toExponential", - "kind": "value", - "name": "toExponential", - "docstrings": [ - "`toExponential(n, ~digits=?)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point. See [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential)\n\n## Examples\n\n```rescript\nInt.toExponential(1000) // \"1e+3\"\nInt.toExponential(-1000) // \"-1e+3\"\nInt.toExponential(77, ~digits=2) // \"7.70e+1\"\nInt.toExponential(5678, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." - ], - "signature": "let toExponential: (int, ~digits: int=?) => string" - }, - { - "id": "Core.Int.toExponentialWithPrecision", - "kind": "value", - "name": "toExponentialWithPrecision", - "docstrings": [ - "`toExponential(n, ~digits)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point. See [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential)\non MDN.\n\n## Examples\n\n```rescript\nInt.toExponentialWithPrecision(77, ~digits=2) // \"7.70e+1\"\nInt.toExponentialWithPrecision(5678, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." - ], - "signature": "let toExponentialWithPrecision: (int, ~digits: int) => string", - "deprecated": "Use `toExponential` instead" - }, - { - "id": "Core.Int.toFixed", - "kind": "value", - "name": "toFixed", - "docstrings": [ - "`toFixed(n, ~digits=?)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point. See [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)\non MDN.\n\n## Examples\n\n```rescript\nInt.toFixed(123456) // \"123456.00\"\nInt.toFixed(10) // \"10.00\"\nInt.toFixed(300, ~digits=4) // \"300.0000\"\nInt.toFixed(300, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." - ], - "signature": "let toFixed: (int, ~digits: int=?) => string" - }, - { - "id": "Core.Int.toFixedWithPrecision", - "kind": "value", - "name": "toFixedWithPrecision", - "docstrings": [ - "`toFixedWithPrecision(n, ~digits)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point. See [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed)\non MDN.\n\n## Examples\n\n```rescript\nInt.toFixedWithPrecision(300, ~digits=4) // \"300.0000\"\nInt.toFixedWithPrecision(300, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." - ], - "signature": "let toFixedWithPrecision: (int, ~digits: int) => string", - "deprecated": "Use `toFixed` instead" - }, - { - "id": "Core.Int.toPrecision", - "kind": "value", - "name": "toPrecision", - "docstrings": [ - "`toPrecision(n, ~digits=?)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits. See [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nInt.toPrecision(100) // \"100\"\nInt.toPrecision(1) // \"1\"\nInt.toPrecision(100, ~digits=2) // \"1.0e+2\"\nInt.toPrecision(1, ~digits=2) // \"1.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." - ], - "signature": "let toPrecision: (int, ~digits: int=?) => string" - }, - { - "id": "Core.Int.toPrecisionWithPrecision", - "kind": "value", - "name": "toPrecisionWithPrecision", - "docstrings": [ - "`toPrecisionWithPrecision(n, ~digits)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits. See [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nInt.toPrecisionWithPrecision(100, ~digits=2) // \"1.0e+2\"\nInt.toPrecisionWithPrecision(1, ~digits=2) // \"1.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." - ], - "signature": "let toPrecisionWithPrecision: (int, ~digits: int) => string", - "deprecated": "Use `toPrecision` instead" - }, - { - "id": "Core.Int.toString", - "kind": "value", - "name": "toString", - "docstrings": [ - "`toString(n, ~radix=?)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString)\non MDN.\n\n## Examples\n\n```rescript\nInt.toString(1000) // \"1000\"\nInt.toString(-1000) // \"-1000\"\nInt.toString(6, ~radix=2) // \"110\"\nInt.toString(373592855, ~radix=16) // \"16449317\"\nInt.toString(123456, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." - ], - "signature": "let toString: (int, ~radix: int=?) => string" - }, - { - "id": "Core.Int.toStringWithRadix", - "kind": "value", - "name": "toStringWithRadix", - "docstrings": [ - "`toStringWithRadix(n, ~radix)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString)\non MDN.\n\n## Examples\n\n```rescript\nInt.toStringWithRadix(6, ~radix=2) // \"110\"\nInt.toStringWithRadix(373592855, ~radix=16) // \"16449317\"\nInt.toStringWithRadix(123456, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." - ], - "signature": "let toStringWithRadix: (int, ~radix: int) => string", - "deprecated": "Use `toString` instead" - }, - { - "id": "Core.Int.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [ - "`toLocaleString(n)` return a `string` with language-sensitive representing the\ngiven value. See [`Number.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) on MDN.\n\n## Examples\n\n```rescript\n// If the application uses English as the default language\nInt.toLocaleString(1000) // \"1,000\"\n\n// If the application uses Portuguese Brazil as the default language\nInt.toLocaleString(1000) // \"1.000\"\n```" - ], - "signature": "let toLocaleString: int => string" - }, - { - "id": "Core.Int.toFloat", - "kind": "value", - "name": "toFloat", - "docstrings": [ - "`toFloat(n)` return a `float` representing the given value.\n\n## Examples\n\n```rescript\nInt.toFloat(100) == 100.0\nInt.toFloat(2) == 2.0\n```" - ], - "signature": "let toFloat: int => float" - }, - { - "id": "Core.Int.fromFloat", - "kind": "value", - "name": "fromFloat", - "docstrings": [ - "`fromFloat(n)` return an `int` representing the given value. The conversion is\ndone by truncating the decimal part.\n\n## Examples\n\n```rescript\nInt.fromFloat(2.0) == 2\nInt.fromFloat(1.999) == 1\nInt.fromFloat(1.5) == 1\nInt.fromFloat(0.9999) == 0\n```" - ], - "signature": "let fromFloat: float => int" - }, - { - "id": "Core.Int.fromString", - "kind": "value", - "name": "fromString", - "docstrings": [ - "`fromString(str, ~radix=?)` return an `option` representing the given value\n`str`. `~radix` specifies the radix base to use for the formatted number.\n\n## Examples\n\n```rescript\nInt.fromString(\"0\") == Some(0)\nInt.fromString(\"NaN\") == None\nInt.fromString(\"6\", ~radix=2) == None\n```" - ], - "signature": "let fromString: (string, ~radix: int=?) => option" - }, - { - "id": "Core.Int.mod", - "kind": "value", - "name": "mod", - "docstrings": [ - "`mod(n1, n2)` calculates the modulo (remainder after division) of two integers.\n\n## Examples\n\n```rescript\nInt.mod(7, 4) == 3\n```" - ], - "signature": "let mod: (int, int) => int" - }, - { - "id": "Core.Int.rangeOptions", - "kind": "type", - "name": "rangeOptions", - "docstrings": [ - "The options for `range`." - ], - "signature": "type rangeOptions = {step?: int, inclusive?: bool}" - }, - { - "id": "Core.Int.range", - "kind": "value", - "name": "range", - "docstrings": [ - "`range(start, end, ~options=?)` returns an int array of the sequence of integers in the\nrange `[start, end)`. That is, including `start` but excluding `end`.\n\nIf `step` is not set and `start < end`, the sequence will be increasing in steps of 1.\n\nIf `step` is not set and `start > end`, the sequence will be decreasing in steps of -1.\n\nIf `step` is set, the sequence will increase or decrease by that amount for each\nstep. If `start < end` and `step` is negative, or vice versa, an empty array is\nreturned since the sequence would otherwise never reach or exceed the end value\nand hence be infinite. If `step` is `0` and `start !=` end, a `RangeError` is\nraised as the sequence would never reach or exceed the end value and hence be\ninfinite.\n\nIf `inclusive` is set to `true`, the sequence will include `end` if `step` is\nset such that the sequence includes it.\n\n## Examples\n\n```rescript\nInt.range(3, 6) == [3, 4, 5]\nInt.range(-3, -1) == [-3, -2]\nInt.range(3, 1) == [3, 2]\nInt.range(3, 7, ~options={step: 2}) == [3, 5]\nInt.range(3, 7, ~options={step: 2, inclusive: true}) == [3, 5, 7]\nInt.range(3, 6, ~options={step: -2}) // RangeError\n```\n\n## Exceptions\n\n- Raises `RangeError` if `step == 0 && start != end`." - ], - "signature": "let range: (int, int, ~options: rangeOptions=?) => array" - }, - { - "id": "Core.Int.rangeWithOptions", - "kind": "value", - "name": "rangeWithOptions", - "docstrings": [ - "`rangeWithOptions(start, end, options)` is like `range`, but with `step` and\n`inclusive` options configurable.\n\nIf `step` is set, the sequence will increase or decrease by that amount for each\nstep. If `start < end` and `step` is negative, or vice versa, an empty array is\nreturned since the sequence would otherwise never reach or exceed the end value\nand hence be infinite. If `step` is `0` and `start !=` end, a `RangeError` is\nraised as the sequence would never reach or exceed the end value and hence be\ninfinite.\n\nIf `inclusive` is set to `true`, the sequence will include `end` if `step` is\nset such that the sequence includes it.\n\n## Examples\n\n```rescript\nInt.rangeWithOptions(3, 7, {step: 2}) == [3, 5]\nInt.rangeWithOptions(3, 7, {step: 2, inclusive: true}) == [3, 5, 7]\nInt.rangeWithOptions(3, 6, {step: -2}) // RangeError\n```\n\n## Exceptions\n\n- Raises `RangeError` if `step == 0 && start != end`." - ], - "signature": "let rangeWithOptions: (int, int, rangeOptions) => array", - "deprecated": "Use `range` instead" - }, - { - "id": "Core.Int.clamp", - "kind": "value", - "name": "clamp", - "docstrings": [ - "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nInt.clamp(42) == 42\nInt.clamp(42, ~min=50) == 50\nInt.clamp(42, ~max=40) == 40\nInt.clamp(42, ~min=50, ~max=40) == 50\n```" - ], - "signature": "let clamp: (~min: int=?, ~max: int=?, int) => int" - } - ] - }, - "core/float": { - "id": "Core.Float", - "name": "Float", - "docstrings": [ - "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", - "name": "equal", - "docstrings": [], - "signature": "let equal: (float, float) => bool" - }, - { - "id": "Core.Float.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (float, float) => Ordering.t" - }, - { - "id": "Core.Float.isNaN", - "kind": "value", - "name": "isNaN", - "docstrings": [ - "`isNaN(v)` tests if the given `v` is `NaN`.\nSee [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n## Examples\n\n```rescript\nFloat.isNaN(3.0) // false\nFloat.isNaN(Float.Constants.nan) // true\n```" - ], - "signature": "let isNaN: float => bool" - }, - { - "id": "Core.Float.isFinite", - "kind": "value", - "name": "isFinite", - "docstrings": [ - "`isFinite(v)` tests if the given `v` is finite.\nSee [`isFinite`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite) on MDN.\n\n## Examples\n\n```rescript\nFloat.isFinite(1.0) // true\nFloat.isFinite(Float.Constants.nan) // false\nFloat.isFinite(Float.Constants.positiveInfinity) // false\n```" - ], - "signature": "let isFinite: float => bool" - }, - { - "id": "Core.Float.parseFloat", - "kind": "value", - "name": "parseFloat", - "docstrings": [ - "`parseFloat(v)` parse the given `v` and returns a float. Leading whitespace in\n`v` is ignored. Returns `NaN` if `v` can't be parsed. Use [`fromString`] to\nensure it returns a valid float and not `NaN`.\nSee [`parseFloat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseFloat(\"1.0\") // 1.0\nFloat.parseFloat(\" 3.14 \") // 3.14\nFloat.parseFloat(\"3.0\") // 3.0\nFloat.parseFloat(\"3.14some non-digit characters\") // 3.14\nFloat.parseFloat(\"error\")->Float.isNaN // true\n```" - ], - "signature": "let parseFloat: string => float" - }, - { - "id": "Core.Float.parseInt", - "kind": "value", - "name": "parseInt", - "docstrings": [ - "`parseInt(v, ~radix=?)` parse the given `v` and returns a float. Leading\nwhitespace in this argument `v`is ignored. `radix` specifies the radix base to\nuse for the formatted number. The value must be in the range [2, 36] (inclusive).\nReturns `NaN` if `v` can't be parsed and `radix` is smaller than 2 or bigger\nthan 36.\nSee [`parseInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseInt(\"1.0\") // 1.0\nFloat.parseInt(\" 3.14 \") // 3.0\nFloat.parseInt(3) // 3.0\nFloat.parseInt(\"3.14some non-digit characters\") // 3.0\nFloat.parseInt(\"error\")->Float.isNaN // true\nFloat.parseInt(\"10.0\", ~radix=2) // 2.0\nFloat.parseInt(\"15 * 3\", ~radix=10) // 15.0\nFloat.parseInt(\"12\", ~radix=13) // 15.0\nFloat.parseInt(\"17\", ~radix=40)->Float.isNaN // true\n```" - ], - "signature": "let parseInt: ('a, ~radix: int=?) => float" - }, - { - "id": "Core.Float.parseIntWithRadix", - "kind": "value", - "name": "parseIntWithRadix", - "docstrings": [ - "`parseIntWithRadix(v, ~radix)` parse the given `v` and returns a float. Leading\nwhitespace in this argument `v`is ignored. `radix` specifies the radix base to\nuse for the formatted number. The value must be in the range [2, 36] (inclusive).\nReturns `NaN` if `v` can't be parsed and `radix` is smaller than 2 or bigger\nthan 36.\nSee [`parseInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) on MDN.\n\n## Examples\n\n```rescript\nFloat.parseIntWithRadix(\"10.0\", ~radix=2) // 2.0\nFloat.parseIntWithRadix(\"15 * 3\", ~radix=10) // 15.0\nFloat.parseIntWithRadix(\"12\", ~radix=13) // 15.0\nFloat.parseIntWithRadix(\"17\", ~radix=40)->Float.isNaN // true\n```" - ], - "signature": "let parseIntWithRadix: ('a, ~radix: int) => float", - "deprecated": "Use `parseInt` instead" - }, - { - "id": "Core.Float.toExponential", - "kind": "value", - "name": "toExponential", - "docstrings": [ - "`toExponential(v, ~digits=?)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point.\nSee [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) on MDN.\n\n## Examples\n\n```rescript\nFloat.toExponential(1000.0) // \"1e+3\"\nFloat.toExponential(-1000.0) // \"-1e+3\"\nFloat.toExponential(77.0, ~digits=2) // \"7.70e+1\"\nFloat.toExponential(5678.0, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." - ], - "signature": "let toExponential: (float, ~digits: int=?) => string" - }, - { - "id": "Core.Float.toExponentialWithPrecision", - "kind": "value", - "name": "toExponentialWithPrecision", - "docstrings": [ - "`toExponential(v, ~digits)` return a `string` representing the given value in\nexponential notation. `digits` specifies how many digits should appear after\nthe decimal point.\nSee [`Number.toExponential`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) on MDN.\n\n## Examples\n\n```rescript\nFloat.toExponentialWithPrecision(77.0, ~digits=2) // \"7.70e+1\"\nFloat.toExponentialWithPrecision(5678.0, ~digits=2) // \"5.68e+3\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` less than 0 or greater than 10." - ], - "signature": "let toExponentialWithPrecision: (float, ~digits: int) => string", - "deprecated": "Use `toExponential` instead" - }, - { - "id": "Core.Float.toFixed", - "kind": "value", - "name": "toFixed", - "docstrings": [ - "`toFixed(v, ~digits=?)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point.\nSee [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) on MDN.\n\n## Examples\n\n```rescript\nFloat.toFixed(123456.0) // \"123456.00\"\nFloat.toFixed(10.0) // \"10.00\"\nFloat.toFixed(300.0, ~digits=4) // \"300.0000\"\nFloat.toFixed(300.0, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." - ], - "signature": "let toFixed: (float, ~digits: int=?) => string" - }, - { - "id": "Core.Float.toFixedWithPrecision", - "kind": "value", - "name": "toFixedWithPrecision", - "docstrings": [ - "`toFixedWithPrecision(v, ~digits)` return a `string` representing the given\nvalue using fixed-point notation. `digits` specifies how many digits should\nappear after the decimal point.\nSee [`Number.toFixed`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) on MDN.\n\n## Examples\n\n```rescript\nFloat.toFixedWithPrecision(300.0, ~digits=4) // \"300.0000\"\nFloat.toFixedWithPrecision(300.0, ~digits=1) // \"300.0\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is less than 0 or larger than 100." - ], - "signature": "let toFixedWithPrecision: (float, ~digits: int) => string", - "deprecated": "Use `toFixed` instead" - }, - { - "id": "Core.Float.toPrecision", - "kind": "value", - "name": "toPrecision", - "docstrings": [ - "`toPrecision(v, ~digits=?)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits.\nSee [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nFloat.toPrecision(100.0) // \"100\"\nFloat.toPrecision(1.0) // \"1\"\nFloat.toPrecision(100.0, ~digits=2) // \"1.0e+2\"\nFloat.toPrecision(1.0, ~digits=1) // \"1\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." - ], - "signature": "let toPrecision: (float, ~digits: int=?) => string" - }, - { - "id": "Core.Float.toPrecisionWithPrecision", - "kind": "value", - "name": "toPrecisionWithPrecision", - "docstrings": [ - "`toPrecisionWithPrecision(v, ~digits)` return a `string` representing the giver value with\nprecision. `digits` specifies the number of significant digits.\nSee [`Number.toPrecision`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision) on MDN.\n\n## Examples\n\n```rescript\nFloat.toPrecisionWithPrecision(100.0, ~digits=2) // \"1.0e+2\"\nFloat.toPrecisionWithPrecision(1.0, ~digits=1) // \"1\"\n```\n\n## Exceptions\n\n- `RangeError`: If `digits` is not between 1 and 100 (inclusive).\nImplementations are allowed to support larger and smaller values as well.\nECMA-262 only requires a precision of up to 21 significant digits." - ], - "signature": "let toPrecisionWithPrecision: (float, ~digits: int) => string", - "deprecated": "Use `toPrecision` instead" - }, - { - "id": "Core.Float.toString", - "kind": "value", - "name": "toString", - "docstrings": [ - "`toString(v)` return a `string` representing the given value.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\nFloat.toString(1000.0) // \"1000\"\nFloat.toString(-1000.0) // \"-1000\"\n```" - ], - "signature": "let toString: (float, ~radix: int=?) => string" - }, - { - "id": "Core.Float.toStringWithRadix", - "kind": "value", - "name": "toStringWithRadix", - "docstrings": [ - "`toStringWithRadix(v, ~radix)` return a `string` representing the given value.\n`~radix` specifies the radix base to use for the formatted number.\nSee [`Number.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN.\n\n## Examples\n\n```rescript\nFloat.toStringWithRadix(6.0, ~radix=2) // \"110\"\nFloat.toStringWithRadix(3735928559.0, ~radix=16) // \"deadbeef\"\nFloat.toStringWithRadix(123456.0, ~radix=36) // \"2n9c\"\n```\n\n## Exceptions\n\n`RangeError`: if `radix` is less than 2 or greater than 36." - ], - "signature": "let toStringWithRadix: (float, ~radix: int) => string", - "deprecated": "Use `toString` with `~radix` instead" - }, - { - "id": "Core.Float.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [ - "`toLocaleString(v)` return a `string` with language-sensitive representing the\ngiven value.\nSee [`Number.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString) on MDN.\n\n## Examples\n\n```rescript\n// If the application uses English as the default language\nFloat.toLocaleString(1000.0) // \"1,000\"\n\n// If the application uses Portuguese Brazil as the default language\nFloat.toLocaleString(1000.0) // \"1.000\"\n```" - ], - "signature": "let toLocaleString: float => string" - }, - { - "id": "Core.Float.fromString", - "kind": "value", - "name": "fromString", - "docstrings": [ - "`fromString(str)` return an `option` representing the given value `str`.\n\n## Examples\n\n```rescript\nFloat.fromString(\"0\") == Some(0.0)\nFloat.fromString(\"NaN\") == None\nFloat.fromString(\"6\") == Some(6.0)\n```" - ], - "signature": "let fromString: string => option" - }, - { - "id": "Core.Float.toInt", - "kind": "value", - "name": "toInt", - "docstrings": [ - "`toInt(v)` returns an int to given float `v`.\n\n## Examples\n\n```rescript\nFloat.toInt(2.0) == 2\nFloat.toInt(1.0) == 1\nFloat.toInt(1.1) == 1\nFloat.toInt(1.6) == 1\n```" - ], - "signature": "let toInt: float => int" - }, - { - "id": "Core.Float.fromInt", - "kind": "value", - "name": "fromInt", - "docstrings": [ - "`fromInt(v)` returns a float to given int `v`.\n\n## Examples\n\n```rescript\nFloat.fromInt(2) == 2.0\nFloat.fromInt(1) == 1.0\n```" - ], - "signature": "let fromInt: int => float" - }, - { - "id": "Core.Float.mod", - "kind": "value", - "name": "mod", - "docstrings": [ - "`mod(n1, n2)` calculates the modulo (remainder after division) of two floats.\n\n## Examples\n\n```rescript\nFloat.mod(7.0, 4.0) == 3.0\n```" - ], - "signature": "let mod: (float, float) => float" - }, - { - "id": "Core.Float.clamp", - "kind": "value", - "name": "clamp", - "docstrings": [ - "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nFloat.clamp(4.2) == 4.2\nFloat.clamp(4.2, ~min=4.3) == 4.3\nFloat.clamp(4.2, ~max=4.1) == 4.1\nFloat.clamp(4.2, ~min=4.3, ~max=4.1) == 4.3\n```" - ], - "signature": "let clamp: (~min: float=?, ~max: float=?, float) => float" - } - ] - }, - "core/error": { - "id": "Core.Error", - "name": "Error", - "docstrings": [ - "Functions for working with JavaScript exceptions.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) on MDN." - ], - "items": [ - { - "id": "Core.Error.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Represents a JavaScript exception." - ], - "signature": "type t = Exn.t" - }, - { - "id": "Core.Error.fromException", - "kind": "value", - "name": "fromException", - "docstrings": [], - "signature": "let fromException: exn => option" - }, - { - "id": "Core.Error.toException", - "kind": "value", - "name": "toException", - "docstrings": [ - "Turns an `Error.t` into an `exn`.\n\n## Examples\n```rescript\nlet error = Error.make(\"Something went wrong.\")\n\nlet asExn = error->Error.toException // `asExn` is now type `exn`\n```" - ], - "signature": "let toException: t => exn" - }, - { - "id": "Core.Error.stack", - "kind": "value", - "name": "stack", - "docstrings": [ - "`stack(error)` retrieves the `stack` property of the error, if it exists. The stack is a list of what functions were called, and what files they are defined in, prior to the error happening.\n\nSee [`Error.prototype.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"error\")\nConsole.log(error->Error.stack) // Logs `stack` if it exists on `someError`\n```" - ], - "signature": "let stack: t => option" - }, - { - "id": "Core.Error.message", - "kind": "value", - "name": "message", - "docstrings": [ - "`message(error)` retrieves the `message` property of the error, if it exists.\n\nSee [`Error.prototype.message`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\n```" - ], - "signature": "let message: t => option" - }, - { - "id": "Core.Error.name", - "kind": "value", - "name": "name", - "docstrings": [ - "`name(error)` retrieves the `name` property of the error, if it exists.\n\nSee [`Error.prototype.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.name) // Logs \"SyntaxError\" to the console\n```" - ], - "signature": "let name: t => option" - }, - { - "id": "Core.Error.fileName", - "kind": "value", - "name": "fileName", - "docstrings": [ - "`fileName(error)` retrieves the `fileName` property of the error, if it exists.\n\nSee [`Error.prototype.fileName`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName) on MDN." - ], - "signature": "let fileName: t => option" - }, - { - "id": "Core.Error.make", - "kind": "value", - "name": "make", - "docstrings": [ - "`make(message)` creates a new error, setting its `message` to the provided value.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\nConsole.log(error->Error.name) // Logs \"Error\" to the console, because this is a regular error\n```" - ], - "signature": "let make: string => t" - }, - { - "id": "Core.Error.raise", - "kind": "value", - "name": "raise", - "docstrings": [ - "Raises (throws in JavaScript language) the provided `Error.t`, which will stop execution.\n\n## Examples\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->Error.raise\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```" - ], - "signature": "let raise: t => 'a" - }, - { - "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": "raiseUriError", - "docstrings": [], - "signature": "let raiseUriError: string => 'a" - } - ] - }, - "core/dict": { - "id": "Core.Dict", - "name": "Dict", - "docstrings": [ - "A mutable dictionary with string keys.\n\nCompiles to a regular JavaScript object." - ], - "items": [ - { - "id": "Core.Dict.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Type representing a dictionary of value `'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{\"key1\": \"value1\", \"key2\": \"value2\"}\nlet value = dict->Dict.getUnsafe(\"key1\")\nConsole.log(value) // value1\n```" - ], - "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{\"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: (dict<'a>, string) => option<'a>" - }, - { - "id": "Core.Dict.set", - "kind": "value", - "name": "set", - "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: (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{\"someKey\": \"someValue\"}\n\ndict->Dict.delete(\"someKey\")\n```" - ], - "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 = 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 => dict<'a>" - }, - { - "id": "Core.Dict.fromArray", - "kind": "value", - "name": "fromArray", - "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)> => 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\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: Iterator.t<(string, 'a)> => dict<'a>" - }, - { - "id": "Core.Dict.toArray", - "kind": "value", - "name": "toArray", - "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: dict<'a> => array<(string, 'a)>" - }, - { - "id": "Core.Dict.keysToArray", - "kind": "value", - "name": "keysToArray", - "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: dict<'a> => array" - }, - { - "id": "Core.Dict.valuesToArray", - "kind": "value", - "name": "valuesToArray", - "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: dict<'a> => array<'a>" - }, - { - "id": "Core.Dict.assign", - "kind": "value", - "name": "assign", - "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: (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{\"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: 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{\"key1\": \"value1\", \"key2\": \"value2\"}\n\ndict->Dict.forEach(value => {\n Console.log(value)\n})\n```" - ], - "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{\"key1\": \"value1\", \"key2\": \"value2\"}\n\ndict->Dict.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" - ], - "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{\"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 has: (dict<'a>, string) => bool" - } - ] - }, - "core/date": { - "id": "Core.Date", - "name": "Date", - "docstrings": [ - "Functions for interacting with JavaScript Dates." - ], - "items": [ - { - "id": "Core.Date.t", - "kind": "type", - "name": "t", - "docstrings": [ - "A type representing a JavaScript date." - ], - "signature": "type t" - }, - { - "id": "Core.Date.msSinceEpoch", - "kind": "type", - "name": "msSinceEpoch", - "docstrings": [ - "Time, in milliseconds, since / until the UNIX epoch (January 1, 1970 00:00:00 UTC).\nPositive numbers represent dates after, negative numbers dates before epoch." - ], - "signature": "type msSinceEpoch = float" - }, - { - "id": "Core.Date.localeOptions", - "kind": "type", - "name": "localeOptions", - "docstrings": [ - "A type representing date time format options.\n\nNote: There are some properties missing:\n- fractionalSecondDigits\n- dayPeriod\n- calendar\n- numberingSystem\n- localeMatcher\n- timeZone\n- hour12\n- hourCycle\n- formatMatcher\n\nSee full spec at https://tc39.es/ecma402/#datetimeformat-objects" - ], - "signature": "type localeOptions = {\n dateStyle?: [#full | #long | #medium | #short],\n timeStyle?: [#full | #long | #medium | #short],\n weekday?: [#long | #narrow | #short],\n era?: [#long | #narrow | #short],\n year?: [#\"2-digit\" | #numeric],\n month?: [\n | #\"2-digit\"\n | #long\n | #narrow\n | #numeric\n | #short\n ],\n day?: [#\"2-digit\" | #numeric],\n hour?: [#\"2-digit\" | #numeric],\n minute?: [#\"2-digit\" | #numeric],\n second?: [#\"2-digit\" | #numeric],\n timeZoneName?: [#long | #short],\n}" - }, - { - "id": "Core.Date.make", - "kind": "value", - "name": "make", - "docstrings": [ - "`make()`\n\nCreates a date object with the current date time as value.\n\n## Examples\n```rescript\nDate.make()\n```" - ], - "signature": "let make: unit => t" - }, - { - "id": "Core.Date.fromString", - "kind": "value", - "name": "fromString", - "docstrings": [ - "`fromString(dateTimeString)`\n\nCreates a date object from given date time string.\nThe string has to be in the ISO 8601 format YYYY-MM-DDTHH:mm:ss.sssZ (https://tc39.es/ecma262/#sec-date-time-string-format).\n\nInvalid date time strings will create invalid dates.\nYou can use the result like any valid date, but many functions like `toString` will return \"Invalid Date\" or functions like `Date.getTime` will return NaN.\n\n## Examples\n```rescript\nDate.fromString(\"2023\") // 2023-01-01T00:00:00.000Z\n\nDate.fromString(\"2023-02-20\") // 2023-02-20T00:00:00.000Z\n\nDate.fromString(\"2023-02-20T16:40:00.00Z\") // 2023-02-20T16:40:00.000Z\n\nDate.fromString(\"\") // Invalid Date\n\nDate.fromString(\"\")->Date.getTime // NaN\n```" - ], - "signature": "let fromString: string => t" - }, - { - "id": "Core.Date.fromTime", - "kind": "value", - "name": "fromTime", - "docstrings": [ - "`fromTime(msSinceEpoch)`\n\nCreates a date object from the given time in milliseconds since / until UNIX epoch (January 1, 1970 00:00:00 UTC).\nPositive numbers create dates after epoch, negative numbers create dates before epoch.\n\n## Examples\n```rescript\nDate.fromTime(0.0)\n// 1970-01-01T00:00:00.000Z\n\nDate.fromTime(-86_400_000.0)\n// 1969-12-31T00:00:00.000Z\n\nDate.fromTime(86_400_000.0)\n// 1970-01-02T00:00:00.000Z\n```" - ], - "signature": "let fromTime: msSinceEpoch => t" - }, - { - "id": "Core.Date.makeWithYM", - "kind": "value", - "name": "makeWithYM", - "docstrings": [ - "Creates a date object with the given year and 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.makeWithYM(~year=2023, ~month=0)\n// 2023-01-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=11)\n// 2023-12-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=12)\n// 2024-01-01T00:00:00.000Z\n\nDate.makeWithYM(~year=2023, ~month=-1)\n// 2022-12-01T00: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 makeWithYM: (~year: int, ~month: int) => t" - }, - { - "id": "Core.Date.makeWithYMD", - "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, ~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, ~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, ~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, ~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, ~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 ~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, ~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 ~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, ~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 ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => t" - }, - { - "id": "Core.Date.now", - "kind": "value", - "name": "now", - "docstrings": [ - "`now()`\n\nReturns the time, in milliseconds, between UNIX epoch (January 1, 1970 00:00:00 UTC) and the current date time." - ], - "signature": "let now: unit => msSinceEpoch" - }, - { - "id": "Core.Date.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t, t) => bool" - }, - { - "id": "Core.Date.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (t, t) => Ordering.t" - }, - { - "id": "Core.Date.getTime", - "kind": "value", - "name": "getTime", - "docstrings": [ - "`getTime(date)`\n\nReturns the time, in milliseconds, between UNIX epoch (January 1, 1970 00:00:00 UTC) and the current date time.\nInvalid dates will return NaN.\nDates before epoch will return negative numbers.\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20\")->Date.getTime\n// 1676851200000\n```" - ], - "signature": "let getTime: t => msSinceEpoch" - }, - { - "id": "Core.Date.getTimezoneOffset", - "kind": "value", - "name": "getTimezoneOffset", - "docstrings": [ - "`getTimezoneOffset(date)`\n\nReturns the time in minutes between the UTC time and the locale time.\nThe timezone of the given date doesn't matter.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01\")->Date.getTimezoneOffset\n// -60 with local time zone = Europe/Berlin\n\nDate.fromString(\"2023-06-01\")->Date.getTimezoneOffset\n// -120 with local time zone = Europe/Berlin\n```" - ], - "signature": "let getTimezoneOffset: t => int" - }, - { - "id": "Core.Date.getFullYear", - "kind": "value", - "name": "getFullYear", - "docstrings": [ - "`getFullYear(date)`\n\nReturns the year of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20\")->Date.getFullYear\n// 2023\n```" - ], - "signature": "let getFullYear: t => int" - }, - { - "id": "Core.Date.getMonth", - "kind": "value", - "name": "getMonth", - "docstrings": [ - "`getMonth(date)`\n\nReturns the month (0-indexed) of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01\")->Date.getMonth\n// 0\n```" - ], - "signature": "let getMonth: t => int" - }, - { - "id": "Core.Date.getDate", - "kind": "value", - "name": "getDate", - "docstrings": [ - "`getDate(date)`\n\nReturns the date (day of month) of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getDate\n// 20\n```" - ], - "signature": "let getDate: t => int" - }, - { - "id": "Core.Date.getHours", - "kind": "value", - "name": "getHours", - "docstrings": [ - "`getHours(date)`\n\nReturns the hours of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getHours\n// 16\n```" - ], - "signature": "let getHours: t => int" - }, - { - "id": "Core.Date.getMinutes", - "kind": "value", - "name": "getMinutes", - "docstrings": [ - "`getMinutes(date)`\n\nReturns the minutes of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getMinutes\n// 40\n```" - ], - "signature": "let getMinutes: t => int" - }, - { - "id": "Core.Date.getSeconds", - "kind": "value", - "name": "getSeconds", - "docstrings": [ - "`getSeconds(date)`\n\nReturns the seconds of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getSeconds\n// 0\n```" - ], - "signature": "let getSeconds: t => int" - }, - { - "id": "Core.Date.getMilliseconds", - "kind": "value", - "name": "getMilliseconds", - "docstrings": [ - "`getMilliseconds(date)`\n\nReturns the milliseconds of a given date (according to local time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getMilliseconds\n// 0\n```" - ], - "signature": "let getMilliseconds: t => int" - }, - { - "id": "Core.Date.getDay", - "kind": "value", - "name": "getDay", - "docstrings": [ - "`getDay(date)`\n\nReturns the day of week of a given date (according to local time).\n0 = Sunday, 1 = Monday, ... 6 = Saturday\n\n## Examples\n```rescript\nDate.fromString(\"2023-02-20T16:40:00.00\")->Date.getDay\n// 1\n```" - ], - "signature": "let getDay: t => int" - }, - { - "id": "Core.Date.setFullYear", - "kind": "value", - "name": "setFullYear", - "docstrings": [ - "`setFullYear(date, year)`\n\nSets the year 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.setFullYear(2024)\n```" - ], - "signature": "let setFullYear: (t, int) => unit" - }, - { - "id": "Core.Date.setFullYearM", - "kind": "value", - "name": "setFullYearM", - "docstrings": [ - "`setFullYearM(date, ~year, ~month)`\n\nSets the year and 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.setFullYearM(~year=2024, ~month=0)\n```" - ], - "signature": "let setFullYearM: (t, ~year: int, ~month: int) => unit" - }, - { - "id": "Core.Date.setFullYearMD", - "kind": "value", - "name": "setFullYearMD", - "docstrings": [ - "`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, ~day: int) => unit" - }, - { - "id": "Core.Date.setMonth", - "kind": "value", - "name": "setMonth", - "docstrings": [ - "`setMonth(date, month)`\n\nSets the 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.setMonth(0)\n```" - ], - "signature": "let setMonth: (t, int) => unit" - }, - { - "id": "Core.Date.setDate", - "kind": "value", - "name": "setDate", - "docstrings": [ - "`setDate(date, day)`\n\nSets the 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.setDate(1)\n```" - ], - "signature": "let setDate: (t, int) => unit" - }, - { - "id": "Core.Date.setHours", - "kind": "value", - "name": "setHours", - "docstrings": [ - "`setHours(date, hours)`\n\nSets the hours 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.setHours(0)\n```" - ], - "signature": "let setHours: (t, int) => unit" - }, - { - "id": "Core.Date.setHoursM", - "kind": "value", - "name": "setHoursM", - "docstrings": [ - "`setHoursM(date, ~hours, ~minutes)`\n\nSets the hours and minutes 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.setHoursM(~hours=0, ~minutes=0)\n```" - ], - "signature": "let setHoursM: (t, ~hours: int, ~minutes: int) => unit" - }, - { - "id": "Core.Date.setHoursMS", - "kind": "value", - "name": "setHoursMS", - "docstrings": [ - "`setHoursMS(date, ~hours, ~minutes, ~seconds)`\n\nSets the hours, minutes and seconds 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.setHoursMS(~hours=0, ~minutes=0, ~seconds=0)\n```" - ], - "signature": "let setHoursMS: (t, ~hours: int, ~minutes: int, ~seconds: int) => unit" - }, - { - "id": "Core.Date.setHoursMSMs", - "kind": "value", - "name": "setHoursMSMs", - "docstrings": [ - "`setHoursMSMs(date, ~hours, ~minutes, ~seconds, ~milliseconds)`\n\nSets the hours, minutes, seconds and milliseconds 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.setHoursMSMs(~hours=0, ~minutes=0, ~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setHoursMSMs: (\n t,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" - }, - { - "id": "Core.Date.setMinutes", - "kind": "value", - "name": "setMinutes", - "docstrings": [ - "`setMinutes(date, minutes)`\n\nSets the minutes 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.setMinutes(0)\n```" - ], - "signature": "let setMinutes: (t, int) => unit" - }, - { - "id": "Core.Date.setMinutesS", - "kind": "value", - "name": "setMinutesS", - "docstrings": [ - "`setMinutesS(date, ~minutes, ~seconds)`\n\nSets the minutes and seconds 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.setMinutesS(~minutes=0, ~seconds=0)\n```" - ], - "signature": "let setMinutesS: (t, ~minutes: int, ~seconds: int) => unit" - }, - { - "id": "Core.Date.setMinutesSMs", - "kind": "value", - "name": "setMinutesSMs", - "docstrings": [ - "`setMinutesSMs(date, ~minutes, ~seconds, ~milliseconds)`\n\nSets the minutes, seconds and milliseconds 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.setMinutesSMs(~minutes=0, ~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setMinutesSMs: (\n t,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" - }, - { - "id": "Core.Date.setSeconds", - "kind": "value", - "name": "setSeconds", - "docstrings": [ - "`setSeconds(date, seconds)`\n\nSets the seconds 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.setSeconds(0)\n```" - ], - "signature": "let setSeconds: (t, int) => unit" - }, - { - "id": "Core.Date.setSecondsMs", - "kind": "value", - "name": "setSecondsMs", - "docstrings": [ - "`setSecondsMs(date, ~seconds, ~milliseconds)`\n\nSets the seconds and milliseconds 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.setSecondsMs(~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setSecondsMs: (t, ~seconds: int, ~milliseconds: int) => unit" - }, - { - "id": "Core.Date.setMilliseconds", - "kind": "value", - "name": "setMilliseconds", - "docstrings": [ - "`setMilliseconds(date, milliseconds)`\n\nSets the milliseconds 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.setMilliseconds(0)\n```" - ], - "signature": "let setMilliseconds: (t, int) => unit" - }, - { - "id": "Core.Date.getUTCFullYear", - "kind": "value", - "name": "getUTCFullYear", - "docstrings": [ - "`getUTCFullYear(date)`\n\nReturns the year of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCFullYear // 2022\n```" - ], - "signature": "let getUTCFullYear: t => int" - }, - { - "id": "Core.Date.getUTCMonth", - "kind": "value", - "name": "getUTCMonth", - "docstrings": [ - "`getUTCMonth(date)`\n\nReturns the month of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMonth // 11\n```" - ], - "signature": "let getUTCMonth: t => int" - }, - { - "id": "Core.Date.getUTCDate", - "kind": "value", - "name": "getUTCDate", - "docstrings": [ - "`getUTCDate(date)`\n\nReturns the date (day of month) of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCDate // 31\n```" - ], - "signature": "let getUTCDate: t => int" - }, - { - "id": "Core.Date.getUTCHours", - "kind": "value", - "name": "getUTCHours", - "docstrings": [ - "`getUTCHours(date)`\n\nReturns the hours of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCHours // 23\n```" - ], - "signature": "let getUTCHours: t => int" - }, - { - "id": "Core.Date.getUTCMinutes", - "kind": "value", - "name": "getUTCMinutes", - "docstrings": [ - "`getUTCMinutes(date)`\n\nReturns the minutes of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMinutes // 0\n```" - ], - "signature": "let getUTCMinutes: t => int" - }, - { - "id": "Core.Date.getUTCSeconds", - "kind": "value", - "name": "getUTCSeconds", - "docstrings": [ - "`getUTCSeconds(date)`\n\nReturns the seconds of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCSeconds // 0\n```" - ], - "signature": "let getUTCSeconds: t => int" - }, - { - "id": "Core.Date.getUTCMilliseconds", - "kind": "value", - "name": "getUTCMilliseconds", - "docstrings": [ - "`getUTCMilliseconds(date)`\n\nReturns the milliseconds of a given date (according to UTC time).\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCMilliseconds // 0\n```" - ], - "signature": "let getUTCMilliseconds: t => int" - }, - { - "id": "Core.Date.getUTCDay", - "kind": "value", - "name": "getUTCDay", - "docstrings": [ - "`getUTCDay(date)`\n\nReturns the day (day of week) of a given date (according to UTC time).\n0 = Sunday, 1 = Monday, ... 6 = Saturday\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.getUTCDay // 6\n```" - ], - "signature": "let getUTCDay: t => int" - }, - { - "id": "Core.Date.setUTCFullYear", - "kind": "value", - "name": "setUTCFullYear", - "docstrings": [ - "`setUTCFullYear(date, year)`\n\nSets the year 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.setUTCFullYear(2024)\n```" - ], - "signature": "let setUTCFullYear: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCFullYearM", - "kind": "value", - "name": "setUTCFullYearM", - "docstrings": [ - "`setUTCFullYearM(date, ~year, ~month)`\n\nSets the year and 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.setUTCFullYearM(~year=2024, ~month=0)\n```" - ], - "signature": "let setUTCFullYearM: (t, ~year: int, ~month: int) => unit" - }, - { - "id": "Core.Date.setUTCFullYearMD", - "kind": "value", - "name": "setUTCFullYearMD", - "docstrings": [ - "`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, ~day: int) => unit" - }, - { - "id": "Core.Date.setUTCMonth", - "kind": "value", - "name": "setUTCMonth", - "docstrings": [ - "`setUTCMonth(date, month)`\n\nSets the 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.setUTCMonth(0)\n```" - ], - "signature": "let setUTCMonth: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCDate", - "kind": "value", - "name": "setUTCDate", - "docstrings": [ - "`setDate(date, day)`\n\nSets the 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.setUTCDate(1)\n```" - ], - "signature": "let setUTCDate: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCHours", - "kind": "value", - "name": "setUTCHours", - "docstrings": [ - "`setUTCHours(date, hours)`\n\nSets the hours 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.setUTCHours(0)\n```" - ], - "signature": "let setUTCHours: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCHoursM", - "kind": "value", - "name": "setUTCHoursM", - "docstrings": [ - "`setHoursM(date, ~hours, ~minutes)`\n\nSets the hours and minutes 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.setUTCHoursM(~hours=0, ~minutes=0)\n```" - ], - "signature": "let setUTCHoursM: (t, ~hours: int, ~minutes: int) => unit" - }, - { - "id": "Core.Date.setUTCHoursMS", - "kind": "value", - "name": "setUTCHoursMS", - "docstrings": [ - "`setUTCHoursMS(date, ~hours, ~minutes, ~seconds)`\n\nSets the hours, minutes and seconds 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.setUTCHoursMS(~hours=0, ~minutes=0, ~seconds=0)\n```" - ], - "signature": "let setUTCHoursMS: (t, ~hours: int, ~minutes: int, ~seconds: int) => unit" - }, - { - "id": "Core.Date.setUTCHoursMSMs", - "kind": "value", - "name": "setUTCHoursMSMs", - "docstrings": [ - "`setUTCHoursMSMs(date, ~hours, ~minutes, ~seconds, ~milliseconds)`\n\nSets the hours, minutes, seconds and milliseconds 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.setUTCHoursMSMs(~hours=0, ~minutes=0, ~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setUTCHoursMSMs: (\n t,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" - }, - { - "id": "Core.Date.setUTCMinutes", - "kind": "value", - "name": "setUTCMinutes", - "docstrings": [ - "`setUTCMinutes(date, minutes)`\n\nSets the minutes 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.setUTCMinutes(0)\n```" - ], - "signature": "let setUTCMinutes: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCMinutesS", - "kind": "value", - "name": "setUTCMinutesS", - "docstrings": [ - "`setUTCMinutesS(date, ~minutes, ~seconds)`\n\nSets the minutes and seconds 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.setUTCMinutesS(~minutes=0, ~seconds=0)\n```" - ], - "signature": "let setUTCMinutesS: (t, ~minutes: int, ~seconds: int) => unit" - }, - { - "id": "Core.Date.setUTCMinutesSMs", - "kind": "value", - "name": "setUTCMinutesSMs", - "docstrings": [ - "`setUTCMinutesSMs(date, ~minutes, ~seconds, ~milliseconds)`\n\nSets the minutes, seconds and milliseconds 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.setUTCMinutesSMs(~minutes=0, ~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setUTCMinutesSMs: (\n t,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => unit" - }, - { - "id": "Core.Date.setUTCSeconds", - "kind": "value", - "name": "setUTCSeconds", - "docstrings": [ - "`setUTCSeconds(date, seconds)`\n\nSets the seconds 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.setUTCSeconds(0)\n```" - ], - "signature": "let setUTCSeconds: (t, int) => unit" - }, - { - "id": "Core.Date.setUTCSecondsMs", - "kind": "value", - "name": "setUTCSecondsMs", - "docstrings": [ - "`setUTCSecondsMs(date, ~seconds, ~milliseconds)`\n\nSets the seconds and milliseconds 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.setUTCSecondsMs(~seconds=0, ~milliseconds=0)\n```" - ], - "signature": "let setUTCSecondsMs: (t, ~seconds: int, ~milliseconds: int) => unit" - }, - { - "id": "Core.Date.setUTCMilliseconds", - "kind": "value", - "name": "setUTCMilliseconds", - "docstrings": [ - "`setUTCMilliseconds(date, milliseconds)`\n\nSets the milliseconds 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.setUTCMilliseconds(0)\n```" - ], - "signature": "let setUTCMilliseconds: (t, int) => unit" - }, - { - "id": "Core.Date.toDateString", - "kind": "value", - "name": "toDateString", - "docstrings": [ - "`toDateString(date)`\n\nConverts a JavaScript date to a standard date string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleDateString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toDateString->Console.log\n// Sun Jan 01 2023\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toDateString->Console.log\n// Sat Dec 31 2022\n```" - ], - "signature": "let toDateString: t => string" - }, - { - "id": "Core.Date.toString", - "kind": "value", - "name": "toString", - "docstrings": [ - "`toString(date)`\n\nConverts a JavaScript date to a standard date time string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toString->Console.log\n// Sun Jan 01 2023 00:00:00 GMT+0100 (Central European Standard Time)\n\nDate.fromString(\"2023-06-01T00:00:00.00+01:00\")->Date.toString->Console.log\n// Thu Jun 01 2023 01:00:00 GMT+0200 (Central European Summer Time)\n```" - ], - "signature": "let toString: t => string" - }, - { - "id": "Core.Date.toTimeString", - "kind": "value", - "name": "toTimeString", - "docstrings": [ - "`toTimeString(date)`\n\nConverts a JavaScript date to a standard time string. The date will be mapped to the current time zone.\nIf you want to convert it to a localized string, use `Date.toLocaleStimeString` instead.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+01:00\")->Date.toTimeString->Console.log\n// 00:00:00 GMT+0100 (Central European Standard Time)\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toTimeString->Console.log\n// 17:00:00 GMT+0100 (Central European Standard Time)\n```" - ], - "signature": "let toTimeString: t => string" - }, - { - "id": "Core.Date.toLocaleDateString", - "kind": "value", - "name": "toLocaleDateString", - "docstrings": [ - "`toLocaleDateString(date)`\n\nConverts a JavaScript date to a localized date string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateString->Console.log\n// 2/19/2023\n```" - ], - "signature": "let toLocaleDateString: t => string" - }, - { - "id": "Core.Date.toLocaleDateStringWithLocale", - "kind": "value", - "name": "toLocaleDateStringWithLocale", - "docstrings": [ - "`toLocaleDateStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized date string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateStringWithLocale(\"en-US\")->Console.log\n// 2/19/2023\n```" - ], - "signature": "let toLocaleDateStringWithLocale: (t, string) => string" - }, - { - "id": "Core.Date.toLocaleDateStringWithLocaleAndOptions", - "kind": "value", - "name": "toLocaleDateStringWithLocaleAndOptions", - "docstrings": [ - "`toLocaleDateStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized date string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"en-US\", { dateStyle: #long })->Console.log\n// February 19, 2023\n\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"de\", { hour: #\"2-digit\", minute: #\"2-digit\" })->Console.log\n// 19.2.2023, 15:40\n\nDate.make()->Date.toLocaleDateStringWithLocaleAndOptions(\"de\", { year: #numeric })->Console.log\n// 2023\n```" - ], - "signature": "let toLocaleDateStringWithLocaleAndOptions: (t, string, localeOptions) => string" - }, - { - "id": "Core.Date.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [ - "`toLocaleString(date)`\n\nConverts a JavaScript date to a localized date-time string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleString->Console.log\n// 2/19/2023, 3:40:00 PM\n```" - ], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Core.Date.toLocaleStringWithLocale", - "kind": "value", - "name": "toLocaleStringWithLocale", - "docstrings": [ - "`toLocaleStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized date-time string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleStringWithLocale(\"en-US\")->Console.log\n// 2/19/2023, 3:40:00 PM\n```" - ], - "signature": "let toLocaleStringWithLocale: (t, string) => string" - }, - { - "id": "Core.Date.toLocaleStringWithLocaleAndOptions", - "kind": "value", - "name": "toLocaleStringWithLocaleAndOptions", - "docstrings": [ - "`toLocaleStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized date-time string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleStringWithLocaleAndOptions(\"en\", { dateStyle: #short, timeStyle: #short })->Console.log\n// 2/19/23, 3:40 PM\n\nDate.make()->Date.toLocaleStringWithLocaleAndOptions(\"en\", { era: #long, year: #numeric, month: #\"2-digit\", day: #\"2-digit\", hour: #numeric, timeZoneName: #short })->Console.log\n// 02/19/2023 Anno Domini, 3 PM GMT+1\n```" - ], - "signature": "let toLocaleStringWithLocaleAndOptions: (t, string, localeOptions) => string" - }, - { - "id": "Core.Date.toLocaleTimeString", - "kind": "value", - "name": "toLocaleTimeString", - "docstrings": [ - "`toLocaleTimeString(date)`\n\nConverts a JavaScript date to a localized time string. It will use the current locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeString->Console.log\n// 3:40:00 PM\n```" - ], - "signature": "let toLocaleTimeString: t => string" - }, - { - "id": "Core.Date.toLocaleTimeStringWithLocale", - "kind": "value", - "name": "toLocaleTimeStringWithLocale", - "docstrings": [ - "`toLocaleTimeStringWithLocale(date, locale)`\n\nConverts a JavaScript date to a localized time string. It will use the specified locale.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeStringWithLocale(\"en-US\")->Console.log\n// 3:40:00 PM\n```" - ], - "signature": "let toLocaleTimeStringWithLocale: (t, string) => string" - }, - { - "id": "Core.Date.toLocaleTimeStringWithLocaleAndOptions", - "kind": "value", - "name": "toLocaleTimeStringWithLocaleAndOptions", - "docstrings": [ - "`toLocaleTimeStringWithLocaleAndOptions(date, locale, options)`\n\nConverts a JavaScript date to a localized time string. It will use the specified locale and formatting options.\n\n## Examples\n```rescript\nDate.make()->Date.toLocaleTimeStringWithLocaleAndOptions(\"en-US\", { timeStyle: #long })->Console.log\n// 3:40:00 PM GMT+1\n\nDate.make()->Date.toLocaleTimeStringWithLocaleAndOptions(\"de\", { hour: #\"2-digit\", minute: #\"2-digit\" })->Console.log\n// 15:40\n```" - ], - "signature": "let toLocaleTimeStringWithLocaleAndOptions: (t, string, localeOptions) => string" - }, - { - "id": "Core.Date.toISOString", - "kind": "value", - "name": "toISOString", - "docstrings": [ - "`toISOString(date)`\n\nConverts a JavaScript date to a ISO 8601 string (YYYY-MM-DDTHH:mm:ss.sssZ). The date will be mapped to the UTC time.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toISOString->Console.log\n// 2023-01-01T00:00:00.000Z\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toISOString->Console.log\n// 2022-12-31T16:00:00.000Z\n```" - ], - "signature": "let toISOString: t => string" - }, - { - "id": "Core.Date.toUTCString", - "kind": "value", - "name": "toUTCString", - "docstrings": [ - "`toUTCString(date)`\n\nConverts a JavaScript date to date time string. The date will be mapped to the UTC time.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toUTCString->Console.log\n// Sun, 01 Jan 2023 00:00:00 GMT\n\nDate.fromString(\"2023-01-01T00:00:00.00+08:00\")->Date.toUTCString->Console.log\n// Sat, 31 Dec 2022 16:00:00 GMT\n```" - ], - "signature": "let toUTCString: t => string" - }, - { - "id": "Core.Date.toJSON", - "kind": "value", - "name": "toJSON", - "docstrings": [ - "`toJSON(date)`\n\nConverts a JavaScript date to a string.\nIf the date is valid, the function will return the same result as `Date.toISOString`.\nInvalid dates will return `None`.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toJSON\n// Some(\"2023-01-01T00:00:00.000Z\")\n\nDate.fromString(\"\")->Date.toJSON\n// None\n```" - ], - "signature": "let toJSON: t => option" - } - ] - }, - "core/dataview": { - "id": "Core.DataView", - "name": "DataView", - "docstrings": [], - "items": [ - { - "id": "Core.DataView.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Core.DataView.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [], - "signature": "let fromBuffer: ArrayBuffer.t => t" - }, - { - "id": "Core.DataView.fromBufferToEnd", - "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [], - "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" - }, - { - "id": "Core.DataView.fromBufferWithRange", - "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [], - "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" - }, - { - "id": "Core.DataView.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => ArrayBuffer.t" - }, - { - "id": "Core.DataView.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Core.DataView.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Core.DataView.getInt8", - "kind": "value", - "name": "getInt8", - "docstrings": [], - "signature": "let getInt8: (t, int) => int" - }, - { - "id": "Core.DataView.getUint8", - "kind": "value", - "name": "getUint8", - "docstrings": [], - "signature": "let getUint8: (t, int) => int" - }, - { - "id": "Core.DataView.getInt16", - "kind": "value", - "name": "getInt16", - "docstrings": [], - "signature": "let getInt16: (t, int) => int" - }, - { - "id": "Core.DataView.getUint16", - "kind": "value", - "name": "getUint16", - "docstrings": [], - "signature": "let getUint16: (t, int) => int" - }, - { - "id": "Core.DataView.getInt32", - "kind": "value", - "name": "getInt32", - "docstrings": [], - "signature": "let getInt32: (t, int) => int" - }, - { - "id": "Core.DataView.getUint32", - "kind": "value", - "name": "getUint32", - "docstrings": [], - "signature": "let getUint32: (t, int) => int" - }, - { - "id": "Core.DataView.getFloat32", - "kind": "value", - "name": "getFloat32", - "docstrings": [], - "signature": "let getFloat32: (t, int) => float" - }, - { - "id": "Core.DataView.getFloat64", - "kind": "value", - "name": "getFloat64", - "docstrings": [], - "signature": "let getFloat64: (t, int) => float" - }, - { - "id": "Core.DataView.getBigInt64", - "kind": "value", - "name": "getBigInt64", - "docstrings": [], - "signature": "let getBigInt64: (t, int) => bigint" - }, - { - "id": "Core.DataView.getBigUint64", - "kind": "value", - "name": "getBigUint64", - "docstrings": [], - "signature": "let getBigUint64: (t, int) => bigint" - }, - { - "id": "Core.DataView.setInt8", - "kind": "value", - "name": "setInt8", - "docstrings": [], - "signature": "let setInt8: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setUint8", - "kind": "value", - "name": "setUint8", - "docstrings": [], - "signature": "let setUint8: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setInt16", - "kind": "value", - "name": "setInt16", - "docstrings": [], - "signature": "let setInt16: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setUint16", - "kind": "value", - "name": "setUint16", - "docstrings": [], - "signature": "let setUint16: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setInt32", - "kind": "value", - "name": "setInt32", - "docstrings": [], - "signature": "let setInt32: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setUint32", - "kind": "value", - "name": "setUint32", - "docstrings": [], - "signature": "let setUint32: (t, int, int) => unit" - }, - { - "id": "Core.DataView.setFloat32", - "kind": "value", - "name": "setFloat32", - "docstrings": [], - "signature": "let setFloat32: (t, int, float) => unit" - }, - { - "id": "Core.DataView.setFloat64", - "kind": "value", - "name": "setFloat64", - "docstrings": [], - "signature": "let setFloat64: (t, int, float) => unit" - }, - { - "id": "Core.DataView.setBigInt64", - "kind": "value", - "name": "setBigInt64", - "docstrings": [], - "signature": "let setBigInt64: (t, int, bigint) => unit" - }, - { - "id": "Core.DataView.setBigUint64", - "kind": "value", - "name": "setBigUint64", - "docstrings": [], - "signature": "let setBigUint64: (t, int, bigint) => unit" - } - ] - }, - "core/console": { - "id": "Core.Console", - "name": "Console", - "docstrings": [ - "Functions for interacting with JavaScript console.\n\nSee: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console)." - ], - "items": [ - { - "id": "Core.Console.assert_", - "kind": "value", - "name": "assert_", - "docstrings": [ - "`assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`.\n\nSee [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert)\non MDN.\n\n## Examples\n\n```rescript\nConsole.assert_(false, \"Hello World!\")\nConsole.assert_(42 == 42, \"The answer\")\n```" - ], - "signature": "let assert_: (bool, 'a) => unit" - }, - { - "id": "Core.Console.assert2", - "kind": "value", - "name": "assert2", - "docstrings": [ - "`assert2(v1, v2)`. Like `assert_`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.assert2(false, \"Hello\", \"World\")\nConsole.assert2(42 == 42, [1, 2, 3], '4')\n```" - ], - "signature": "let assert2: (bool, 'a, 'b) => unit" - }, - { - "id": "Core.Console.assert3", - "kind": "value", - "name": "assert3", - "docstrings": [ - "`assert3(v1, v2, v3)`. Like `assert_`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.assert3(false, \"Hello\", \"World\", \"ReScript\")\nConsole.assert3(42 == 42, \"One\", 2, #3)\n```" - ], - "signature": "let assert3: (bool, 'a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.assert4", - "kind": "value", - "name": "assert4", - "docstrings": [ - "`assert4(v1, v2, v3, v4)`. Like `assert_`, but with four arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert4(false, \"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.assert4(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" - ], - "signature": "let assert4: (bool, 'a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.assert5", - "kind": "value", - "name": "assert5", - "docstrings": [ - "`assert5(v1, v2, v3, v4, v5)`. Like `assert_`, but with five arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert5(false, \"Hello\", \"World\", \"JS\", '!', '!')\nConsole.assert5(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.assert6", - "kind": "value", - "name": "assert6", - "docstrings": [ - "`assert6(v1, v2)`. Like `assert_`, but with six arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert6(false, \"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.assert6(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.assertMany", - "kind": "value", - "name": "assertMany", - "docstrings": [ - "`assertMany(assertion, arr)`. Like `assert_`, but variadic.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assertMany(false, [\"Hello\", \"World\"])\nConsole.assertMany(value == 42, [1, 2, 3])\n```" - ], - "signature": "let assertMany: (bool, array<'a>) => unit" - }, - { - "id": "Core.Console.clear", - "kind": "value", - "name": "clear", - "docstrings": [ - "`clear()` clears the console, if allowed.\n\nSee [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear)\non MDN.\n\n## Examples\n\n```rescript\nConsole.clear()\n```" - ], - "signature": "let clear: unit => unit" - }, - { - "id": "Core.Console.count", - "kind": "value", - "name": "count", - "docstrings": [ - "`count(label)` prints to the console the number of times it's been called with the given label.\n\nSee [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count)\non MDN.\n\n## Examples\n\n```rescript\nConsole.count(\"rescript\")\n```" - ], - "signature": "let count: string => unit" - }, - { - "id": "Core.Console.countReset", - "kind": "value", - "name": "countReset", - "docstrings": [ - "`countReset(label)` resets the count for the given label to 0.\n\nSee [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset)\non MDN.\n\n## Examples\n\n```rescript\nConsole.countReset(\"rescript\")\n```" - ], - "signature": "let countReset: string => unit" - }, - { - "id": "Core.Console.debug", - "kind": "value", - "name": "debug", - "docstrings": [ - "`debug(value)` print a debug message to console.\n\nSee [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug)\non MDN.\n\n## Examples\n\n```rescript\nConsole.debug(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.debug(obj)\n```" - ], - "signature": "let debug: 'a => unit" - }, - { - "id": "Core.Console.debug2", - "kind": "value", - "name": "debug2", - "docstrings": [ - "`debug2(v1, v2)`. Like `debug`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.debug2(\"Hello\", \"World\")\nConsole.debug2([1, 2, 3], '4')\n```" - ], - "signature": "let debug2: ('a, 'b) => unit" - }, - { - "id": "Core.Console.debug3", - "kind": "value", - "name": "debug3", - "docstrings": [ - "`debug3(v1, v2, v3)`. Like `debug`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.debug3(\"Hello\", \"World\", \"ReScript\")\nConsole.debug3(\"One\", 2, #3)\n```" - ], - "signature": "let debug3: ('a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.debug4", - "kind": "value", - "name": "debug4", - "docstrings": [ - "`debug4(v1, v2, v3, v4)`. Like `debug`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.debug4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.debug4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" - ], - "signature": "let debug4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.debug5", - "kind": "value", - "name": "debug5", - "docstrings": [ - "`debug5(v1, v2, v3, v4, v5)`. Like `debug`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.debug5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.debug5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let debug5: ('a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.debug6", - "kind": "value", - "name": "debug6", - "docstrings": [ - "`debug6(v1, v2, v3, v4, v5, v6)`. Like `debug`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.debug6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.debug6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.debugMany", - "kind": "value", - "name": "debugMany", - "docstrings": [ - "`debugMany(arr)`. Like `debug`, but variadic.\n\n## Examples\n\n```rescript\nConsole.debugMany([\"Hello\", \"World\"])\nConsole.debugMany([1, 2, 3])\n```" - ], - "signature": "let debugMany: array<'a> => unit" - }, - { - "id": "Core.Console.dir", - "kind": "value", - "name": "dir", - "docstrings": [ - "`dir(object)` displays an interactive view of the object in the console.\n\nSee [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir)\non MDN.\n\n## Examples\n\n```rescript\nConsole.dir({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" - ], - "signature": "let dir: 'a => unit" - }, - { - "id": "Core.Console.dirxml", - "kind": "value", - "name": "dirxml", - "docstrings": [ - "`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console.\n\nSee [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml)\non MDN." - ], - "signature": "let dirxml: 'a => unit" - }, - { - "id": "Core.Console.error", - "kind": "value", - "name": "error", - "docstrings": [ - "`error(value)` prints an error message to console.\n\nSee [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\non MDN.\n\n## Examples\n\n```rescript\nConsole.error(\"error message\")\nConsole.error((\"error\", \"invalid value\"))\n```" - ], - "signature": "let error: 'a => unit" - }, - { - "id": "Core.Console.error2", - "kind": "value", - "name": "error2", - "docstrings": [ - "`error(v1, v2)`. Like `error`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.error2(\"Error\", \"here\")\nConsole.error2((\"log\", \"error\"), \"message\")\n```" - ], - "signature": "let error2: ('a, 'b) => unit" - }, - { - "id": "Core.Console.error3", - "kind": "value", - "name": "error3", - "docstrings": [ - "`error3(v1, v2, v3)`. Like `error`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.error3(\"Hello\", \"World\", \"!!!\")\nConsole.error3(#first, #second, #third)\n```" - ], - "signature": "let error3: ('a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.error4", - "kind": "value", - "name": "error4", - "docstrings": [ - "`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.error4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.error4(#first, #second, #third, (\"fourth\"))\n```" - ], - "signature": "let error4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.error5", - "kind": "value", - "name": "error5", - "docstrings": [ - "`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.error5('e', 'r', 'r', 'o', 'r')\nConsole.error5(1, #second, #third, (\"fourth\"), 'c')\n```" - ], - "signature": "let error5: ('a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.error6", - "kind": "value", - "name": "error6", - "docstrings": [ - "`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.error6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.error6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.group", - "kind": "value", - "name": "group", - "docstrings": [ - "`group(label)` creates a new \"group\" level with the given label.\n\nSee [`console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group)\non MDN.\n\n## Example\n\n```rescript\nConsole.group(\"first group\")\nConsole.group(\"second group\")\nConsole.log(\"a message on the second level\")\nConsole.groupEnd()\nConsole.log(\"a message message on the first level\")\nConsole.groupEnd()\n```" - ], - "signature": "let group: string => unit" - }, - { - "id": "Core.Console.groupCollapsed", - "kind": "value", - "name": "groupCollapsed", - "docstrings": [ - "`groupCollapsed(label)`. Like `group` but collapses the group initially.\n\nSee [`console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed)\non MDN." - ], - "signature": "let groupCollapsed: string => unit" - }, - { - "id": "Core.Console.groupEnd", - "kind": "value", - "name": "groupEnd", - "docstrings": [ - "`groupEnd()` ends the current group.\n\nSee [`console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd)\non MDN." - ], - "signature": "let groupEnd: unit => unit" - }, - { - "id": "Core.Console.errorMany", - "kind": "value", - "name": "errorMany", - "docstrings": [ - "`errorMany(arr)`. Like `error`, but variadic.\n\n## Examples\n\n```rescript\nConsole.errorMany([\"Hello\", \"World\"])\nConsole.errorMany([1, 2, 3])\n```" - ], - "signature": "let errorMany: array<'a> => unit" - }, - { - "id": "Core.Console.info", - "kind": "value", - "name": "info", - "docstrings": [ - "`info(value)` print an informational message to console.\n\nSee [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info)\non MDN.\n\n## Examples\n\n```rescript\nConsole.info(\"Information\")\nConsole.info((\"Hello\", \"JS\"))\n```" - ], - "signature": "let info: 'a => unit" - }, - { - "id": "Core.Console.info2", - "kind": "value", - "name": "info2", - "docstrings": [ - "`info2(v1, v2)`. Like `info`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.info2(\"Info\", \"failed to download\")\nConsole.info2(#info, {\"name\": \"ReScript\"})\n```" - ], - "signature": "let info2: ('a, 'b) => unit" - }, - { - "id": "Core.Console.info3", - "kind": "value", - "name": "info3", - "docstrings": [ - "`info3(v1, v2, v3)`. Like `info`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.info3(\"Hello\", \"World\", \"ReScript\")\nConsole.info3([1, 2, 3], #4, #5)\n```" - ], - "signature": "let info3: ('a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.info4", - "kind": "value", - "name": "info4", - "docstrings": [ - "`info4(v1, v2, v3, v4)`. Like `info`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.info4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.info4([1, 2, 3], #4, #5, #lastinfo)\n```" - ], - "signature": "let info4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.info5", - "kind": "value", - "name": "info5", - "docstrings": [ - "`info5(v1, v2, v3, v4, v5)`. Like `info`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.info5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.info5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let info5: ('a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.info6", - "kind": "value", - "name": "info6", - "docstrings": [ - "`info6(v1, v2, v3, v4, v5, v6)`. Like `info`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.info6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.info6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.infoMany", - "kind": "value", - "name": "infoMany", - "docstrings": [ - "`infoMany(arr)`. Like `info`, but variadic.\n\n## Examples\n\n```rescript\nConsole.infoMany([\"Hello\", \"World\"])\nConsole.infoMany([1, 2, 3])\n```" - ], - "signature": "let infoMany: array<'a> => unit" - }, - { - "id": "Core.Console.log", - "kind": "value", - "name": "log", - "docstrings": [ - "`log(value)` print a message to console.\n\nSee [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log)\non MDN.\n\n## Examples\n\n```rescript\nConsole.log(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.log(obj)\n```" - ], - "signature": "let log: 'a => unit" - }, - { - "id": "Core.Console.log2", - "kind": "value", - "name": "log2", - "docstrings": [ - "`log2(v1, v2)`. Like `log`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.log2(\"Hello\", \"World\")\nConsole.log2([1, 2, 3], '4')\n```" - ], - "signature": "let log2: ('a, 'b) => unit" - }, - { - "id": "Core.Console.log3", - "kind": "value", - "name": "log3", - "docstrings": [ - "`log3(v1, v2, v3)`. Like `log`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.log3(\"Hello\", \"World\", \"ReScript\")\nConsole.log3(\"One\", 2, #3)\n```" - ], - "signature": "let log3: ('a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.log4", - "kind": "value", - "name": "log4", - "docstrings": [ - "`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.log4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.log4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" - ], - "signature": "let log4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.log5", - "kind": "value", - "name": "log5", - "docstrings": [ - "`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.log5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.log5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let log5: ('a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.log6", - "kind": "value", - "name": "log6", - "docstrings": [ - "`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.log6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.log6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.logMany", - "kind": "value", - "name": "logMany", - "docstrings": [ - "`logMany(arr)`. Like `log`, but variadic.\n\n## Examples\n\n```rescript\nConsole.logMany([\"Hello\", \"World\"])\nConsole.logMany([1, 2, 3])\n```" - ], - "signature": "let logMany: array<'a> => unit" - }, - { - "id": "Core.Console.table", - "kind": "value", - "name": "table", - "docstrings": [ - "`table(object)` displays an tabular view of the object in the console.\n\nSee [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table)\non MDN.\n\n## Examples\n\n```rescript\nConsole.table({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" - ], - "signature": "let table: 'a => unit" - }, - { - "id": "Core.Console.time", - "kind": "value", - "name": "time", - "docstrings": [ - "`time(label)` creates a timer to measure how long an operation takes. `label`\nmust be a unique name. Call `console.timeEnd` with the same `label` to print\noutput time.\n\nSee [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let time: string => unit" - }, - { - "id": "Core.Console.timeEnd", - "kind": "value", - "name": "timeEnd", - "docstrings": [ - "`timeEnd(label)` stops a timer created by `time`.\n\nSee [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let timeEnd: string => unit" - }, - { - "id": "Core.Console.timeLog", - "kind": "value", - "name": "timeLog", - "docstrings": [ - "`timeLog(label)` prints the current elapsed time of the given timer to the console.\n\nSee [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let timeLog: string => unit" - }, - { - "id": "Core.Console.trace", - "kind": "value", - "name": "trace", - "docstrings": [ - "`trace()` print a stack trace to console.\n\nSee [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace)\non MDN.\n\n## Examples\n\n```rescript\nlet main = () => {\n Console.trace()\n}\nmain()\n// In the console, the following trace will be displayed:\n// main\n// \n```" - ], - "signature": "let trace: unit => unit" - }, - { - "id": "Core.Console.warn", - "kind": "value", - "name": "warn", - "docstrings": [ - "`warn(value)` print a warning message to console.\n\nSee [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn)\non MDN.\n\n## Examples\n\n```rescript\nConsole.warn(\"Warning\")\nConsole.warn((\"Warning\", \"invalid number\"))\n```" - ], - "signature": "let warn: 'a => unit" - }, - { - "id": "Core.Console.warn2", - "kind": "value", - "name": "warn2", - "docstrings": [ - "`warn2(v1, v2)`. Like `warn`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.warn2(\"Hello\", \"World\")\nConsole.warn2([1, 2, 3], 4)\n```" - ], - "signature": "let warn2: ('a, 'b) => unit" - }, - { - "id": "Core.Console.warn3", - "kind": "value", - "name": "warn3", - "docstrings": [ - "`warn3(v1, v2, v3)`. Like `warn`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.warn3(\"Hello\", \"World\", \"ReScript\")\nConsole.warn3([1, 2, 3], #4, #5)\n```" - ], - "signature": "let warn3: ('a, 'b, 'c) => unit" - }, - { - "id": "Core.Console.warn4", - "kind": "value", - "name": "warn4", - "docstrings": [ - "`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.warn4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.warn4(#first, #second, #third, (\"fourth\"))\n```" - ], - "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Core.Console.warn5", - "kind": "value", - "name": "warn5", - "docstrings": [ - "`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.warn5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.warn5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let warn5: ('a, 'b, 'c, 'd, 'e) => unit" - }, - { - "id": "Core.Console.warn6", - "kind": "value", - "name": "warn6", - "docstrings": [ - "`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.warn6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.warn6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" - }, - { - "id": "Core.Console.warnMany", - "kind": "value", - "name": "warnMany", - "docstrings": [ - "`warnMany(arr)`. Like `warn`, but variadic.\n\n## Examples\n\n```rescript\nConsole.warnMany([\"Hello\", \"World\"])\nConsole.warnMany([1, 2, 3])\n```" - ], - "signature": "let warnMany: array<'a> => unit" - } - ] - }, - "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": [ - "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\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: Iterator.t<'a> => array<'a>" - }, - { - "id": "Core.Array.fromArrayLike", - "kind": "value", - "name": "fromArrayLike", - "docstrings": [], - "signature": "let fromArrayLike: arrayLike<'a> => array<'a>" - }, - { - "id": "Core.Array.fromArrayLikeWithMap", - "kind": "value", - "name": "fromArrayLikeWithMap", - "docstrings": [], - "signature": "let fromArrayLikeWithMap: (arrayLike<'a>, 'a => 'b) => array<'b>" - }, - { - "id": "Core.Array.make", - "kind": "value", - "name": "make", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.fromInitializer", - "kind": "value", - "name": "fromInitializer", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (array<'a>, array<'a>, ('a, 'a) => bool) => bool" - }, - { - "id": "Core.Array.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" - }, - { - "id": "Core.Array.isArray", - "kind": "value", - "name": "isArray", - "docstrings": [], - "signature": "let isArray: 'a => bool" - }, - { - "id": "Core.Array.length", - "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\n```rescript\nlet someArray = [\"hi\", \"hello\"]\n\nsomeArray\n->Array.length\n->assertEqual(2)\n```" - ], - "signature": "let length: array<'a> => int" - }, - { - "id": "Core.Array.copyAllWithin", - "kind": "value", - "name": "copyAllWithin", - "docstrings": [], - "signature": "let copyAllWithin: (array<'a>, ~target: int) => array<'a>" - }, - { - "id": "Core.Array.copyWithinToEnd", - "kind": "value", - "name": "copyWithinToEnd", - "docstrings": [], - "signature": "let copyWithinToEnd: (array<'a>, ~target: int, ~start: int) => array<'a>" - }, - { - "id": "Core.Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (\n array<'a>,\n ~target: int,\n ~start: int,\n ~end: int,\n) => array<'a>" - }, - { - "id": "Core.Array.fillAll", - "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\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" - }, - { - "id": "Core.Array.fillToEnd", - "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\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" - }, - { - "id": "Core.Array.fill", - "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\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" - }, - { - "id": "Core.Array.pop", - "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\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>" - }, - { - "id": "Core.Array.push", - "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\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" - }, - { - "id": "Core.Array.pushMany", - "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\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" - }, - { - "id": "Core.Array.reverse", - "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\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.reverse\n\nsomeArray->assertEqual([\"hello\", \"hi\"])\n```" - ], - "signature": "let reverse: array<'a> => unit" - }, - { - "id": "Core.Array.shift", - "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\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>" - }, - { - "id": "Core.Array.toSorted", - "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\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) => 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\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) => Ordering.t) => unit" - }, - { - "id": "Core.Array.splice", - "kind": "value", - "name": "splice", - "docstrings": [], - "signature": "let splice: (\n array<'a>,\n ~start: int,\n ~remove: int,\n ~insert: array<'a>,\n) => unit" - }, - { - "id": "Core.Array.toSpliced", - "kind": "value", - "name": "toSpliced", - "docstrings": [], - "signature": "let toSpliced: (\n array<'a>,\n ~start: int,\n ~remove: int,\n ~insert: array<'a>,\n) => array<'a>" - }, - { - "id": "Core.Array.with", - "kind": "value", - "name": "with", - "docstrings": [], - "signature": "let with: (array<'a>, int, 'a) => array<'a>" - }, - { - "id": "Core.Array.unshift", - "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\n```rescript\nlet someArray = [\"hi\", \"hello\"]\nsomeArray->Array.unshift(\"yay\")\nsomeArray->assertEqual([\"yay\", \"hi\", \"hello\"])\n```" - ], - "signature": "let unshift: (array<'a>, 'a) => unit" - }, - { - "id": "Core.Array.unshiftMany", - "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\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" - }, - { - "id": "Core.Array.concat", - "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\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>" - }, - { - "id": "Core.Array.concatMany", - "kind": "value", - "name": "concatMany", - "docstrings": [ - "`concatMany(array1, arrays)` concatenates array1 with several other 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\"]\nlet array3 = [\"wehoo\"]\n\nlet someArray = array1->Array.concatMany([array2, array3])\n\nConsole.log(someArray) // [\"hi\", \"hello\", \"yay\", \"wehoo\"]\n```" - ], - "signature": "let concatMany: (array<'a>, array>) => array<'a>" - }, - { - "id": "Core.Array.flat", - "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\n```rescript\n[[1], [2], [3, 4]]\n->Array.flat\n->assertEqual([1, 2, 3, 4])\n```" - ], - "signature": "let flat: array> => array<'a>" - }, - { - "id": "Core.Array.includes", - "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\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" - }, - { - "id": "Core.Array.indexOf", - "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\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" - }, - { - "id": "Core.Array.indexOfOpt", - "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\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" - }, - { - "id": "Core.Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (array<'a>, 'a, int) => int" - }, - { - "id": "Core.Array.join", - "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\n```rescript\n[\"One\", \"Two\", \"Three\"]\n->Array.join(\" -- \")\n->assertEqual(\"One -- Two -- Three\")\n```" - ], - "signature": "let join: (array, string) => string" - }, - { - "id": "Core.Array.joinWith", - "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\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" - }, - { - "id": "Core.Array.joinUnsafe", - "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\n```rescript\n[1, 2, 3]\n->Array.joinUnsafe(\" -- \")\n->assertEqual(\"1 -- 2 -- 3\")\n```" - ], - "signature": "let joinUnsafe: (array<'a>, string) => string" - }, - { - "id": "Core.Array.joinWithUnsafe", - "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\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" - }, - { - "id": "Core.Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (array<'a>, 'a) => int" - }, - { - "id": "Core.Array.lastIndexOfOpt", - "kind": "value", - "name": "lastIndexOfOpt", - "docstrings": [], - "signature": "let lastIndexOfOpt: (array<'a>, 'a) => option" - }, - { - "id": "Core.Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (array<'a>, 'a, int) => int" - }, - { - "id": "Core.Array.slice", - "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\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>" - }, - { - "id": "Core.Array.sliceToEnd", - "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\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>" - }, - { - "id": "Core.Array.copy", - "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\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>" - }, - { - "id": "Core.Array.toString", - "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\n```rescript\n[1, 2, 3, 4]\n->Array.toString\n->assertEqual(\"1,2,3,4\")\n```" - ], - "signature": "let toString: array<'a> => string" - }, - { - "id": "Core.Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: array<'a> => string" - }, - { - "id": "Core.Array.every", - "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\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" - }, - { - "id": "Core.Array.everyWithIndex", - "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\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" - }, - { - "id": "Core.Array.filter", - "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\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>" - }, - { - "id": "Core.Array.filterWithIndex", - "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\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>" - }, - { - "id": "Core.Array.find", - "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\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>" - }, - { - "id": "Core.Array.findWithIndex", - "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\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>" - }, - { - "id": "Core.Array.findIndex", - "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\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" - }, - { - "id": "Core.Array.findIndexWithIndex", - "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\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" - }, - { - "id": "Core.Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [ - "`forEach(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.forEach(item => {\n Console.log(item)\n})\n```" - ], - "signature": "let forEach: (array<'a>, 'a => unit) => unit" - }, - { - "id": "Core.Array.forEachWithIndex", - "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\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" - }, - { - "id": "Core.Array.map", - "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\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>" - }, - { - "id": "Core.Array.mapWithIndex", - "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\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>" - }, - { - "id": "Core.Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [ - "`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" - }, - { - "id": "Core.Array.reduceWithIndex", - "kind": "value", - "name": "reduceWithIndex", - "docstrings": [ - "`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" - }, - { - "id": "Core.Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [ - "`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" - }, - { - "id": "Core.Array.reduceRightWithIndex", - "kind": "value", - "name": "reduceRightWithIndex", - "docstrings": [ - "`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" - }, - { - "id": "Core.Array.some", - "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\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" - }, - { - "id": "Core.Array.someWithIndex", - "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\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" - }, - { - "id": "Core.Array.get", - "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\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>" - }, - { - "id": "Core.Array.set", - "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\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" - }, - { - "id": "Core.Array.getSymbol", - "kind": "value", - "name": "getSymbol", - "docstrings": [], - "signature": "let getSymbol: (array<'a>, Symbol.t) => option<'b>" - }, - { - "id": "Core.Array.getSymbolUnsafe", - "kind": "value", - "name": "getSymbolUnsafe", - "docstrings": [], - "signature": "let getSymbolUnsafe: (array<'a>, Symbol.t) => 'b" - }, - { - "id": "Core.Array.setSymbol", - "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: (array<'a>, Symbol.t, 'b) => unit" - }, - { - "id": "Core.Array.getUnsafe", - "kind": "value", - "name": "getUnsafe", - "docstrings": [ - "`getUnsafe(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.getUnsafe` only when you are sure the `index` exists (i.e. when using for-loop).\n\n## Examples\n```rescript\nlet array = [1, 2, 3]\nfor index in 0 to array->Array.length - 1 {\n let value = array->Array.getUnsafe(index)\n Console.log(value)\n}\n```" - ], - "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\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" - }, - { - "id": "Core.Array.findIndexOpt", - "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\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" - }, - { - "id": "Core.Array.toReversed", - "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\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>" - }, - { - "id": "Core.Array.filterMap", - "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\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>" - }, - { - "id": "Core.Array.keepSome", - "kind": "value", - "name": "keepSome", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.toShuffled", - "kind": "value", - "name": "toShuffled", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.shuffle", - "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\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" - }, - { - "id": "Core.Array.flatMap", - "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\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>" - }, - { - "id": "Core.Array.flatMapWithIndex", - "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\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>" - }, - { - "id": "Core.Array.findMap", - "kind": "value", - "name": "findMap", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.at", - "kind": "value", - "name": "at", - "docstrings": [ - "`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>" - }, - { - "id": "Core.Array.last", - "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\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>" - } - ] - } -} \ No newline at end of file diff --git a/data/api/v12.0.0/js.json b/data/api/v12.0.0/js.json index c9b052ef9..482bb54dd 100644 --- a/data/api/v12.0.0/js.json +++ b/data/api/v12.0.0/js.json @@ -3,7 +3,7 @@ "id": "Js", "name": "Js", "docstrings": [ - "The Js module mostly contains ReScript bindings to _standard JavaScript APIs_\nlike [console.log](https://developer.mozilla.org/en-US/docs/Web/API/Console/log),\nor the JavaScript\n[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String),\n[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), and\n[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\nclasses.\n\nIt is meant as a zero-abstraction interop layer and directly exposes JavaScript functions as they are. If you can find your API in this module, prefer this over an equivalent Belt helper. For example, prefer [Js.Array2](js/array2) over [Belt.Array](belt/array)\n\n## Argument Order\n\nFor historical reasons, some APIs in the Js namespace (e.g. [Js.String](js/string)) are\nusing the data-last argument order whereas others (e.g. [Js.Date](js/date)) are using data-first.\n\nFor more information about these argument orders and the trade-offs between them, see\n[this blog post](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/).\n\n_Eventually, all modules in the Js namespace are going to be migrated to data-first though._\n\nIn the meantime, there are several options for dealing with the data-last APIs:\n\n## Examples\n\n```rescript\n/* Js.String (data-last API used with pipe last operator) */\nJs.log(\"2019-11-10\" |> Js.String.split(\"-\"))\nJs.log(\"ReScript\" |> Js.String.startsWith(\"Re\"))\n\n/* Js.String (data-last API used with pipe first operator) */\nJs.log(\"2019-11-10\"->Js.String.split(\"-\", _))\nJs.log(\"ReScript\"->Js.String.startsWith(\"Re\", _))\n\n/* Js.String (data-last API used without any piping) */\nJs.log(Js.String.split(\"-\", \"2019-11-10\"))\nJs.log(Js.String.startsWith(\"Re\", \"ReScript\"))\n```\n## Js.Xxx2 Modules\n\nPrefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latters are old modules." + "The Js module mostly contains ReScript bindings to _standard JavaScript APIs_\nlike [console.log](https://developer.mozilla.org/en-US/docs/Web/API/Console/log),\nor the JavaScript\n[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String),\n[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date), and\n[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\nclasses.\n\nIt is meant as a zero-abstraction interop layer and directly exposes JavaScript functions as they are. If you can find your API in this module, prefer this over an equivalent Belt helper. For example, prefer [Js.Array2](js/array2) over [Belt.Array](belt/array)\n\n## Argument Order\n\nFor historical reasons, some APIs in the Js namespace (e.g. [Js.String](js/string)) are\nusing the data-last argument order whereas others (e.g. [Js.Date](js/date)) are using data-first.\n\nFor more information about these argument orders and the trade-offs between them, see\n[this blog post](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/).\n\n_Eventually, all modules in the Js namespace are going to be migrated to data-first though._\n\nIn the meantime, there are several options for dealing with the data-last APIs:\n\n## Examples\n\n```rescript\n/* Js.String (data-last API used with pipe last operator) */\nJs.log(\\\"2019-11-10\\\" |> Js.String.split(\\\"-\\\"))\nJs.log(\\\"ReScript\\\" |> Js.String.startsWith(\\\"Re\\\"))\n\n/* Js.String (data-last API used with pipe first operator) */\nJs.log(\\\"2019-11-10\\\"->Js.String.split(\\\"-\\\", _))\nJs.log(\\\"ReScript\\\"->Js.String.startsWith(\\\"Re\\\", _))\n\n/* Js.String (data-last API used without any piping) */\nJs.log(Js.String.split(\\\"-\\\", \\\"2019-11-10\\\"))\nJs.log(Js.String.startsWith(\\\"Re\\\", \\\"ReScript\\\"))\n```\n## Js.Xxx2 Modules\n\nPrefer `Js.Array2` over `Js.Array`, `Js.String2` over `Js.String`, etc. The latters are old modules." ], "items": [ { @@ -15,30 +15,35 @@ ], "signature": "type t<'a> = 'a\n constraint 'a = {..}" }, + { + "id": "Js.globalThis", + "kind": "value", + "name": "globalThis", + "docstrings": [ + "JS global object reference" + ], + "signature": "let globalThis: t<{..}>" + }, { "id": "Js.null", "kind": "type", "name": "null", - "docstrings": [ - "Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t." - ], - "signature": "type null<'a> = Value('a) | Null" + "docstrings": [], + "signature": "@unboxed\ntype null<'a> = Js_null.t<'a> = Value('a) | @as(null) Null" }, { "id": "Js.undefined", "kind": "type", "name": "undefined", - "docstrings": [ - "A value of this type can be either undefined or 'a. This type is equivalent to Js.Undefined.t." - ], - "signature": "type undefined<+'a>" + "docstrings": [], + "signature": "type undefined<'a> = Js_undefined.t<'a>" }, { "id": "Js.nullable", "kind": "type", "name": "nullable", "docstrings": [], - "signature": "type nullable<'a> = Value('a) | Null | Undefined" + "signature": "@unboxed\ntype nullable<'a> = Js_null_undefined.t<'a> =\n | Value('a)\n | @as(null) Null\n | @as(undefined) Undefined" }, { "id": "Js.null_undefined", @@ -768,14 +773,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Float64Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Float64Array.findIndex", @@ -1200,14 +1205,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Float32Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Float32Array.findIndex", @@ -1632,14 +1637,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint32Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint32Array.findIndex", @@ -2064,14 +2069,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int32Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int32Array.findIndex", @@ -2496,14 +2501,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint16Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint16Array.findIndex", @@ -2928,14 +2933,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int16Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int16Array.findIndex", @@ -3360,14 +3365,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint8ClampedArray.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint8ClampedArray.findIndex", @@ -3792,14 +3797,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint8Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Uint8Array.findIndex", @@ -4224,14 +4229,14 @@ "kind": "value", "name": "find", "docstrings": [], - "signature": "let find: (t, elt => bool) => Js.undefined" + "signature": "let find: (t, elt => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int8Array.findi", "kind": "value", "name": "findi", "docstrings": [], - "signature": "let findi: (t, (elt, int) => bool) => Js.undefined" + "signature": "let findi: (t, (elt, int) => bool) => Js_undefined.t" }, { "id": "Js.TypedArray2.Int8Array.findIndex", @@ -4750,20 +4755,6 @@ "docstrings": [], "signature": "let byteOffset: t => int" }, - { - "id": "Js.Typed_array.Float64Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Float64Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, { "id": "Js.Typed_array.Float64Array.length", "kind": "value", @@ -4771,292 +4762,26 @@ "docstrings": [], "signature": "let length: t => int" }, - { - "id": "Js.Typed_array.Float64Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, { "id": "Js.Typed_array.Float64Array.copyWithinFromRange", "kind": "value", "name": "copyWithinFromRange", "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Float64Array.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Float64Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Float64Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Float64Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Float64Array.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Float64Array.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Float64Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Float64Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { "id": "Js.Typed_array.Float64Array.slice", "kind": "value", "name": "slice", "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Float64Array.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { "id": "Js.Typed_array.Float64Array.subarray", "kind": "value", "name": "subarray", "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Float64Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Float64Array.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Float64Array.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Float64Array.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Float64Array.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Float64Array.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Float64Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Float64Array.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Float64Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Float64Array.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Float64Array.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Float64Array.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Float64Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Float64Array.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Float64Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Float64Array.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Float64Array.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Float64Array.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { "id": "Js.Typed_array.Float64Array._BYTES_PER_ELEMENT", @@ -5200,20 +4925,6 @@ "docstrings": [], "signature": "let byteOffset: t => int" }, - { - "id": "Js.Typed_array.Float32Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Float32Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, { "id": "Js.Typed_array.Float32Array.length", "kind": "value", @@ -5222,308 +4933,360 @@ "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Float32Array.copyWithin", + "id": "Js.Typed_array.Float32Array.copyWithinFromRange", "kind": "value", - "name": "copyWithin", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.copyWithinFrom", + "id": "Js.Typed_array.Float32Array.slice", "kind": "value", - "name": "copyWithinFrom", + "name": "slice", "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.copyWithinFromRange", + "id": "Js.Typed_array.Float32Array.subarray", "kind": "value", - "name": "copyWithinFromRange", + "name": "subarray", "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.fillInPlace", + "id": "Js.Typed_array.Float32Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "fillInPlace", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Float32Array.fillFromInPlace", + "id": "Js.Typed_array.Float32Array.make", "kind": "value", - "name": "fillFromInPlace", + "name": "make", "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Float32Array.fillRangeInPlace", + "id": "Js.Typed_array.Float32Array.fromBuffer", "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Float32Array.reverseInPlace", + "id": "Js.Typed_array.Float32Array.fromBufferOffset", "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" + "name": "fromBufferOffset", + "docstrings": [ + "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Float32Array.sortInPlace", + "id": "Js.Typed_array.Float32Array.fromBufferRange", "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" + "name": "fromBufferRange", + "docstrings": [ + "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Float32Array.sortInPlaceWith", + "id": "Js.Typed_array.Float32Array.fromLength", "kind": "value", - "name": "sortInPlaceWith", + "name": "fromLength", "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Float32Array.includes", + "id": "Js.Typed_array.Float32Array.from", "kind": "value", - "name": "includes", + "name": "from", "docstrings": [], - "signature": "let includes: (elt, t) => bool" + "signature": "let from: array_like => t" }, { - "id": "Js.Typed_array.Float32Array.indexOf", + "id": "Js.Typed_array.Float32Array.create", "kind": "value", - "name": "indexOf", + "name": "create", "docstrings": [], - "signature": "let indexOf: (elt, t) => int" + "signature": "let create: array => t", + "deprecated": "use `make` instead" }, { - "id": "Js.Typed_array.Float32Array.indexOfFrom", + "id": "Js.Typed_array.Float32Array.of_buffer", "kind": "value", - "name": "indexOfFrom", + "name": "of_buffer", "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" + "signature": "let of_buffer: array_buffer => t", + "deprecated": "use `fromBuffer` instead" + } + ] + }, + "js/typed_array/uint32array": { + "id": "Js.Typed_array.Uint32Array", + "name": "Uint32Array", + "docstrings": [], + "items": [ + { + "id": "Js.Typed_array.Uint32Array.elt", + "kind": "type", + "name": "elt", + "docstrings": [ + "" + ], + "signature": "type elt = int" }, { - "id": "Js.Typed_array.Float32Array.join", - "kind": "value", - "name": "join", + "id": "Js.Typed_array.Uint32Array.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let join: t => string" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint32Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Float32Array.joinWith", - "kind": "value", - "name": "joinWith", + "id": "Js.Typed_array.Uint32Array.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let joinWith: (string, t) => string" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Float32Array.lastIndexOf", + "id": "Js.Typed_array.Uint32Array.unsafe_get", "kind": "value", - "name": "lastIndexOf", + "name": "unsafe_get", "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Float32Array.lastIndexOfFrom", + "id": "Js.Typed_array.Uint32Array.unsafe_set", "kind": "value", - "name": "lastIndexOfFrom", + "name": "unsafe_set", "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Float32Array.slice", + "id": "Js.Typed_array.Uint32Array.buffer", "kind": "value", - "name": "slice", + "name": "buffer", "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Float32Array.copy", + "id": "Js.Typed_array.Uint32Array.byteLength", "kind": "value", - "name": "copy", + "name": "byteLength", "docstrings": [], - "signature": "let copy: t => t" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Float32Array.sliceFrom", + "id": "Js.Typed_array.Uint32Array.byteOffset", "kind": "value", - "name": "sliceFrom", + "name": "byteOffset", "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Float32Array.subarray", + "id": "Js.Typed_array.Uint32Array.length", "kind": "value", - "name": "subarray", + "name": "length", "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Float32Array.subarrayFrom", + "id": "Js.Typed_array.Uint32Array.copyWithinFromRange", "kind": "value", - "name": "subarrayFrom", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.toString", + "id": "Js.Typed_array.Uint32Array.slice", "kind": "value", - "name": "toString", + "name": "slice", "docstrings": [], - "signature": "let toString: t => string" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.toLocaleString", + "id": "Js.Typed_array.Uint32Array.subarray", "kind": "value", - "name": "toLocaleString", + "name": "subarray", "docstrings": [], - "signature": "let toLocaleString: t => string" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.every", + "id": "Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "every", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Float32Array.everyi", + "id": "Js.Typed_array.Uint32Array.make", "kind": "value", - "name": "everyi", + "name": "make", "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Float32Array.filter", + "id": "Js.Typed_array.Uint32Array.fromBuffer", "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Float32Array.filteri", + "id": "Js.Typed_array.Uint32Array.fromBufferOffset", "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" + "name": "fromBufferOffset", + "docstrings": [ + "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Float32Array.find", + "id": "Js.Typed_array.Uint32Array.fromBufferRange", "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" + "name": "fromBufferRange", + "docstrings": [ + "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Float32Array.findi", + "id": "Js.Typed_array.Uint32Array.fromLength", "kind": "value", - "name": "findi", + "name": "fromLength", "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Float32Array.findIndex", + "id": "Js.Typed_array.Uint32Array.from", "kind": "value", - "name": "findIndex", + "name": "from", "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" + "signature": "let from: array_like => t" + } + ] + }, + "js/typed_array/int32_array": { + "id": "Js.Typed_array.Int32_array", + "name": "Int32_array", + "docstrings": [], + "items": [] + }, + "js/typed_array/int32array": { + "id": "Js.Typed_array.Int32Array", + "name": "Int32Array", + "docstrings": [], + "items": [ + { + "id": "Js.Typed_array.Int32Array.elt", + "kind": "type", + "name": "elt", + "docstrings": [ + "" + ], + "signature": "type elt = int" }, { - "id": "Js.Typed_array.Float32Array.findIndexi", - "kind": "value", - "name": "findIndexi", + "id": "Js.Typed_array.Int32Array.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int32Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Float32Array.forEach", - "kind": "value", - "name": "forEach", + "id": "Js.Typed_array.Int32Array.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Float32Array.forEachi", + "id": "Js.Typed_array.Int32Array.unsafe_get", "kind": "value", - "name": "forEachi", + "name": "unsafe_get", "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Float32Array.map", + "id": "Js.Typed_array.Int32Array.unsafe_set", "kind": "value", - "name": "map", + "name": "unsafe_set", "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Float32Array.mapi", + "id": "Js.Typed_array.Int32Array.buffer", "kind": "value", - "name": "mapi", + "name": "buffer", "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Float32Array.reduce", + "id": "Js.Typed_array.Int32Array.byteLength", "kind": "value", - "name": "reduce", + "name": "byteLength", "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Float32Array.reducei", + "id": "Js.Typed_array.Int32Array.byteOffset", "kind": "value", - "name": "reducei", + "name": "byteOffset", "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Float32Array.reduceRight", + "id": "Js.Typed_array.Int32Array.length", "kind": "value", - "name": "reduceRight", + "name": "length", "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Float32Array.reduceRighti", + "id": "Js.Typed_array.Int32Array.copyWithinFromRange", "kind": "value", - "name": "reduceRighti", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.some", + "id": "Js.Typed_array.Int32Array.slice", "kind": "value", - "name": "some", + "name": "slice", "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array.somei", + "id": "Js.Typed_array.Int32Array.subarray", "kind": "value", - "name": "somei", + "name": "subarray", "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Float32Array._BYTES_PER_ELEMENT", + "id": "Js.Typed_array.Int32Array._BYTES_PER_ELEMENT", "kind": "value", "name": "_BYTES_PER_ELEMENT", "docstrings": [], "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Float32Array.make", + "id": "Js.Typed_array.Int32Array.make", "kind": "value", "name": "make", "docstrings": [], "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Float32Array.fromBuffer", + "id": "Js.Typed_array.Int32Array.fromBuffer", "kind": "value", "name": "fromBuffer", "docstrings": [ @@ -5532,7 +5295,7 @@ "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Float32Array.fromBufferOffset", + "id": "Js.Typed_array.Int32Array.fromBufferOffset", "kind": "value", "name": "fromBufferOffset", "docstrings": [ @@ -5541,7 +5304,7 @@ "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Float32Array.fromBufferRange", + "id": "Js.Typed_array.Int32Array.fromBufferRange", "kind": "value", "name": "fromBufferRange", "docstrings": [ @@ -5550,29 +5313,29 @@ "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Float32Array.fromLength", + "id": "Js.Typed_array.Int32Array.fromLength", "kind": "value", "name": "fromLength", "docstrings": [], "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Float32Array.from", + "id": "Js.Typed_array.Int32Array.from", "kind": "value", "name": "from", "docstrings": [], "signature": "let from: array_like => t" }, { - "id": "Js.Typed_array.Float32Array.create", + "id": "Js.Typed_array.Int32Array.create", "kind": "value", "name": "create", "docstrings": [], - "signature": "let create: array => t", + "signature": "let create: array => t", "deprecated": "use `make` instead" }, { - "id": "Js.Typed_array.Float32Array.of_buffer", + "id": "Js.Typed_array.Int32Array.of_buffer", "kind": "value", "name": "of_buffer", "docstrings": [], @@ -5581,13 +5344,13 @@ } ] }, - "js/typed_array/uint32array": { - "id": "Js.Typed_array.Uint32Array", - "name": "Uint32Array", + "js/typed_array/uint16array": { + "id": "Js.Typed_array.Uint16Array", + "name": "Uint16Array", "docstrings": [], "items": [ { - "id": "Js.Typed_array.Uint32Array.elt", + "id": "Js.Typed_array.Uint16Array.elt", "kind": "type", "name": "elt", "docstrings": [ @@ -5596,378 +5359,394 @@ "signature": "type elt = int" }, { - "id": "Js.Typed_array.Uint32Array.typed_array", + "id": "Js.Typed_array.Uint16Array.typed_array", "kind": "type", "name": "typed_array", "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint32Array.typed_array<'a>" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint16Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Uint32Array.t", + "id": "Js.Typed_array.Uint16Array.t", "kind": "type", "name": "t", "docstrings": [], "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Uint32Array.unsafe_get", + "id": "Js.Typed_array.Uint16Array.unsafe_get", "kind": "value", "name": "unsafe_get", "docstrings": [], "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Uint32Array.unsafe_set", + "id": "Js.Typed_array.Uint16Array.unsafe_set", "kind": "value", "name": "unsafe_set", "docstrings": [], "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Uint32Array.buffer", + "id": "Js.Typed_array.Uint16Array.buffer", "kind": "value", "name": "buffer", "docstrings": [], "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Uint32Array.byteLength", + "id": "Js.Typed_array.Uint16Array.byteLength", "kind": "value", "name": "byteLength", "docstrings": [], "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Uint32Array.byteOffset", + "id": "Js.Typed_array.Uint16Array.byteOffset", "kind": "value", "name": "byteOffset", "docstrings": [], "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Uint32Array.setArray", + "id": "Js.Typed_array.Uint16Array.length", "kind": "value", - "name": "setArray", + "name": "length", "docstrings": [], - "signature": "let setArray: (array, t) => unit" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Uint32Array.setArrayOffset", + "id": "Js.Typed_array.Uint16Array.copyWithinFromRange", "kind": "value", - "name": "setArrayOffset", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.length", + "id": "Js.Typed_array.Uint16Array.slice", "kind": "value", - "name": "length", + "name": "slice", "docstrings": [], - "signature": "let length: t => int" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.copyWithin", + "id": "Js.Typed_array.Uint16Array.subarray", "kind": "value", - "name": "copyWithin", + "name": "subarray", "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.copyWithinFrom", + "id": "Js.Typed_array.Uint16Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "copyWithinFrom", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Uint32Array.copyWithinFromRange", + "id": "Js.Typed_array.Uint16Array.make", "kind": "value", - "name": "copyWithinFromRange", + "name": "make", "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Uint32Array.fillInPlace", + "id": "Js.Typed_array.Uint16Array.fromBuffer", "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Uint32Array.fillFromInPlace", + "id": "Js.Typed_array.Uint16Array.fromBufferOffset", "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" + "name": "fromBufferOffset", + "docstrings": [ + "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Uint32Array.fillRangeInPlace", + "id": "Js.Typed_array.Uint16Array.fromBufferRange", "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" + "name": "fromBufferRange", + "docstrings": [ + "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.reverseInPlace", + "id": "Js.Typed_array.Uint16Array.fromLength", "kind": "value", - "name": "reverseInPlace", + "name": "fromLength", "docstrings": [], - "signature": "let reverseInPlace: t => t" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Uint32Array.sortInPlace", + "id": "Js.Typed_array.Uint16Array.from", "kind": "value", - "name": "sortInPlace", + "name": "from", "docstrings": [], - "signature": "let sortInPlace: t => t" - }, + "signature": "let from: array_like => t" + } + ] + }, + "js/typed_array/int16array": { + "id": "Js.Typed_array.Int16Array", + "name": "Int16Array", + "docstrings": [], + "items": [ { - "id": "Js.Typed_array.Uint32Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" + "id": "Js.Typed_array.Int16Array.elt", + "kind": "type", + "name": "elt", + "docstrings": [ + "" + ], + "signature": "type elt = int" }, { - "id": "Js.Typed_array.Uint32Array.includes", - "kind": "value", - "name": "includes", + "id": "Js.Typed_array.Int16Array.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let includes: (elt, t) => bool" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int16Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Uint32Array.indexOf", - "kind": "value", - "name": "indexOf", + "id": "Js.Typed_array.Int16Array.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let indexOf: (elt, t) => int" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Uint32Array.indexOfFrom", + "id": "Js.Typed_array.Int16Array.unsafe_get", "kind": "value", - "name": "indexOfFrom", + "name": "unsafe_get", "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Uint32Array.join", + "id": "Js.Typed_array.Int16Array.unsafe_set", "kind": "value", - "name": "join", + "name": "unsafe_set", "docstrings": [], - "signature": "let join: t => string" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Uint32Array.joinWith", + "id": "Js.Typed_array.Int16Array.buffer", "kind": "value", - "name": "joinWith", + "name": "buffer", "docstrings": [], - "signature": "let joinWith: (string, t) => string" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Uint32Array.lastIndexOf", + "id": "Js.Typed_array.Int16Array.byteLength", "kind": "value", - "name": "lastIndexOf", + "name": "byteLength", "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Uint32Array.lastIndexOfFrom", + "id": "Js.Typed_array.Int16Array.byteOffset", "kind": "value", - "name": "lastIndexOfFrom", + "name": "byteOffset", "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Uint32Array.slice", + "id": "Js.Typed_array.Int16Array.length", "kind": "value", - "name": "slice", + "name": "length", "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Uint32Array.copy", + "id": "Js.Typed_array.Int16Array.copyWithinFromRange", "kind": "value", - "name": "copy", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let copy: t => t" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.sliceFrom", + "id": "Js.Typed_array.Int16Array.slice", "kind": "value", - "name": "sliceFrom", + "name": "slice", "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.subarray", + "id": "Js.Typed_array.Int16Array.subarray", "kind": "value", "name": "subarray", "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint32Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint32Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.toLocaleString", + "id": "Js.Typed_array.Int16Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "toLocaleString", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let toLocaleString: t => string" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Uint32Array.every", + "id": "Js.Typed_array.Int16Array.make", "kind": "value", - "name": "every", + "name": "make", "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Uint32Array.everyi", + "id": "Js.Typed_array.Int16Array.fromBuffer", "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Uint32Array.filter", + "id": "Js.Typed_array.Int16Array.fromBufferOffset", "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" + "name": "fromBufferOffset", + "docstrings": [ + "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Uint32Array.filteri", + "id": "Js.Typed_array.Int16Array.fromBufferRange", "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" + "name": "fromBufferRange", + "docstrings": [ + "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.find", + "id": "Js.Typed_array.Int16Array.fromLength", "kind": "value", - "name": "find", + "name": "fromLength", "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Uint32Array.findi", + "id": "Js.Typed_array.Int16Array.from", "kind": "value", - "name": "findi", + "name": "from", "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, + "signature": "let from: array_like => t" + } + ] + }, + "js/typed_array/uint8clampedarray": { + "id": "Js.Typed_array.Uint8ClampedArray", + "name": "Uint8ClampedArray", + "docstrings": [], + "items": [ { - "id": "Js.Typed_array.Uint32Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" + "id": "Js.Typed_array.Uint8ClampedArray.elt", + "kind": "type", + "name": "elt", + "docstrings": [ + "" + ], + "signature": "type elt = int" }, { - "id": "Js.Typed_array.Uint32Array.findIndexi", - "kind": "value", - "name": "findIndexi", + "id": "Js.Typed_array.Uint8ClampedArray.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint8ClampedArray.typed_array<'a>" }, { - "id": "Js.Typed_array.Uint32Array.forEach", - "kind": "value", - "name": "forEach", + "id": "Js.Typed_array.Uint8ClampedArray.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Uint32Array.forEachi", + "id": "Js.Typed_array.Uint8ClampedArray.unsafe_get", "kind": "value", - "name": "forEachi", + "name": "unsafe_get", "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Uint32Array.map", + "id": "Js.Typed_array.Uint8ClampedArray.unsafe_set", "kind": "value", - "name": "map", + "name": "unsafe_set", "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Uint32Array.mapi", + "id": "Js.Typed_array.Uint8ClampedArray.buffer", "kind": "value", - "name": "mapi", + "name": "buffer", "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Uint32Array.reduce", + "id": "Js.Typed_array.Uint8ClampedArray.byteLength", "kind": "value", - "name": "reduce", + "name": "byteLength", "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Uint32Array.reducei", + "id": "Js.Typed_array.Uint8ClampedArray.byteOffset", "kind": "value", - "name": "reducei", + "name": "byteOffset", "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Uint32Array.reduceRight", + "id": "Js.Typed_array.Uint8ClampedArray.length", "kind": "value", - "name": "reduceRight", + "name": "length", "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Uint32Array.reduceRighti", + "id": "Js.Typed_array.Uint8ClampedArray.copyWithinFromRange", "kind": "value", - "name": "reduceRighti", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.some", + "id": "Js.Typed_array.Uint8ClampedArray.slice", "kind": "value", - "name": "some", + "name": "slice", "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.somei", + "id": "Js.Typed_array.Uint8ClampedArray.subarray", "kind": "value", - "name": "somei", + "name": "subarray", "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT", + "id": "Js.Typed_array.Uint8ClampedArray._BYTES_PER_ELEMENT", "kind": "value", "name": "_BYTES_PER_ELEMENT", "docstrings": [], "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Uint32Array.make", + "id": "Js.Typed_array.Uint8ClampedArray.make", "kind": "value", "name": "make", "docstrings": [], "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Uint32Array.fromBuffer", + "id": "Js.Typed_array.Uint8ClampedArray.fromBuffer", "kind": "value", "name": "fromBuffer", "docstrings": [ @@ -5976,7 +5755,7 @@ "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Uint32Array.fromBufferOffset", + "id": "Js.Typed_array.Uint8ClampedArray.fromBufferOffset", "kind": "value", "name": "fromBufferOffset", "docstrings": [ @@ -5985,7 +5764,7 @@ "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Uint32Array.fromBufferRange", + "id": "Js.Typed_array.Uint8ClampedArray.fromBufferRange", "kind": "value", "name": "fromBufferRange", "docstrings": [ @@ -5994,14 +5773,14 @@ "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Uint32Array.fromLength", + "id": "Js.Typed_array.Uint8ClampedArray.fromLength", "kind": "value", "name": "fromLength", "docstrings": [], "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Uint32Array.from", + "id": "Js.Typed_array.Uint8ClampedArray.from", "kind": "value", "name": "from", "docstrings": [], @@ -6009,19 +5788,13 @@ } ] }, - "js/typed_array/int32_array": { - "id": "Js.Typed_array.Int32_array", - "name": "Int32_array", - "docstrings": [], - "items": [] - }, - "js/typed_array/int32array": { - "id": "Js.Typed_array.Int32Array", - "name": "Int32Array", + "js/typed_array/uint8array": { + "id": "Js.Typed_array.Uint8Array", + "name": "Uint8Array", "docstrings": [], "items": [ { - "id": "Js.Typed_array.Int32Array.elt", + "id": "Js.Typed_array.Uint8Array.elt", "kind": "type", "name": "elt", "docstrings": [ @@ -6030,3601 +5803,684 @@ "signature": "type elt = int" }, { - "id": "Js.Typed_array.Int32Array.typed_array", + "id": "Js.Typed_array.Uint8Array.typed_array", "kind": "type", "name": "typed_array", "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int32Array.typed_array<'a>" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint8Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Int32Array.t", + "id": "Js.Typed_array.Uint8Array.t", "kind": "type", "name": "t", "docstrings": [], "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Int32Array.unsafe_get", + "id": "Js.Typed_array.Uint8Array.unsafe_get", "kind": "value", "name": "unsafe_get", "docstrings": [], "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Int32Array.unsafe_set", + "id": "Js.Typed_array.Uint8Array.unsafe_set", "kind": "value", "name": "unsafe_set", "docstrings": [], "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Int32Array.buffer", + "id": "Js.Typed_array.Uint8Array.buffer", "kind": "value", "name": "buffer", "docstrings": [], "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Int32Array.byteLength", + "id": "Js.Typed_array.Uint8Array.byteLength", "kind": "value", "name": "byteLength", "docstrings": [], "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Int32Array.byteOffset", + "id": "Js.Typed_array.Uint8Array.byteOffset", "kind": "value", "name": "byteOffset", "docstrings": [], "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Int32Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Int32Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Int32Array.length", + "id": "Js.Typed_array.Uint8Array.length", "kind": "value", "name": "length", "docstrings": [], "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Int32Array.copyWithin", + "id": "Js.Typed_array.Uint8Array.copyWithinFromRange", "kind": "value", - "name": "copyWithin", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.copyWithinFrom", + "id": "Js.Typed_array.Uint8Array.slice", "kind": "value", - "name": "copyWithinFrom", + "name": "slice", "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.copyWithinFromRange", + "id": "Js.Typed_array.Uint8Array.subarray", "kind": "value", - "name": "copyWithinFromRange", + "name": "subarray", "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.fillInPlace", + "id": "Js.Typed_array.Uint8Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "fillInPlace", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Int32Array.fillFromInPlace", + "id": "Js.Typed_array.Uint8Array.make", "kind": "value", - "name": "fillFromInPlace", + "name": "make", "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Int32Array.fillRangeInPlace", + "id": "Js.Typed_array.Uint8Array.fromBuffer", "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Int32Array.reverseInPlace", + "id": "Js.Typed_array.Uint8Array.fromBufferOffset", "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" + "name": "fromBufferOffset", + "docstrings": [ + "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Int32Array.sortInPlace", + "id": "Js.Typed_array.Uint8Array.fromBufferRange", "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" + "name": "fromBufferRange", + "docstrings": [ + "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Int32Array.sortInPlaceWith", + "id": "Js.Typed_array.Uint8Array.fromLength", "kind": "value", - "name": "sortInPlaceWith", + "name": "fromLength", "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Int32Array.includes", + "id": "Js.Typed_array.Uint8Array.from", "kind": "value", - "name": "includes", + "name": "from", "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, + "signature": "let from: array_like => t" + } + ] + }, + "js/typed_array/int8array": { + "id": "Js.Typed_array.Int8Array", + "name": "Int8Array", + "docstrings": [], + "items": [ { - "id": "Js.Typed_array.Int32Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" + "id": "Js.Typed_array.Int8Array.elt", + "kind": "type", + "name": "elt", + "docstrings": [ + "" + ], + "signature": "type elt = int" }, { - "id": "Js.Typed_array.Int32Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", + "id": "Js.Typed_array.Int8Array.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" + "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int8Array.typed_array<'a>" }, { - "id": "Js.Typed_array.Int32Array.join", - "kind": "value", - "name": "join", + "id": "Js.Typed_array.Int8Array.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let join: t => string" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Int32Array.joinWith", + "id": "Js.Typed_array.Int8Array.unsafe_get", "kind": "value", - "name": "joinWith", + "name": "unsafe_get", "docstrings": [], - "signature": "let joinWith: (string, t) => string" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Int32Array.lastIndexOf", + "id": "Js.Typed_array.Int8Array.unsafe_set", "kind": "value", - "name": "lastIndexOf", + "name": "unsafe_set", "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Int32Array.lastIndexOfFrom", + "id": "Js.Typed_array.Int8Array.buffer", "kind": "value", - "name": "lastIndexOfFrom", + "name": "buffer", "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Int32Array.slice", + "id": "Js.Typed_array.Int8Array.byteLength", "kind": "value", - "name": "slice", + "name": "byteLength", "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Int32Array.copy", + "id": "Js.Typed_array.Int8Array.byteOffset", "kind": "value", - "name": "copy", + "name": "byteOffset", "docstrings": [], - "signature": "let copy: t => t" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Int32Array.sliceFrom", + "id": "Js.Typed_array.Int8Array.length", "kind": "value", - "name": "sliceFrom", + "name": "length", "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Int32Array.subarray", + "id": "Js.Typed_array.Int8Array.copyWithinFromRange", "kind": "value", - "name": "subarray", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.subarrayFrom", + "id": "Js.Typed_array.Int8Array.slice", "kind": "value", - "name": "subarrayFrom", + "name": "slice", "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" + "signature": "let slice: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.toString", + "id": "Js.Typed_array.Int8Array.subarray", "kind": "value", - "name": "toString", + "name": "subarray", "docstrings": [], - "signature": "let toString: t => string" + "signature": "let subarray: (~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.toLocaleString", + "id": "Js.Typed_array.Int8Array._BYTES_PER_ELEMENT", "kind": "value", - "name": "toLocaleString", + "name": "_BYTES_PER_ELEMENT", "docstrings": [], - "signature": "let toLocaleString: t => string" + "signature": "let _BYTES_PER_ELEMENT: int" }, { - "id": "Js.Typed_array.Int32Array.every", + "id": "Js.Typed_array.Int8Array.make", "kind": "value", - "name": "every", + "name": "make", "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" + "signature": "let make: array => t" }, { - "id": "Js.Typed_array.Int32Array.everyi", + "id": "Js.Typed_array.Int8Array.fromBuffer", "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" + "name": "fromBuffer", + "docstrings": [ + "can throw" + ], + "signature": "let fromBuffer: array_buffer => t" }, { - "id": "Js.Typed_array.Int32Array.filter", + "id": "Js.Typed_array.Int8Array.fromBufferOffset", "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" + "name": "fromBufferOffset", + "docstrings": [ + "raise Js.Exn.Error raise Js exception\n\n param offset is in bytes" + ], + "signature": "let fromBufferOffset: (array_buffer, int) => t" }, { - "id": "Js.Typed_array.Int32Array.filteri", + "id": "Js.Typed_array.Int8Array.fromBufferRange", "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" + "name": "fromBufferRange", + "docstrings": [ + "raise Js.Exn.Error raises Js exception\n\n param offset is in bytes, length in elements" + ], + "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" }, { - "id": "Js.Typed_array.Int32Array.find", + "id": "Js.Typed_array.Int8Array.fromLength", "kind": "value", - "name": "find", + "name": "fromLength", "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" + "signature": "let fromLength: int => t" }, { - "id": "Js.Typed_array.Int32Array.findi", + "id": "Js.Typed_array.Int8Array.from", "kind": "value", - "name": "findi", + "name": "from", "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, + "signature": "let from: array_like => t" + } + ] + }, + "js/typed_array/s": { + "id": "Js.Typed_array.S", + "name": "S", + "docstrings": [], + "items": [ { - "id": "Js.Typed_array.Int32Array.findIndex", - "kind": "value", - "name": "findIndex", + "id": "Js.Typed_array.S.elt", + "kind": "type", + "name": "elt", "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" + "signature": "type elt" }, { - "id": "Js.Typed_array.Int32Array.findIndexi", - "kind": "value", - "name": "findIndexi", + "id": "Js.Typed_array.S.typed_array", + "kind": "type", + "name": "typed_array", "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" + "signature": "type typed_array<'a>" }, { - "id": "Js.Typed_array.Int32Array.forEach", - "kind": "value", - "name": "forEach", + "id": "Js.Typed_array.S.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" + "signature": "type t = typed_array" }, { - "id": "Js.Typed_array.Int32Array.forEachi", + "id": "Js.Typed_array.S.unsafe_get", "kind": "value", - "name": "forEachi", + "name": "unsafe_get", "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" + "signature": "let unsafe_get: (t, int) => elt" }, { - "id": "Js.Typed_array.Int32Array.map", + "id": "Js.Typed_array.S.unsafe_set", "kind": "value", - "name": "map", + "name": "unsafe_set", "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" + "signature": "let unsafe_set: (t, int, elt) => unit" }, { - "id": "Js.Typed_array.Int32Array.mapi", + "id": "Js.Typed_array.S.buffer", "kind": "value", - "name": "mapi", + "name": "buffer", "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" + "signature": "let buffer: t => array_buffer" }, { - "id": "Js.Typed_array.Int32Array.reduce", + "id": "Js.Typed_array.S.byteLength", "kind": "value", - "name": "reduce", + "name": "byteLength", "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let byteLength: t => int" }, { - "id": "Js.Typed_array.Int32Array.reducei", + "id": "Js.Typed_array.S.byteOffset", "kind": "value", - "name": "reducei", + "name": "byteOffset", "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let byteOffset: t => int" }, { - "id": "Js.Typed_array.Int32Array.reduceRight", + "id": "Js.Typed_array.S.length", "kind": "value", - "name": "reduceRight", + "name": "length", "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" + "signature": "let length: t => int" }, { - "id": "Js.Typed_array.Int32Array.reduceRighti", + "id": "Js.Typed_array.S.copyWithinFromRange", "kind": "value", - "name": "reduceRighti", + "name": "copyWithinFromRange", "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int) => t" }, { - "id": "Js.Typed_array.Int32Array.some", + "id": "Js.Typed_array.S.includes", "kind": "value", - "name": "some", + "name": "includes", "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" + "signature": "let includes: elt => bool" }, { - "id": "Js.Typed_array.Int32Array.somei", + "id": "Js.Typed_array.S.filter", "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int32Array._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Int32Array.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Int32Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", + "name": "filter", "docstrings": [ - "can throw" + "should we use `bool` or `boolean` seems they are intechangeable here" ], - "signature": "let fromBuffer: array_buffer => t" - }, + "signature": "let filter: (elt => bool) => t" + } + ] + }, + "js/typed_array/arraybuffer": { + "id": "Js.Typed_array.ArrayBuffer", + "name": "ArrayBuffer", + "docstrings": [ + "The underlying buffer that the typed arrays provide views of\n\n **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)" + ], + "items": [ { - "id": "Js.Typed_array.Int32Array.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" + "id": "Js.Typed_array.ArrayBuffer.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t = array_buffer" }, { - "id": "Js.Typed_array.Int32Array.fromBufferRange", + "id": "Js.Typed_array.ArrayBuffer.make", "kind": "value", - "name": "fromBufferRange", + "name": "make", "docstrings": [ - "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" + "takes length. initializes elements to 0" ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Int32Array.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Int32Array.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - }, - { - "id": "Js.Typed_array.Int32Array.create", - "kind": "value", - "name": "create", - "docstrings": [], - "signature": "let create: array => t", - "deprecated": "use `make` instead" + "signature": "let make: int => t" }, { - "id": "Js.Typed_array.Int32Array.of_buffer", + "id": "Js.Typed_array.ArrayBuffer.byteLength", "kind": "value", - "name": "of_buffer", + "name": "byteLength", "docstrings": [], - "signature": "let of_buffer: array_buffer => t", - "deprecated": "use `fromBuffer` instead" + "signature": "let byteLength: t => int" } ] }, - "js/typed_array/uint16array": { - "id": "Js.Typed_array.Uint16Array", - "name": "Uint16Array", + "js/typed_array/type": { + "id": "Js.Typed_array.Type", + "name": "Type", "docstrings": [], "items": [ { - "id": "Js.Typed_array.Uint16Array.elt", + "id": "Js.Typed_array.Type.t", "kind": "type", - "name": "elt", - "docstrings": [ - "" - ], - "signature": "type elt = int" - }, + "name": "t", + "docstrings": [], + "signature": "type t" + } + ] + }, + "js/json/kind": { + "id": "Js.Json.Kind", + "name": "Kind", + "docstrings": [], + "items": [ { - "id": "Js.Typed_array.Uint16Array.typed_array", + "id": "Js.Json.Kind.json", "kind": "type", - "name": "typed_array", + "name": "json", "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint16Array.typed_array<'a>" + "signature": "type json = t" }, { - "id": "Js.Typed_array.Uint16Array.t", + "id": "Js.Json.Kind.t", "kind": "type", "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.Uint16Array.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.Uint16Array.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.Uint16Array.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.Uint16Array.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.Uint16Array.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.Uint16Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Uint16Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Uint16Array.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.Uint16Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, + "docstrings": [ + "Underlying type of a JSON value" + ], + "signature": "type t<_> =\n | String: t\n | Number: t\n | Object: t>\n | Array: t>\n | Boolean: t\n | Null: t" + } + ] + }, + "js/weakmap": { + "id": "Js.WeakMap", + "name": "WeakMap", + "docstrings": [ + "Provides bindings for ES6 WeakMap", + "ES6 WeakMap API" + ], + "items": [ { - "id": "Js.Typed_array.Uint16Array.fillInPlace", - "kind": "value", - "name": "fillInPlace", + "id": "Js.WeakMap.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, + "signature": "type t<'k, 'v> = WeakMap.t<'k, 'v>" + } + ] + }, + "js/map": { + "id": "Js.Map", + "name": "Map", + "docstrings": [ + "Provides bindings for ES6 Map", + "ES6 Map API" + ], + "items": [ { - "id": "Js.Typed_array.Uint16Array.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", + "id": "Js.Map.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, + "signature": "type t<'k, 'v> = Map.t<'k, 'v>" + } + ] + }, + "js/weakset": { + "id": "Js.WeakSet", + "name": "WeakSet", + "docstrings": [ + "Provides bindings for ES6 WeakSet", + "ES6 WeakSet API" + ], + "items": [ { - "id": "Js.Typed_array.Uint16Array.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", + "id": "Js.WeakSet.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, + "signature": "type t<'a> = WeakSet.t<'a>" + } + ] + }, + "js/set": { + "id": "Js.Set", + "name": "Set", + "docstrings": [ + "Provides bindings for ES6 Set", + "ES6 Set API" + ], + "items": [ { - "id": "Js.Typed_array.Uint16Array.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint16Array.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint16Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Uint16Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Uint16Array.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Uint16Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Uint16Array.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Uint16Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Uint16Array.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint16Array.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint16Array.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint16Array.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint16Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint16Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint16Array.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint16Array.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint16Array.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint16Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint16Array.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint16Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint16Array.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint16Array.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint16Array.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint16Array._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Uint16Array.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Uint16Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "can throw" - ], - "signature": "let fromBuffer: array_buffer => t" - }, - { - "id": "Js.Typed_array.Uint16Array.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.fromBufferRange", - "kind": "value", - "name": "fromBufferRange", - "docstrings": [ - "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" - ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Uint16Array.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Uint16Array.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - } - ] - }, - "js/typed_array/int16array": { - "id": "Js.Typed_array.Int16Array", - "name": "Int16Array", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.Int16Array.elt", - "kind": "type", - "name": "elt", - "docstrings": [ - "" - ], - "signature": "type elt = int" - }, - { - "id": "Js.Typed_array.Int16Array.typed_array", - "kind": "type", - "name": "typed_array", - "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int16Array.typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int16Array.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.Int16Array.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.Int16Array.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.Int16Array.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.Int16Array.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.Int16Array.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.Int16Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Int16Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Int16Array.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.Int16Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Int16Array.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Int16Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Int16Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Int16Array.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Int16Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Int16Array.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Int16Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Int16Array.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int16Array.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int16Array.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Int16Array.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Int16Array.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Int16Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Int16Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Int16Array.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Int16Array.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int16Array.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int16Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int16Array.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int16Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int16Array.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int16Array.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int16Array.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int16Array._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Int16Array.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Int16Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "can throw" - ], - "signature": "let fromBuffer: array_buffer => t" - }, - { - "id": "Js.Typed_array.Int16Array.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" - }, - { - "id": "Js.Typed_array.Int16Array.fromBufferRange", - "kind": "value", - "name": "fromBufferRange", - "docstrings": [ - "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" - ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Int16Array.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Int16Array.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - } - ] - }, - "js/typed_array/uint8clampedarray": { - "id": "Js.Typed_array.Uint8ClampedArray", - "name": "Uint8ClampedArray", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.Uint8ClampedArray.elt", - "kind": "type", - "name": "elt", - "docstrings": [ - "" - ], - "signature": "type elt = int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.typed_array", - "kind": "type", - "name": "typed_array", - "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint8ClampedArray.typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "can throw" - ], - "signature": "let fromBuffer: array_buffer => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fromBufferRange", - "kind": "value", - "name": "fromBufferRange", - "docstrings": [ - "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" - ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Uint8ClampedArray.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - } - ] - }, - "js/typed_array/uint8array": { - "id": "Js.Typed_array.Uint8Array", - "name": "Uint8Array", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.Uint8Array.elt", - "kind": "type", - "name": "elt", - "docstrings": [ - "" - ], - "signature": "type elt = int" - }, - { - "id": "Js.Typed_array.Uint8Array.typed_array", - "kind": "type", - "name": "typed_array", - "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Uint8Array.typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8Array.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.Uint8Array.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.Uint8Array.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.Uint8Array.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.Uint8Array.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.Uint8Array.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.Uint8Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8Array.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.Uint8Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint8Array.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Uint8Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Uint8Array.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Uint8Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Uint8Array.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Uint8Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Uint8Array.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8Array.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8Array.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint8Array.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Uint8Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Uint8Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8Array.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Uint8Array.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8Array.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Uint8Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8Array.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8Array.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Uint8Array.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8Array.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Uint8Array._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Uint8Array.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "can throw" - ], - "signature": "let fromBuffer: array_buffer => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "**raise** Js.Exn.Error raise Js exception\n\n **param** offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fromBufferRange", - "kind": "value", - "name": "fromBufferRange", - "docstrings": [ - "**raise** Js.Exn.Error raises Js exception\n\n **param** offset is in bytes, length in elements" - ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Uint8Array.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Uint8Array.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - } - ] - }, - "js/typed_array/int8array": { - "id": "Js.Typed_array.Int8Array", - "name": "Int8Array", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.Int8Array.elt", - "kind": "type", - "name": "elt", - "docstrings": [ - "" - ], - "signature": "type elt = int" - }, - { - "id": "Js.Typed_array.Int8Array.typed_array", - "kind": "type", - "name": "typed_array", - "docstrings": [], - "signature": "type typed_array<\n 'a,\n> = Js_typed_array2.Int8Array.typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int8Array.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.Int8Array.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.Int8Array.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.Int8Array.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.Int8Array.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.Int8Array.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.Int8Array.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.Int8Array.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.Int8Array.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.Int8Array.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.Int8Array.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.Int8Array.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.Int8Array.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.Int8Array.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.Int8Array.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.Int8Array.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.Int8Array.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.Int8Array.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int8Array.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int8Array.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.Int8Array.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Int8Array.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.Int8Array.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.Int8Array.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Int8Array.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.Int8Array.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int8Array.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'a, t) => typed_array<'a>" - }, - { - "id": "Js.Typed_array.Int8Array.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int8Array.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int8Array.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('a, elt) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int8Array.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('a, elt, int) => 'a, 'a, t) => 'a" - }, - { - "id": "Js.Typed_array.Int8Array.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int8Array.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.Int8Array._BYTES_PER_ELEMENT", - "kind": "value", - "name": "_BYTES_PER_ELEMENT", - "docstrings": [], - "signature": "let _BYTES_PER_ELEMENT: int" - }, - { - "id": "Js.Typed_array.Int8Array.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: array => t" - }, - { - "id": "Js.Typed_array.Int8Array.fromBuffer", - "kind": "value", - "name": "fromBuffer", - "docstrings": [ - "can throw" - ], - "signature": "let fromBuffer: array_buffer => t" - }, - { - "id": "Js.Typed_array.Int8Array.fromBufferOffset", - "kind": "value", - "name": "fromBufferOffset", - "docstrings": [ - "raise Js.Exn.Error raise Js exception\n\n param offset is in bytes" - ], - "signature": "let fromBufferOffset: (array_buffer, int) => t" - }, - { - "id": "Js.Typed_array.Int8Array.fromBufferRange", - "kind": "value", - "name": "fromBufferRange", - "docstrings": [ - "raise Js.Exn.Error raises Js exception\n\n param offset is in bytes, length in elements" - ], - "signature": "let fromBufferRange: (array_buffer, ~offset: int, ~length: int) => t" - }, - { - "id": "Js.Typed_array.Int8Array.fromLength", - "kind": "value", - "name": "fromLength", - "docstrings": [], - "signature": "let fromLength: int => t" - }, - { - "id": "Js.Typed_array.Int8Array.from", - "kind": "value", - "name": "from", - "docstrings": [], - "signature": "let from: array_like => t" - } - ] - }, - "js/typed_array/s": { - "id": "Js.Typed_array.S", - "name": "S", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.S.elt", - "kind": "type", - "name": "elt", - "docstrings": [], - "signature": "type elt" - }, - { - "id": "Js.Typed_array.S.typed_array", - "kind": "type", - "name": "typed_array", - "docstrings": [], - "signature": "type typed_array<'a>" - }, - { - "id": "Js.Typed_array.S.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = typed_array" - }, - { - "id": "Js.Typed_array.S.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t, int) => elt" - }, - { - "id": "Js.Typed_array.S.unsafe_set", - "kind": "value", - "name": "unsafe_set", - "docstrings": [], - "signature": "let unsafe_set: (t, int, elt) => unit" - }, - { - "id": "Js.Typed_array.S.buffer", - "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => array_buffer" - }, - { - "id": "Js.Typed_array.S.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.S.byteOffset", - "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" - }, - { - "id": "Js.Typed_array.S.setArray", - "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (array, t) => unit" - }, - { - "id": "Js.Typed_array.S.setArrayOffset", - "kind": "value", - "name": "setArrayOffset", - "docstrings": [], - "signature": "let setArrayOffset: (array, int, t) => unit" - }, - { - "id": "Js.Typed_array.S.length", - "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t => int" - }, - { - "id": "Js.Typed_array.S.copyWithin", - "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (~to_: int, t) => t" - }, - { - "id": "Js.Typed_array.S.copyWithinFrom", - "kind": "value", - "name": "copyWithinFrom", - "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.S.copyWithinFromRange", - "kind": "value", - "name": "copyWithinFromRange", - "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.S.fillInPlace", - "kind": "value", - "name": "fillInPlace", - "docstrings": [], - "signature": "let fillInPlace: (elt, t) => t" - }, - { - "id": "Js.Typed_array.S.fillFromInPlace", - "kind": "value", - "name": "fillFromInPlace", - "docstrings": [], - "signature": "let fillFromInPlace: (elt, ~from: int, t) => t" - }, - { - "id": "Js.Typed_array.S.fillRangeInPlace", - "kind": "value", - "name": "fillRangeInPlace", - "docstrings": [], - "signature": "let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.S.reverseInPlace", - "kind": "value", - "name": "reverseInPlace", - "docstrings": [], - "signature": "let reverseInPlace: t => t" - }, - { - "id": "Js.Typed_array.S.sortInPlace", - "kind": "value", - "name": "sortInPlace", - "docstrings": [], - "signature": "let sortInPlace: t => t" - }, - { - "id": "Js.Typed_array.S.sortInPlaceWith", - "kind": "value", - "name": "sortInPlaceWith", - "docstrings": [], - "signature": "let sortInPlaceWith: ((elt, elt) => int, t) => t" - }, - { - "id": "Js.Typed_array.S.includes", - "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (elt, t) => bool" - }, - { - "id": "Js.Typed_array.S.indexOf", - "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.S.indexOfFrom", - "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.S.join", - "kind": "value", - "name": "join", - "docstrings": [], - "signature": "let join: t => string" - }, - { - "id": "Js.Typed_array.S.joinWith", - "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (string, t) => string" - }, - { - "id": "Js.Typed_array.S.lastIndexOf", - "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (elt, t) => int" - }, - { - "id": "Js.Typed_array.S.lastIndexOfFrom", - "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (elt, ~from: int, t) => int" - }, - { - "id": "Js.Typed_array.S.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.S.copy", - "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t => t" - }, - { - "id": "Js.Typed_array.S.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.S.subarray", - "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (~start: int, ~end_: int, t) => t" - }, - { - "id": "Js.Typed_array.S.subarrayFrom", - "kind": "value", - "name": "subarrayFrom", - "docstrings": [], - "signature": "let subarrayFrom: (int, t) => t" - }, - { - "id": "Js.Typed_array.S.toString", - "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t => string" - }, - { - "id": "Js.Typed_array.S.toLocaleString", - "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t => string" - }, - { - "id": "Js.Typed_array.S.every", - "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.S.everyi", - "kind": "value", - "name": "everyi", - "docstrings": [], - "signature": "let everyi: ((elt, int) => bool, t) => bool" - }, - { - "id": "Js.Typed_array.S.filter", - "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (elt => bool, t) => t" - }, - { - "id": "Js.Typed_array.S.filteri", - "kind": "value", - "name": "filteri", - "docstrings": [], - "signature": "let filteri: ((elt, int) => bool, t) => t" - }, - { - "id": "Js.Typed_array.S.find", - "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (elt => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.S.findi", - "kind": "value", - "name": "findi", - "docstrings": [], - "signature": "let findi: ((elt, int) => bool, t) => Js.undefined" - }, - { - "id": "Js.Typed_array.S.findIndex", - "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (elt => bool, t) => int" - }, - { - "id": "Js.Typed_array.S.findIndexi", - "kind": "value", - "name": "findIndexi", - "docstrings": [], - "signature": "let findIndexi: ((elt, int) => bool, t) => int" - }, - { - "id": "Js.Typed_array.S.forEach", - "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (elt => unit, t) => unit" - }, - { - "id": "Js.Typed_array.S.forEachi", - "kind": "value", - "name": "forEachi", - "docstrings": [], - "signature": "let forEachi: ((elt, int) => unit, t) => unit" - }, - { - "id": "Js.Typed_array.S.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (elt => 'b, t) => typed_array<'b>" - }, - { - "id": "Js.Typed_array.S.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((elt, int) => 'b, t) => typed_array<'b>" - }, - { - "id": "Js.Typed_array.S.reduce", - "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (('b, elt) => 'b, 'b, t) => 'b" - }, - { - "id": "Js.Typed_array.S.reducei", - "kind": "value", - "name": "reducei", - "docstrings": [], - "signature": "let reducei: (('b, elt, int) => 'b, 'b, t) => 'b" - }, - { - "id": "Js.Typed_array.S.reduceRight", - "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (('b, elt) => 'b, 'b, t) => 'b" - }, - { - "id": "Js.Typed_array.S.reduceRighti", - "kind": "value", - "name": "reduceRighti", - "docstrings": [], - "signature": "let reduceRighti: (('b, elt, int) => 'b, 'b, t) => 'b" - }, - { - "id": "Js.Typed_array.S.some", - "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (elt => bool, t) => bool" - }, - { - "id": "Js.Typed_array.S.somei", - "kind": "value", - "name": "somei", - "docstrings": [], - "signature": "let somei: ((elt, int) => bool, t) => bool" - } - ] - }, - "js/typed_array/arraybuffer": { - "id": "Js.Typed_array.ArrayBuffer", - "name": "ArrayBuffer", - "docstrings": [ - "The underlying buffer that the typed arrays provide views of\n\n **see** [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)" - ], - "items": [ - { - "id": "Js.Typed_array.ArrayBuffer.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = array_buffer" - }, - { - "id": "Js.Typed_array.ArrayBuffer.make", - "kind": "value", - "name": "make", - "docstrings": [ - "takes length. initializes elements to 0" - ], - "signature": "let make: int => t" - }, - { - "id": "Js.Typed_array.ArrayBuffer.byteLength", - "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" - }, - { - "id": "Js.Typed_array.ArrayBuffer.slice", - "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t) => array_buffer" - }, - { - "id": "Js.Typed_array.ArrayBuffer.sliceFrom", - "kind": "value", - "name": "sliceFrom", - "docstrings": [], - "signature": "let sliceFrom: (int, t) => array_buffer" - } - ] - }, - "js/typed_array/type": { - "id": "Js.Typed_array.Type", - "name": "Type", - "docstrings": [], - "items": [ - { - "id": "Js.Typed_array.Type.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - } - ] - }, - "js/json/kind": { - "id": "Js.Json.Kind", - "name": "Kind", - "docstrings": [], - "items": [ - { - "id": "Js.Json.Kind.json", - "kind": "type", - "name": "json", - "docstrings": [], - "signature": "type json = t" - }, - { - "id": "Js.Json.Kind.t", - "kind": "type", - "name": "t", - "docstrings": [ - "Underlying type of a JSON value" - ], - "signature": "type t<_> =\n | String: t\n | Number: t\n | Object: t>\n | Array: t>\n | Boolean: t\n | Null: t" - } - ] - }, - "js/weakmap": { - "id": "Js.WeakMap", - "name": "WeakMap", - "docstrings": [ - "Provides bindings for ES6 WeakMap", - "ES6 WeakMap API" - ], - "items": [ - { - "id": "Js.WeakMap.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'k, 'v>" - } - ] - }, - "js/map": { - "id": "Js.Map", - "name": "Map", - "docstrings": [ - "Provides bindings for ES6 Map", - "ES6 Map API" - ], - "items": [ - { - "id": "Js.Map.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'k, 'v>" - } - ] - }, - "js/weakset": { - "id": "Js.WeakSet", - "name": "WeakSet", - "docstrings": [ - "Provides bindings for ES6 WeakSet", - "ES6 WeakSet API" - ], - "items": [ - { - "id": "Js.WeakSet.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a>" - } - ] - }, - "js/set": { - "id": "Js.Set", - "name": "Set", - "docstrings": [ - "Provides bindings for ES6 Set", - "ES6 Set API" - ], - "items": [ - { - "id": "Js.Set.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a>" - } - ] - }, - "js/console": { - "id": "Js.Console", - "name": "Console", - "docstrings": [ - "Provides bindings for console" - ], - "items": [ - { - "id": "Js.Console.log", - "kind": "value", - "name": "log", - "docstrings": [], - "signature": "let log: 'a => unit" - }, - { - "id": "Js.Console.log2", - "kind": "value", - "name": "log2", - "docstrings": [], - "signature": "let log2: ('a, 'b) => unit" - }, - { - "id": "Js.Console.log3", - "kind": "value", - "name": "log3", - "docstrings": [], - "signature": "let log3: ('a, 'b, 'c) => unit" - }, - { - "id": "Js.Console.log4", - "kind": "value", - "name": "log4", - "docstrings": [], - "signature": "let log4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Js.Console.logMany", - "kind": "value", - "name": "logMany", - "docstrings": [], - "signature": "let logMany: array<'a> => unit" - }, - { - "id": "Js.Console.info", - "kind": "value", - "name": "info", - "docstrings": [], - "signature": "let info: 'a => unit" - }, - { - "id": "Js.Console.info2", - "kind": "value", - "name": "info2", - "docstrings": [], - "signature": "let info2: ('a, 'b) => unit" - }, - { - "id": "Js.Console.info3", - "kind": "value", - "name": "info3", - "docstrings": [], - "signature": "let info3: ('a, 'b, 'c) => unit" - }, - { - "id": "Js.Console.info4", - "kind": "value", - "name": "info4", - "docstrings": [], - "signature": "let info4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Js.Console.infoMany", - "kind": "value", - "name": "infoMany", - "docstrings": [], - "signature": "let infoMany: array<'a> => unit" - }, - { - "id": "Js.Console.warn", - "kind": "value", - "name": "warn", - "docstrings": [], - "signature": "let warn: 'a => unit" - }, - { - "id": "Js.Console.warn2", - "kind": "value", - "name": "warn2", - "docstrings": [], - "signature": "let warn2: ('a, 'b) => unit" - }, - { - "id": "Js.Console.warn3", - "kind": "value", - "name": "warn3", - "docstrings": [], - "signature": "let warn3: ('a, 'b, 'c) => unit" - }, - { - "id": "Js.Console.warn4", - "kind": "value", - "name": "warn4", - "docstrings": [], - "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Js.Console.warnMany", - "kind": "value", - "name": "warnMany", - "docstrings": [], - "signature": "let warnMany: array<'a> => unit" - }, - { - "id": "Js.Console.error", - "kind": "value", - "name": "error", - "docstrings": [], - "signature": "let error: 'a => unit" - }, - { - "id": "Js.Console.error2", - "kind": "value", - "name": "error2", - "docstrings": [], - "signature": "let error2: ('a, 'b) => unit" - }, - { - "id": "Js.Console.error3", - "kind": "value", - "name": "error3", - "docstrings": [], - "signature": "let error3: ('a, 'b, 'c) => unit" - }, - { - "id": "Js.Console.error4", - "kind": "value", - "name": "error4", - "docstrings": [], - "signature": "let error4: ('a, 'b, 'c, 'd) => unit" - }, - { - "id": "Js.Console.errorMany", - "kind": "value", - "name": "errorMany", - "docstrings": [], - "signature": "let errorMany: array<'a> => unit" - }, - { - "id": "Js.Console.trace", - "kind": "value", - "name": "trace", - "docstrings": [], - "signature": "let trace: unit => unit" - }, - { - "id": "Js.Console.timeStart", - "kind": "value", - "name": "timeStart", - "docstrings": [], - "signature": "let timeStart: string => unit" - }, - { - "id": "Js.Console.timeEnd", - "kind": "value", - "name": "timeEnd", - "docstrings": [], - "signature": "let timeEnd: string => unit" - } - ] - }, - "js/vector": { - "id": "Js.Vector", - "name": "Vector", - "docstrings": [ - "Provides bindings for JS Vector" - ], - "items": [ - { - "id": "Js.Vector.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a> = array<'a>" - }, - { - "id": "Js.Vector.filterInPlace", - "kind": "value", - "name": "filterInPlace", - "docstrings": [], - "signature": "let filterInPlace: ('a => bool, t<'a>) => unit" - }, - { - "id": "Js.Vector.empty", - "kind": "value", - "name": "empty", - "docstrings": [], - "signature": "let empty: t<'a> => unit" - }, - { - "id": "Js.Vector.pushBack", - "kind": "value", - "name": "pushBack", - "docstrings": [], - "signature": "let pushBack: ('a, t<'a>) => unit" - }, - { - "id": "Js.Vector.copy", - "kind": "value", - "name": "copy", - "docstrings": [ - "shallow copy" - ], - "signature": "let copy: t<'a> => t<'a>" - }, - { - "id": "Js.Vector.memByRef", - "kind": "value", - "name": "memByRef", - "docstrings": [], - "signature": "let memByRef: ('a, t<'a>) => bool" - }, - { - "id": "Js.Vector.iter", - "kind": "value", - "name": "iter", - "docstrings": [], - "signature": "let iter: ('a => unit, t<'a>) => unit" - }, - { - "id": "Js.Vector.iteri", - "kind": "value", - "name": "iteri", - "docstrings": [], - "signature": "let iteri: ((int, 'a) => unit, t<'a>) => unit" - }, - { - "id": "Js.Vector.toList", - "kind": "value", - "name": "toList", - "docstrings": [], - "signature": "let toList: t<'a> => list<'a>" - }, - { - "id": "Js.Vector.map", - "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: ('a => 'b, t<'a>) => t<'b>" - }, - { - "id": "Js.Vector.mapi", - "kind": "value", - "name": "mapi", - "docstrings": [], - "signature": "let mapi: ((int, 'a) => 'b, t<'a>) => t<'b>" - }, - { - "id": "Js.Vector.foldLeft", - "kind": "value", - "name": "foldLeft", - "docstrings": [], - "signature": "let foldLeft: (('a, 'b) => 'a, 'a, t<'b>) => 'a" - }, - { - "id": "Js.Vector.foldRight", - "kind": "value", - "name": "foldRight", - "docstrings": [], - "signature": "let foldRight: (('b, 'a) => 'a, t<'b>, 'a) => 'a" - }, - { - "id": "Js.Vector.length", - "kind": "value", - "name": "length", - "docstrings": [ - "Return the length (number of elements) of the given array." - ], - "signature": "let length: t<'a> => int" - }, - { - "id": "Js.Vector.get", - "kind": "value", - "name": "get", - "docstrings": [ - "`Vector.get(a, n)` returns the element number `n` of vector `a`. The first\nelement has number 0. The last element has number `Vector.length(a) - 1`. You\ncan also write `a[n]` instead of `Vector.get(a, n)`. Raise `Invalid_argument\n\"index out of bounds\"` if `n` is outside the range 0 to (`Array.length(a) -\n1`)." - ], - "signature": "let get: (t<'a>, int) => 'a" - }, - { - "id": "Js.Vector.set", - "kind": "value", - "name": "set", - "docstrings": [ - "`Vector.set(a, n, x)` modifies vector `a` in place, replacing element number\n`n` with `x`. Raise `Invalid_argument \"index out of bounds\"` if `n` is outside\nthe range 0 to `Array.length(a) - 1`." - ], - "signature": "let set: (t<'a>, int, 'a) => unit" - }, - { - "id": "Js.Vector.make", - "kind": "value", - "name": "make", - "docstrings": [ - "`Vector.make(n, x)` returns a fresh vector of length `n`, initialized with `x`.\nAll the elements of this new vector are initially physically equal to `x` (in\nthe sense of the `==` predicate). Consequently, if `x` is mutable, it is shared\namong all elements of the array, and modifying `x` through one of the array\nentries will modify all other entries at the same time. Raise\n`Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the value of\n`x` is a floating-point number, then the maximum size is only\n`Sys.max_array_length / 2`." - ], - "signature": "let make: (int, 'a) => t<'a>" - }, - { - "id": "Js.Vector.init", - "kind": "value", - "name": "init", - "docstrings": [ - "Raises `RangeError` when n is negative.\nn : size" - ], - "signature": "let init: (int, int => 'a) => t<'a>" - }, - { - "id": "Js.Vector.append", - "kind": "value", - "name": "append", - "docstrings": [ - "`append(x, a)` returns a fresh vector with `x` appended to `a`." - ], - "signature": "let append: ('a, t<'a>) => t<'a>" - }, - { - "id": "Js.Vector.unsafe_get", - "kind": "value", - "name": "unsafe_get", - "docstrings": [], - "signature": "let unsafe_get: (t<'a>, int) => 'a" - }, - { - "id": "Js.Vector.unsafe_set", - "kind": "value", - "name": "unsafe_set", + "id": "Js.Set.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let unsafe_set: (t<'a>, int, 'a) => unit" + "signature": "type t<'a> = Set.t<'a>" } ] }, - "js/list": { - "id": "Js.List", - "name": "List", + "js/console": { + "id": "Js.Console", + "name": "Console", "docstrings": [ - "Provide utilities for list" + "Provides bindings for console" ], "items": [ { - "id": "Js.List.t", - "kind": "type", - "name": "t", + "id": "Js.Console.log", + "kind": "value", + "name": "log", "docstrings": [], - "signature": "type t<'a> = list<'a>" + "signature": "let log: 'a => unit" }, { - "id": "Js.List.length", + "id": "Js.Console.log2", "kind": "value", - "name": "length", + "name": "log2", "docstrings": [], - "signature": "let length: t<'a> => int" + "signature": "let log2: ('a, 'b) => unit" }, { - "id": "Js.List.cons", + "id": "Js.Console.log3", "kind": "value", - "name": "cons", + "name": "log3", "docstrings": [], - "signature": "let cons: ('a, t<'a>) => t<'a>" + "signature": "let log3: ('a, 'b, 'c) => unit" }, { - "id": "Js.List.isEmpty", + "id": "Js.Console.log4", "kind": "value", - "name": "isEmpty", + "name": "log4", "docstrings": [], - "signature": "let isEmpty: t<'a> => bool" + "signature": "let log4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Js.List.hd", + "id": "Js.Console.logMany", "kind": "value", - "name": "hd", + "name": "logMany", "docstrings": [], - "signature": "let hd: t<'a> => option<'a>" + "signature": "let logMany: array<'a> => unit" }, { - "id": "Js.List.tl", + "id": "Js.Console.info", "kind": "value", - "name": "tl", + "name": "info", "docstrings": [], - "signature": "let tl: t<'a> => option>" + "signature": "let info: 'a => unit" }, { - "id": "Js.List.nth", + "id": "Js.Console.info2", "kind": "value", - "name": "nth", + "name": "info2", "docstrings": [], - "signature": "let nth: (t<'a>, int) => option<'a>" + "signature": "let info2: ('a, 'b) => unit" }, { - "id": "Js.List.revAppend", + "id": "Js.Console.info3", "kind": "value", - "name": "revAppend", + "name": "info3", "docstrings": [], - "signature": "let revAppend: (t<'a>, t<'a>) => t<'a>" + "signature": "let info3: ('a, 'b, 'c) => unit" }, { - "id": "Js.List.rev", + "id": "Js.Console.info4", "kind": "value", - "name": "rev", + "name": "info4", "docstrings": [], - "signature": "let rev: t<'a> => t<'a>" + "signature": "let info4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Js.List.mapRev", + "id": "Js.Console.infoMany", "kind": "value", - "name": "mapRev", + "name": "infoMany", "docstrings": [], - "signature": "let mapRev: ('a => 'b, t<'a>) => t<'b>" + "signature": "let infoMany: array<'a> => unit" }, { - "id": "Js.List.map", + "id": "Js.Console.warn", "kind": "value", - "name": "map", + "name": "warn", "docstrings": [], - "signature": "let map: ('a => 'b, t<'a>) => t<'b>" + "signature": "let warn: 'a => unit" }, { - "id": "Js.List.iter", + "id": "Js.Console.warn2", "kind": "value", - "name": "iter", + "name": "warn2", "docstrings": [], - "signature": "let iter: ('a => unit, t<'a>) => unit" + "signature": "let warn2: ('a, 'b) => unit" }, { - "id": "Js.List.iteri", + "id": "Js.Console.warn3", "kind": "value", - "name": "iteri", + "name": "warn3", "docstrings": [], - "signature": "let iteri: ((int, 'a) => unit, t<'a>) => unit" + "signature": "let warn3: ('a, 'b, 'c) => unit" }, { - "id": "Js.List.foldLeft", + "id": "Js.Console.warn4", "kind": "value", - "name": "foldLeft", - "docstrings": [ - "Application order is left to right, tail recurisve" - ], - "signature": "let foldLeft: (('a, 'b) => 'a, 'a, list<'b>) => 'a" + "name": "warn4", + "docstrings": [], + "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Js.List.foldRight", + "id": "Js.Console.warnMany", "kind": "value", - "name": "foldRight", - "docstrings": [ - "Application order is right to left tail-recursive." - ], - "signature": "let foldRight: (('a, 'b) => 'b, list<'a>, 'b) => 'b" + "name": "warnMany", + "docstrings": [], + "signature": "let warnMany: array<'a> => unit" }, { - "id": "Js.List.flatten", + "id": "Js.Console.error", "kind": "value", - "name": "flatten", + "name": "error", "docstrings": [], - "signature": "let flatten: t> => t<'a>" + "signature": "let error: 'a => unit" }, { - "id": "Js.List.filter", + "id": "Js.Console.error2", "kind": "value", - "name": "filter", + "name": "error2", + "docstrings": [], + "signature": "let error2: ('a, 'b) => unit" + }, + { + "id": "Js.Console.error3", + "kind": "value", + "name": "error3", "docstrings": [], - "signature": "let filter: ('a => bool, t<'a>) => t<'a>" + "signature": "let error3: ('a, 'b, 'c) => unit" }, { - "id": "Js.List.filterMap", + "id": "Js.Console.error4", "kind": "value", - "name": "filterMap", + "name": "error4", "docstrings": [], - "signature": "let filterMap: ('a => option<'b>, t<'a>) => t<'b>" + "signature": "let error4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Js.List.countBy", + "id": "Js.Console.errorMany", "kind": "value", - "name": "countBy", + "name": "errorMany", "docstrings": [], - "signature": "let countBy: ('a => bool, list<'a>) => int" + "signature": "let errorMany: array<'a> => unit" }, { - "id": "Js.List.init", + "id": "Js.Console.trace", "kind": "value", - "name": "init", + "name": "trace", "docstrings": [], - "signature": "let init: (int, int => 'a) => t<'a>" + "signature": "let trace: unit => unit" }, { - "id": "Js.List.toVector", + "id": "Js.Console.timeStart", "kind": "value", - "name": "toVector", + "name": "timeStart", "docstrings": [], - "signature": "let toVector: t<'a> => array<'a>" + "signature": "let timeStart: string => unit" }, { - "id": "Js.List.equal", + "id": "Js.Console.timeEnd", "kind": "value", - "name": "equal", + "name": "timeEnd", "docstrings": [], - "signature": "let equal: (('a, 'a) => bool, list<'a>, list<'a>) => bool" + "signature": "let timeEnd: string => unit" } ] }, @@ -10140,23 +6996,14 @@ "docstrings": [ "Js symbol type (only available in ES6)" ], - "signature": "type symbol" - }, - { - "id": "Js.Types.bigint_val", - "kind": "type", - "name": "bigint_val", - "docstrings": [ - "Js bigint type only available in ES2020" - ], - "signature": "type bigint_val" + "signature": "type symbol = Symbol.t" }, { "id": "Js.Types.obj_val", "kind": "type", "name": "obj_val", "docstrings": [], - "signature": "type obj_val" + "signature": "type obj_val = Type.Classify.object" }, { "id": "Js.Types.undefined_val", @@ -10181,14 +7028,14 @@ "kind": "type", "name": "function_val", "docstrings": [], - "signature": "type function_val" + "signature": "type function_val = Type.Classify.function" }, { "id": "Js.Types.t", "kind": "type", "name": "t", "docstrings": [], - "signature": "type t<_> =\n | Undefined: t\n | Null: t\n | Boolean: t\n | Number: t\n | String: t\n | Function: t\n | Object: t\n | Symbol: t\n | BigInt: t" + "signature": "type t<_> =\n | Undefined: t\n | Null: t\n | Boolean: t\n | Number: t\n | String: t\n | Function: t\n | Object: t\n | Symbol: t\n | BigInt: t" }, { "id": "Js.Types.test", @@ -10204,7 +7051,7 @@ "kind": "type", "name": "tagged_t", "docstrings": [], - "signature": "type tagged_t =\n | JSFalse\n | JSTrue\n | JSNull\n | JSUndefined\n | JSNumber(float)\n | JSString(string)\n | JSFunction(function_val)\n | JSObject(obj_val)\n | JSSymbol(symbol)\n | JSBigInt(bigint_val)" + "signature": "type tagged_t =\n | JSFalse\n | JSTrue\n | JSNull\n | JSUndefined\n | JSNumber(float)\n | JSString(string)\n | JSFunction(function_val)\n | JSObject(obj_val)\n | JSSymbol(symbol)\n | JSBigInt(bigint)" }, { "id": "Js.Types.classify", @@ -10228,7 +7075,7 @@ "kind": "type", "name": "array_buffer", "docstrings": [], - "signature": "type array_buffer" + "signature": "type array_buffer = ArrayBuffer.t" }, { "id": "Js.TypedArray2.array_like", @@ -10898,14 +7745,14 @@ "docstrings": [ "The JSON data structure" ], - "signature": "type t =\n | Boolean(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Js.Dict.t)\n | Array(array)" + "signature": "@unboxed\ntype t = JSON.t =\n | Boolean(bool)\n | @as(null) Null\n | String(string)\n | Number(float)\n | Object(dict)\n | Array(array)" }, { "id": "Js.Json.tagged_t", "kind": "type", "name": "tagged_t", "docstrings": [], - "signature": "type tagged_t =\n | JSONFalse\n | JSONTrue\n | JSONNull\n | JSONString(string)\n | JSONNumber(float)\n | JSONObject(Js_dict.t)\n | JSONArray(array)" + "signature": "type tagged_t =\n | JSONFalse\n | JSONTrue\n | JSONNull\n | JSONString(string)\n | JSONNumber(float)\n | JSONObject(dict)\n | JSONArray(array)" }, { "id": "Js.Json.classify", @@ -10948,7 +7795,7 @@ "docstrings": [ "`decodeObject(json)` returns `Some(o)` if `json` is an `object`, `None` otherwise." ], - "signature": "let decodeObject: t => option>" + "signature": "let decodeObject: t => option>" }, { "id": "Js.Json.decodeArray", @@ -11018,9 +7865,9 @@ "kind": "value", "name": "object_", "docstrings": [ - "`object_(dict)` makes a JSON object of the `Js.Dict.t` `dict`." + "`object_(dict)` makes a JSON object of the `dict`." ], - "signature": "let object_: Js_dict.t => t" + "signature": "let object_: dict => t" }, { "id": "Js.Json.array", @@ -11065,14 +7912,14 @@ "docstrings": [ "`objectArray(a) makes a JSON array of the `JsDict.t` array `a`." ], - "signature": "let objectArray: array> => t" + "signature": "let objectArray: array> => t" }, { "id": "Js.Json.parseExn", "kind": "value", "name": "parseExn", "docstrings": [ - "`parseExn(s)` parses the `string` `s` into a JSON data structure.\nReturns a JSON data structure.\nRaises `SyntaxError` if the given string is not a valid JSON. Note: `SyntaxError` is a JavaScript exception.\n\nSee [`parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) on MDN.\n\n## Examples\n\n```rescript\n/* parse a simple JSON string */\n\nlet json = try Js.Json.parseExn(` \"hello\" `) catch {\n| _ => failwith(\"Error parsing JSON string\")\n}\n\nswitch Js.Json.classify(json) {\n| Js.Json.JSONString(value) => Js.log(value)\n| _ => failwith(\"Expected a string\")\n}\n```\n\n```rescript\n/* parse a complex JSON string */\n\nlet getIds = s => {\n let json = try Js.Json.parseExn(s) catch {\n | _ => failwith(\"Error parsing JSON string\")\n }\n\n switch Js.Json.classify(json) {\n | Js.Json.JSONObject(value) =>\n /* In this branch, compiler infer value : Js.Json.t Js.Dict.t */\n switch Js.Dict.get(value, \"ids\") {\n | Some(ids) =>\n switch Js.Json.classify(ids) {\n | Js.Json.JSONArray(ids) => /* In this branch compiler infer ids : Js.Json.t array */\n ids\n | _ => failwith(\"Expected an array\")\n }\n | None => failwith(\"Expected an `ids` property\")\n }\n | _ => failwith(\"Expected an object\")\n }\n}\n\n/* prints `1, 2, 3` */\nJs.log(getIds(` { \"ids\" : [1, 2, 3 ] } `))\n```" + "`parseExn(s)` parses the `string` `s` into a JSON data structure.\nReturns a JSON data structure.\nRaises `SyntaxError` if the given string is not a valid JSON. Note: `SyntaxError` is a JavaScript exception.\n\nSee [`parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) on MDN.\n\n## Examples\n\n```rescript\n/* parse a simple JSON string */\n\nlet json = try Js.Json.parseExn(` \"hello\" `) catch {\n| _ => failwith(\"Error parsing JSON string\")\n}\n\nswitch Js.Json.classify(json) {\n| Js.Json.JSONString(value) => Js.log(value)\n| _ => failwith(\"Expected a string\")\n}\n```\n\n```rescript\n/* parse a complex JSON string */\n\nlet getIds = s => {\n let json = try Js.Json.parseExn(s) catch {\n | _ => failwith(\"Error parsing JSON string\")\n }\n\n switch Js.Json.classify(json) {\n | Js.Json.JSONObject(value) =>\n /* In this branch, compiler infer value : Js.Json.t dict */\n switch Js.Dict.get(value, \"ids\") {\n | Some(ids) =>\n switch Js.Json.classify(ids) {\n | Js.Json.JSONArray(ids) => /* In this branch compiler infer ids : Js.Json.t array */\n ids\n | _ => failwith(\"Expected an array\")\n }\n | None => failwith(\"Expected an `ids` property\")\n }\n | _ => failwith(\"Expected an object\")\n }\n}\n\n/* prints `1, 2, 3` */\nJs.log(getIds(` { \"ids\" : [1, 2, 3 ] } `))\n```" ], "signature": "let parseExn: string => t" }, @@ -11138,7 +7985,7 @@ "docstrings": [ "Identify an interval started by `Js.Global.setInterval`." ], - "signature": "type intervalId" + "signature": "type intervalId = Global.intervalId" }, { "id": "Js.Global.timeoutId", @@ -11147,7 +7994,7 @@ "docstrings": [ "Identify timeout started by `Js.Global.setTimeout`." ], - "signature": "type timeoutId" + "signature": "type timeoutId = Global.timeoutId" }, { "id": "Js.Global.clearInterval", @@ -11379,7 +8226,7 @@ "kind": "type", "name": "t", "docstrings": [], - "signature": "type t" + "signature": "type t = Date.t" }, { "id": "Js.Date.valueOf", @@ -12338,28 +9185,28 @@ "kind": "value", "name": "then_", "docstrings": [], - "signature": "let then_: ('a => promise<'b>, promise<'a>) => promise<'b>" + "signature": "let then_: (promise<'a>, 'a => promise<'b>) => promise<'b>" }, { - "id": "Js.Promise.catch", + "id": "Js.Promise.then_", "kind": "value", - "name": "catch", + "name": "then_", "docstrings": [], - "signature": "let catch: (error => promise<'a>, promise<'a>) => promise<'a>" + "signature": "let then_: ('a => promise<'b>, promise<'a>) => promise<'b>" }, { - "id": "Js.Promise.unsafe_async", + "id": "Js.Promise.catch", "kind": "value", - "name": "unsafe_async", + "name": "catch", "docstrings": [], - "signature": "let unsafe_async: 'a => promise<'a>" + "signature": "let catch: (promise<'a>, error => promise<'a>) => promise<'a>" }, { - "id": "Js.Promise.unsafe_await", + "id": "Js.Promise.catch", "kind": "value", - "name": "unsafe_await", + "name": "catch", "docstrings": [], - "signature": "let unsafe_await: promise<'a> => 'a" + "signature": "let catch: (error => promise<'a>, promise<'a>) => promise<'a>" } ] }, @@ -12378,7 +9225,7 @@ "docstrings": [ "The RegExp object." ], - "signature": "type t" + "signature": "type t = RegExp.t" }, { "id": "Js.Re.result", @@ -12396,7 +9243,7 @@ "docstrings": [ "An `array` of the match and captures, the first is the full match and the\nremaining are the substring captures." ], - "signature": "let captures: result => array>" + "signature": "let captures: result => array>" }, { "id": "Js.Re.matches", @@ -12429,7 +9276,7 @@ "kind": "value", "name": "fromString", "docstrings": [ - "Constructs a RegExp object (Js.Re.t) from a `string`.\nRegex literals `%re(\"/.../\")` should generally be preferred, but `fromString`\nis useful when you need to dynamically construct a regex using strings,\nexactly like when you do so in JavaScript.\n\n## Examples\n\n```rescript\nlet firstReScriptFileExtension = (filename, content) => {\n let result = Js.Re.fromString(filename ++ \"\\.(res|resi)\")->Js.Re.exec_(content)\n switch result {\n | Some(r) => Js.Nullable.toOption(Js.Re.captures(r)[1])\n | None => None\n }\n}\n\n// outputs \"res\"\nfirstReScriptFileExtension(\"School\", \"School.res School.resi Main.js School.bs.js\")\n```" + "Constructs a RegExp object (Js.Re.t) from a `string`.\nRegex literals `/.../` should generally be preferred, but `fromString`\nis useful when you need to dynamically construct a regex using strings,\nexactly like when you do so in JavaScript.\n\n## Examples\n\n```rescript\nlet firstReScriptFileExtension = (filename, content) => {\n let result = Js.Re.fromString(filename ++ \"\\.(res|resi)\")->Js.Re.exec_(content)\n switch result {\n | Some(r) => Js.Nullable.toOption(Js.Re.captures(r)[1])\n | None => None\n }\n}\n\n// outputs \"res\"\nfirstReScriptFileExtension(\"School\", \"School.res School.resi Main.js School.bs.js\")\n```" ], "signature": "let fromString: string => t" }, @@ -12474,7 +9321,7 @@ "kind": "value", "name": "lastIndex", "docstrings": [ - "Returns the index where the next match will start its search. This property\nwill be modified when the RegExp object is used, if the global (\"g\") flag is\nset.\n\n## Examples\n\n```rescript\nlet re = %re(\"/ab*TODO/g\")\nlet str = \"abbcdefabh\"\n\nlet break = ref(false)\nwhile !break.contents {\n switch Js.Re.exec_(re, str) {\n | Some(result) => Js.Nullable.iter(Js.Re.captures(result)[0], (. match_) => {\n let next = Belt.Int.toString(Js.Re.lastIndex(re))\n Js.log(\"Found \" ++ (match_ ++ (\". Next match starts at \" ++ next)))\n })\n | None => break := true\n }\n}\n```\n\nSee\n[`RegExp: lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex)\non MDN." + "Returns the index where the next match will start its search. This property\nwill be modified when the RegExp object is used, if the global (\"g\") flag is\nset.\n\n## Examples\n\n```rescript\nlet re = /ab*TODO/g\nlet str = \"abbcdefabh\"\n\nlet break = ref(false)\nwhile !break.contents {\n switch Js.Re.exec_(re, str) {\n | Some(result) => Js.Nullable.iter(Js.Re.captures(result)[0], (. match_) => {\n let next = Belt.Int.toString(Js.Re.lastIndex(re))\n Js.log(\"Found \" ++ (match_ ++ (\". Next match starts at \" ++ next)))\n })\n | None => break := true\n }\n}\n```\n\nSee\n[`RegExp: lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex)\non MDN." ], "signature": "let lastIndex: t => int" }, @@ -12528,7 +9375,7 @@ "kind": "value", "name": "exec_", "docstrings": [ - "Executes a search on a given string using the given RegExp object.\nReturns `Some(Js.Re.result)` if a match is found, `None` otherwise.\n\n## Examples\n\n```rescript\n/* Match \"quick brown\" followed by \"jumps\", ignoring characters in between\n * Remember \"brown\" and \"jumps\"\n * Ignore case\n */\n\nlet re = %re(\"/quick\\s(brown).+?(jumps)/ig\")\nlet result = Js.Re.exec_(re, \"The Quick Brown Fox Jumps Over The Lazy Dog\")\n```\n\nSee [`RegExp.prototype.exec()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec)\non MDN." + "Executes a search on a given string using the given RegExp object.\nReturns `Some(Js.Re.result)` if a match is found, `None` otherwise.\n\n## Examples\n\n```rescript\n/* Match \"quick brown\" followed by \"jumps\", ignoring characters in between\n * Remember \"brown\" and \"jumps\"\n * Ignore case\n */\n\nlet re = /quick\\s(brown).+?(jumps)/ig\nlet result = Js.Re.exec_(re, \"The Quick Brown Fox Jumps Over The Lazy Dog\")\n```\n\nSee [`RegExp.prototype.exec()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec)\non MDN." ], "signature": "let exec_: (t, string) => option" }, @@ -12752,7 +9599,7 @@ "kind": "value", "name": "match_", "docstrings": [ - "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\n there 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.\n\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.match_(\"The better bats\", %re(\"/b[aeiou]t/\")) == Some([\"bet\"])\nJs.String2.match_(\"The better bats\", %re(\"/b[aeiou]t/g\")) == Some([\"bet\", \"bat\"])\nJs.String2.match_(\"Today is 2018-04-05.\", %re(\"/(\\d+)-(\\d+)-(\\d+)/\")) ==\n Some([\"2018-04-05\", \"2018\", \"04\", \"05\"])\nJs.String2.match_(\"The large container.\", %re(\"/b[aeiou]g/\")) == None\n```" + "`match(str, regexp)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\n there 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.\n\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.match_(\"The better bats\", /b[aeiou]t/) == Some([\"bet\"])\nJs.String2.match_(\"The better bats\", /b[aeiou]t/g) == Some([\"bet\", \"bat\"])\nJs.String2.match_(\"Today is 2018-04-05.\", /(\\d+)-(\\d+)-(\\d+)/) ==\n Some([\"2018-04-05\", \"2018\", \"04\", \"05\"])\nJs.String2.match_(\"The large container.\", /b[aeiou]g/) == None\n```" ], "signature": "let match_: (t, Js_re.t) => option>>" }, @@ -12797,7 +9644,7 @@ "kind": "value", "name": "replaceByRe", "docstrings": [ - "`replaceByRe(str, regex, replacement)` returns a new `string` where occurrences\nmatching regex have been replaced by `replacement`.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.replaceByRe(\"vowels be gone\", %re(\"/[aeiou]/g\"), \"x\") == \"vxwxls bx gxnx\"\nJs.String2.replaceByRe(\"Juan Fulano\", %re(\"/(\\w+) (\\w+)/\"), \"$2, $1\") == \"Fulano, Juan\"\n```" + "`replaceByRe(str, regex, replacement)` returns a new `string` where occurrences\nmatching regex have been replaced by `replacement`.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.replaceByRe(\"vowels be gone\", /[aeiou]/g, \"x\") == \"vxwxls bx gxnx\"\nJs.String2.replaceByRe(\"Juan Fulano\", /(\\w+) (\\w+)/, \"$2, $1\") == \"Fulano, Juan\"\n```" ], "signature": "let replaceByRe: (t, Js_re.t, t) => t" }, @@ -12806,7 +9653,7 @@ "kind": "value", "name": "unsafeReplaceBy0", "docstrings": [ - "Returns a new `string` with some or all matches of a pattern with no capturing\nparentheses replaced by the value returned from the given function. The\nfunction receives as its parameters the matched string, the offset at which the\nmatch begins, and the whole string being matched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = %re(\"/[aeiou]/g\")\nlet matchFn = (matchPart, _offset, _wholeString) => Js.String2.toUpperCase(matchPart)\n\nJs.String2.unsafeReplaceBy0(str, re, matchFn) == \"bEAUtIfUl vOwEls\"\n```" + "Returns a new `string` with some or all matches of a pattern with no capturing\nparentheses replaced by the value returned from the given function. The\nfunction receives as its parameters the matched string, the offset at which the\nmatch begins, and the whole string being matched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = /[aeiou]/g\nlet matchFn = (matchPart, _offset, _wholeString) => Js.String2.toUpperCase(matchPart)\n\nJs.String2.unsafeReplaceBy0(str, re, matchFn) == \"bEAUtIfUl vOwEls\"\n```" ], "signature": "let unsafeReplaceBy0: (t, Js_re.t, (t, int, t) => t) => t" }, @@ -12815,7 +9662,7 @@ "kind": "value", "name": "unsafeReplaceBy1", "docstrings": [ - "Returns a new `string` with some or all matches of a pattern with one set of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstring, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = %re(\"/(Jony is )\\d+/g\")\nlet matchFn = (_match, part1, _offset, _wholeString) => {\n part1 ++ \"41\"\n}\n\nJs.String2.unsafeReplaceBy1(str, re, matchFn) == \"Jony is 41\"\n```" + "Returns a new `string` with some or all matches of a pattern with one set of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstring, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = /(Jony is )\\d+/g\nlet matchFn = (_match, part1, _offset, _wholeString) => {\n part1 ++ \"41\"\n}\n\nJs.String2.unsafeReplaceBy1(str, re, matchFn) == \"Jony is 41\"\n```" ], "signature": "let unsafeReplaceBy1: (t, Js_re.t, (t, t, int, t) => t) => t" }, @@ -12824,7 +9671,7 @@ "kind": "value", "name": "unsafeReplaceBy2", "docstrings": [ - "Returns a new `string` with some or all matches of a pattern with two sets of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstrings, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = %re(\"/(\\d+) times (\\d+)/\")\nlet matchFn = (_match, p1, p2, _offset, _wholeString) => {\n switch (Belt.Int.fromString(p1), Belt.Int.fromString(p2)) {\n | (Some(x), Some(y)) => Belt.Int.toString(x * y)\n | _ => \"???\"\n }\n}\n\nJs.String2.unsafeReplaceBy2(str, re, matchFn) == \"42\"\n```" + "Returns a new `string` with some or all matches of a pattern with two sets of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstrings, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = /(\\d+) times (\\d+)/\nlet matchFn = (_match, p1, p2, _offset, _wholeString) => {\n switch (Belt.Int.fromString(p1), Belt.Int.fromString(p2)) {\n | (Some(x), Some(y)) => Belt.Int.toString(x * y)\n | _ => \"???\"\n }\n}\n\nJs.String2.unsafeReplaceBy2(str, re, matchFn) == \"42\"\n```" ], "signature": "let unsafeReplaceBy2: (t, Js_re.t, (t, t, t, int, t) => t) => t" }, @@ -12842,7 +9689,7 @@ "kind": "value", "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.\n\nSee [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.search(\"testing 1 2 3\", %re(\"/\\d+/\")) == 8\nJs.String2.search(\"no numbers\", %re(\"/\\d+/\")) == -1\n```" + "`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.\n\nSee [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.search(\"testing 1 2 3\", /\\d+/) == 8\nJs.String2.search(\"no numbers\", /\\d+/) == -1\n```" ], "signature": "let search: (t, Js_re.t) => int" }, @@ -12887,7 +9734,7 @@ "kind": "value", "name": "splitByRe", "docstrings": [ - "`splitByRe(str, regex)` splits the given `str` at every occurrence of `regex`\nand returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.splitByRe(\"art; bed , cog ;dad\", %re(\"/\\s*[,;]\\s*TODO/\")) == [\n Some(\"art\"),\n Some(\"bed\"),\n Some(\"cog\"),\n Some(\"dad\"),\n ]\n```" + "`splitByRe(str, regex)` splits the given `str` at every occurrence of `regex`\nand returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.splitByRe(\"art; bed , cog ;dad\", /\\s*[,;]\\s*TODO/) == [\n Some(\"art\"),\n Some(\"bed\"),\n Some(\"cog\"),\n Some(\"dad\"),\n ]\n```" ], "signature": "let splitByRe: (t, Js_re.t) => array>" }, @@ -12896,7 +9743,7 @@ "kind": "value", "name": "splitByReAtMost", "docstrings": [ - "`splitByReAtMost(str, regex, ~limit:n)` splits the given `str` at every\noccurrence of `regex` and returns an array of the first `n` resulting\nsubstrings. If `n` is negative or greater than the number of substrings, the\narray will contain all the substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*TODO/\"), ~limit=3) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n ]\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*TODO/\"), ~limit=0) == []\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*TODO/\"), ~limit=8) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n Some(\"four\"),\n ]\n```" + "`splitByReAtMost(str, regex, ~limit:n)` splits the given `str` at every\noccurrence of `regex` and returns an array of the first `n` resulting\nsubstrings. If `n` is negative or greater than the number of substrings, the\narray will contain all the substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String2.splitByReAtMost(\"one: two: three: four\", /\\s*:\\s*TODO/, ~limit=3) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n ]\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", /\\s*:\\s*TODO/, ~limit=0) == []\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", /\\s*:\\s*TODO/, ~limit=8) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n Some(\"four\"),\n ]\n```" ], "signature": "let splitByReAtMost: (t, Js_re.t, ~limit: int) => array>" }, @@ -13106,6 +9953,15 @@ ], "signature": "let get: (t, int) => t" }, + { + "id": "Js.String.charAt", + "kind": "value", + "name": "charAt", + "docstrings": [ + "`charAt(n, s)` gets the character at index `n` within string `s`. If `n` is\nnegative or greater than the length of `s`, it returns the empty string. If the\nstring contains characters outside the range \\u0000-\\uffff, it will return the\nfirst 16-bit value at that position in the string.\n\nSee [`String.charAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.charAt(0, \"Reason\") == \"R\"\nJs.String.charAt(12, \"Reason\") == \"\"\nJs.String.charAt(5, `Rẽasöń`) == `ń`\n```" + ], + "signature": "let charAt: (t, int) => t" + }, { "id": "Js.String.charAt", "kind": "value", @@ -13113,6 +9969,15 @@ "docstrings": [], "signature": "let charAt: (int, t) => t" }, + { + "id": "Js.String.charCodeAt", + "kind": "value", + "name": "charCodeAt", + "docstrings": [ + "`charCodeAt(n, s)` returns the character code at position `n` in string `s`;\nthe result is in the range 0-65535, unlke `codePointAt`, so it will not work\ncorrectly for characters with code points greater than or equal to 0x10000. The\nreturn type is `float` because this function returns NaN if `n` is less than\nzero or greater than the length of the string.\n\nSee [`String.charCodeAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.charCodeAt(0, `😺`) == 0xd83d->Belt.Int.toFloat\nJs.String.codePointAt(0, `😺`) == Some(0x1f63a)\n```" + ], + "signature": "let charCodeAt: (t, int) => float" + }, { "id": "Js.String.charCodeAt", "kind": "value", @@ -13120,6 +9985,15 @@ "docstrings": [], "signature": "let charCodeAt: (int, t) => float" }, + { + "id": "Js.String.codePointAt", + "kind": "value", + "name": "codePointAt", + "docstrings": [ + "`codePointAt(n, s)` returns the code point at position `n` within string `s` as\na `Some(value)`. The return value handles code points greater than or equal to\n0x10000. If there is no code point at the given position, the function returns\n`None`.\n\nSee [`String.codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.codePointAt(1, `¿😺?`) == Some(0x1f63a)\nJs.String.codePointAt(5, \"abc\") == None\n```" + ], + "signature": "let codePointAt: (t, int) => option" + }, { "id": "Js.String.codePointAt", "kind": "value", @@ -13127,6 +10001,15 @@ "docstrings": [], "signature": "let codePointAt: (int, t) => option" }, + { + "id": "Js.String.concat", + "kind": "value", + "name": "concat", + "docstrings": [ + "`concat(append, original)` returns a new `string` with `append` added after\n`original`.\n\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.concat(\"bell\", \"cow\") == \"cowbell\"\n```" + ], + "signature": "let concat: (t, t) => t" + }, { "id": "Js.String.concat", "kind": "value", @@ -13134,6 +10017,15 @@ "docstrings": [], "signature": "let concat: (t, t) => t" }, + { + "id": "Js.String.concatMany", + "kind": "value", + "name": "concatMany", + "docstrings": [ + "`concat(arr, original)` returns a new `string` consisting of each item of an\narray of strings added to the `original` string.\n\nSee [`String.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.concatMany([\"2nd\", \"3rd\", \"4th\"], \"1st\") == \"1st2nd3rd4th\"\n```" + ], + "signature": "let concatMany: (t, array) => t" + }, { "id": "Js.String.concatMany", "kind": "value", @@ -13141,6 +10033,15 @@ "docstrings": [], "signature": "let concatMany: (array, t) => t" }, + { + "id": "Js.String.endsWith", + "kind": "value", + "name": "endsWith", + "docstrings": [ + "ES2015: `endsWith(substr, str)` returns `true` if the `str` ends with `substr`,\n`false` otherwise.\n\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.endsWith(\"Script\", \"ReScript\") == true\nJs.String.endsWith(\"Script\", \"C++\") == false\n```" + ], + "signature": "let endsWith: (t, t) => bool" + }, { "id": "Js.String.endsWith", "kind": "value", @@ -13148,6 +10049,15 @@ "docstrings": [], "signature": "let endsWith: (t, t) => bool" }, + { + "id": "Js.String.endsWithFrom", + "kind": "value", + "name": "endsWithFrom", + "docstrings": [ + "`endsWithFrom(ending, len, str)` 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`. (Honestly, this should\nhave been named endsWithAt, but oh well.)\n\nSee [`String.endsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.endsWithFrom(\"cd\", 4, \"abcd\") == true\nJs.String.endsWithFrom(\"cd\", 3, \"abcde\") == false\nJs.String.endsWithFrom(\"cde\", 99, \"abcde\") == true\nJs.String.endsWithFrom(\"ple\", 7, \"example.dat\") == true\n```" + ], + "signature": "let endsWithFrom: (t, t, int) => bool" + }, { "id": "Js.String.endsWithFrom", "kind": "value", @@ -13155,6 +10065,15 @@ "docstrings": [], "signature": "let endsWithFrom: (t, int, t) => bool" }, + { + "id": "Js.String.includes", + "kind": "value", + "name": "includes", + "docstrings": [ + "ES2015: `includes(searchValue, str)` returns `true` if `searchValue` is found\nanywhere within `str`, false otherwise.\n\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.includes(\"gram\", \"programmer\") == true\nJs.String.includes(\"er\", \"programmer\") == true\nJs.String.includes(\"pro\", \"programmer\") == true\nJs.String.includes(\"xyz\", \"programmer.dat\") == false\n```" + ], + "signature": "let includes: (t, t) => bool" + }, { "id": "Js.String.includes", "kind": "value", @@ -13162,6 +10081,15 @@ "docstrings": [], "signature": "let includes: (t, t) => bool" }, + { + "id": "Js.String.includesFrom", + "kind": "value", + "name": "includesFrom", + "docstrings": [ + "ES2015: `includes(searchValue start, str)` returns `true` if `searchValue` is\nfound anywhere within `str` starting at character number `start` (where 0 is\nthe first character), `false` otherwise.\n\nSee [`String.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.includesFrom(\"gram\", 1, \"programmer\") == true\nJs.String.includesFrom(\"gram\", 4, \"programmer\") == false\nJs.String.includesFrom(`한`, 1, `대한민국`) == true\n```" + ], + "signature": "let includesFrom: (t, t, int) => bool" + }, { "id": "Js.String.includesFrom", "kind": "value", @@ -13169,6 +10097,15 @@ "docstrings": [], "signature": "let includesFrom: (t, int, t) => bool" }, + { + "id": "Js.String.indexOf", + "kind": "value", + "name": "indexOf", + "docstrings": [ + "ES2015: `indexOf(searchValue, str)` returns the position at which `searchValue`\nwas first found within `str`, or -1 if `searchValue` is not in `str`.\n\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.indexOf(\"ok\", \"bookseller\") == 2\nJs.String.indexOf(\"sell\", \"bookseller\") == 4\nJs.String.indexOf(\"ee\", \"beekeeper\") == 1\nJs.String.indexOf(\"xyz\", \"bookseller\") == -1\n```" + ], + "signature": "let indexOf: (t, t) => int" + }, { "id": "Js.String.indexOf", "kind": "value", @@ -13176,6 +10113,15 @@ "docstrings": [], "signature": "let indexOf: (t, t) => int" }, + { + "id": "Js.String.indexOfFrom", + "kind": "value", + "name": "indexOfFrom", + "docstrings": [ + "`indexOfFrom(searchValue, start, str)` 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.\n\nSee [`String.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.indexOfFrom(\"ok\", 1, \"bookseller\") == 2\nJs.String.indexOfFrom(\"sell\", 2, \"bookseller\") == 4\nJs.String.indexOfFrom(\"sell\", 5, \"bookseller\") == -1\n```" + ], + "signature": "let indexOfFrom: (t, t, int) => int" + }, { "id": "Js.String.indexOfFrom", "kind": "value", @@ -13183,6 +10129,15 @@ "docstrings": [], "signature": "let indexOfFrom: (t, int, t) => int" }, + { + "id": "Js.String.lastIndexOf", + "kind": "value", + "name": "lastIndexOf", + "docstrings": [ + "`lastIndexOf(searchValue, str)` 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.\n\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.lastIndexOf(\"ok\", \"bookseller\") == 2\nJs.String.lastIndexOf(\"ee\", \"beekeeper\") == 4\nJs.String.lastIndexOf(\"xyz\", \"abcdefg\") == -1\n```" + ], + "signature": "let lastIndexOf: (t, t) => int" + }, { "id": "Js.String.lastIndexOf", "kind": "value", @@ -13190,6 +10145,15 @@ "docstrings": [], "signature": "let lastIndexOf: (t, t) => int" }, + { + "id": "Js.String.lastIndexOfFrom", + "kind": "value", + "name": "lastIndexOfFrom", + "docstrings": [ + "`lastIndexOfFrom(searchValue, start, str)` 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.\n\nSee [`String.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.lastIndexOfFrom(\"ok\", 6, \"bookseller\") == 2\nJs.String.lastIndexOfFrom(\"ee\", 8, \"beekeeper\") == 4\nJs.String.lastIndexOfFrom(\"ee\", 3, \"beekeeper\") == 1\nJs.String.lastIndexOfFrom(\"xyz\", 4, \"abcdefg\") == -1\n```" + ], + "signature": "let lastIndexOfFrom: (t, t, int) => int" + }, { "id": "Js.String.lastIndexOfFrom", "kind": "value", @@ -13197,6 +10161,15 @@ "docstrings": [], "signature": "let lastIndexOfFrom: (t, int, t) => int" }, + { + "id": "Js.String.localeCompare", + "kind": "value", + "name": "localeCompare", + "docstrings": [ + "`localeCompare(comparison, reference)` returns\n- a negative value if reference comes before comparison in sort order\n- zero if reference and comparison have the same sort order\n- a positive value if reference comes after comparison in sort order\n\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\nJs.String.localeCompare(\"ant\", \"zebra\") > 0.0\nJs.String.localeCompare(\"zebra\", \"ant\") < 0.0\nJs.String.localeCompare(\"cat\", \"cat\") == 0.0\nJs.String.localeCompare(\"cat\", \"CAT\") > 0.0\n```" + ], + "signature": "let localeCompare: (t, t) => float" + }, { "id": "Js.String.localeCompare", "kind": "value", @@ -13204,6 +10177,15 @@ "docstrings": [], "signature": "let localeCompare: (t, t) => float" }, + { + "id": "Js.String.match_", + "kind": "value", + "name": "match_", + "docstrings": [ + "`match(regexp, str)` matches a `string` against the given `regexp`. If there is\nno match, it returns `None`. For regular expressions without the g modifier, if\n there 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\n\nFor regular expressions with the g modifier, a matched expression returns\n`Some(array)` with all the matched substrings and no capture groups.\n\nSee [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.match_(/b[aeiou]t/, \"The better bats\") == Some([\"bet\"])\nJs.String.match_(/b[aeiou]t/g, \"The better bats\") == Some([\"bet\", \"bat\"])\nJs.String.match_(/(\\d+)-(\\d+)-(\\d+)/, \"Today is 2018-04-05.\") ==\n Some([\"2018-04-05\", \"2018\", \"04\", \"05\"])\nJs.String.match_(/b[aeiou]g/, \"The large container.\") == None\n```" + ], + "signature": "let match_: (t, Js_re.t) => option>>" + }, { "id": "Js.String.match_", "kind": "value", @@ -13220,6 +10202,15 @@ ], "signature": "let normalize: t => t" }, + { + "id": "Js.String.normalizeByForm", + "kind": "value", + "name": "normalizeByForm", + "docstrings": [ + "ES2015: `normalize(form, str)` returns the normalized Unicode string using the specified 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.\n\nSee [`String.normalize`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize) on MDN.\n\nSee also [Unicode technical report #15](https://unicode.org/reports/tr15/) for details." + ], + "signature": "let normalizeByForm: (t, t) => t" + }, { "id": "Js.String.normalizeByForm", "kind": "value", @@ -13227,6 +10218,15 @@ "docstrings": [], "signature": "let normalizeByForm: (t, t) => t" }, + { + "id": "Js.String.repeat", + "kind": "value", + "name": "repeat", + "docstrings": [ + "`repeat(n, str)` returns a `string` that consists of `n` repetitions of `str`.\nRaises `RangeError` if `n` is negative.\n\nSee [`String.repeat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.repeat(3, \"ha\") == \"hahaha\"\nJs.String.repeat(0, \"empty\") == \"\"\n```" + ], + "signature": "let repeat: (t, int) => t" + }, { "id": "Js.String.repeat", "kind": "value", @@ -13234,6 +10234,15 @@ "docstrings": [], "signature": "let repeat: (int, t) => t" }, + { + "id": "Js.String.replace", + "kind": "value", + "name": "replace", + "docstrings": [ + "ES2015: `replace(substr, newSubstr, str)` 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.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.replace(\"old\", \"new\", \"old string\") == \"new string\"\nJs.String.replace(\"the\", \"this\", \"the cat and the dog\") == \"this cat and the dog\"\n```" + ], + "signature": "let replace: (t, t, t) => t" + }, { "id": "Js.String.replace", "kind": "value", @@ -13241,6 +10250,15 @@ "docstrings": [], "signature": "let replace: (t, t, t) => t" }, + { + "id": "Js.String.replaceByRe", + "kind": "value", + "name": "replaceByRe", + "docstrings": [ + "`replaceByRe(regex, replacement, str)` returns a new `string` where occurrences\nmatching regex have been replaced by `replacement`.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.replaceByRe(/[aeiou]/g, \"x\", \"vowels be gone\") == \"vxwxls bx gxnx\"\nJs.String.replaceByRe(/(\\w+) (\\w+)/, \"$2, $1\", \"Juan Fulano\") == \"Fulano, Juan\"\n```" + ], + "signature": "let replaceByRe: (t, Js_re.t, t) => t" + }, { "id": "Js.String.replaceByRe", "kind": "value", @@ -13248,6 +10266,15 @@ "docstrings": [], "signature": "let replaceByRe: (Js_re.t, t, t) => t" }, + { + "id": "Js.String.unsafeReplaceBy0", + "kind": "value", + "name": "unsafeReplaceBy0", + "docstrings": [ + "Returns a new `string` with some or all matches of a pattern with no capturing\nparentheses replaced by the value returned from the given function. The\nfunction receives as its parameters the matched string, the offset at which the\nmatch begins, and the whole string being matched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"beautiful vowels\"\nlet re = /[aeiou]/g\nlet matchFn = (matchPart, _offset, _wholeString) => Js.String.toUpperCase(matchPart)\n\nJs.String.unsafeReplaceBy0(re, matchFn, str) == \"bEAUtIfUl vOwEls\"\n```" + ], + "signature": "let unsafeReplaceBy0: (t, Js_re.t, (t, int, t) => t) => t" + }, { "id": "Js.String.unsafeReplaceBy0", "kind": "value", @@ -13255,6 +10282,15 @@ "docstrings": [], "signature": "let unsafeReplaceBy0: (Js_re.t, (t, int, t) => t, t) => t" }, + { + "id": "Js.String.unsafeReplaceBy1", + "kind": "value", + "name": "unsafeReplaceBy1", + "docstrings": [ + "Returns a new `string` with some or all matches of a pattern with one set of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstring, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"Jony is 40\"\nlet re = /(Jony is )\\d+/g\nlet matchFn = (_match, part1, _offset, _wholeString) => {\n part1 ++ \"41\"\n}\n\nJs.String.unsafeReplaceBy1(re, matchFn, str) == \"Jony is 41\"\n```" + ], + "signature": "let unsafeReplaceBy1: (t, Js_re.t, (t, t, int, t) => t) => t" + }, { "id": "Js.String.unsafeReplaceBy1", "kind": "value", @@ -13262,6 +10298,15 @@ "docstrings": [], "signature": "let unsafeReplaceBy1: (Js_re.t, (t, t, int, t) => t, t) => t" }, + { + "id": "Js.String.unsafeReplaceBy2", + "kind": "value", + "name": "unsafeReplaceBy2", + "docstrings": [ + "Returns a new `string` with some or all matches of a pattern with two sets of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstrings, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN.\n\n## Examples\n\n```rescript\nlet str = \"7 times 6\"\nlet re = /(\\d+) times (\\d+)/\nlet matchFn = (_match, p1, p2, _offset, _wholeString) => {\n switch (Belt.Int.fromString(p1), Belt.Int.fromString(p2)) {\n | (Some(x), Some(y)) => Belt.Int.toString(x * y)\n | _ => \"???\"\n }\n}\n\nJs.String.unsafeReplaceBy2(re, matchFn, str) == \"42\"\n```" + ], + "signature": "let unsafeReplaceBy2: (t, Js_re.t, (t, t, t, int, t) => t) => t" + }, { "id": "Js.String.unsafeReplaceBy2", "kind": "value", @@ -13269,6 +10314,15 @@ "docstrings": [], "signature": "let unsafeReplaceBy2: (Js_re.t, (t, t, t, int, t) => t, t) => t" }, + { + "id": "Js.String.unsafeReplaceBy3", + "kind": "value", + "name": "unsafeReplaceBy3", + "docstrings": [ + "Returns a new `string` with some or all matches of a pattern with three sets of\ncapturing parentheses replaced by the value returned from the given function.\nThe function receives as its parameters the matched string, the captured\nstrings, the offset at which the match begins, and the whole string being\nmatched.\n\nSee [`String.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\non MDN." + ], + "signature": "let unsafeReplaceBy3: (t, Js_re.t, (t, t, t, t, int, t) => t) => t" + }, { "id": "Js.String.unsafeReplaceBy3", "kind": "value", @@ -13276,6 +10330,15 @@ "docstrings": [], "signature": "let unsafeReplaceBy3: (Js_re.t, (t, t, t, t, int, t) => t, t) => t" }, + { + "id": "Js.String.search", + "kind": "value", + "name": "search", + "docstrings": [ + "`search(regexp, str)` returns the starting position of the first match of\n`regexp` in the given `str`, or -1 if there is no match.\n\nSee [`String.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.search(/\\d+/, \"testing 1 2 3\") == 8\nJs.String.search(/\\d+/, \"no numbers\") == -1\n```" + ], + "signature": "let search: (t, Js_re.t) => int" + }, { "id": "Js.String.search", "kind": "value", @@ -13283,6 +10346,15 @@ "docstrings": [], "signature": "let search: (Js_re.t, t) => int" }, + { + "id": "Js.String.slice", + "kind": "value", + "name": "slice", + "docstrings": [ + "`slice(from:n1, to_:n2, str)` returns the substring of `str` starting at\ncharacter `n1` up to but not including `n2`.\n- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`.\n- If `n2` is greater than the length of `str`, then it is treated as `length(str)`.\n- If `n1` is greater than `n2`, slice returns the empty string.\n\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\nJs.String.slice(~from=2, ~to_=5, \"abcdefg\") == \"cde\"\nJs.String.slice(~from=2, ~to_=9, \"abcdefg\") == \"cdefg\"\nJs.String.slice(~from=-4, ~to_=-2, \"abcdefg\") == \"de\"\nJs.String.slice(~from=5, ~to_=1, \"abcdefg\") == \"\"\n```" + ], + "signature": "let slice: (t, ~from: int, ~to_: int) => t" + }, { "id": "Js.String.slice", "kind": "value", @@ -13290,6 +10362,15 @@ "docstrings": [], "signature": "let slice: (~from: int, ~to_: int, t) => t" }, + { + "id": "Js.String.sliceToEnd", + "kind": "value", + "name": "sliceToEnd", + "docstrings": [ + "`sliceToEnd(str, from:n)` returns the substring of `str` starting at character\n`n` to the end of the string.\n- If `n` is negative, then it is evaluated as `length(str - n)`.\n- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string.\n\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\nJs.String.sliceToEnd(~from=4, \"abcdefg\") == \"efg\"\nJs.String.sliceToEnd(~from=-2, \"abcdefg\") == \"fg\"\nJs.String.sliceToEnd(~from=7, \"abcdefg\") == \"\"\n```" + ], + "signature": "let sliceToEnd: (t, ~from: int) => t" + }, { "id": "Js.String.sliceToEnd", "kind": "value", @@ -13297,6 +10378,15 @@ "docstrings": [], "signature": "let sliceToEnd: (~from: int, t) => t" }, + { + "id": "Js.String.split", + "kind": "value", + "name": "split", + "docstrings": [ + "`split(delimiter, str)` splits the given `str` at every occurrence of\n`delimiter` and returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.split(\"-\", \"2018-01-02\") == [\"2018\", \"01\", \"02\"]\nJs.String.split(\",\", \"a,b,,c\") == [\"a\", \"b\", \"\", \"c\"]\nJs.String.split(\"::\", \"good::bad as great::awful\") == [\"good\", \"bad as great\", \"awful\"]\nJs.String.split(\";\", \"has-no-delimiter\") == [\"has-no-delimiter\"]\n```" + ], + "signature": "let split: (t, t) => array" + }, { "id": "Js.String.split", "kind": "value", @@ -13304,6 +10394,15 @@ "docstrings": [], "signature": "let split: (t, t) => array" }, + { + "id": "Js.String.splitAtMost", + "kind": "value", + "name": "splitAtMost", + "docstrings": [ + "`splitAtMost(delimiter, ~limit:n, str)` splits the given `str` at every\noccurrence of `delimiter` and returns an array of the first `n` resulting\nsubstrings. If `n` is negative or greater than the number of substrings, the\narray will contain all the substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.splitAtMost(\"/\", ~limit=3, \"ant/bee/cat/dog/elk\") == [\"ant\", \"bee\", \"cat\"]\nJs.String.splitAtMost(\"/\", ~limit=0, \"ant/bee/cat/dog/elk\") == []\nJs.String.splitAtMost(\"/\", ~limit=9, \"ant/bee/cat/dog/elk\") == [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n```" + ], + "signature": "let splitAtMost: (t, t, ~limit: int) => array" + }, { "id": "Js.String.splitAtMost", "kind": "value", @@ -13311,6 +10410,15 @@ "docstrings": [], "signature": "let splitAtMost: (t, ~limit: int, t) => array" }, + { + "id": "Js.String.splitByRe", + "kind": "value", + "name": "splitByRe", + "docstrings": [ + "`splitByRe(regex, str)` splits the given `str` at every occurrence of `regex`\nand returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.splitByRe(%re(\"/\\s*[,;]\\s*TODO/\"), \"art; bed , cog ;dad\") == [\n Some(\"art\"),\n Some(\"bed\"),\n Some(\"cog\"),\n Some(\"dad\"),\n ]\n```" + ], + "signature": "let splitByRe: (t, Js_re.t) => array>" + }, { "id": "Js.String.splitByRe", "kind": "value", @@ -13318,6 +10426,15 @@ "docstrings": [], "signature": "let splitByRe: (Js_re.t, t) => array>" }, + { + "id": "Js.String.splitByReAtMost", + "kind": "value", + "name": "splitByReAtMost", + "docstrings": [ + "`splitByReAtMost(regex, ~limit:n, str)` splits the given `str` at every\noccurrence of `regex` and returns an array of the first `n` resulting\nsubstrings. If `n` is negative or greater than the number of substrings, the\narray will contain all the substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.splitByReAtMost(%re(\"/\\s*[,;]\\s*TODO/\"), ~limit=3, \"one: two: three: four\") == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n ]\n\nJs.String.splitByReAtMost(%re(\"/\\s*[,;]\\s*TODO/\"), ~limit=0, \"one: two: three: four\") == []\n\nJs.String.splitByReAtMost(%re(\"/\\s*[,;]\\s*TODO/\"), ~limit=8, \"one: two: three: four\") == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n Some(\"four\"),\n ]\n```" + ], + "signature": "let splitByReAtMost: (t, Js_re.t, ~limit: int) => array>" + }, { "id": "Js.String.splitByReAtMost", "kind": "value", @@ -13325,6 +10442,15 @@ "docstrings": [], "signature": "let splitByReAtMost: (Js_re.t, ~limit: int, t) => array>" }, + { + "id": "Js.String.startsWith", + "kind": "value", + "name": "startsWith", + "docstrings": [ + "ES2015: `startsWith(substr, str)` returns `true` if the `str` starts with\n`substr`, `false` otherwise.\n\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.startsWith(\"Re\", \"ReScript\") == true\nJs.String.startsWith(\"\", \"ReScript\") == true\nJs.String.startsWith(\"Re\", \"JavaScript\") == false\n```" + ], + "signature": "let startsWith: (t, t) => bool" + }, { "id": "Js.String.startsWith", "kind": "value", @@ -13332,6 +10458,15 @@ "docstrings": [], "signature": "let startsWith: (t, t) => bool" }, + { + "id": "Js.String.startsWithFrom", + "kind": "value", + "name": "startsWithFrom", + "docstrings": [ + "ES2015: `startsWithFrom(substr, n, str)` 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`.\n\nSee [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.startsWithFrom(\"Scri\", 2, \"ReScript\") == true\nJs.String.startsWithFrom(\"\", 2, \"ReScript\") == true\nJs.String.startsWithFrom(\"Scri\", 2, \"JavaScript\") == false\n```" + ], + "signature": "let startsWithFrom: (t, t, int) => bool" + }, { "id": "Js.String.startsWithFrom", "kind": "value", @@ -13339,6 +10474,15 @@ "docstrings": [], "signature": "let startsWithFrom: (t, int, t) => bool" }, + { + "id": "Js.String.substr", + "kind": "value", + "name": "substr", + "docstrings": [ + "`substr(~from:n, str)` returns the substring of `str` from position `n` to the\nend of the string.\n- If `n` is less than zero, the starting position is the length of `str - n`.\n- If `n` is greater than or equal to the length of `str`, returns the empty string.\n\nJavaScript’s `String.substr()` is a legacy function. When possible, use\n`substring()` instead.\n\nSee [`String.substr`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.substr(~from=3, \"abcdefghij\") == \"defghij\"\nJs.String.substr(~from=-3, \"abcdefghij\") == \"hij\"\nJs.String.substr(~from=12, \"abcdefghij\") == \"\"\n```" + ], + "signature": "let substr: (t, ~from: int) => t" + }, { "id": "Js.String.substr", "kind": "value", @@ -13346,6 +10490,15 @@ "docstrings": [], "signature": "let substr: (~from: int, t) => t" }, + { + "id": "Js.String.substrAtMost", + "kind": "value", + "name": "substrAtMost", + "docstrings": [ + "`substrAtMost(~from: pos, ~length: n, str)` returns the substring of `str` of\nlength `n` starting at position `pos`.\n- If `pos` is less than zero, the starting position is the length of `str - pos`.\n- If `pos` is greater than or equal to the length of `str`, returns the empty string.\n- If `n` is less than or equal to zero, returns the empty string.\n\nJavaScript’s `String.substr()` is a legacy function. When possible, use\n`substring()` instead.\n\nSee [`String.substr`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.substrAtMost(~from=3, ~length=4, \"abcdefghij\") == \"defg\"\nJs.String.substrAtMost(~from=-3, ~length=4, \"abcdefghij\") == \"hij\"\nJs.String.substrAtMost(~from=12, ~length=2, \"abcdefghij\") == \"\"\n```" + ], + "signature": "let substrAtMost: (t, ~from: int, ~length: int) => t" + }, { "id": "Js.String.substrAtMost", "kind": "value", @@ -13353,6 +10506,15 @@ "docstrings": [], "signature": "let substrAtMost: (~from: int, ~length: int, t) => t" }, + { + "id": "Js.String.substring", + "kind": "value", + "name": "substring", + "docstrings": [ + "`substring(~from: start, ~to_: finish, str)` returns characters `start` up to\nbut not including finish from `str`.\n- If `start` is less than zero, it is treated as zero.\n- If `finish` is zero or negative, the empty string is returned.\n- If `start` is greater than `finish`, the `start` and `finish` points are swapped.\n\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\nJs.String.substring(~from=3, ~to_=6, \"playground\") == \"ygr\"\nJs.String.substring(~from=6, ~to_=3, \"playground\") == \"ygr\"\nJs.String.substring(~from=4, ~to_=12, \"playground\") == \"ground\"\n```" + ], + "signature": "let substring: (t, ~from: int, ~to_: int) => t" + }, { "id": "Js.String.substring", "kind": "value", @@ -13360,6 +10522,15 @@ "docstrings": [], "signature": "let substring: (~from: int, ~to_: int, t) => t" }, + { + "id": "Js.String.substringToEnd", + "kind": "value", + "name": "substringToEnd", + "docstrings": [ + "`substringToEnd(~from: start, str)` returns the substring of `str` from\nposition `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 is returned.\n\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\nJs.String.substringToEnd(~from=4, \"playground\") == \"ground\"\nJs.String.substringToEnd(~from=-3, \"playground\") == \"playground\"\nJs.String.substringToEnd(~from=12, \"playground\") == \"\"\n```" + ], + "signature": "let substringToEnd: (t, ~from: int) => t" + }, { "id": "Js.String.substringToEnd", "kind": "value", @@ -13412,6 +10583,15 @@ ], "signature": "let trim: t => t" }, + { + "id": "Js.String.anchor", + "kind": "value", + "name": "anchor", + "docstrings": [ + "`anchor(anchorName, anchorText)` creates a string with an HTML `` element\nwith name attribute of `anchorName` and `anchorText` as its content. Please do\nnot use this method, as it has been removed from the relevant web standards.\n\nSee [`String.anchor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/anchor)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.anchor(\"page1\", \"Page One\") == \"Page One\"\n```" + ], + "signature": "let anchor: (t, t) => t" + }, { "id": "Js.String.anchor", "kind": "value", @@ -13419,6 +10599,15 @@ "docstrings": [], "signature": "let anchor: (t, t) => t" }, + { + "id": "Js.String.link", + "kind": "value", + "name": "link", + "docstrings": [ + "ES2015: `link(urlText, linkText)` creates a string with an HTML `` element\nwith href attribute of `urlText` and `linkText` as its content. Please do not\nuse this method, as it has been removed from the relevant web standards.\n\nSee [`String.link`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/link)\non MDN.\n\n## Examples\n\n```rescript\nJs.String.link(\"page2.html\", \"Go to page two\") == \"Go to page two\"\n```" + ], + "signature": "let link: (t, t) => t" + }, { "id": "Js.String.link", "kind": "value", @@ -13461,7 +10650,7 @@ "docstrings": [ "A type used to describe JavaScript objects that are like an array or are iterable." ], - "signature": "type array_like<'a>" + "signature": "type array_like<'a> = Array.arrayLike<'a>" }, { "id": "Js.Array2.from", @@ -14028,47 +11217,101 @@ ], "signature": "let length: array<'a> => int" }, + { + "id": "Js.Array.copyWithin", + "kind": "value", + "name": "copyWithin", + "docstrings": [ + "Copies from the first element in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.\n\n## Examples\n\n```rescript\nlet arr = [100, 101, 102, 103, 104]\nJs.Array.copyWithin(~to_=2, arr) == [100, 101, 100, 101, 102]\narr == [100, 101, 100, 101, 102]\n```" + ], + "signature": "let copyWithin: (t<'a>, ~to_: int) => 'this" + }, { "id": "Js.Array.copyWithin", "kind": "value", "name": "copyWithin", "docstrings": [], - "signature": "let copyWithin: (~to_: int, t<'a>) => t<'a>" + "signature": "let copyWithin: (~to_: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.copyWithinFrom", + "kind": "value", + "name": "copyWithinFrom", + "docstrings": [ + "Copies starting at element `~from` in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.\n\n## Examples\n\n```rescript\nlet arr = [100, 101, 102, 103, 104]\nJs.Array.copyWithinFrom(~from=2, ~to_=0, arr) == [102, 103, 104, 103, 104]\narr == [102, 103, 104, 103, 104]\n```" + ], + "signature": "let copyWithinFrom: (t<'a>, ~to_: int, ~from: int) => 'this" }, { "id": "Js.Array.copyWithinFrom", "kind": "value", "name": "copyWithinFrom", "docstrings": [], - "signature": "let copyWithinFrom: (~to_: int, ~from: int, t<'a>) => t<'a>" + "signature": "let copyWithinFrom: (~to_: int, ~from: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.copyWithinFromRange", + "kind": "value", + "name": "copyWithinFromRange", + "docstrings": [ + "Copies starting at element `~start` in the given array up to but not including `~end_` to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.\n\n## Examples\n\n```rescript\nlet arr = [100, 101, 102, 103, 104, 105]\nJs.Array.copyWithinFromRange(~start=2, ~end_=5, ~to_=1, arr) == [100, 102, 103, 104, 104, 105]\narr == [100, 102, 103, 104, 104, 105]\n```" + ], + "signature": "let copyWithinFromRange: (t<'a>, ~to_: int, ~start: int, ~end_: int) => 'this" }, { "id": "Js.Array.copyWithinFromRange", "kind": "value", "name": "copyWithinFromRange", "docstrings": [], - "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t<'a>) => t<'a>" + "signature": "let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.fillInPlace", + "kind": "value", + "name": "fillInPlace", + "docstrings": [ + "Sets all elements of the given array (the second arumgent) to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`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 arr = [100, 101, 102, 103, 104]\nJs.Array.fillInPlace(99, arr) == [99, 99, 99, 99, 99]\narr == [99, 99, 99, 99, 99]\n```" + ], + "signature": "let fillInPlace: (t<'a>, 'a) => 'this" }, { "id": "Js.Array.fillInPlace", "kind": "value", "name": "fillInPlace", "docstrings": [], - "signature": "let fillInPlace: ('a, t<'a>) => t<'a>" + "signature": "let fillInPlace: ('a, t<'a>) => 'b" + }, + { + "id": "Js.Array.fillFromInPlace", + "kind": "value", + "name": "fillFromInPlace", + "docstrings": [ + "Sets all elements of the given array (the last arumgent) from position `~from` to the end to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`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 arr = [100, 101, 102, 103, 104]\nJs.Array.fillFromInPlace(99, ~from=2, arr) == [100, 101, 99, 99, 99]\narr == [100, 101, 99, 99, 99]\n```" + ], + "signature": "let fillFromInPlace: (t<'a>, 'a, ~from: int) => 'this" }, { "id": "Js.Array.fillFromInPlace", "kind": "value", "name": "fillFromInPlace", "docstrings": [], - "signature": "let fillFromInPlace: ('a, ~from: int, t<'a>) => t<'a>" + "signature": "let fillFromInPlace: ('a, ~from: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.fillRangeInPlace", + "kind": "value", + "name": "fillRangeInPlace", + "docstrings": [ + "Sets the elements of the given array (the last arumgent) from position `~start` up to but not including position `~end_` to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`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 arr = [100, 101, 102, 103, 104]\nJs.Array.fillRangeInPlace(99, ~start=1, ~end_=4, arr) == [100, 99, 99, 99, 104]\narr == [100, 99, 99, 99, 104]\n```" + ], + "signature": "let fillRangeInPlace: (t<'a>, 'a, ~start: int, ~end_: int) => 'this" }, { "id": "Js.Array.fillRangeInPlace", "kind": "value", "name": "fillRangeInPlace", "docstrings": [], - "signature": "let fillRangeInPlace: ('a, ~start: int, ~end_: int, t<'a>) => t<'a>" + "signature": "let fillRangeInPlace: ('a, ~start: int, ~end_: int, t<'a>) => 'b" }, { "id": "Js.Array.pop", @@ -14079,6 +11322,15 @@ ], "signature": "let pop: t<'a> => option<'a>" }, + { + "id": "Js.Array.push", + "kind": "value", + "name": "push", + "docstrings": [ + "Appends the given value to the array, returning the number of elements in the updated array. *This function modifies the original array.* See [`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 arr = [\"ant\", \"bee\", \"cat\"]\nJs.Array.push(\"dog\", arr) == 4\narr == [\"ant\", \"bee\", \"cat\", \"dog\"]\n```" + ], + "signature": "let push: (t<'a>, 'a) => int" + }, { "id": "Js.Array.push", "kind": "value", @@ -14086,6 +11338,15 @@ "docstrings": [], "signature": "let push: ('a, t<'a>) => int" }, + { + "id": "Js.Array.pushMany", + "kind": "value", + "name": "pushMany", + "docstrings": [ + "Appends the values from one array (the first argument) to another (the second argument), returning the number of elements in the updated array. *This function modifies the original array.* See [`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 arr = [\"ant\", \"bee\", \"cat\"]\nJs.Array.pushMany([\"dog\", \"elk\"], arr) == 5\narr == [\"ant\", \"bee\", \"cat\", \"dog\", \"elk\"]\n```" + ], + "signature": "let pushMany: (t<'a>, array<'a>) => int" + }, { "id": "Js.Array.pushMany", "kind": "value", @@ -14100,7 +11361,7 @@ "docstrings": [ "Returns an array with the elements of the input array in reverse order. *This function modifies the original array.* See [`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 arr = [\"ant\", \"bee\", \"cat\"]\nJs.Array.reverseInPlace(arr) == [\"cat\", \"bee\", \"ant\"]\narr == [\"cat\", \"bee\", \"ant\"]\n```" ], - "signature": "let reverseInPlace: t<'a> => t<'a>" + "signature": "let reverseInPlace: t<'a> => 'this" }, { "id": "Js.Array.shift", @@ -14118,35 +11379,80 @@ "docstrings": [ "Sorts the given array in place and returns the sorted array. JavaScript sorts the array by converting the arguments to UTF-16 strings and sorting them. See the second example with sorting numbers, which does not do a numeric sort. *This function modifies the original array.* See [`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 words = [\"bee\", \"dog\", \"ant\", \"cat\"]\nJs.Array.sortInPlace(words) == [\"ant\", \"bee\", \"cat\", \"dog\"]\nwords == [\"ant\", \"bee\", \"cat\", \"dog\"]\n\nlet numbers = [3, 30, 10, 1, 20, 2]\nJs.Array.sortInPlace(numbers) == [1, 10, 2, 20, 3, 30]\nnumbers == [1, 10, 2, 20, 3, 30]\n```" ], - "signature": "let sortInPlace: t<'a> => t<'a>" + "signature": "let sortInPlace: t<'a> => 'this" + }, + { + "id": "Js.Array.sortInPlaceWith", + "kind": "value", + "name": "sortInPlaceWith", + "docstrings": [ + "Sorts the given array in place and returns the sorted array. *This function modifies the original array.*\n\nThe first argument to `sortInPlaceWith()` is a function that compares two items from the array and returns:\n\n* an integer less than zero if the first item is less than the second item\n* zero if the items are equal\n* an integer greater than zero if the first item is greater than the second item\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\n// sort by word length\nlet words = [\"horse\", \"aardvark\", \"dog\", \"camel\"]\nlet byLength = (s1, s2) => Js.String.length(s1) - Js.String.length(s2)\n\nJs.Array.sortInPlaceWith(byLength, words) == [\"dog\", \"horse\", \"camel\", \"aardvark\"]\n\n// sort in reverse numeric order\nlet numbers = [3, 30, 10, 1, 20, 2]\nlet reverseNumeric = (n1, n2) => n2 - n1\nJs.Array.sortInPlaceWith(reverseNumeric, numbers) == [30, 20, 10, 3, 2, 1]\n```" + ], + "signature": "let sortInPlaceWith: (t<'a>, ('a, 'a) => int) => 'this" }, { "id": "Js.Array.sortInPlaceWith", "kind": "value", "name": "sortInPlaceWith", "docstrings": [], - "signature": "let sortInPlaceWith: (('a, 'a) => int, t<'a>) => t<'a>" + "signature": "let sortInPlaceWith: (('a, 'a) => int, t<'a>) => 'b" + }, + { + "id": "Js.Array.spliceInPlace", + "kind": "value", + "name": "spliceInPlace", + "docstrings": [ + "Starting at position `~pos`, remove `~remove` elements and then add the\nelements from the `~add` array. Returns an array consisting of the removed\nitems. *This function modifies the original array.* See\n[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\nJs.Array.spliceInPlace(~pos=2, ~remove=2, ~add=[\"x\", \"y\", \"z\"], arr) == [\"c\", \"d\"]\narr == [\"a\", \"b\", \"x\", \"y\", \"z\", \"e\", \"f\"]\n\nlet arr2 = [\"a\", \"b\", \"c\", \"d\"]\nJs.Array.spliceInPlace(~pos=3, ~remove=0, ~add=[\"x\", \"y\"], arr2) == []\narr2 == [\"a\", \"b\", \"c\", \"x\", \"y\", \"d\"]\n\nlet arr3 = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\nJs.Array.spliceInPlace(~pos=9, ~remove=2, ~add=[\"x\", \"y\", \"z\"], arr3) == []\narr3 == [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"x\", \"y\", \"z\"]\n```" + ], + "signature": "let spliceInPlace: (t<'a>, ~pos: int, ~remove: int, ~add: array<'a>) => 'this" }, { "id": "Js.Array.spliceInPlace", "kind": "value", "name": "spliceInPlace", "docstrings": [], - "signature": "let spliceInPlace: (~pos: int, ~remove: int, ~add: array<'a>, t<'a>) => t<'a>" + "signature": "let spliceInPlace: (~pos: int, ~remove: int, ~add: array<'a>, t<'a>) => 'b" + }, + { + "id": "Js.Array.removeFromInPlace", + "kind": "value", + "name": "removeFromInPlace", + "docstrings": [ + "Removes elements from the given array starting at position `~pos` to the end\nof the array, returning the removed elements. *This function modifies the\noriginal array.* See\n[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\nJs.Array.removeFromInPlace(~pos=4, arr) == [\"e\", \"f\"]\narr == [\"a\", \"b\", \"c\", \"d\"]\n```" + ], + "signature": "let removeFromInPlace: (t<'a>, ~pos: int) => 'this" }, { "id": "Js.Array.removeFromInPlace", "kind": "value", "name": "removeFromInPlace", "docstrings": [], - "signature": "let removeFromInPlace: (~pos: int, t<'a>) => t<'a>" + "signature": "let removeFromInPlace: (~pos: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.removeCountInPlace", + "kind": "value", + "name": "removeCountInPlace", + "docstrings": [ + "Removes `~count` elements from the given array starting at position `~pos`,\nreturning the removed elements. *This function modifies the original array.*\nSee\n[`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\nJs.Array.removeCountInPlace(~pos=2, ~count=3, arr) == [\"c\", \"d\", \"e\"]\narr == [\"a\", \"b\", \"f\"]\n```" + ], + "signature": "let removeCountInPlace: (t<'a>, ~pos: int, ~count: int) => 'this" }, { "id": "Js.Array.removeCountInPlace", "kind": "value", "name": "removeCountInPlace", "docstrings": [], - "signature": "let removeCountInPlace: (~pos: int, ~count: int, t<'a>) => t<'a>" + "signature": "let removeCountInPlace: (~pos: int, ~count: int, t<'a>) => 'b" + }, + { + "id": "Js.Array.unshift", + "kind": "value", + "name": "unshift", + "docstrings": [ + "Adds the given element to the array, returning the new number of elements in\nthe array. *This function modifies the original array.* See\n[`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [\"b\", \"c\", \"d\"]\nJs.Array.unshift(\"a\", arr) == 4\narr == [\"a\", \"b\", \"c\", \"d\"]\n```" + ], + "signature": "let unshift: (t<'a>, 'a) => int" }, { "id": "Js.Array.unshift", @@ -14155,6 +11461,15 @@ "docstrings": [], "signature": "let unshift: ('a, t<'a>) => int" }, + { + "id": "Js.Array.unshiftMany", + "kind": "value", + "name": "unshiftMany", + "docstrings": [ + "Adds the elements in the first array argument at the beginning of the second\narray argument, returning the new number of elements in the array. *This\nfunction modifies the original array.* See\n[`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [\"d\", \"e\"]\nJs.Array.unshiftMany([\"a\", \"b\", \"c\"], arr) == 5\narr == [\"a\", \"b\", \"c\", \"d\", \"e\"]\n```" + ], + "signature": "let unshiftMany: (t<'a>, array<'a>) => int" + }, { "id": "Js.Array.unshiftMany", "kind": "value", @@ -14162,19 +11477,46 @@ "docstrings": [], "signature": "let unshiftMany: (array<'a>, t<'a>) => int" }, + { + "id": "Js.Array.concat", + "kind": "value", + "name": "concat", + "docstrings": [ + "Concatenates the first array argument to the second array argument, returning\na new array. The original arrays are not modified. See\n[`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.concat([\"c\", \"d\", \"e\"], [\"a\", \"b\"]) == [\"a\", \"b\", \"c\", \"d\", \"e\"]\n```" + ], + "signature": "let concat: (t<'a>, 'this) => 'this" + }, { "id": "Js.Array.concat", "kind": "value", "name": "concat", "docstrings": [], - "signature": "let concat: (t<'a>, t<'a>) => t<'a>" + "signature": "let concat: ('a, t<'b>) => 'a" + }, + { + "id": "Js.Array.concatMany", + "kind": "value", + "name": "concatMany", + "docstrings": [ + "The first argument to `concatMany()` is an array of arrays; these are added\nat the end of the second argument, returning a new array. See\n[`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.concatMany([[\"d\", \"e\"], [\"f\", \"g\", \"h\"]], [\"a\", \"b\", \"c\"]) == [\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n ]\n```" + ], + "signature": "let concatMany: (t<'a>, array<'this>) => 'this" }, { "id": "Js.Array.concatMany", "kind": "value", "name": "concatMany", "docstrings": [], - "signature": "let concatMany: (array>, t<'a>) => t<'a>" + "signature": "let concatMany: (array<'a>, t<'b>) => 'a" + }, + { + "id": "Js.Array.includes", + "kind": "value", + "name": "includes", + "docstrings": [ + "Returns true if the given value is in the array, `false` otherwise. See\n[`Array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.includes(\"b\", [\"a\", \"b\", \"c\"]) == true\nJs.Array.includes(\"x\", [\"a\", \"b\", \"c\"]) == false\n```" + ], + "signature": "let includes: (t<'a>, 'a) => bool" }, { "id": "Js.Array.includes", @@ -14183,6 +11525,15 @@ "docstrings": [], "signature": "let includes: ('a, t<'a>) => bool" }, + { + "id": "Js.Array.indexOf", + "kind": "value", + "name": "indexOf", + "docstrings": [ + "Returns the index of the first element in the array that has the given value.\nIf the value is not in the array, returns -1. See\n[`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.indexOf(102, [100, 101, 102, 103]) == 2\nJs.Array.indexOf(999, [100, 101, 102, 103]) == -1\n```" + ], + "signature": "let indexOf: (t<'a>, 'a) => int" + }, { "id": "Js.Array.indexOf", "kind": "value", @@ -14190,6 +11541,15 @@ "docstrings": [], "signature": "let indexOf: ('a, t<'a>) => int" }, + { + "id": "Js.Array.indexOfFrom", + "kind": "value", + "name": "indexOfFrom", + "docstrings": [ + "Returns the index of the first element in the array with the given value. The\nsearch starts at position `~from`. See\n[`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.indexOfFrom(\"a\", ~from=2, [\"a\", \"b\", \"a\", \"c\", \"a\"]) == 2\nJs.Array.indexOfFrom(\"a\", ~from=3, [\"a\", \"b\", \"a\", \"c\", \"a\"]) == 4\nJs.Array.indexOfFrom(\"b\", ~from=2, [\"a\", \"b\", \"a\", \"c\", \"a\"]) == -1\n```" + ], + "signature": "let indexOfFrom: (t<'a>, 'a, ~from: int) => int" + }, { "id": "Js.Array.indexOfFrom", "kind": "value", @@ -14205,6 +11565,15 @@ "signature": "let join: t<'a> => string", "deprecated": "please use joinWith instead" }, + { + "id": "Js.Array.joinWith", + "kind": "value", + "name": "joinWith", + "docstrings": [ + "This function converts each element of the array to a string (via JavaScript)\nand concatenates them, separated by the string given in the first argument,\ninto a single string. See\n[`Array.join`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.joinWith(\"--\", [\"ant\", \"bee\", \"cat\"]) == \"ant--bee--cat\"\nJs.Array.joinWith(\"\", [\"door\", \"bell\"]) == \"doorbell\"\nJs.Array.joinWith(\"/\", [2020, 9, 4]) == \"2020/9/4\"\nJs.Array.joinWith(\";\", [2.5, 3.6, 3e-2]) == \"2.5;3.6;0.03\"\n```" + ], + "signature": "let joinWith: (t<'a>, string) => string" + }, { "id": "Js.Array.joinWith", "kind": "value", @@ -14212,6 +11581,15 @@ "docstrings": [], "signature": "let joinWith: (string, t<'a>) => string" }, + { + "id": "Js.Array.lastIndexOf", + "kind": "value", + "name": "lastIndexOf", + "docstrings": [ + "Returns the index of the last element in the array that has the given value.\nIf the value is not in the array, returns -1. See\n[`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.lastIndexOf(\"a\", [\"a\", \"b\", \"a\", \"c\"]) == 2\nJs.Array.lastIndexOf(\"x\", [\"a\", \"b\", \"a\", \"c\"]) == -1\n```" + ], + "signature": "let lastIndexOf: (t<'a>, 'a) => int" + }, { "id": "Js.Array.lastIndexOf", "kind": "value", @@ -14219,6 +11597,15 @@ "docstrings": [], "signature": "let lastIndexOf: ('a, t<'a>) => int" }, + { + "id": "Js.Array.lastIndexOfFrom", + "kind": "value", + "name": "lastIndexOfFrom", + "docstrings": [ + "Returns the index of the last element in the array that has the given value,\nsearching from position `~from` down to the start of the array. If the value\nis not in the array, returns -1. See\n[`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.lastIndexOfFrom(\"a\", ~from=3, [\"a\", \"b\", \"a\", \"c\", \"a\", \"d\"]) == 2\nJs.Array.lastIndexOfFrom(\"c\", ~from=2, [\"a\", \"b\", \"a\", \"c\", \"a\", \"d\"]) == -1\n```" + ], + "signature": "let lastIndexOfFrom: (t<'a>, 'a, ~from: int) => int" + }, { "id": "Js.Array.lastIndexOfFrom", "kind": "value", @@ -14226,12 +11613,21 @@ "docstrings": [], "signature": "let lastIndexOfFrom: ('a, ~from: int, t<'a>) => int" }, + { + "id": "Js.Array.slice", + "kind": "value", + "name": "slice", + "docstrings": [ + "Returns a shallow copy of the given array from the `~start` index up to but\nnot including the `~end_` position. Negative numbers indicate an offset from\nthe end of the array. See\n[`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)\non MDN.\n\n## Examples\n\n```rescript\nlet arr = [100, 101, 102, 103, 104, 105, 106]\nJs.Array.slice(~start=2, ~end_=5, arr) == [102, 103, 104]\nJs.Array.slice(~start=-3, ~end_=-1, arr) == [104, 105]\nJs.Array.slice(~start=9, ~end_=10, arr) == []\n```" + ], + "signature": "let slice: (t<'a>, ~start: int, ~end_: int) => 'this" + }, { "id": "Js.Array.slice", "kind": "value", "name": "slice", "docstrings": [], - "signature": "let slice: (~start: int, ~end_: int, t<'a>) => t<'a>" + "signature": "let slice: (int, ~end_: int, ~obj: t<'a>) => 'b" }, { "id": "Js.Array.copy", @@ -14240,14 +11636,23 @@ "docstrings": [ "Returns a copy of the entire array. Same as `Js.Array.Slice(~start=0,\n~end_=Js.Array.length(arr), arr)`. See\n[`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)\non MDN." ], - "signature": "let copy: t<'a> => t<'a>" + "signature": "let copy: t<'a> => 'this" + }, + { + "id": "Js.Array.sliceFrom", + "kind": "value", + "name": "sliceFrom", + "docstrings": [ + "Returns a shallow copy of the given array from the given index to the end. \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\nJs.Array.sliceFrom(2, [100, 101, 102, 103, 104]) == [102, 103, 104]\n```" + ], + "signature": "let sliceFrom: (t<'a>, int) => 'this" }, { "id": "Js.Array.sliceFrom", "kind": "value", "name": "sliceFrom", "docstrings": [], - "signature": "let sliceFrom: (int, t<'a>) => t<'a>" + "signature": "let sliceFrom: (int, t<'a>) => 'b" }, { "id": "Js.Array.toString", @@ -14267,6 +11672,15 @@ ], "signature": "let toLocaleString: t<'a> => string" }, + { + "id": "Js.Array.every", + "kind": "value", + "name": "every", + "docstrings": [ + "The first argument to `every()` is a predicate function that returns a boolean. The `every()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`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 isEven = x => mod(x, 2) == 0\nJs.Array.every(isEven, [6, 22, 8, 4]) == true\nJs.Array.every(isEven, [6, 22, 7, 4]) == false\n```" + ], + "signature": "let every: (t<'a>, 'a => bool) => bool" + }, { "id": "Js.Array.every", "kind": "value", @@ -14274,6 +11688,15 @@ "docstrings": [], "signature": "let every: ('a => bool, t<'a>) => bool" }, + { + "id": "Js.Array.everyi", + "kind": "value", + "name": "everyi", + "docstrings": [ + "The first argument to `everyi()` is a predicate function with two arguments: an array element and that element’s index; it returns a boolean. The `everyi()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.\n\n## Examples\n\n```rescript\n// determine if all even-index items are positive\nlet evenIndexPositive = (item, index) => mod(index, 2) == 0 ? item > 0 : true\n\nJs.Array.everyi(evenIndexPositive, [6, -3, 5, 8]) == true\nJs.Array.everyi(evenIndexPositive, [6, 3, -5, 8]) == false\n```" + ], + "signature": "let everyi: (t<'a>, ('a, int) => bool) => bool" + }, { "id": "Js.Array.everyi", "kind": "value", @@ -14281,19 +11704,46 @@ "docstrings": [], "signature": "let everyi: (('a, int) => bool, t<'a>) => bool" }, + { + "id": "Js.Array.filter", + "kind": "value", + "name": "filter", + "docstrings": [ + "Applies the given predicate function to each element in the array; the result is an array of those elements for which the predicate function returned `true`. See [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.\n\n## Examples\n\n```rescript\nlet nonEmpty = s => s != \"\"\nJs.Array.filter(nonEmpty, [\"abc\", \"\", \"\", \"def\", \"ghi\"]) == [\"abc\", \"def\", \"ghi\"]\n```" + ], + "signature": "let filter: (t<'a>, 'a => bool) => 'this" + }, { "id": "Js.Array.filter", "kind": "value", "name": "filter", "docstrings": [], - "signature": "let filter: ('a => bool, t<'a>) => t<'a>" + "signature": "let filter: ('a => bool, t<'a>) => 'b" + }, + { + "id": "Js.Array.filteri", + "kind": "value", + "name": "filteri", + "docstrings": [ + "Each element of the given array are passed to the predicate function. The\nreturn value is an array of all those elements for which the predicate\nfunction returned `true`. See\n[`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)\non MDN.\n\n## Examples\n\n```rescript\n// keep only positive elements at odd indices\nlet positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0\n\nJs.Array.filteri(positiveOddElement, [6, 3, 5, 8, 7, -4, 1]) == [3, 8]\n```" + ], + "signature": "let filteri: (t<'a>, ('a, int) => bool) => 'this" }, { "id": "Js.Array.filteri", "kind": "value", "name": "filteri", "docstrings": [], - "signature": "let filteri: (('a, int) => bool, t<'a>) => t<'a>" + "signature": "let filteri: (('a, int) => bool, t<'a>) => 'b" + }, + { + "id": "Js.Array.find", + "kind": "value", + "name": "find", + "docstrings": [ + "Returns `Some(value)` for the first element in the array that satisifies the\ngiven predicate function, or `None` if no element satisifies the predicate.\nSee\n[`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)\non MDN.\n\n## Examples\n\n```rescript\n// find first negative element\nJs.Array.find(x => x < 0, [33, 22, -55, 77, -44]) == Some(-55)\nJs.Array.find(x => x < 0, [33, 22, 55, 77, 44]) == None\n```" + ], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" }, { "id": "Js.Array.find", @@ -14302,6 +11752,15 @@ "docstrings": [], "signature": "let find: ('a => bool, t<'a>) => option<'a>" }, + { + "id": "Js.Array.findi", + "kind": "value", + "name": "findi", + "docstrings": [ + "Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n\n```rescript\n// find first positive item at an odd index\nlet positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0\n\nJs.Array.findi(positiveOddElement, [66, -33, 55, 88, 22]) == Some(88)\nJs.Array.findi(positiveOddElement, [66, -33, 55, -88, 22]) == None\n```" + ], + "signature": "let findi: (t<'a>, ('a, int) => bool) => option<'a>" + }, { "id": "Js.Array.findi", "kind": "value", @@ -14309,6 +11768,15 @@ "docstrings": [], "signature": "let findi: (('a, int) => bool, t<'a>) => option<'a>" }, + { + "id": "Js.Array.findIndex", + "kind": "value", + "name": "findIndex", + "docstrings": [ + "Returns the index of the first element in the array that satisifies the given predicate function, or -1 if no element satisifies the predicate. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n\n```rescript\nJs.Array.findIndex(x => x < 0, [33, 22, -55, 77, -44]) == 2\nJs.Array.findIndex(x => x < 0, [33, 22, 55, 77, 44]) == -1\n```" + ], + "signature": "let findIndex: (t<'a>, 'a => bool) => int" + }, { "id": "Js.Array.findIndex", "kind": "value", @@ -14316,6 +11784,15 @@ "docstrings": [], "signature": "let findIndex: ('a => bool, t<'a>) => int" }, + { + "id": "Js.Array.findIndexi", + "kind": "value", + "name": "findIndexi", + "docstrings": [ + "Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.\n\n## Examples\n\n```rescript\n// find index of first positive item at an odd index\nlet positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0\n\nJs.Array.findIndexi(positiveOddElement, [66, -33, 55, 88, 22]) == 3\nJs.Array.findIndexi(positiveOddElement, [66, -33, 55, -88, 22]) == -1\n```" + ], + "signature": "let findIndexi: (t<'a>, ('a, int) => bool) => int" + }, { "id": "Js.Array.findIndexi", "kind": "value", @@ -14323,6 +11800,15 @@ "docstrings": [], "signature": "let findIndexi: (('a, int) => bool, t<'a>) => int" }, + { + "id": "Js.Array.forEach", + "kind": "value", + "name": "forEach", + "docstrings": [ + "The `forEach()` function applies the function given as the first argument to each element in the array. The function you provide returns `unit`, and the `forEach()` function also returns `unit`. You use `forEach()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.\n\n## Examples\n\n```rescript\n// display all elements in an array\nJs.Array.forEach(x => Js.log(x), [\"a\", \"b\", \"c\"]) == ()\n```" + ], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" + }, { "id": "Js.Array.forEach", "kind": "value", @@ -14330,6 +11816,15 @@ "docstrings": [], "signature": "let forEach: ('a => unit, t<'a>) => unit" }, + { + "id": "Js.Array.forEachi", + "kind": "value", + "name": "forEachi", + "docstrings": [ + "The `forEachi()` function applies the function given as the first argument to each element in the array. The function you provide takes an item in the array and its index number, and returns `unit`. The `forEachi()` function also returns `unit`. You use `forEachi()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.\n\n## Examples\n\n```rescript\n// display all elements in an array as a numbered list\nJs.Array.forEachi((item, index) => Js.log2(index + 1, item), [\"a\", \"b\", \"c\"]) == ()\n```" + ], + "signature": "let forEachi: (t<'a>, ('a, int) => unit) => unit" + }, { "id": "Js.Array.forEachi", "kind": "value", @@ -14337,6 +11832,15 @@ "docstrings": [], "signature": "let forEachi: (('a, int) => unit, t<'a>) => unit" }, + { + "id": "Js.Array.map", + "kind": "value", + "name": "map", + "docstrings": [ + "Applies the function (given as the first argument) to each item in the array,\nreturning a new array. The result array does not have to have elements of the\nsame type as the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n## Examples\n\n```rescript\nJs.Array.map(x => x * x, [12, 4, 8]) == [144, 16, 64]\nJs.Array.map(Js.String.length, [\"animal\", \"vegetable\", \"mineral\"]) == [6, 9, 7]\n```" + ], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + }, { "id": "Js.Array.map", "kind": "value", @@ -14344,6 +11848,15 @@ "docstrings": [], "signature": "let map: ('a => 'b, t<'a>) => t<'b>" }, + { + "id": "Js.Array.mapi", + "kind": "value", + "name": "mapi", + "docstrings": [ + "Applies the function (given as the first argument) to each item in the array,\nreturning a new array. The function acceps two arguments: an item from the\narray and its index number. The result array does not have to have elements\nof the same type as the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n## Examples\n\n```rescript\n// multiply each item in array by its position\nlet product = (item, index) => item * index\nJs.Array.mapi(product, [10, 11, 12]) == [0, 11, 24]\n```" + ], + "signature": "let mapi: (t<'a>, ('a, int) => 'b) => t<'b>" + }, { "id": "Js.Array.mapi", "kind": "value", @@ -14351,6 +11864,15 @@ "docstrings": [], "signature": "let mapi: (('a, int) => 'b, t<'a>) => t<'b>" }, + { + "id": "Js.Array.reduce", + "kind": "value", + "name": "reduce", + "docstrings": [ + "The `reduce()` function takes three parameters: a *reducer function*, a\nbeginning accumulator value, and an array. The reducer function has two\nparameters: an accumulated value and an element of the array.\n\n`reduce()` first calls the reducer function with the beginning value and the\nfirst element in the array. The result becomes the new accumulator value, which\nis passed in to the reducer function along with the second element in the\narray. `reduce()` proceeds through the array, passing in the result of each\nstage as the accumulator to the reducer function.\n\nWhen all array elements are processed, the final value of the accumulator\nbecomes the return value of `reduce()`. See\n[`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)\non MDN.\n\n## Examples\n\n```rescript\nlet sumOfSquares = (accumulator, item) => accumulator + item * item\n\nJs.Array.reduce(sumOfSquares, 0, [10, 2, 4]) == 120\nJs.Array.reduce(\\\"*\", 1, [10, 2, 4]) == 80\nJs.Array.reduce(\n (acc, item) => acc + Js.String.length(item),\n 0,\n [\"animal\", \"vegetable\", \"mineral\"],\n) == 22 // 6 + 9 + 7\nJs.Array.reduce((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 2.0 // 4.0 / (2.0 / 1.0)\n```" + ], + "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + }, { "id": "Js.Array.reduce", "kind": "value", @@ -14358,6 +11880,15 @@ "docstrings": [], "signature": "let reduce: (('a, 'b) => 'a, 'a, t<'b>) => 'a" }, + { + "id": "Js.Array.reducei", + "kind": "value", + "name": "reducei", + "docstrings": [ + "The `reducei()` function takes three parameters: a *reducer function*, a\nbeginning accumulator value, and an array. The reducer function has three\nparameters: an accumulated value, an element of the array, and the index of\nthat element.\n\n`reducei()` first calls the reducer function with the beginning value, the\nfirst element in the array, and zero (its index). The result becomes the new\naccumulator value, which is passed to the reducer function along with the\nsecond element in the array and one (its index). `reducei()` proceeds from left\nto right through the array, passing in the result of each stage as the\naccumulator to the reducer function.\n\nWhen all array elements are processed, the final value of the accumulator\nbecomes the return value of `reducei()`. See\n[`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)\non MDN.\n\n## Examples\n\n```rescript\n// find sum of even-index elements in array\nlet sumOfEvens = (accumulator, item, index) =>\n if mod(index, 2) == 0 {\n accumulator + item\n } else {\n accumulator\n }\n\nJs.Array.reducei(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6\n```" + ], + "signature": "let reducei: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + }, { "id": "Js.Array.reducei", "kind": "value", @@ -14365,6 +11896,15 @@ "docstrings": [], "signature": "let reducei: (('a, 'b, int) => 'a, 'a, t<'b>) => 'a" }, + { + "id": "Js.Array.reduceRight", + "kind": "value", + "name": "reduceRight", + "docstrings": [ + "The `reduceRight()` function takes three parameters: a *reducer function*, a\nbeginning accumulator value, and an array. The reducer function has two\nparameters: an accumulated value and an element of the array.\n\n`reduceRight()` first calls the reducer function with the beginning value and\nthe last element in the array. The result becomes the new accumulator value,\nwhich is passed in to the reducer function along with the next-to-last element\nin the array. `reduceRight()` proceeds from right to left through the array,\npassing in the result of each stage as the accumulator to the reducer function.\n\nWhen all array elements are processed, the final value of the accumulator\nbecomes the return value of `reduceRight()`. See\n[`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)\non MDN.\n\n**NOTE:** In many cases, `reduce()` and `reduceRight()` give the same result. However, see the last example here and compare it to the example from `reduce()`, where order makes a difference.\n\n## Examples\n\n```rescript\nlet sumOfSquares = (accumulator, item) => accumulator + item * item\n\nJs.Array.reduceRight(sumOfSquares, 0, [10, 2, 4]) == 120\nJs.Array.reduceRight((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 0.5 // 2.0 / (4.0 / 1.0)\n```" + ], + "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + }, { "id": "Js.Array.reduceRight", "kind": "value", @@ -14372,6 +11912,15 @@ "docstrings": [], "signature": "let reduceRight: (('a, 'b) => 'a, 'a, t<'b>) => 'a" }, + { + "id": "Js.Array.reduceRighti", + "kind": "value", + "name": "reduceRighti", + "docstrings": [ + "The `reduceRighti()` function takes three parameters: a *reducer function*, a\nbeginning accumulator value, and an array. The reducer function has three\nparameters: an accumulated value, an element of the array, and the index of\nthat element. `reduceRighti()` first calls the reducer function with the\nbeginning value, the last element in the array, and its index (length of array\nminus one). The result becomes the new accumulator value, which is passed in to\nthe reducer function along with the second element in the array and one (its\nindex). `reduceRighti()` proceeds from right to left through the array, passing\nin the result of each stage as the accumulator to the reducer function.\n\nWhen all array elements are processed, the final value of the accumulator\nbecomes the return value of `reduceRighti()`. See\n[`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)\non MDN.\n\n**NOTE:** In many cases, `reducei()` and `reduceRighti()` give the same result.\nHowever, there are cases where the order in which items are processed makes a\ndifference.\n\n## Examples\n\n```rescript\n// find sum of even-index elements in array\nlet sumOfEvens = (accumulator, item, index) =>\n if mod(index, 2) == 0 {\n accumulator + item\n } else {\n accumulator\n }\n\nJs.Array.reduceRighti(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6\n```" + ], + "signature": "let reduceRighti: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + }, { "id": "Js.Array.reduceRighti", "kind": "value", @@ -14379,6 +11928,15 @@ "docstrings": [], "signature": "let reduceRighti: (('a, 'b, int) => 'a, 'a, t<'b>) => 'a" }, + { + "id": "Js.Array.some", + "kind": "value", + "name": "some", + "docstrings": [ + "Returns `true` if the predicate function given as the first argument to\n`some()` returns `true` for any element in the array; `false` otherwise.\n\n## Examples\n\n```rescript\nlet isEven = x => mod(x, 2) == 0\n\nJs.Array.some(isEven, [3, 7, 5, 2, 9]) == true\nJs.Array.some(isEven, [3, 7, 5, 1, 9]) == false\n```" + ], + "signature": "let some: (t<'a>, 'a => bool) => bool" + }, { "id": "Js.Array.some", "kind": "value", @@ -14386,6 +11944,15 @@ "docstrings": [], "signature": "let some: ('a => bool, t<'a>) => bool" }, + { + "id": "Js.Array.somei", + "kind": "value", + "name": "somei", + "docstrings": [ + "Returns `true` if the predicate function given as the first argument to\n`somei()` returns `true` for any element in the array; `false` otherwise. The\npredicate function has two arguments: an item from the array and the index\nvalue\n\n## Examples\n\n```rescript\n// Does any string in the array\n// have the same length as its index?\n\nlet sameLength = (str, index) => Js.String.length(str) == index\n\n// \"ef\" has length 2 and is it at index 2\nJs.Array.somei(sameLength, [\"ab\", \"cd\", \"ef\", \"gh\"]) == true\n// no item has the same length as its index\nJs.Array.somei(sameLength, [\"a\", \"bc\", \"def\", \"gh\"]) == false\n```" + ], + "signature": "let somei: (t<'a>, ('a, int) => bool) => bool" + }, { "id": "Js.Array.somei", "kind": "value", @@ -14428,60 +11995,58 @@ "docstrings": [ "Represents a JS exception" ], - "signature": "type t" + "signature": "type t", + "deprecated": "Use `JsExn.t` instead" }, { "id": "Js.Exn.asJsExn", "kind": "value", "name": "asJsExn", "docstrings": [], - "signature": "let asJsExn: exn => option" + "signature": "let asJsExn: exn => option", + "deprecated": "Use `JsExn.fromException` instead" }, { "id": "Js.Exn.stack", "kind": "value", "name": "stack", "docstrings": [], - "signature": "let stack: t => option" + "signature": "let stack: t => option", + "deprecated": "Use `JsExn.stack` instead" }, { "id": "Js.Exn.message", "kind": "value", "name": "message", "docstrings": [], - "signature": "let message: t => option" + "signature": "let message: t => option", + "deprecated": "Use `JsExn.message` instead" }, { "id": "Js.Exn.name", "kind": "value", "name": "name", "docstrings": [], - "signature": "let name: t => option" + "signature": "let name: t => option", + "deprecated": "Use `JsExn.name` instead" }, { "id": "Js.Exn.fileName", "kind": "value", "name": "fileName", "docstrings": [], - "signature": "let fileName: t => option" - }, - { - "id": "Js.Exn.isCamlExceptionOrOpenVariant", - "kind": "value", - "name": "isCamlExceptionOrOpenVariant", - "docstrings": [ - "internal use only" - ], - "signature": "let isCamlExceptionOrOpenVariant: 'a => bool" + "signature": "let fileName: t => option", + "deprecated": "Use `JsExn.fileName` instead" }, { "id": "Js.Exn.anyToExnInternal", "kind": "value", "name": "anyToExnInternal", "docstrings": [ - "`anyToExnInternal(obj)` will take any value `obj` and wrap it\nin a Js.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.\n\n## Examples\n\n```rescript\nswitch (Js.Exn.unsafeAnyToExn(\"test\")) {\n| Js.Exn.Error(v) =>\n switch(Js.Exn.message(v)) {\n | Some(str) => Js.log(\"We won't end up here\")\n | None => Js.log2(\"We will land here: \", v)\n }\n}\n```" + "`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" + "signature": "let anyToExnInternal: 'a => exn", + "deprecated": "Use `JsExn.anyToExnInternal` instead" }, { "id": "Js.Exn.raiseError", @@ -14490,49 +12055,66 @@ "docstrings": [ "Raise Js exception Error object with stacktrace" ], - "signature": "let raiseError: string => 'a" + "signature": "let raiseError: string => 'a", + "deprecated": "Use `JsError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseEvalError", "kind": "value", "name": "raiseEvalError", "docstrings": [], - "signature": "let raiseEvalError: string => 'a" + "signature": "let raiseEvalError: string => 'a", + "deprecated": "Use `JsError.EvalError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseRangeError", "kind": "value", "name": "raiseRangeError", "docstrings": [], - "signature": "let raiseRangeError: string => 'a" + "signature": "let raiseRangeError: string => 'a", + "deprecated": "Use `JsError.RangeError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseReferenceError", "kind": "value", "name": "raiseReferenceError", "docstrings": [], - "signature": "let raiseReferenceError: string => 'a" + "signature": "let raiseReferenceError: string => 'a", + "deprecated": "Use `JsError.ReferenceError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseSyntaxError", "kind": "value", "name": "raiseSyntaxError", "docstrings": [], - "signature": "let raiseSyntaxError: string => 'a" + "signature": "let raiseSyntaxError: string => 'a", + "deprecated": "Use `JsError.SyntaxError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseTypeError", "kind": "value", "name": "raiseTypeError", "docstrings": [], - "signature": "let raiseTypeError: string => 'a" + "signature": "let raiseTypeError: string => 'a", + "deprecated": "Use `JsError.TypeError.throwWithMessage` instead" }, { "id": "Js.Exn.raiseUriError", "kind": "value", "name": "raiseUriError", "docstrings": [], - "signature": "let raiseUriError: string => 'a" + "signature": "let raiseUriError: string => 'a", + "deprecated": "Use `JsError.URIError.throwWithMessage` instead" + }, + { + "id": "Js.Exn.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(exn)` ignores the provided exn and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit", + "deprecated": "Use `JsExn.ignore` instead" } ] }, @@ -14547,10 +12129,8 @@ "id": "Js.Null_undefined.t", "kind": "type", "name": "t", - "docstrings": [ - "Local alias for `Js.null_undefined<'a>`." - ], - "signature": "type t<'a> = Js.nullable<'a> = Value('a) | Null | Undefined" + "docstrings": [], + "signature": "@unboxed\ntype t<'a> = nullable<'a> =\n | Value('a)\n | @as(null) Null\n | @as(undefined) Undefined" }, { "id": "Js.Null_undefined.return", @@ -14654,10 +12234,8 @@ "id": "Js.Nullable.t", "kind": "type", "name": "t", - "docstrings": [ - "Local alias for `Js.null_undefined<'a>`." - ], - "signature": "type t<'a> = Js.nullable<'a> = Value('a) | Null | Undefined" + "docstrings": [], + "signature": "@unboxed\ntype t<'a> = nullable<'a> =\n | Value('a)\n | @as(null) Null\n | @as(undefined) Undefined" }, { "id": "Js.Nullable.return", @@ -14764,7 +12342,7 @@ "docstrings": [ "Local alias for `Js.undefined<'a>`" ], - "signature": "type t<'a> = Js.undefined<'a>" + "signature": "type t<'a> = undefined<'a>" }, { "id": "Js.Undefined.return", @@ -14883,10 +12461,8 @@ "id": "Js.Null.t", "kind": "type", "name": "t", - "docstrings": [ - "Local alias for `Js.null<'a>`" - ], - "signature": "type t<'a> = Js.null<'a> = Value('a) | Null" + "docstrings": [], + "signature": "@unboxed\ntype t<'a> = null<'a> =\n | Value('a)\n | @as(null) Null" }, { "id": "Js.Null.return", diff --git a/data/api/v12.0.0/stdlib.json b/data/api/v12.0.0/stdlib.json index ff93bb6cc..0d02ba655 100644 --- a/data/api/v12.0.0/stdlib.json +++ b/data/api/v12.0.0/stdlib.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": "Stdlib.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": "Stdlib.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,57 @@ ], "signature": "let decodeURIComponent: string => string" }, + { + "id": "Stdlib.date", + "kind": "type", + "name": "date", + "docstrings": [], + "signature": "type date = Date.t" + }, + { + "id": "Stdlib.null", + "kind": "type", + "name": "null", + "docstrings": [], + "signature": "type null<'a> = null<'a>" + }, + { + "id": "Stdlib.undefined", + "kind": "type", + "name": "undefined", + "docstrings": [], + "signature": "type undefined<'a> = undefined<'a>" + }, + { + "id": "Stdlib.nullable", + "kind": "type", + "name": "nullable", + "docstrings": [], + "signature": "type nullable<'a> = nullable<'a>" + }, + { + "id": "Stdlib.lazy_t", + "kind": "type", + "name": "lazy_t", + "docstrings": [], + "signature": "type lazy_t<'a> = Lazy.t<'a>", + "deprecated": "Use Lazy.t instead" + }, { "id": "Stdlib.window", "kind": "value", "name": "window", "docstrings": [], - "signature": "let window: Dom.window" + "signature": "let window: Dom.window", + "deprecated": "Use rescript-webapi instead" }, { "id": "Stdlib.document", "kind": "value", "name": "document", "docstrings": [], - "signature": "let document: Dom.document" + "signature": "let document: Dom.document", + "deprecated": "Use rescript-webapi instead" }, { "id": "Stdlib.globalThis", @@ -134,62 +172,50 @@ "signature": "let globalThis: {..}" }, { - "id": "Stdlib.null", - "kind": "value", - "name": "null", - "docstrings": [], - "signature": "let null: Stdlib__Nullable.t<'a>" - }, - { - "id": "Stdlib.undefined", + "id": "Stdlib.import", "kind": "value", - "name": "undefined", - "docstrings": [], - "signature": "let undefined: Stdlib__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": "Stdlib.typeof", + "id": "Stdlib.panic", "kind": "value", - "name": "typeof", + "name": "panic", "docstrings": [], - "signature": "let typeof: 'a => Stdlib__Type.t" + "signature": "let panic: string => 'a" }, { - "id": "Stdlib.import", + "id": "Stdlib.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`Stdlib__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 `Stdlib__Array.res`\n\n```rescript\nlet main = async () => {\n let indexOfOpt = await import(Stdlib__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(\"./Stdlib__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": "Stdlib.null", - "kind": "type", + "kind": "value", "name": "null", "docstrings": [], - "signature": "type null<'a> = Js.null<'a>" + "signature": "let null: nullable<'a>" }, { "id": "Stdlib.undefined", - "kind": "type", + "kind": "value", "name": "undefined", "docstrings": [], - "signature": "type undefined<'a> = Js.undefined<'a>" - }, - { - "id": "Stdlib.nullable", - "kind": "type", - "name": "nullable", - "docstrings": [], - "signature": "type nullable<'a> = Js.nullable<'a>" + "signature": "let undefined: nullable<'a>" }, { - "id": "Stdlib.panic", + "id": "Stdlib.typeof", "kind": "value", - "name": "panic", + "name": "typeof", "docstrings": [], - "signature": "let panic: string => 'a" + "signature": "let typeof: 'a => Type.t" } ] }, @@ -232,131 +258,932 @@ "name": "parseJsValue", "docstrings": [], "signature": "let parseJsValue: 'a => option<[> #always | #auto | #bool(bool) | #min2]>" + }, + { + "id": "Stdlib.Intl.NumberFormat.Grouping.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(grouping)` ignores the provided grouping and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, - "stdlib/intl/segments": { - "id": "Stdlib.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" - ], + "stdlib/biguint64array/constants": { + "id": "Stdlib.BigUint64Array.Constants", + "name": "Constants", + "docstrings": [], "items": [ { - "id": "Stdlib.Intl.Segments.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Stdlib.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": "Stdlib.Intl.Segments.containing", + "id": "Stdlib.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" + } + ] + }, + "stdlib/bigint64array/constants": { + "id": "Stdlib.BigInt64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Segments.containingWithIndex", + "id": "Stdlib.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" } ] }, - "stdlib/intl/segmenter": { - "id": "Stdlib.Intl.Segmenter", - "name": "Segmenter", - "docstrings": ["Not supported in Firefox"], + "stdlib/uint8clampedarray/constants": { + "id": "Stdlib.Uint8ClampedArray.Constants", + "name": "Constants", + "docstrings": [], "items": [ { - "id": "Stdlib.Intl.Segmenter.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t" - }, - { - "id": "Stdlib.Intl.Segmenter.granularity", - "kind": "type", - "name": "granularity", - "docstrings": [], - "signature": "type granularity = [#grapheme | #sentence | #word]" - }, - { - "id": "Stdlib.Intl.Segmenter.options", - "kind": "type", - "name": "options", - "docstrings": [], - "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n granularity?: granularity,\n}" - }, - { - "id": "Stdlib.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": "Stdlib.Intl.Segmenter.resolvedOptions", - "kind": "type", - "name": "resolvedOptions", - "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n granularity: granularity,\n}" - }, - { - "id": "Stdlib.Intl.Segmenter.supportedLocalesOptions", - "kind": "type", - "name": "supportedLocalesOptions", - "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" - }, + "id": "Stdlib.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" + } + ] + }, + "stdlib/uint32array/constants": { + "id": "Stdlib.Uint32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Segmenter.make", + "id": "Stdlib.Uint32Array.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" + } + ] + }, + "stdlib/uint16array/constants": { + "id": "Stdlib.Uint16Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Segmenter.supportedLocalesOf", + "id": "Stdlib.Uint16Array.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" + } + ] + }, + "stdlib/uint8array/constants": { + "id": "Stdlib.Uint8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Segmenter.resolvedOptions", + "id": "Stdlib.Uint8Array.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" + } + ] + }, + "stdlib/int32array/constants": { + "id": "Stdlib.Int32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Segmenter.segment", + "id": "Stdlib.Int32Array.Constants.bytesPerElement", "kind": "value", - "name": "segment", - "docstrings": [], - "signature": "let segment: (t, string) => Stdlib__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" } ] }, - "stdlib/intl/relativetimeformat": { - "id": "Stdlib.Intl.RelativeTimeFormat", - "name": "RelativeTimeFormat", + "stdlib/int16array/constants": { + "id": "Stdlib.Int16Array.Constants", + "name": "Constants", "docstrings": [], "items": [ { - "id": "Stdlib.Intl.RelativeTimeFormat.t", - "kind": "type", + "id": "Stdlib.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" + } + ] + }, + "stdlib/int8array/constants": { + "id": "Stdlib.Int8Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/float64array/constants": { + "id": "Stdlib.Float64Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/float32array/constants": { + "id": "Stdlib.Float32Array.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/type/classify": { + "id": "Stdlib.Type.Classify", + "name": "Classify", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Type.Classify.function", + "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" + }, + { + "id": "Stdlib.Type.Classify.object", + "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" + }, + { + "id": "Stdlib.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(Symbol.t)\n | BigInt(bigint)" + }, + { + "id": "Stdlib.Type.Classify.classify", + "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" + } + ] + }, + "stdlib/regexp/result": { + "id": "Stdlib.RegExp.Result", + "name": "Result", + "docstrings": [], + "items": [ + { + "id": "Stdlib.RegExp.Result.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing the result of a `RegExp` execution." + ], + "signature": "type t = array>" + }, + { + "id": "Stdlib.RegExp.Result.fullMatch", + "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" + }, + { + "id": "Stdlib.RegExp.Result.matches", + "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->Array.keepSome {\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": "Stdlib.RegExp.Result.index", + "kind": "value", + "name": "index", + "docstrings": [], + "signature": "let index: t => int" + }, + { + "id": "Stdlib.RegExp.Result.input", + "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" + } + ] + }, + "stdlib/math/int": { + "id": "Stdlib.Math.Int", + "name": "Int", + "docstrings": [ + "Provide Math utilities for `int`" + ], + "items": [ + { + "id": "Stdlib.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 assertEqual(Math.Int.abs(-2), 2)\n assertEqual(Math.Int.abs(3), 3)\n ```" + ], + "signature": "let abs: int => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.clz32(1), 31)\n // 00000000000000000000000000000100\n assertEqual(Math.Int.clz32(4), 29)\n ```" + ], + "signature": "let clz32: int => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.imul(3, 4), 12)\n assertEqual(Math.Int.imul(-5, 12), -60)\n ```" + ], + "signature": "let imul: (int, int) => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.min(1, 2), 1)\n assertEqual(Math.Int.min(-1, -2), -2)\n ```" + ], + "signature": "let min: (int, int) => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.minMany([1, 2]), 1)\n assertEqual(Math.Int.minMany([-1, -2]), -2)\n assertEqual(Math.Int.minMany([])->Int.toFloat->Float.isFinite, false)\n ```" + ], + "signature": "let minMany: array => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.max(1, 2), 2)\n assertEqual(Math.Int.max(-1, -2), -1)\n ```" + ], + "signature": "let max: (int, int) => int" + }, + { + "id": "Stdlib.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 assertEqual(Math.Int.maxMany([1, 2]), 2)\n assertEqual(Math.Int.maxMany([-1, -2]), -1)\n assertEqual(Math.Int.maxMany([])->Int.toFloat->Float.isFinite, false)\n ```" + ], + "signature": "let maxMany: array => int" + }, + { + "id": "Stdlib.Math.Int.pow", + "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 assertEqual(Math.Int.pow(2, ~exp=4), 16)\n assertEqual(Math.Int.pow(3, ~exp=4), 81)\n ```" + ], + "signature": "let pow: (int, ~exp: int) => int" + }, + { + "id": "Stdlib.Math.Int.sign", + "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 assertEqual(Math.Int.sign(3), 1)\n assertEqual(Math.Int.sign(-3), -1)\n assertEqual(Math.Int.sign(0), 0)\n ```" + ], + "signature": "let sign: int => int" + }, + { + "id": "Stdlib.Math.Int.floor", + "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 assertEqual(Math.Int.floor(3.7), 3)\n assertEqual(Math.Int.floor(3.0), 3)\n assertEqual(Math.Int.floor(-3.1), -4)\n ```" + ], + "signature": "let floor: float => int" + }, + { + "id": "Stdlib.Math.Int.ceil", + "kind": "value", + "name": "ceil", + "docstrings": [ + "ceil(v) returns the smallest `int` greater than or equal to the argument;\n See [`Math.floor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor)\n on MDN.\n\n ## Examples\n\n ```rescript\n assertEqual(Math.Int.ceil(3.7), 4)\n assertEqual(Math.Int.ceil(3.0), 3)\n assertEqual(Math.Int.ceil(-3.1), -3)\n ```" + ], + "signature": "let ceil: float => int" + }, + { + "id": "Stdlib.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)\n Math.Int.random(505, 2000)\n Math.Int.random(-7, -2)\n ```" + ], + "signature": "let random: (int, int) => int" + } + ] + }, + "stdlib/math/constants": { + "id": "Stdlib.Math.Constants", + "name": "Constants", + "docstrings": [ + "Mathematical Constants" + ], + "items": [ + { + "id": "Stdlib.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": "Stdlib.Math.Constants.ln2", + "kind": "value", + "name": "ln2", + "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 ```" + ], + "signature": "let ln2: float" + }, + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.Math.Constants.pi", + "kind": "value", + "name": "pi", + "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 ```" + ], + "signature": "let pi: float" + }, + { + "id": "Stdlib.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": "Stdlib.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" + } + ] + }, + "stdlib/json/decode": { + "id": "Stdlib.JSON.Decode", + "name": "Decode", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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.parseOrThrow(`true`)->JSON.Decode.bool\n // Some(true)\n\n JSON.parseOrThrow(`\"hello world\"`)->JSON.Decode.bool\n // None\n ```" + ], + "signature": "let bool: t => option" + }, + { + "id": "Stdlib.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.parseOrThrow(`null`)->JSON.Decode.null\n // Some(null)\n\n JSON.parseOrThrow(`\"hello world\"`)->JSON.Decode.null\n // None\n ```" + ], + "signature": "let null: t => option>" + }, + { + "id": "Stdlib.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.parseOrThrow(`\"hello world\"`)->JSON.Decode.string\n // Some(\"hello world\")\n\n JSON.parseOrThrow(`42`)->JSON.Decode.string\n // None \n ```" + ], + "signature": "let string: t => option" + }, + { + "id": "Stdlib.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.parseOrThrow(`42.0`)->JSON.Decode.float\n // Some(42.0)\n\n JSON.parseOrThrow(`\"hello world\"`)->JSON.Decode.float\n // None\n ```" + ], + "signature": "let float: t => option" + }, + { + "id": "Stdlib.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.parseOrThrow(`{\"foo\":\"bar\"}`)->JSON.Decode.object\n // Some({ foo: 'bar' })\n\n JSON.parseOrThrow(`\"hello world\"`)->JSON.Decode.object\n // None\n ```" + ], + "signature": "let object: t => option>" + }, + { + "id": "Stdlib.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.parseOrThrow(`[\"foo\", \"bar\"]`)->JSON.Decode.array\n // Some([ 'foo', 'bar' ])\n\n JSON.parseOrThrow(`\"hello world\"`)->JSON.Decode.array\n // None\n ```" + ], + "signature": "let array: t => option>" + } + ] + }, + "stdlib/json/encode": { + "id": "Stdlib.JSON.Encode", + "name": "Encode", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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" + } + ] + }, + "stdlib/json/classify": { + "id": "Stdlib.JSON.Classify", + "name": "Classify", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JSON.Classify.t", + "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(dict)\n | Array(array)" + }, + { + "id": "Stdlib.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" + } + ] + }, + "stdlib/jserror/urierror": { + "id": "Stdlib.JsError.URIError", + "name": "URIError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.URIError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `URIError` with the provided `message`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.URIError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `URIError` with the provided `message` and throws it.\n\n `JsError.URIError.throwWithMessage(\"message\")` is equivalent to `JsError.URIError.make(\"message\")->JsError.throw`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/jserror/typeerror": { + "id": "Stdlib.JsError.TypeError", + "name": "TypeError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.TypeError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `TypeError` with the provided `message`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.TypeError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `TypeError` with the provided `message` and throws it.\n\n `JsError.TypeError.throwWithMessage(\"message\")` is equivalent to `JsError.TypeError.make(\"message\")->JsError.throw`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/jserror/syntaxerror": { + "id": "Stdlib.JsError.SyntaxError", + "name": "SyntaxError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.SyntaxError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `SyntaxError` with the provided `message`.\n\n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.SyntaxError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `SyntaxError` with the provided `message` and throws it.\n \n `JsError.SyntaxError.throwWithMessage(\"message\")` is equivalent to `JsError.SyntaxError.make(\"message\")->JsError.throw`.\n \n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/jserror/referenceerror": { + "id": "Stdlib.JsError.ReferenceError", + "name": "ReferenceError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.ReferenceError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `ReferenceError` with the provided `message`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.ReferenceError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `ReferenceError` with the provided `message` and throws it.\n\n `JsError.ReferenceError.throwWithMessage(\"message\")` is equivalent to `JsError.ReferenceError.make(\"message\")->JsError.throw`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/jserror/rangeerror": { + "id": "Stdlib.JsError.RangeError", + "name": "RangeError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.RangeError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `RangeError` with the provided `message`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.RangeError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `RangeError` with the provided `message` and throws it.\n \n `JsError.RangeError.throwWithMessage(\"message\")` is equivalent to `JsError.RangeError.make(\"message\")->JsError.throw`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/jserror/evalerror": { + "id": "Stdlib.JsError.EvalError", + "name": "EvalError", + "docstrings": [], + "items": [ + { + "id": "Stdlib.JsError.EvalError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `EvalError` with the provided `message`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." + ], + "signature": "let make: string => t" + }, + { + "id": "Stdlib.JsError.EvalError.throwWithMessage", + "kind": "value", + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `EvalError` with the provided `message` and throws it.\n\n `JsError.EvalError.throwWithMessage(\"message\")` is equivalent to `JsError.EvalError.make(\"message\")->JsError.throw`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." + ], + "signature": "let throwWithMessage: string => 'a" + } + ] + }, + "stdlib/intl/segments": { + "id": "Stdlib.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": "Stdlib.Intl.Segments.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.Segments.containing", + "kind": "value", + "name": "containing", + "docstrings": [], + "signature": "let containing: t => segmentData" + }, + { + "id": "Stdlib.Intl.Segments.containingWithIndex", + "kind": "value", + "name": "containingWithIndex", + "docstrings": [], + "signature": "let containingWithIndex: (t, int) => segmentData" + }, + { + "id": "Stdlib.Intl.Segments.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(segments)` ignores the provided segments and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/intl/segmenter": { + "id": "Stdlib.Intl.Segmenter", + "name": "Segmenter", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.Segmenter.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" + }, + { + "id": "Stdlib.Intl.Segmenter.granularity", + "kind": "type", + "name": "granularity", + "docstrings": [], + "signature": "type granularity = [#grapheme | #sentence | #word]" + }, + { + "id": "Stdlib.Intl.Segmenter.options", + "kind": "type", + "name": "options", + "docstrings": [], + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n granularity?: granularity,\n}" + }, + { + "id": "Stdlib.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": "Stdlib.Intl.Segmenter.resolvedOptions", + "kind": "type", + "name": "resolvedOptions", + "docstrings": [], + "signature": "type resolvedOptions = {\n locale: string,\n granularity: granularity,\n}" + }, + { + "id": "Stdlib.Intl.Segmenter.supportedLocalesOptions", + "kind": "type", + "name": "supportedLocalesOptions", + "docstrings": [], + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.Segmenter.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.Segmenter.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.Segmenter.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.Segmenter.segment", + "kind": "value", + "name": "segment", + "docstrings": [], + "signature": "let segment: (t, string) => Intl_Segments.t" + }, + { + "id": "Stdlib.Intl.Segmenter.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(segmenter)` ignores the provided segmenter and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/intl/relativetimeformat": { + "id": "Stdlib.Intl.RelativeTimeFormat", + "name": "RelativeTimeFormat", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.RelativeTimeFormat.t", + "kind": "type", "name": "t", "docstrings": [], "signature": "type t" @@ -387,14 +1214,14 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n numeric?: numeric,\n style?: style,\n}" }, { "id": "Stdlib.Intl.RelativeTimeFormat.supportedLocalesOptions", "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { "id": "Stdlib.Intl.RelativeTimeFormat.resolvedOptions", @@ -451,6 +1278,15 @@ "name": "formatToParts", "docstrings": [], "signature": "let formatToParts: (t, int, timeUnit) => array" + }, + { + "id": "Stdlib.Intl.RelativeTimeFormat.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(relativeTimeFormat)` ignores the provided relativeTimeFormat and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -478,7 +1314,7 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n \\\"type\"?: localeType,\n minimumIntegerDigits?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\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": "Stdlib.Intl.PluralRules.pluralCategories", @@ -492,14 +1328,14 @@ "kind": "type", "name": "resolvedOptions", "docstrings": [], - "signature": "type resolvedOptions = {\n locale: string,\n pluralCategories: array,\n \\\"type\": localeType,\n minimumIntegerDigits?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n}" + "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": "Stdlib.Intl.PluralRules.supportedLocalesOptions", "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { "id": "Stdlib.Intl.PluralRules.make", @@ -570,6 +1406,15 @@ "name": "selectRangeBigInt", "docstrings": [], "signature": "let selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule" + }, + { + "id": "Stdlib.Intl.PluralRules.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(pluralRules)` ignores the provided pluralRules and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -589,7 +1434,9 @@ "id": "Stdlib.Intl.NumberFormat.currency", "kind": "type", "name": "currency", - "docstrings": ["An ISO 4217 currency code. e.g. USD, EUR, CNY"], + "docstrings": [ + "An ISO 4217 currency code. e.g. USD, EUR, CNY" + ], "signature": "type currency = string" }, { @@ -617,7 +1464,9 @@ "id": "Stdlib.Intl.NumberFormat.compactDisplay", "kind": "type", "name": "compactDisplay", - "docstrings": ["Used only when notation is #compact"], + "docstrings": [ + "Used only when notation is #compact" + ], "signature": "type compactDisplay = [#long | #short]" }, { @@ -647,7 +1496,9 @@ "id": "Stdlib.Intl.NumberFormat.unitDisplay", "kind": "type", "name": "unitDisplay", - "docstrings": ["Only used when style is #unit"], + "docstrings": [ + "Only used when style is #unit" + ], "signature": "type unitDisplay = [#long | #narrow | #short]" }, { @@ -683,21 +1534,21 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n compactDisplay?: compactDisplay,\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n currency?: currency,\n currencyDisplay?: currencyDisplay,\n currencySign?: currencySign,\n localeMatcher?: Stdlib__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?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n}" + "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": "Stdlib.Intl.NumberFormat.resolvedOptions", "kind": "type", "name": "resolvedOptions", "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?: Stdlib__Intl__Common.oneTo21,\n minimumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n maximumFractionDigits?: Stdlib__Intl__Common.zeroTo20,\n minimumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n maximumSignificantDigits?: Stdlib__Intl__Common.oneTo21,\n locale: string,\n notation: notation,\n numberingSystem: Stdlib__Intl__Common.numberingSystem,\n signDisplay: signDisplay,\n style: style,\n useGrouping: Grouping.t,\n}" + "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": "Stdlib.Intl.NumberFormat.supportedLocalesOptions", "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { "id": "Stdlib.Intl.NumberFormat.numberFormatPartType", @@ -845,6 +1696,15 @@ "name": "formatStringToParts", "docstrings": [], "signature": "let formatStringToParts: (t, string) => array" + }, + { + "id": "Stdlib.Intl.NumberFormat.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(numberFormat)` ignores the provided numberFormat and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -865,7 +1725,7 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n baseName?: string,\n calendar?: Stdlib__Intl__Common.calendar,\n collation?: Stdlib__Intl__Common.collation,\n hourCycle?: [#h11 | #h12 | #h23 | #h24],\n caseFirst?: [#\"false\" | #lower | #upper],\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n numeric?: bool,\n language?: string,\n script?: string,\n region?: string,\n}" + "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": "Stdlib.Intl.Locale.make", @@ -957,6 +1817,15 @@ "name": "minimize", "docstrings": [], "signature": "let minimize: t => t" + }, + { + "id": "Stdlib.Intl.Locale.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(locale)` ignores the provided locale and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -991,7 +1860,7 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" + "signature": "type options = {\n localeMatcher?: Intl_Common.localeMatcher,\n \\\"type\"?: listType,\n style?: style,\n}" }, { "id": "Stdlib.Intl.ListFormat.listPartComponentType", @@ -1019,7 +1888,7 @@ "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { "id": "Stdlib.Intl.ListFormat.make", @@ -1055,6 +1924,15 @@ "name": "formatToParts", "docstrings": [], "signature": "let formatToParts: (t, array) => array" + }, + { + "id": "Stdlib.Intl.ListFormat.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(listFormat)` ignores the provided listFormat and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -1182,21 +2060,21 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n dateStyle?: dateStyle,\n timeStyle?: timeStyle,\n calendar?: Stdlib__Intl__Common.calendar,\n dayPeriod?: dayPeriod,\n numberingSystem?: Stdlib__Intl__Common.numberingSystem,\n localeMatcher?: Stdlib__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": "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": "Stdlib.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: Stdlib__Intl__Common.calendar,\n hour12: bool,\n hourCycle: hourCycle,\n locale: string,\n numberingSystem: Stdlib__Intl__Common.numberingSystem,\n timeZone: string,\n}" + "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": "Stdlib.Intl.DateTimeFormat.supportedLocalesOptions", "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" }, { "id": "Stdlib.Intl.DateTimeFormat.dateTimeComponent", @@ -1252,28 +2130,37 @@ "kind": "value", "name": "format", "docstrings": [], - "signature": "let format: (t, Stdlib__Date.t) => string" + "signature": "let format: (t, Date.t) => string" }, { "id": "Stdlib.Intl.DateTimeFormat.formatToParts", "kind": "value", "name": "formatToParts", "docstrings": [], - "signature": "let formatToParts: (t, Stdlib__Date.t) => array" + "signature": "let formatToParts: (t, Date.t) => array" }, { "id": "Stdlib.Intl.DateTimeFormat.formatRange", "kind": "value", "name": "formatRange", "docstrings": [], - "signature": "let formatRange: (\n t,\n ~startDate: Stdlib__Date.t,\n ~endDate: Stdlib__Date.t,\n) => string" + "signature": "let formatRange: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => string" }, { "id": "Stdlib.Intl.DateTimeFormat.formatRangeToParts", "kind": "value", "name": "formatRangeToParts", "docstrings": [], - "signature": "let formatRangeToParts: (\n t,\n ~startDate: Stdlib__Date.t,\n ~endDate: Stdlib__Date.t,\n) => array" + "signature": "let formatRangeToParts: (\n t,\n ~startDate: Date.t,\n ~endDate: Date.t,\n) => array" + }, + { + "id": "Stdlib.Intl.DateTimeFormat.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(dateTimeFormat)` ignores the provided dateTimeFormat and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -1315,7 +2202,7 @@ "kind": "type", "name": "options", "docstrings": [], - "signature": "type options = {\n localeMatcher?: Stdlib__Intl__Common.localeMatcher,\n usage?: usage,\n sensitivity?: sensitivity,\n ignorePunctuation?: bool,\n numeric?: bool,\n caseFirst?: caseFirst,\n}" + "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": "Stdlib.Intl.Collator.resolvedOptions", @@ -1329,5831 +2216,6064 @@ "kind": "type", "name": "supportedLocalesOptions", "docstrings": [], - "signature": "type supportedLocalesOptions = {\n localeMatcher: Stdlib__Intl__Common.localeMatcher,\n}" + "signature": "type supportedLocalesOptions = {\n localeMatcher: Intl_Common.localeMatcher,\n}" + }, + { + "id": "Stdlib.Intl.Collator.make", + "kind": "value", + "name": "make", + "docstrings": [], + "signature": "let make: (~locales: array=?, ~options: options=?) => t" + }, + { + "id": "Stdlib.Intl.Collator.supportedLocalesOf", + "kind": "value", + "name": "supportedLocalesOf", + "docstrings": [], + "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + }, + { + "id": "Stdlib.Intl.Collator.resolvedOptions", + "kind": "value", + "name": "resolvedOptions", + "docstrings": [], + "signature": "let resolvedOptions: t => resolvedOptions" + }, + { + "id": "Stdlib.Intl.Collator.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (t, string, string) => int" + }, + { + "id": "Stdlib.Intl.Collator.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(collator)` ignores the provided collator and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/intl/common": { + "id": "Stdlib.Intl.Common", + "name": "Common", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Intl.Common.localeMatcher", + "kind": "type", + "name": "localeMatcher", + "docstrings": [], + "signature": "type localeMatcher = [#\"best fit\" | #lookup]" + }, + { + "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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]" + } + ] + }, + "stdlib/int/ref": { + "id": "Stdlib.Int.Ref", + "name": "Ref", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int.Ref.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t = ref" + }, + { + "id": "Stdlib.Int.Ref.increment", + "kind": "value", + "name": "increment", + "docstrings": [ + "`increment(intRef)` increments the value of the provided reference by 1.\n\n ## Examples\n\n ```rescript\n let myRef = ref(4)\n Int.Ref.increment(myRef)\n assertEqual(myRef.contents, 5)\n ```" + ], + "signature": "let increment: ref => unit" + }, + { + "id": "Stdlib.Int.Ref.decrement", + "kind": "value", + "name": "decrement", + "docstrings": [ + "`decrement(intRef)` decrements the value of the provided reference by 1.\n\n ## Examples\n\n ```rescript\n let myRef = ref(4)\n Int.Ref.decrement(myRef)\n assertEqual(myRef.contents, 3)\n ```" + ], + "signature": "let decrement: ref => unit" + } + ] + }, + "stdlib/int/constants": { + "id": "Stdlib.Int.Constants", + "name": "Constants", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Int.Constants.minValue", + "kind": "value", + "name": "minValue", + "docstrings": [ + "The smallest positive number represented in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.minValue)\n ```" + ], + "signature": "let minValue: int" + }, + { + "id": "Stdlib.Int.Constants.maxValue", + "kind": "value", + "name": "maxValue", + "docstrings": [ + "The largest positive number represented in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.maxValue)\n ```" + ], + "signature": "let maxValue: int" + } + ] + }, + "stdlib/float/constants": { + "id": "Stdlib.Float.Constants", + "name": "Constants", + "docstrings": [ + "Float constants." + ], + "items": [ + { + "id": "Stdlib.Float.Constants.nan", + "kind": "value", + "name": "nan", + "docstrings": [ + "The special value \"Not a Number\"\n See [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.nan\n ```" + ], + "signature": "let nan: float" + }, + { + "id": "Stdlib.Float.Constants.epsilon", + "kind": "value", + "name": "epsilon", + "docstrings": [ + "Represents the difference between 1 and the smallest floating point number greater than 1.\n See [`Number.EPSILON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.epsilon\n ```" + ], + "signature": "let epsilon: float" + }, + { + "id": "Stdlib.Float.Constants.positiveInfinity", + "kind": "value", + "name": "positiveInfinity", + "docstrings": [ + "The positive Infinity value\n See [`Number.POSITIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.positiveInfinity\n ```" + ], + "signature": "let positiveInfinity: float" }, { - "id": "Stdlib.Intl.Collator.make", + "id": "Stdlib.Float.Constants.negativeInfinity", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: (~locales: array=?, ~options: options=?) => t" + "name": "negativeInfinity", + "docstrings": [ + "The negative Infinity value\n See [`Number.NEGATIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.negativeInfinity\n ```" + ], + "signature": "let negativeInfinity: float" }, { - "id": "Stdlib.Intl.Collator.supportedLocalesOf", + "id": "Stdlib.Float.Constants.minValue", "kind": "value", - "name": "supportedLocalesOf", - "docstrings": [], - "signature": "let supportedLocalesOf: (array, ~options: supportedLocalesOptions=?) => t" + "name": "minValue", + "docstrings": [ + "The smallest positive numeric value representable in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" + ], + "signature": "let minValue: float" }, { - "id": "Stdlib.Intl.Collator.resolvedOptions", + "id": "Stdlib.Float.Constants.maxValue", "kind": "value", - "name": "resolvedOptions", - "docstrings": [], - "signature": "let resolvedOptions: t => resolvedOptions" - }, + "name": "maxValue", + "docstrings": [ + "The maximum positive numeric value representable in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\n ```" + ], + "signature": "let maxValue: float" + } + ] + }, + "stdlib/error/urierror": { + "id": "Stdlib.Error.URIError", + "name": "URIError", + "docstrings": [], + "items": [ { - "id": "Stdlib.Intl.Collator.compare", + "id": "Stdlib.Error.URIError.make", "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (t, string, string) => int" + "name": "make", + "docstrings": [ + "Creates a new `URIError` with the provided `message`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." + ], + "signature": "let make: string => t", + "deprecated": "Use `JsError.URIError.make` instead" } ] }, - "stdlib/intl/common": { - "id": "Stdlib.Intl.Common", - "name": "Common", + "stdlib/error/typeerror": { + "id": "Stdlib.Error.TypeError", + "name": "TypeError", "docstrings": [], "items": [ { - "id": "Stdlib.Intl.Common.localeMatcher", - "kind": "type", - "name": "localeMatcher", - "docstrings": [], - "signature": "type localeMatcher = [#\"best fit\" | #lookup]" - }, - { - "id": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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]" + "id": "Stdlib.Error.TypeError.make", + "kind": "value", + "name": "make", + "docstrings": [ + "Creates a new `TypeError` with the provided `message`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." + ], + "signature": "let make: string => t", + "deprecated": "Use `JsError.TypeError.make` instead" } ] }, - "stdlib/biguint64array/constants": { - "id": "Stdlib.BigUint64Array.Constants", - "name": "Constants", + "stdlib/error/syntaxerror": { + "id": "Stdlib.Error.SyntaxError", + "name": "SyntaxError", "docstrings": [], "items": [ { - "id": "Stdlib.BigUint64Array.Constants.bytesPerElement", + "id": "Stdlib.Error.SyntaxError.make", "kind": "value", - "name": "bytesPerElement", + "name": "make", "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)" + "Creates a new `SyntaxError` with the provided `message`.\n\n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." ], - "signature": "let bytesPerElement: int" + "signature": "let make: string => t", + "deprecated": "Use `JsError.SyntaxError.make` instead" } ] }, - "stdlib/bigint64array/constants": { - "id": "Stdlib.BigInt64Array.Constants", - "name": "Constants", + "stdlib/error/referenceerror": { + "id": "Stdlib.Error.ReferenceError", + "name": "ReferenceError", "docstrings": [], "items": [ { - "id": "Stdlib.BigInt64Array.Constants.bytesPerElement", + "id": "Stdlib.Error.ReferenceError.make", "kind": "value", - "name": "bytesPerElement", + "name": "make", "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)" + "Creates a new `ReferenceError` with the provided `message`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." ], - "signature": "let bytesPerElement: int" + "signature": "let make: string => t", + "deprecated": "Use `JsError.ReferenceError.make` instead" } ] }, - "stdlib/uint8clampedarray/constants": { - "id": "Stdlib.Uint8ClampedArray.Constants", - "name": "Constants", + "stdlib/error/rangeerror": { + "id": "Stdlib.Error.RangeError", + "name": "RangeError", "docstrings": [], "items": [ { - "id": "Stdlib.Uint8ClampedArray.Constants.bytesPerElement", + "id": "Stdlib.Error.RangeError.make", "kind": "value", - "name": "bytesPerElement", + "name": "make", "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)" + "Creates a new `RangeError` with the provided `message`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." ], - "signature": "let bytesPerElement: int" + "signature": "let make: string => t", + "deprecated": "Use `JsError.RangeError.make` instead" } ] }, - "stdlib/uint32array/constants": { - "id": "Stdlib.Uint32Array.Constants", - "name": "Constants", + "stdlib/error/evalerror": { + "id": "Stdlib.Error.EvalError", + "name": "EvalError", "docstrings": [], "items": [ { - "id": "Stdlib.Uint32Array.Constants.bytesPerElement", + "id": "Stdlib.Error.EvalError.make", "kind": "value", - "name": "bytesPerElement", + "name": "make", "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)" + "Creates a new `EvalError` with the provided `message`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." ], - "signature": "let bytesPerElement: int" + "signature": "let make: string => t", + "deprecated": "Use `JsError.EvalError.make` instead" } ] }, - "stdlib/uint16array/constants": { - "id": "Stdlib.Uint16Array.Constants", - "name": "Constants", + "stdlib/date/utc": { + "id": "Stdlib.Date.UTC", + "name": "UTC", "docstrings": [], "items": [ { - "id": "Stdlib.Uint16Array.Constants.bytesPerElement", + "id": "Stdlib.Date.UTC.makeWithYM", "kind": "value", - "name": "bytesPerElement", + "name": "makeWithYM", "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)" + "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.makeWithYM(~year=2023, ~month=0)\n // 1672531200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=11)\n // 1701388800000\n\n Date.UTC.makeWithYM(~year=2023, ~month=12)\n // 1704067200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=-1)\n // 1669852800000\n ```" ], - "signature": "let bytesPerElement: int" + "signature": "let makeWithYM: (~year: int, ~month: int) => msSinceEpoch" + }, + { + "id": "Stdlib.Date.UTC.makeWithYMD", + "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, ~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, ~day: int) => msSinceEpoch" + }, + { + "id": "Stdlib.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, ~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 ~day: int,\n ~hours: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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, ~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 ~day: int,\n ~hours: int,\n ~minutes: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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, ~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 ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => msSinceEpoch" + }, + { + "id": "Stdlib.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, ~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 ~day: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n ~milliseconds: int,\n) => msSinceEpoch" } ] }, - "stdlib/uint8array/constants": { - "id": "Stdlib.Uint8Array.Constants", - "name": "Constants", + "stdlib/biguint64array": { + "id": "Stdlib.BigUint64Array", + "name": "BigUint64Array", "docstrings": [], "items": [ { - "id": "Stdlib.Uint8Array.Constants.bytesPerElement", + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "type t = TypedArray.t" + }, + { + "id": "Stdlib.BigUint64Array.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)" + ], + "signature": "let fromArray: array => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBuffer: ArrayBuffer.t => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.BigUint64Array.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." + ], + "signature": "let fromLength: int => t" + }, + { + "id": "Stdlib.BigUint64Array.fromArrayLikeOrIterable", "kind": "value", - "name": "bytesPerElement", + "name": "fromArrayLikeOrIterable", "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)" + "`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 bytesPerElement: int" - } - ] - }, - "stdlib/int32array/constants": { - "id": "Stdlib.Int32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, { - "id": "Stdlib.Int32Array.Constants.bytesPerElement", + "id": "Stdlib.BigUint64Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "bytesPerElement", + "name": "fromArrayLikeOrIterableWithMap", "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)" + "`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 bytesPerElement: int" - } - ] - }, - "stdlib/int16array/constants": { - "id": "Stdlib.Int16Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + }, { - "id": "Stdlib.Int16Array.Constants.bytesPerElement", + "id": "Stdlib.BigUint64Array.ignore", "kind": "value", - "name": "bytesPerElement", + "name": "ignore", "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)" + "`ignore(bigUintArray)` ignores the provided bigUintArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let bytesPerElement: int" + "signature": "let ignore: t => unit" } ] }, - "stdlib/int8array/constants": { - "id": "Stdlib.Int8Array.Constants", - "name": "Constants", + "stdlib/bigint64array": { + "id": "Stdlib.BigInt64Array", + "name": "BigInt64Array", "docstrings": [], "items": [ { - "id": "Stdlib.Int8Array.Constants.bytesPerElement", - "kind": "value", - "name": "bytesPerElement", + "id": "Stdlib.BigInt64Array.t", + "kind": "type", + "name": "t", "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)" + "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 bytesPerElement: int" - } - ] - }, - "stdlib/float64array/constants": { - "id": "Stdlib.Float64Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "signature": "type t = TypedArray.t" + }, { - "id": "Stdlib.Float64Array.Constants.bytesPerElement", + "id": "Stdlib.BigInt64Array.fromArray", "kind": "value", - "name": "bytesPerElement", + "name": "fromArray", "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)" + "`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 bytesPerElement: int" - } - ] - }, - "stdlib/float32array/constants": { - "id": "Stdlib.Float32Array.Constants", - "name": "Constants", - "docstrings": [], - "items": [ + "signature": "let fromArray: array => t" + }, { - "id": "Stdlib.Float32Array.Constants.bytesPerElement", + "id": "Stdlib.BigInt64Array.fromBuffer", "kind": "value", - "name": "bytesPerElement", + "name": "fromBuffer", "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)" + "`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 bytesPerElement: int" - } - ] - }, - "stdlib/json/decode": { - "id": "Stdlib.JSON.Decode", - "name": "Decode", - "docstrings": [], - "items": [ + "signature": "let fromBuffer: ArrayBuffer.t => t" + }, { - "id": "Stdlib.JSON.Decode.bool", + "id": "Stdlib.BigInt64Array.fromBufferToEnd", "kind": "value", - "name": "bool", + "name": "fromBufferToEnd", "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 ```" + "`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 bool: t => option" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.JSON.Decode.null", + "id": "Stdlib.BigInt64Array.fromBufferWithRange", "kind": "value", - "name": "null", + "name": "fromBufferWithRange", "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 ```" + "`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 null: t => option>" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.JSON.Decode.string", + "id": "Stdlib.BigInt64Array.fromLength", "kind": "value", - "name": "string", + "name": "fromLength", "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 ```" + "`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 string: t => option" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.JSON.Decode.float", + "id": "Stdlib.BigInt64Array.fromArrayLikeOrIterable", "kind": "value", - "name": "float", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 float: t => option" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.JSON.Decode.object", + "id": "Stdlib.BigInt64Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "object", + "name": "fromArrayLikeOrIterableWithMap", "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 ```" + "`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 object: t => option>" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" }, { - "id": "Stdlib.JSON.Decode.array", + "id": "Stdlib.BigInt64Array.ignore", "kind": "value", - "name": "array", + "name": "ignore", "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 ```" + "`ignore(bigIntArray)` ignores the provided bigIntArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let array: t => option>" + "signature": "let ignore: t => unit" } ] }, - "stdlib/json/encode": { - "id": "Stdlib.JSON.Encode", - "name": "Encode", + "stdlib/uint8clampedarray": { + "id": "Stdlib.Uint8ClampedArray", + "name": "Uint8ClampedArray", "docstrings": [], "items": [ { - "id": "Stdlib.JSON.Encode.bool", + "id": "Stdlib.Uint8ClampedArray.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 = TypedArray.t" + }, + { + "id": "Stdlib.Uint8ClampedArray.fromArray", "kind": "value", - "name": "bool", + "name": "fromArray", "docstrings": [ - "Returns a boolean as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.bool(true)\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 bool: bool => t" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.JSON.Encode.null", + "id": "Stdlib.Uint8ClampedArray.fromBuffer", "kind": "value", - "name": "null", + "name": "fromBuffer", "docstrings": [ - "Returns null as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.null\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 null: t" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.JSON.Encode.string", + "id": "Stdlib.Uint8ClampedArray.fromBufferToEnd", "kind": "value", - "name": "string", + "name": "fromBufferToEnd", "docstrings": [ - "Returns a string as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.string(\"hello world\")\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 string: string => t" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.JSON.Encode.int", + "id": "Stdlib.Uint8ClampedArray.fromBufferWithRange", "kind": "value", - "name": "int", + "name": "fromBufferWithRange", "docstrings": [ - "Returns an int as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.int(42)\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 int: int => t" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.JSON.Encode.float", + "id": "Stdlib.Uint8ClampedArray.fromLength", "kind": "value", - "name": "float", + "name": "fromLength", "docstrings": [ - "Returns a float as a JSON object.\n\n ## Examples\n ```rescript\n JSON.Encode.float(42.0)\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 float: float => t" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.JSON.Encode.object", + "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterable", "kind": "value", - "name": "object", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 object: Stdlib__Dict.t => t" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.JSON.Encode.array", + "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "array", + "name": "fromArrayLikeOrIterableWithMap", "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 ```" + "`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 array: array => t" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + }, + { + "id": "Stdlib.Uint8ClampedArray.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(uintArray)` ignores the provided uintArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, - "stdlib/json/classify": { - "id": "Stdlib.JSON.Classify", - "name": "Classify", + "stdlib/uint32array": { + "id": "Stdlib.Uint32Array", + "name": "Uint32Array", "docstrings": [], "items": [ { - "id": "Stdlib.JSON.Classify.t", + "id": "Stdlib.Uint32Array.t", "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(Stdlib__Dict.t)\n | Array(array)" + "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 = TypedArray.t" }, { - "id": "Stdlib.JSON.Classify.classify", + "id": "Stdlib.Uint32Array.fromArray", "kind": "value", - "name": "classify", + "name": "fromArray", "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 ```" + "`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 classify: 'a => t" - } - ] - }, - "stdlib/type/classify": { - "id": "Stdlib.Type.Classify", - "name": "Classify", - "docstrings": [], - "items": [ + "signature": "let fromArray: array => t" + }, { - "id": "Stdlib.Type.Classify.function", - "kind": "type", - "name": "function", + "id": "Stdlib.Uint32Array.fromBuffer", + "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: ArrayBuffer.t => t" + }, + { + "id": "Stdlib.Uint32Array.fromBufferToEnd", + "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: (ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.Uint32Array.fromBufferWithRange", + "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: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.Uint32Array.fromLength", + "kind": "value", + "name": "fromLength", "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." + "`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": "type function" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Type.Classify.object", - "kind": "type", - "name": "object", + "id": "Stdlib.Uint32Array.fromArrayLikeOrIterable", + "kind": "value", + "name": "fromArrayLikeOrIterable", "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." + "`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": "type object" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.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(Stdlib__Symbol.t)\n | BigInt(bigint)" + "id": "Stdlib.Uint32Array.fromArrayLikeOrIterableWithMap", + "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" }, { - "id": "Stdlib.Type.Classify.classify", + "id": "Stdlib.Uint32Array.ignore", "kind": "value", - "name": "classify", + "name": "ignore", "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```" + "`ignore(uintArray)` ignores the provided uintArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let classify: 'a => t" + "signature": "let ignore: t => unit" } ] }, - "stdlib/regexp/result": { - "id": "Stdlib.RegExp.Result", - "name": "Result", + "stdlib/uint16array": { + "id": "Stdlib.Uint16Array", + "name": "Uint16Array", "docstrings": [], "items": [ { - "id": "Stdlib.RegExp.Result.t", + "id": "Stdlib.Uint16Array.t", "kind": "type", "name": "t", - "docstrings": ["Type representing the result of a `RegExp` execution."], - "signature": "type t = array>" + "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 = TypedArray.t" }, { - "id": "Stdlib.RegExp.Result.fullMatch", + "id": "Stdlib.Uint16Array.fromArray", "kind": "value", - "name": "fullMatch", + "name": "fromArray", "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 ```" + "`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 fullMatch: t => string" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.RegExp.Result.matches", + "id": "Stdlib.Uint16Array.fromBuffer", "kind": "value", - "name": "matches", + "name": "fromBuffer", "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 ```" + "`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 matches: t => array" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.RegExp.Result.index", + "id": "Stdlib.Uint16Array.fromBufferToEnd", "kind": "value", - "name": "index", - "docstrings": [], - "signature": "let index: t => int" + "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: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.RegExp.Result.input", + "id": "Stdlib.Uint16Array.fromBufferWithRange", "kind": "value", - "name": "input", + "name": "fromBufferWithRange", "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 ```" + "`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 input: t => string" - } - ] - }, - "stdlib/math/int": { - "id": "Stdlib.Math.Int", - "name": "Int", - "docstrings": ["Provide Math utilities for `int`"], - "items": [ + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, { - "id": "Stdlib.Math.Int.abs", + "id": "Stdlib.Uint16Array.fromLength", "kind": "value", - "name": "abs", + "name": "fromLength", "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 ```" + "`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 abs: int => int" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Math.Int.clz32", + "id": "Stdlib.Uint16Array.fromArrayLikeOrIterable", "kind": "value", - "name": "clz32", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 clz32: int => int" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.Math.Int.imul", + "id": "Stdlib.Uint16Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "imul", + "name": "fromArrayLikeOrIterableWithMap", "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 ```" + "`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 imul: (int, int) => int" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" }, { - "id": "Stdlib.Math.Int.min", + "id": "Stdlib.Uint16Array.ignore", "kind": "value", - "name": "min", + "name": "ignore", "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 ```" + "`ignore(uintArray)` ignores the provided uintArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let min: (int, int) => int" + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/uint8array": { + "id": "Stdlib.Uint8Array", + "name": "Uint8Array", + "docstrings": [], + "items": [ + { + "id": "Stdlib.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 = TypedArray.t" }, { - "id": "Stdlib.Math.Int.minMany", + "id": "Stdlib.Uint8Array.fromArray", "kind": "value", - "name": "minMany", + "name": "fromArray", "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 ```" + "`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 minMany: array => int" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.Math.Int.max", + "id": "Stdlib.Uint8Array.fromBuffer", "kind": "value", - "name": "max", + "name": "fromBuffer", "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 ```" + "`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 max: (int, int) => int" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.Math.Int.maxMany", + "id": "Stdlib.Uint8Array.fromBufferToEnd", "kind": "value", - "name": "maxMany", + "name": "fromBufferToEnd", "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 ```" + "`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 maxMany: array => int" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.Math.Int.pow", + "id": "Stdlib.Uint8Array.fromBufferWithRange", "kind": "value", - "name": "pow", + "name": "fromBufferWithRange", "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 ```" + "`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 pow: (int, ~exp: int) => int" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.Math.Int.sign", + "id": "Stdlib.Uint8Array.fromLength", "kind": "value", - "name": "sign", + "name": "fromLength", "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 ```" + "`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 sign: int => int" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Math.Int.floor", + "id": "Stdlib.Uint8Array.fromArrayLikeOrIterable", "kind": "value", - "name": "floor", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 floor: float => int" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.Math.Int.ceil", + "id": "Stdlib.Uint8Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "ceil", + "name": "fromArrayLikeOrIterableWithMap", "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 ```" + "`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 ceil: float => int" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" }, { - "id": "Stdlib.Math.Int.random", + "id": "Stdlib.Uint8Array.ignore", "kind": "value", - "name": "random", + "name": "ignore", "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 ```" + "`ignore(uintArray)` ignores the provided uintArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let random: (int, int) => int" + "signature": "let ignore: t => unit" } ] }, - "stdlib/math/constants": { - "id": "Stdlib.Math.Constants", - "name": "Constants", - "docstrings": ["Mathematical Constants"], + "stdlib/int32array": { + "id": "Stdlib.Int32Array", + "name": "Int32Array", + "docstrings": [], "items": [ { - "id": "Stdlib.Math.Constants.e", - "kind": "value", - "name": "e", + "id": "Stdlib.Int32Array.t", + "kind": "type", + "name": "t", "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 ```" + "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 e: float" + "signature": "type t = TypedArray.t" }, { - "id": "Stdlib.Math.Constants.ln2", + "id": "Stdlib.Int32Array.fromArray", "kind": "value", - "name": "ln2", + "name": "fromArray", "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 ```" + "`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 ln2: float" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.Math.Constants.ln10", + "id": "Stdlib.Int32Array.fromBuffer", "kind": "value", - "name": "ln10", + "name": "fromBuffer", "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 ```" + "`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 ln10: float" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.Math.Constants.log2e", + "id": "Stdlib.Int32Array.fromBufferToEnd", "kind": "value", - "name": "log2e", + "name": "fromBufferToEnd", "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 ```" + "`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 log2e: float" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.Math.Constants.log10e", + "id": "Stdlib.Int32Array.fromBufferWithRange", "kind": "value", - "name": "log10e", + "name": "fromBufferWithRange", "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 ```" + "`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 log10e: float" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.Math.Constants.pi", + "id": "Stdlib.Int32Array.fromLength", "kind": "value", - "name": "pi", + "name": "fromLength", "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 ```" + "`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 pi: float" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Math.Constants.sqrt1_2", + "id": "Stdlib.Int32Array.fromArrayLikeOrIterable", "kind": "value", - "name": "sqrt1_2", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 sqrt1_2: float" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.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" - } - ] - }, - "stdlib/int/constants": { - "id": "Stdlib.Int.Constants", - "name": "Constants", - "docstrings": [], - "items": [ - { - "id": "Stdlib.Int.Constants.minValue", + "id": "Stdlib.Int32Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "minValue", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "The smallest positive number represented in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.minValue)\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 minValue: int" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" }, { - "id": "Stdlib.Int.Constants.maxValue", + "id": "Stdlib.Int32Array.ignore", "kind": "value", - "name": "maxValue", + "name": "ignore", "docstrings": [ - "The largest positive number represented in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE)\n on MDN.\n\n ## Examples\n\n ```rescript\n Console.log(Int.Constants.maxValue)\n ```" + "`ignore(intArray)` ignores the provided intArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let maxValue: int" + "signature": "let ignore: t => unit" } ] }, - "stdlib/float/constants": { - "id": "Stdlib.Float.Constants", - "name": "Constants", - "docstrings": ["Float constants."], + "stdlib/int16array": { + "id": "Stdlib.Int16Array", + "name": "Int16Array", + "docstrings": [], "items": [ { - "id": "Stdlib.Float.Constants.nan", - "kind": "value", - "name": "nan", + "id": "Stdlib.Int16Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "The special value \"Not a Number\"\n See [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.nan\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 nan: float" + "signature": "type t = TypedArray.t" }, { - "id": "Stdlib.Float.Constants.epsilon", + "id": "Stdlib.Int16Array.fromArray", "kind": "value", - "name": "epsilon", + "name": "fromArray", "docstrings": [ - "Represents the difference between 1 and the smallest floating point number greater than 1.\n See [`Number.EPSILON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.epsilon\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 epsilon: float" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.Float.Constants.positiveInfinity", + "id": "Stdlib.Int16Array.fromBuffer", "kind": "value", - "name": "positiveInfinity", + "name": "fromBuffer", "docstrings": [ - "The positive Infinity value\n See [`Number.POSITIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.positiveInfinity\n ```" + "`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 positiveInfinity: float" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.Float.Constants.negativeInfinity", + "id": "Stdlib.Int16Array.fromBufferToEnd", "kind": "value", - "name": "negativeInfinity", + "name": "fromBufferToEnd", "docstrings": [ - "The negative Infinity value\n See [`Number.NEGATIVE_INFINITY`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.negativeInfinity\n ```" + "`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 negativeInfinity: float" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.Float.Constants.minValue", + "id": "Stdlib.Int16Array.fromBufferWithRange", "kind": "value", - "name": "minValue", + "name": "fromBufferWithRange", "docstrings": [ - "The smallest positive numeric value representable in JavaScript.\n See [`Number.MIN_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\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 minValue: float" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.Float.Constants.maxValue", + "id": "Stdlib.Int16Array.fromLength", "kind": "value", - "name": "maxValue", + "name": "fromLength", "docstrings": [ - "The maximum positive numeric value representable in JavaScript.\n See [`Number.MAX_VALUE`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE) on MDN.\n\n ## Examples\n\n ```rescript\n Float.Constants.minValue\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 maxValue: float" - } - ] - }, - "stdlib/error/urierror": { - "id": "Stdlib.Error.URIError", - "name": "URIError", - "docstrings": [], - "items": [ + "signature": "let fromLength: int => t" + }, { - "id": "Stdlib.Error.URIError.make", + "id": "Stdlib.Int16Array.fromArrayLikeOrIterable", "kind": "value", - "name": "make", + "name": "fromArrayLikeOrIterable", "docstrings": [ - "Creates a new `URIError` with the provided `message`.\n\n See [`URIError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError) on MDN." + "`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 make: string => t" - } - ] - }, - "stdlib/error/typeerror": { - "id": "Stdlib.Error.TypeError", - "name": "TypeError", - "docstrings": [], - "items": [ + "signature": "let fromArrayLikeOrIterable: 'a => t" + }, { - "id": "Stdlib.Error.TypeError.make", + "id": "Stdlib.Int16Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "make", + "name": "fromArrayLikeOrIterableWithMap", "docstrings": [ - "Creates a new `TypeError` with the provided `message`.\n\n See [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) on MDN." + "`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 make: string => t" - } - ] - }, - "stdlib/error/syntaxerror": { - "id": "Stdlib.Error.SyntaxError", - "name": "SyntaxError", - "docstrings": [], - "items": [ + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + }, { - "id": "Stdlib.Error.SyntaxError.make", + "id": "Stdlib.Int16Array.ignore", "kind": "value", - "name": "make", + "name": "ignore", "docstrings": [ - "Creates a new `SyntaxError` with the provided `message`.\n\n See [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) on MDN." + "`ignore(intArray)` ignores the provided intArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let make: string => t" + "signature": "let ignore: t => unit" } ] }, - "stdlib/error/referenceerror": { - "id": "Stdlib.Error.ReferenceError", - "name": "ReferenceError", + "stdlib/int8array": { + "id": "Stdlib.Int8Array", + "name": "Int8Array", "docstrings": [], "items": [ { - "id": "Stdlib.Error.ReferenceError.make", - "kind": "value", - "name": "make", + "id": "Stdlib.Int8Array.t", + "kind": "type", + "name": "t", "docstrings": [ - "Creates a new `ReferenceError` with the provided `message`.\n\n See [`ReferenceError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError) on MDN." + "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 make: string => t" - } - ] - }, - "stdlib/error/rangeerror": { - "id": "Stdlib.Error.RangeError", - "name": "RangeError", - "docstrings": [], - "items": [ + "signature": "type t = TypedArray.t" + }, { - "id": "Stdlib.Error.RangeError.make", + "id": "Stdlib.Int8Array.fromArray", "kind": "value", - "name": "make", + "name": "fromArray", "docstrings": [ - "Creates a new `RangeError` with the provided `message`.\n\n See [`RangeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError) on MDN." + "`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 make: string => t" - } - ] - }, - "stdlib/error/evalerror": { - "id": "Stdlib.Error.EvalError", - "name": "EvalError", - "docstrings": [], - "items": [ + "signature": "let fromArray: array => t" + }, { - "id": "Stdlib.Error.EvalError.make", + "id": "Stdlib.Int8Array.fromBuffer", "kind": "value", - "name": "make", + "name": "fromBuffer", "docstrings": [ - "Creates a new `EvalError` with the provided `message`.\n\n See [`EvalError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError) on MDN." + "`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 make: string => t" - } - ] - }, - "stdlib/date/utc": { - "id": "Stdlib.Date.UTC", - "name": "UTC", - "docstrings": [], - "items": [ + "signature": "let fromBuffer: ArrayBuffer.t => t" + }, { - "id": "Stdlib.Date.UTC.makeWithYM", + "id": "Stdlib.Int8Array.fromBufferToEnd", "kind": "value", - "name": "makeWithYM", + "name": "fromBufferToEnd", "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.makeWithYM(~year=2023, ~month=0)\n // 1672531200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=11)\n // 1701388800000\n\n Date.UTC.makeWithYM(~year=2023, ~month=12)\n // 1704067200000\n\n Date.UTC.makeWithYM(~year=2023, ~month=-1)\n // 1669852800000\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 makeWithYM: (~year: int, ~month: int) => msSinceEpoch" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.Date.UTC.makeWithYMD", + "id": "Stdlib.Int8Array.fromBufferWithRange", "kind": "value", - "name": "makeWithYMD", + "name": "fromBufferWithRange", "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 ```" + "`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 makeWithYMD: (~year: int, ~month: int, ~date: int) => msSinceEpoch" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.Date.UTC.makeWithYMDH", + "id": "Stdlib.Int8Array.fromLength", "kind": "value", - "name": "makeWithYMDH", + "name": "fromLength", "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 ```" + "`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 makeWithYMDH: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n) => msSinceEpoch" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Date.UTC.makeWithYMDHM", + "id": "Stdlib.Int8Array.fromArrayLikeOrIterable", "kind": "value", - "name": "makeWithYMDHM", + "name": "fromArrayLikeOrIterable", "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 ```" + "`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 makeWithYMDHM: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n) => msSinceEpoch" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.Date.UTC.makeWithYMDHMS", + "id": "Stdlib.Int8Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "makeWithYMDHMS", + "name": "fromArrayLikeOrIterableWithMap", "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 ```" + "`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 makeWithYMDHMS: (\n ~year: int,\n ~month: int,\n ~date: int,\n ~hours: int,\n ~minutes: int,\n ~seconds: int,\n) => msSinceEpoch" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" }, { - "id": "Stdlib.Date.UTC.makeWithYMDHMSM", + "id": "Stdlib.Int8Array.ignore", "kind": "value", - "name": "makeWithYMDHMSM", + "name": "ignore", "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 ```" + "`ignore(intArray)` ignores the provided intArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "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 ignore: t => unit" } ] }, - "stdlib/result": { - "id": "Stdlib.Result", - "name": "Result", + "stdlib/float64array": { + "id": "Stdlib.Float64Array", + "name": "Float64Array", "docstrings": [], "items": [ { - "id": "Stdlib.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": "Stdlib.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": "Stdlib.Result.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (result<'a, 'c>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" - }, - { - "id": "Stdlib.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": "Stdlib.Result.flatMap", - "kind": "value", - "name": "flatMap", + "id": "Stdlib.Float64Array.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 `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": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" + "signature": "type t = TypedArray.t" }, { - "id": "Stdlib.Result.getOr", + "id": "Stdlib.Float64Array.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 `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 getOr: (result<'a, 'b>, 'a) => 'a" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.Result.getWithDefault", - "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (result<'a, 'b>, 'a) => 'a", - "deprecated": "Use getOr instead" + "id": "Stdlib.Float64Array.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "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." + ], + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.Result.isOk", + "id": "Stdlib.Float64Array.fromBufferToEnd", "kind": "value", - "name": "isOk", + "name": "fromBufferToEnd", "docstrings": [ - "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." + "`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 isOk: result<'a, 'b> => bool" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.Result.isError", + "id": "Stdlib.Float64Array.fromBufferWithRange", "kind": "value", - "name": "isError", + "name": "fromBufferWithRange", "docstrings": [ - "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." + "`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 isError: result<'a, 'b> => bool" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.Result.equal", + "id": "Stdlib.Float64Array.fromLength", "kind": "value", - "name": "equal", + "name": "fromLength", "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```" + "`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 equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.Result.compare", + "id": "Stdlib.Float64Array.fromArrayLikeOrIterable", "kind": "value", - "name": "compare", + "name": "fromArrayLikeOrIterable", "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```" + "`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 compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.Result.forEach", + "id": "Stdlib.Float64Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "forEach", + "name": "fromArrayLikeOrIterableWithMap", "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```" + "`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 forEach: (result<'a, 'b>, 'a => unit) => unit" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" }, { - "id": "Stdlib.Result.mapError", + "id": "Stdlib.Float64Array.ignore", "kind": "value", - "name": "mapError", + "name": "ignore", "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```" + "`ignore(floatArray)` ignores the provided floatArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" + "signature": "let ignore: t => unit" } ] }, - "stdlib/list": { - "id": "Stdlib.List", - "name": "List", + "stdlib/float32array": { + "id": "Stdlib.Float32Array", + "name": "Float32Array", "docstrings": [], "items": [ { - "id": "Stdlib.List.t", + "id": "Stdlib.Float32Array.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." + "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<'a> = list<'a>" + "signature": "type t = TypedArray.t" }, { - "id": "Stdlib.List.length", + "id": "Stdlib.Float32Array.fromArray", "kind": "value", - "name": "length", + "name": "fromArray", "docstrings": [ - "`length(list)` returns the length of `list`.\n\n## Examples\n\n```rescript\nList.length(list{1, 2, 3}) // 3\n```" + "`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 length: t<'a> => int" + "signature": "let fromArray: array => t" }, { - "id": "Stdlib.List.size", + "id": "Stdlib.Float32Array.fromBuffer", "kind": "value", - "name": "size", + "name": "fromBuffer", "docstrings": [ - "`size(list)`. See [`length`](#length)\n\n## Examples\n\n```rescript\nList.size(list{1, 2, 3}) // 3\n```" + "`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 size: t<'a> => int" + "signature": "let fromBuffer: ArrayBuffer.t => t" }, { - "id": "Stdlib.List.head", + "id": "Stdlib.Float32Array.fromBufferToEnd", "kind": "value", - "name": "head", + "name": "fromBufferToEnd", "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```" + "`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 head: t<'a> => option<'a>" + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" }, { - "id": "Stdlib.List.headExn", + "id": "Stdlib.Float32Array.fromBufferWithRange", "kind": "value", - "name": "headExn", + "name": "fromBufferWithRange", "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." + "`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 headExn: t<'a> => 'a" + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" }, { - "id": "Stdlib.List.tail", + "id": "Stdlib.Float32Array.fromLength", "kind": "value", - "name": "tail", + "name": "fromLength", "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```" + "`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 tail: t<'a> => option>" + "signature": "let fromLength: int => t" }, { - "id": "Stdlib.List.tailExn", + "id": "Stdlib.Float32Array.fromArrayLikeOrIterable", "kind": "value", - "name": "tailExn", + "name": "fromArrayLikeOrIterable", "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." + "`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 tailExn: t<'a> => t<'a>" + "signature": "let fromArrayLikeOrIterable: 'a => t" }, { - "id": "Stdlib.List.add", + "id": "Stdlib.Float32Array.fromArrayLikeOrIterableWithMap", "kind": "value", - "name": "add", + "name": "fromArrayLikeOrIterableWithMap", "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```" + "`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 add: (t<'a>, 'a) => t<'a>" + "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" }, { - "id": "Stdlib.List.get", + "id": "Stdlib.Float32Array.ignore", "kind": "value", - "name": "get", + "name": "ignore", "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```" + "`ignore(floatArray)` ignores the provided floatArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/typedarray": { + "id": "Stdlib.TypedArray", + "name": "TypedArray", + "docstrings": [], + "items": [ + { + "id": "Stdlib.TypedArray.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t<'a>" + }, + { + "id": "Stdlib.TypedArray.get", + "kind": "value", + "name": "get", + "docstrings": [], "signature": "let get: (t<'a>, int) => option<'a>" }, { - "id": "Stdlib.List.getExn", + "id": "Stdlib.TypedArray.set", "kind": "value", - "name": "getExn", - "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." - ], - "signature": "let getExn: (t<'a>, int) => 'a" + "name": "set", + "docstrings": [], + "signature": "let set: (t<'a>, int, 'a) => unit" }, { - "id": "Stdlib.List.make", + "id": "Stdlib.TypedArray.buffer", "kind": "value", - "name": "make", - "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```" - ], - "signature": "let make: (~length: int, 'a) => t<'a>" + "name": "buffer", + "docstrings": [], + "signature": "let buffer: t<'a> => ArrayBuffer.t" }, { - "id": "Stdlib.List.fromInitializer", + "id": "Stdlib.TypedArray.byteLength", "kind": "value", - "name": "fromInitializer", - "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```" - ], - "signature": "let fromInitializer: (~length: int, int => 'a) => t<'a>" + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t<'a> => int" }, { - "id": "Stdlib.List.toShuffled", + "id": "Stdlib.TypedArray.byteOffset", "kind": "value", - "name": "toShuffled", - "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```" - ], - "signature": "let toShuffled: t<'a> => t<'a>" + "name": "byteOffset", + "docstrings": [], + "signature": "let byteOffset: t<'a> => int" }, { - "id": "Stdlib.List.drop", + "id": "Stdlib.TypedArray.setArray", "kind": "value", - "name": "drop", - "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```" - ], - "signature": "let drop: (t<'a>, int) => option>" + "name": "setArray", + "docstrings": [], + "signature": "let setArray: (t<'a>, array<'a>) => unit" }, { - "id": "Stdlib.List.take", + "id": "Stdlib.TypedArray.setArrayFrom", "kind": "value", - "name": "take", - "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```" - ], - "signature": "let take: (t<'a>, int) => option>" + "name": "setArrayFrom", + "docstrings": [], + "signature": "let setArrayFrom: (t<'a>, array<'a>, int) => unit" }, { - "id": "Stdlib.List.splitAt", + "id": "Stdlib.TypedArray.length", "kind": "value", - "name": "splitAt", - "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```" - ], - "signature": "let splitAt: (t<'a>, int) => option<(list<'a>, list<'a>)>" + "name": "length", + "docstrings": [], + "signature": "let length: t<'a> => int" }, { - "id": "Stdlib.List.concat", + "id": "Stdlib.TypedArray.copyAllWithin", "kind": "value", - "name": "concat", - "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```" - ], - "signature": "let concat: (t<'a>, t<'a>) => t<'a>" + "name": "copyAllWithin", + "docstrings": [], + "signature": "let copyAllWithin: (t<'a>, ~target: int) => array<'a>" }, { - "id": "Stdlib.List.concatMany", + "id": "Stdlib.TypedArray.copyWithinToEnd", "kind": "value", - "name": "concatMany", - "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```" - ], - "signature": "let concatMany: array> => t<'a>" + "name": "copyWithinToEnd", + "docstrings": [], + "signature": "let copyWithinToEnd: (t<'a>, ~target: int, ~start: int) => array<'a>" }, { - "id": "Stdlib.List.reverseConcat", + "id": "Stdlib.TypedArray.copyWithin", "kind": "value", - "name": "reverseConcat", - "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```" - ], - "signature": "let reverseConcat: (t<'a>, t<'a>) => t<'a>" + "name": "copyWithin", + "docstrings": [], + "signature": "let copyWithin: (t<'a>, ~target: int, ~start: int, ~end: int) => array<'a>" }, { - "id": "Stdlib.List.flat", + "id": "Stdlib.TypedArray.fillAll", "kind": "value", - "name": "flat", - "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```" - ], - "signature": "let flat: t> => t<'a>" + "name": "fillAll", + "docstrings": [], + "signature": "let fillAll: (t<'a>, 'a) => t<'a>" }, { - "id": "Stdlib.List.map", + "id": "Stdlib.TypedArray.fillToEnd", "kind": "value", - "name": "map", - "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```" - ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "name": "fillToEnd", + "docstrings": [], + "signature": "let fillToEnd: (t<'a>, 'a, ~start: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.fill", + "kind": "value", + "name": "fill", + "docstrings": [], + "signature": "let fill: (t<'a>, 'a, ~start: int, ~end: int) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.reverse", + "kind": "value", + "name": "reverse", + "docstrings": [], + "signature": "let reverse: t<'a> => unit" + }, + { + "id": "Stdlib.TypedArray.toReversed", + "kind": "value", + "name": "toReversed", + "docstrings": [], + "signature": "let toReversed: t<'a> => t<'a>" + }, + { + "id": "Stdlib.TypedArray.sort", + "kind": "value", + "name": "sort", + "docstrings": [], + "signature": "let sort: (t<'a>, ('a, 'a) => Ordering.t) => unit" + }, + { + "id": "Stdlib.TypedArray.toSorted", + "kind": "value", + "name": "toSorted", + "docstrings": [], + "signature": "let toSorted: (t<'a>, ('a, 'a) => Ordering.t) => t<'a>" + }, + { + "id": "Stdlib.TypedArray.with", + "kind": "value", + "name": "with", + "docstrings": [], + "signature": "let with: (t<'a>, int, 'a) => t<'a>" }, { - "id": "Stdlib.List.zip", + "id": "Stdlib.TypedArray.includes", "kind": "value", - "name": "zip", - "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```" - ], - "signature": "let zip: (t<'a>, t<'b>) => t<('a, 'b)>" + "name": "includes", + "docstrings": [], + "signature": "let includes: (t<'a>, 'a) => bool" }, { - "id": "Stdlib.List.zipBy", + "id": "Stdlib.TypedArray.indexOf", "kind": "value", - "name": "zipBy", - "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```" - ], - "signature": "let zipBy: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "name": "indexOf", + "docstrings": [], + "signature": "let indexOf: (t<'a>, 'a) => int" }, { - "id": "Stdlib.List.mapWithIndex", + "id": "Stdlib.TypedArray.indexOfFrom", "kind": "value", - "name": "mapWithIndex", - "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```" - ], - "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" + "name": "indexOfFrom", + "docstrings": [], + "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" }, { - "id": "Stdlib.List.fromArray", + "id": "Stdlib.TypedArray.joinWith", "kind": "value", - "name": "fromArray", - "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```" - ], - "signature": "let fromArray: array<'a> => t<'a>" + "name": "joinWith", + "docstrings": [], + "signature": "let joinWith: (t<'a>, string) => string" }, { - "id": "Stdlib.List.toArray", + "id": "Stdlib.TypedArray.lastIndexOf", "kind": "value", - "name": "toArray", - "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```" - ], - "signature": "let toArray: t<'a> => array<'a>" + "name": "lastIndexOf", + "docstrings": [], + "signature": "let lastIndexOf: (t<'a>, 'a) => int" }, { - "id": "Stdlib.List.reverse", + "id": "Stdlib.TypedArray.lastIndexOfFrom", "kind": "value", - "name": "reverse", - "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```" - ], - "signature": "let reverse: t<'a> => t<'a>" + "name": "lastIndexOfFrom", + "docstrings": [], + "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" }, { - "id": "Stdlib.List.mapReverse", + "id": "Stdlib.TypedArray.slice", "kind": "value", - "name": "mapReverse", - "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```" - ], - "signature": "let mapReverse: (t<'a>, 'a => 'b) => t<'b>" + "name": "slice", + "docstrings": [], + "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" }, { - "id": "Stdlib.List.forEach", + "id": "Stdlib.TypedArray.sliceToEnd", "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" }, { - "id": "Stdlib.List.forEachWithIndex", + "id": "Stdlib.TypedArray.copy", "kind": "value", - "name": "forEachWithIndex", - "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```" - ], - "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + "name": "copy", + "docstrings": [], + "signature": "let copy: t<'a> => t<'a>" }, { - "id": "Stdlib.List.reduce", + "id": "Stdlib.TypedArray.subarray", "kind": "value", - "name": "reduce", - "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```" - ], - "signature": "let reduce: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "name": "subarray", + "docstrings": [], + "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" }, { - "id": "Stdlib.List.reduceWithIndex", + "id": "Stdlib.TypedArray.subarrayToEnd", "kind": "value", - "name": "reduceWithIndex", - "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```" - ], - "signature": "let reduceWithIndex: (t<'a>, 'b, ('b, 'a, int) => 'b) => 'b" + "name": "subarrayToEnd", + "docstrings": [], + "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" }, { - "id": "Stdlib.List.reduceReverse", + "id": "Stdlib.TypedArray.toString", "kind": "value", - "name": "reduceReverse", - "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```" - ], - "signature": "let reduceReverse: (t<'a>, 'b, ('b, 'a) => 'b) => 'b" + "name": "toString", + "docstrings": [], + "signature": "let toString: t<'a> => string" }, { - "id": "Stdlib.List.mapReverse2", + "id": "Stdlib.TypedArray.toLocaleString", "kind": "value", - "name": "mapReverse2", - "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```" - ], - "signature": "let mapReverse2: (t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>" + "name": "toLocaleString", + "docstrings": [], + "signature": "let toLocaleString: t<'a> => string" }, { - "id": "Stdlib.List.forEach2", + "id": "Stdlib.TypedArray.every", "kind": "value", - "name": "forEach2", - "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```" - ], - "signature": "let forEach2: (t<'a>, t<'b>, ('a, 'b) => 'c) => unit" + "name": "every", + "docstrings": [], + "signature": "let every: (t<'a>, 'a => bool) => bool" }, { - "id": "Stdlib.List.reduce2", + "id": "Stdlib.TypedArray.everyWithIndex", "kind": "value", - "name": "reduce2", - "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```" - ], - "signature": "let reduce2: (t<'b>, t<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" + "name": "everyWithIndex", + "docstrings": [], + "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" }, { - "id": "Stdlib.List.reduceReverse2", + "id": "Stdlib.TypedArray.filter", "kind": "value", - "name": "reduceReverse2", - "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```" - ], - "signature": "let reduceReverse2: (t<'a>, t<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" + "name": "filter", + "docstrings": [], + "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" }, { - "id": "Stdlib.List.every", + "id": "Stdlib.TypedArray.filterWithIndex", "kind": "value", - "name": "every", - "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```" - ], - "signature": "let every: (t<'a>, 'a => bool) => bool" + "name": "filterWithIndex", + "docstrings": [], + "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" }, { - "id": "Stdlib.List.some", + "id": "Stdlib.TypedArray.find", "kind": "value", - "name": "some", - "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```" - ], - "signature": "let some: (t<'a>, 'a => bool) => bool" + "name": "find", + "docstrings": [], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" }, { - "id": "Stdlib.List.every2", + "id": "Stdlib.TypedArray.findWithIndex", "kind": "value", - "name": "every2", - "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```" - ], - "signature": "let every2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "name": "findWithIndex", + "docstrings": [], + "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" }, { - "id": "Stdlib.List.some2", + "id": "Stdlib.TypedArray.findLast", "kind": "value", - "name": "some2", - "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```" - ], - "signature": "let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "name": "findLast", + "docstrings": [], + "signature": "let findLast: (t<'a>, 'a => bool) => option<'a>" }, { - "id": "Stdlib.List.compareLength", + "id": "Stdlib.TypedArray.findLastWithIndex", "kind": "value", - "name": "compareLength", - "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```" - ], - "signature": "let compareLength: (t<'a>, t<'a>) => Stdlib__Ordering.t" + "name": "findLastWithIndex", + "docstrings": [], + "signature": "let findLastWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" }, { - "id": "Stdlib.List.compare", + "id": "Stdlib.TypedArray.findIndex", "kind": "value", - "name": "compare", - "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." - ], - "signature": "let compare: (\n t<'a>,\n t<'a>,\n ('a, 'a) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + "name": "findIndex", + "docstrings": [], + "signature": "let findIndex: (t<'a>, 'a => bool) => int" }, { - "id": "Stdlib.List.equal", + "id": "Stdlib.TypedArray.findIndexWithIndex", "kind": "value", - "name": "equal", - "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```" - ], - "signature": "let equal: (t<'a>, t<'a>, ('a, 'a) => bool) => bool" + "name": "findIndexWithIndex", + "docstrings": [], + "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" }, { - "id": "Stdlib.List.has", + "id": "Stdlib.TypedArray.findLastIndex", "kind": "value", - "name": "has", - "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```" - ], - "signature": "let has: (t<'a>, 'b, ('a, 'b) => bool) => bool" + "name": "findLastIndex", + "docstrings": [], + "signature": "let findLastIndex: (t<'a>, 'a => bool) => int" }, { - "id": "Stdlib.List.find", + "id": "Stdlib.TypedArray.findLastIndexWithIndex", "kind": "value", - "name": "find", - "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```" - ], - "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + "name": "findLastIndexWithIndex", + "docstrings": [], + "signature": "let findLastIndexWithIndex: (t<'a>, ('a, int) => bool) => int" }, { - "id": "Stdlib.List.filter", + "id": "Stdlib.TypedArray.forEach", "kind": "value", - "name": "filter", - "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```" - ], - "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + "name": "forEach", + "docstrings": [], + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.List.filterWithIndex", + "id": "Stdlib.TypedArray.forEachWithIndex", "kind": "value", - "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: (t<'a>, ('a, int) => bool) => t<'a>" + "name": "forEachWithIndex", + "docstrings": [], + "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" }, { - "id": "Stdlib.List.filterMap", + "id": "Stdlib.TypedArray.map", "kind": "value", - "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: (t<'a>, 'a => option<'b>) => t<'b>" + "name": "map", + "docstrings": [], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Stdlib.List.partition", + "id": "Stdlib.TypedArray.mapWithIndex", "kind": "value", - "name": "partition", - "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```" - ], - "signature": "let partition: (t<'a>, 'a => bool) => (t<'a>, t<'a>)" + "name": "mapWithIndex", + "docstrings": [], + "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" }, { - "id": "Stdlib.List.unzip", + "id": "Stdlib.TypedArray.reduce", "kind": "value", - "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: t<('a, 'b)> => (t<'a>, t<'b>)" + "name": "reduce", + "docstrings": [], + "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" }, { - "id": "Stdlib.List.getAssoc", + "id": "Stdlib.TypedArray.reduceWithIndex", "kind": "value", - "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: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>" + "name": "reduceWithIndex", + "docstrings": [], + "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + }, + { + "id": "Stdlib.TypedArray.reduceRight", + "kind": "value", + "name": "reduceRight", + "docstrings": [], + "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" }, { - "id": "Stdlib.List.hasAssoc", + "id": "Stdlib.TypedArray.reduceRightWithIndex", "kind": "value", - "name": "hasAssoc", - "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```" - ], - "signature": "let hasAssoc: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => bool" + "name": "reduceRightWithIndex", + "docstrings": [], + "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" }, { - "id": "Stdlib.List.removeAssoc", + "id": "Stdlib.TypedArray.some", "kind": "value", - "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: (t<('a, 'c)>, 'b, ('a, 'b) => bool) => t<('a, 'c)>" + "name": "some", + "docstrings": [], + "signature": "let some: (t<'a>, 'a => bool) => bool" }, { - "id": "Stdlib.List.setAssoc", + "id": "Stdlib.TypedArray.someWithIndex", "kind": "value", - "name": "setAssoc", - "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." - ], - "signature": "let setAssoc: (t<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => t<('a, 'c)>" + "name": "someWithIndex", + "docstrings": [], + "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" }, { - "id": "Stdlib.List.sort", + "id": "Stdlib.TypedArray.ignore", "kind": "value", - "name": "sort", + "name": "ignore", "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```" + "`ignore(typedArray)` ignores the provided typedArray and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let sort: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => t<'a>" + "signature": "let ignore: t<'a> => unit" } ] }, - "stdlib/option": { - "id": "Stdlib.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```" - ], + "stdlib/arraybuffer": { + "id": "Stdlib.ArrayBuffer", + "name": "ArrayBuffer", + "docstrings": [], "items": [ { - "id": "Stdlib.Option.filter", - "kind": "value", - "name": "filter", - "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```" - ], - "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" + "id": "Stdlib.ArrayBuffer.t", + "kind": "type", + "name": "t", + "docstrings": [], + "signature": "type t" }, { - "id": "Stdlib.Option.forEach", + "id": "Stdlib.ArrayBuffer.make", "kind": "value", - "name": "forEach", - "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```" - ], - "signature": "let forEach: (option<'a>, 'a => unit) => unit" + "name": "make", + "docstrings": [], + "signature": "let make: int => t" }, { - "id": "Stdlib.Option.getExn", + "id": "Stdlib.ArrayBuffer.byteLength", "kind": "value", - "name": "getExn", - "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`" - ], - "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t => int" }, { - "id": "Stdlib.Option.getUnsafe", + "id": "Stdlib.ArrayBuffer.slice", "kind": "value", - "name": "getUnsafe", - "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." - ], - "signature": "let getUnsafe: option<'a> => 'a" + "name": "slice", + "docstrings": [], + "signature": "let slice: (t, ~start: int, ~end: int) => t" }, { - "id": "Stdlib.Option.mapOr", + "id": "Stdlib.ArrayBuffer.sliceToEnd", "kind": "value", - "name": "mapOr", - "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```" - ], - "signature": "let mapOr: (option<'a>, 'b, 'a => 'b) => 'b" - }, + "name": "sliceToEnd", + "docstrings": [], + "signature": "let sliceToEnd: (t, ~start: int) => t" + } + ] + }, + "stdlib/weakset": { + "id": "Stdlib.WeakSet", + "name": "WeakSet", + "docstrings": [], + "items": [ { - "id": "Stdlib.Option.mapWithDefault", - "kind": "value", - "name": "mapWithDefault", + "id": "Stdlib.WeakSet.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "signature": "type t<'a>" }, { - "id": "Stdlib.Option.map", + "id": "Stdlib.WeakSet.make", "kind": "value", - "name": "map", - "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```" - ], - "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'a>" }, { - "id": "Stdlib.Option.flatMap", + "id": "Stdlib.WeakSet.add", "kind": "value", - "name": "flatMap", - "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```" - ], - "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" + "name": "add", + "docstrings": [], + "signature": "let add: (t<'a>, 'a) => t<'a>" }, { - "id": "Stdlib.Option.getOr", + "id": "Stdlib.WeakSet.delete", "kind": "value", - "name": "getOr", - "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```" - ], - "signature": "let getOr: (option<'a>, 'a) => 'a" + "name": "delete", + "docstrings": [], + "signature": "let delete: (t<'a>, 'a) => bool" }, { - "id": "Stdlib.Option.getWithDefault", + "id": "Stdlib.WeakSet.has", "kind": "value", - "name": "getWithDefault", + "name": "has", "docstrings": [], - "signature": "let getWithDefault: (option<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" + "signature": "let has: (t<'a>, 'a) => bool" }, { - "id": "Stdlib.Option.orElse", + "id": "Stdlib.WeakSet.ignore", "kind": "value", - "name": "orElse", + "name": "ignore", "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```" + "`ignore(weakSet)` ignores the provided weakSet and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" - }, + "signature": "let ignore: t<'a> => unit" + } + ] + }, + "stdlib/set": { + "id": "Stdlib.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": "Stdlib.Option.isSome", - "kind": "value", - "name": "isSome", + "id": "Stdlib.Set.t", + "kind": "type", + "name": "t", "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```" + "Type representing an instance of `Set`." ], - "signature": "let isSome: option<'a> => bool" + "signature": "type t<'a>" }, { - "id": "Stdlib.Option.isNone", + "id": "Stdlib.Set.make", "kind": "value", - "name": "isNone", + "name": "make", "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```" + "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 isNone: option<'a> => bool" + "signature": "let make: unit => t<'a>" }, { - "id": "Stdlib.Option.equal", + "id": "Stdlib.Set.fromArray", "kind": "value", - "name": "equal", + "name": "fromArray", "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```" + "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 equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" + "signature": "let fromArray: array<'a> => t<'a>" }, { - "id": "Stdlib.Option.compare", + "id": "Stdlib.Set.fromIterator", "kind": "value", - "name": "compare", + "name": "fromIterator", "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```" + "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 compare: (\n option<'a>,\n option<'b>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" - } - ] - }, - "stdlib/exn": { - "id": "Stdlib.Exn", - "name": "Exn", - "docstrings": [], - "items": [] - }, - "stdlib/intl": { - "id": "Stdlib.Intl", - "name": "Intl", - "docstrings": [], - "items": [ - { - "id": "Stdlib.Intl.getCanonicalLocalesExn", - "kind": "value", - "name": "getCanonicalLocalesExn", - "docstrings": ["@throws RangeError"], - "signature": "let getCanonicalLocalesExn: string => array" - }, - { - "id": "Stdlib.Intl.getCanonicalLocalesManyExn", - "kind": "value", - "name": "getCanonicalLocalesManyExn", - "docstrings": ["@throws RangeError"], - "signature": "let getCanonicalLocalesManyExn: array => array" + "signature": "let fromIterator: Iterator.t<'a> => t<'a>" }, { - "id": "Stdlib.Intl.supportedValuesOfExn", + "id": "Stdlib.Set.size", "kind": "value", - "name": "supportedValuesOfExn", - "docstrings": ["@throws RangeError"], - "signature": "let supportedValuesOfExn: string => array" - } - ] - }, - "stdlib/biguint64array": { - "id": "Stdlib.BigUint64Array", - "name": "BigUint64Array", - "docstrings": [], - "items": [ - { - "id": "Stdlib.BigUint64Array.t", - "kind": "type", - "name": "t", + "name": "size", "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)" + "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": "type t = Stdlib__TypedArray.t" + "signature": "let size: t<'a> => int" }, { - "id": "Stdlib.BigUint64Array.fromArray", + "id": "Stdlib.Set.clear", "kind": "value", - "name": "fromArray", + "name": "clear", "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)" + "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 fromArray: array => t" + "signature": "let clear: t<'a> => unit" }, { - "id": "Stdlib.BigUint64Array.fromBuffer", + "id": "Stdlib.Set.add", "kind": "value", - "name": "fromBuffer", + "name": "add", "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." + "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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let add: (t<'a>, 'a) => unit" }, { - "id": "Stdlib.BigUint64Array.fromBufferToEnd", + "id": "Stdlib.Set.delete", "kind": "value", - "name": "fromBufferToEnd", + "name": "delete", "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." + "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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let delete: (t<'a>, 'a) => bool" }, { - "id": "Stdlib.BigUint64Array.fromBufferWithRange", + "id": "Stdlib.Set.has", "kind": "value", - "name": "fromBufferWithRange", + "name": "has", "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." + "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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let has: (t<'a>, 'a) => bool" }, { - "id": "Stdlib.BigUint64Array.fromLength", + "id": "Stdlib.Set.forEach", "kind": "value", - "name": "fromLength", + "name": "forEach", "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." + "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 fromLength: int => t" + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.BigUint64Array.fromArrayLikeOrIterable", + "id": "Stdlib.Set.values", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "values", "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)" + "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": "let fromArrayLikeOrIterable: 'a => t" + "signature": "let values: t<'a> => Iterator.t<'a>" }, { - "id": "Stdlib.BigUint64Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Set.difference", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "difference", "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)" + "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 fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" - } - ] - }, - "stdlib/bigint64array": { - "id": "Stdlib.BigInt64Array", - "name": "BigInt64Array", - "docstrings": [], - "items": [ + "signature": "let difference: (t<'a>, t<'a>) => t<'a>" + }, { - "id": "Stdlib.BigInt64Array.t", - "kind": "type", - "name": "t", + "id": "Stdlib.Set.symmetricDifference", + "kind": "value", + "name": "symmetricDifference", "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)" + "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": "type t = Stdlib__TypedArray.t" + "signature": "let symmetricDifference: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Stdlib.BigInt64Array.fromArray", + "id": "Stdlib.Set.intersection", "kind": "value", - "name": "fromArray", + "name": "intersection", "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)" + "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 fromArray: array => t" + "signature": "let intersection: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Stdlib.BigInt64Array.fromBuffer", + "id": "Stdlib.Set.isDisjointFrom", "kind": "value", - "name": "fromBuffer", + "name": "isDisjointFrom", "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." + "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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let isDisjointFrom: (t<'a>, t<'a>) => bool" }, { - "id": "Stdlib.BigInt64Array.fromBufferToEnd", + "id": "Stdlib.Set.isSubsetOf", "kind": "value", - "name": "fromBufferToEnd", + "name": "isSubsetOf", "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." + "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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let isSubsetOf: (t<'a>, t<'a>) => bool" }, { - "id": "Stdlib.BigInt64Array.fromBufferWithRange", + "id": "Stdlib.Set.isSupersetOf", "kind": "value", - "name": "fromBufferWithRange", + "name": "isSupersetOf", "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." + "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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let isSupersetOf: (t<'a>, t<'a>) => bool" }, { - "id": "Stdlib.BigInt64Array.fromLength", + "id": "Stdlib.Set.union", "kind": "value", - "name": "fromLength", + "name": "union", "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." + "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 fromLength: int => t" + "signature": "let union: (t<'a>, t<'a>) => t<'a>" }, { - "id": "Stdlib.BigInt64Array.fromArrayLikeOrIterable", + "id": "Stdlib.Set.toArray", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "toArray", "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)" + "`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 fromArrayLikeOrIterable: 'a => t" + "signature": "let toArray: t<'a> => array<'a>" }, { - "id": "Stdlib.BigInt64Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Set.ignore", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "ignore", "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)" + "`ignore(set)` ignores the provided set and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t" + "signature": "let ignore: t<'a> => unit" } ] }, - "stdlib/uint8clampedarray": { - "id": "Stdlib.Uint8ClampedArray", - "name": "Uint8ClampedArray", + "stdlib/weakmap": { + "id": "Stdlib.WeakMap", + "name": "WeakMap", "docstrings": [], "items": [ { - "id": "Stdlib.Uint8ClampedArray.t", + "id": "Stdlib.WeakMap.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 = Stdlib__TypedArray.t" - }, - { - "id": "Stdlib.Uint8ClampedArray.fromArray", - "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" + "docstrings": [], + "signature": "type t<'k, 'v>" }, { - "id": "Stdlib.Uint8ClampedArray.fromBuffer", + "id": "Stdlib.WeakMap.make", "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: Stdlib__ArrayBuffer.t => t" + "name": "make", + "docstrings": [], + "signature": "let make: unit => t<'k, 'v>" }, { - "id": "Stdlib.Uint8ClampedArray.fromBufferToEnd", + "id": "Stdlib.WeakMap.get", "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "get", + "docstrings": [], + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" }, { - "id": "Stdlib.Uint8ClampedArray.fromBufferWithRange", + "id": "Stdlib.WeakMap.has", "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: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "has", + "docstrings": [], + "signature": "let has: (t<'k, 'v>, 'k) => bool" }, { - "id": "Stdlib.Uint8ClampedArray.fromLength", + "id": "Stdlib.WeakMap.set", "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": "set", + "docstrings": [], + "signature": "let set: (t<'k, 'v>, 'k, 'v) => t<'k, 'v>" }, { - "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterable", + "id": "Stdlib.WeakMap.delete", "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": "delete", + "docstrings": [], + "signature": "let delete: (t<'k, 'v>, 'k) => bool" }, { - "id": "Stdlib.Uint8ClampedArray.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.WeakMap.ignore", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "ignore", "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)" + "`ignore(weakMap)` ignores the provided weakMap and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let ignore: t<'k, 'v> => unit" } ] }, - "stdlib/uint32array": { - "id": "Stdlib.Uint32Array", - "name": "Uint32Array", - "docstrings": [], + "stdlib/map": { + "id": "Stdlib.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": "Stdlib.Uint32Array.t", + "id": "Stdlib.Map.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)" + "Type representing an instance of `Map`." ], - "signature": "type t = Stdlib__TypedArray.t" + "signature": "type t<'k, 'v>" }, { - "id": "Stdlib.Uint32Array.fromArray", + "id": "Stdlib.Map.make", "kind": "value", - "name": "fromArray", + "name": "make", "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)" + "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 fromArray: array => t" + "signature": "let make: unit => t<'k, 'v>" }, { - "id": "Stdlib.Uint32Array.fromBuffer", + "id": "Stdlib.Map.fromArray", "kind": "value", - "name": "fromBuffer", + "name": "fromArray", "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." + "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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let fromArray: array<('k, 'v)> => t<'k, 'v>" }, { - "id": "Stdlib.Uint32Array.fromBufferToEnd", + "id": "Stdlib.Map.fromIterator", "kind": "value", - "name": "fromBufferToEnd", + "name": "fromIterator", "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." + "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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromIterator: Iterator.t<('k, 'v)> => t<'k, 'v>" }, { - "id": "Stdlib.Uint32Array.fromBufferWithRange", + "id": "Stdlib.Map.size", "kind": "value", - "name": "fromBufferWithRange", + "name": "size", "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." + "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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let size: t<'k, 'v> => int" }, { - "id": "Stdlib.Uint32Array.fromLength", + "id": "Stdlib.Map.clear", "kind": "value", - "name": "fromLength", + "name": "clear", "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." + "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 fromLength: int => t" + "signature": "let clear: t<'k, 'v> => unit" }, { - "id": "Stdlib.Uint32Array.fromArrayLikeOrIterable", + "id": "Stdlib.Map.forEach", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "forEach", "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)" + "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 fromArrayLikeOrIterable: 'a => t" + "signature": "let forEach: (t<'k, 'v>, 'v => unit) => unit" }, { - "id": "Stdlib.Uint32Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Map.forEachWithKey", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "forEachWithKey", "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)" + "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": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "stdlib/uint16array": { - "id": "Stdlib.Uint16Array", - "name": "Uint16Array", - "docstrings": [], - "items": [ + "signature": "let forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" + }, { - "id": "Stdlib.Uint16Array.t", - "kind": "type", - "name": "t", + "id": "Stdlib.Map.get", + "kind": "value", + "name": "get", "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)" + "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": "type t = Stdlib__TypedArray.t" + "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" }, { - "id": "Stdlib.Uint16Array.fromArray", + "id": "Stdlib.Map.has", "kind": "value", - "name": "fromArray", + "name": "has", "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)" + "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 fromArray: array => t" + "signature": "let has: (t<'k, 'v>, 'k) => bool" }, { - "id": "Stdlib.Uint16Array.fromBuffer", + "id": "Stdlib.Map.set", "kind": "value", - "name": "fromBuffer", + "name": "set", "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." + "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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let set: (t<'k, 'v>, 'k, 'v) => unit" }, { - "id": "Stdlib.Uint16Array.fromBufferToEnd", + "id": "Stdlib.Map.delete", "kind": "value", - "name": "fromBufferToEnd", + "name": "delete", "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." + "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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let delete: (t<'k, 'v>, 'k) => bool" }, { - "id": "Stdlib.Uint16Array.fromBufferWithRange", + "id": "Stdlib.Map.keys", "kind": "value", - "name": "fromBufferWithRange", + "name": "keys", "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." + "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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let keys: t<'k, 'v> => Iterator.t<'k>" }, { - "id": "Stdlib.Uint16Array.fromLength", + "id": "Stdlib.Map.values", "kind": "value", - "name": "fromLength", + "name": "values", "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." + "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 fromLength: int => t" + "signature": "let values: t<'k, 'v> => Iterator.t<'v>" }, { - "id": "Stdlib.Uint16Array.fromArrayLikeOrIterable", + "id": "Stdlib.Map.entries", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "entries", "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)" + "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 fromArrayLikeOrIterable: 'a => t" + "signature": "let entries: t<'k, 'v> => Iterator.t<('k, 'v)>" }, { - "id": "Stdlib.Uint16Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Map.ignore", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "ignore", "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)" + "`ignore(map)` ignores the provided map and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let ignore: t<'k, 'v> => unit" } ] }, - "stdlib/uint8array": { - "id": "Stdlib.Uint8Array", - "name": "Uint8Array", - "docstrings": [], + "stdlib/asynciterator": { + "id": "Stdlib.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": "Stdlib.Uint8Array.t", + "id": "Stdlib.AsyncIterator.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)" + "The type representing an async iterator." ], - "signature": "type t = Stdlib__TypedArray.t" + "signature": "type t<'a>" }, { - "id": "Stdlib.Uint8Array.fromArray", - "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" + "id": "Stdlib.AsyncIterator.value", + "kind": "type", + "name": "value", + "docstrings": [], + "signature": "type value<'a> = {done: bool, value: option<'a>}" }, { - "id": "Stdlib.Uint8Array.fromBuffer", + "id": "Stdlib.AsyncIterator.make", "kind": "value", - "name": "fromBuffer", + "name": "make", "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." + "`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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let make: (unit => promise>) => t<'value>" }, { - "id": "Stdlib.Uint8Array.fromBufferToEnd", + "id": "Stdlib.AsyncIterator.value", "kind": "value", - "name": "fromBufferToEnd", + "name": "value", "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." + "`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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let value: 'value => value<'value>" }, { - "id": "Stdlib.Uint8Array.fromBufferWithRange", + "id": "Stdlib.AsyncIterator.done", "kind": "value", - "name": "fromBufferWithRange", + "name": "done", "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." + "`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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let done: (~finalValue: 'value=?) => value<'value>" }, { - "id": "Stdlib.Uint8Array.fromLength", + "id": "Stdlib.AsyncIterator.next", "kind": "value", - "name": "fromLength", + "name": "next", "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." + "`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 fromLength: int => t" + "signature": "let next: t<'a> => promise>" }, { - "id": "Stdlib.Uint8Array.fromArrayLikeOrIterable", + "id": "Stdlib.AsyncIterator.forEach", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "forEach", "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)" + "`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 fromArrayLikeOrIterable: 'a => t" + "signature": "let forEach: (t<'a>, option<'a> => unit) => promise" }, { - "id": "Stdlib.Uint8Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.AsyncIterator.ignore", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "ignore", "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)" + "`ignore(iterator)` ignores the provided async iterator and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let ignore: t<'a> => unit" } ] }, - "stdlib/int32array": { - "id": "Stdlib.Int32Array", - "name": "Int32Array", - "docstrings": [], + "stdlib/iterator": { + "id": "Stdlib.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": "Stdlib.Int32Array.t", + "id": "Stdlib.Iterator.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)" + "The type representing an iterator." ], - "signature": "type t = Stdlib__TypedArray.t" + "signature": "type t<'a>" }, { - "id": "Stdlib.Int32Array.fromArray", + "id": "Stdlib.Iterator.value", + "kind": "type", + "name": "value", + "docstrings": [ + "The current value of an iterator." + ], + "signature": "type value<'a> = {done: bool, value: option<'a>}" + }, + { + "id": "Stdlib.Iterator.next", "kind": "value", - "name": "fromArray", + "name": "next", "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)" + "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 fromArray: array => t" + "signature": "let next: t<'a> => value<'a>" }, { - "id": "Stdlib.Int32Array.fromBuffer", + "id": "Stdlib.Iterator.toArray", "kind": "value", - "name": "fromBuffer", + "name": "toArray", "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." + "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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let toArray: t<'a> => array<'a>" }, { - "id": "Stdlib.Int32Array.fromBufferToEnd", + "id": "Stdlib.Iterator.toArrayWithMapper", "kind": "value", - "name": "fromBufferToEnd", + "name": "toArrayWithMapper", "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." + "`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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b>" }, { - "id": "Stdlib.Int32Array.fromBufferWithRange", + "id": "Stdlib.Iterator.forEach", "kind": "value", - "name": "fromBufferWithRange", + "name": "forEach", "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." + "`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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let forEach: (t<'a>, option<'a> => unit) => unit" }, { - "id": "Stdlib.Int32Array.fromLength", + "id": "Stdlib.Iterator.ignore", "kind": "value", - "name": "fromLength", + "name": "ignore", "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." + "`ignore(iterator)` ignores the provided iterator and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromLength: int => t" + "signature": "let ignore: t<'a> => unit" + } + ] + }, + "stdlib/type": { + "id": "Stdlib.Type", + "name": "Type", + "docstrings": [ + "Utilities for classifying the type of JavaScript values at runtime." + ], + "items": [ + { + "id": "Stdlib.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": "Stdlib.Int32Array.fromArrayLikeOrIterable", + "id": "Stdlib.Type.typeof", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "typeof", "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)" + "`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 fromArrayLikeOrIterable: 'a => t" + "signature": "let typeof: 'a => t" }, { - "id": "Stdlib.Int32Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Type.ignore", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "ignore", "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)" + "`ignore(type)` ignores the provided type and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let ignore: t => unit" } ] }, - "stdlib/int16array": { - "id": "Stdlib.Int16Array", - "name": "Int16Array", - "docstrings": [], + "stdlib/symbol": { + "id": "Stdlib.Symbol", + "name": "Symbol", + "docstrings": [ + "A built-in object that serves as a namespace for globally-unique identifiers.\n\nCompiles to a regular JavaScript Symbol." + ], "items": [ { - "id": "Stdlib.Int16Array.t", + "id": "Stdlib.Symbol.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 a Symbol." ], - "signature": "type t = Stdlib__TypedArray.t" + "signature": "type t" }, { - "id": "Stdlib.Int16Array.fromArray", + "id": "Stdlib.Symbol.make", "kind": "value", - "name": "fromArray", + "name": "make", "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)" + "`make(key)`\n\nMakes a new unique Symbol value.\n\n## Examples\n\n```rescript\nSymbol.make(\"sym1\")\n->Symbol.description\n->assertEqual(Some(\"sym1\"))\n```" ], - "signature": "let fromArray: array => t" + "signature": "let make: string => t" }, { - "id": "Stdlib.Int16Array.fromBuffer", + "id": "Stdlib.Symbol.getFor", "kind": "value", - "name": "fromBuffer", + "name": "getFor", "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." + "`getFor(key)`\n\nSearches for existing registered Symbols in the global Symbol registry with the given key and returns it if found.\nOtherwise a new Symbol gets created and registered with key.\n\n## Examples\n\n```rescript\nSymbol.getFor(\"sym1\")->assertEqual(Symbol.getFor(\"sym1\"))\n```" ], - "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let getFor: string => option" }, { - "id": "Stdlib.Int16Array.fromBufferToEnd", + "id": "Stdlib.Symbol.keyFor", "kind": "value", - "name": "fromBufferToEnd", + "name": "keyFor", "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." + "`keyFor(key)`\n\nRetrieves a shared Symbol key from the global Symbol registry for the given Symbol.\n\n## Examples\n\n```rescript\nlet globalSym = Symbol.getFor(\"sym1\") // Global symbol\n\nglobalSym->Option.flatMap(Symbol.description)->assertEqual(Some(\"sym1\"))\n```" ], - "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let keyFor: t => option" }, { - "id": "Stdlib.Int16Array.fromBufferWithRange", + "id": "Stdlib.Symbol.description", "kind": "value", - "name": "fromBufferWithRange", + "name": "description", "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." + "`description`\n\nReturns `Some(string)` containing the description of this symbol, or `None` if the symbol has no description.\n## Examples\n\n```rescript\nlet sym = Symbol.make(\"sym1\")\nSymbol.description(sym)->assertEqual(Some(\"sym1\"))\n```" ], - "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let description: t => option" }, { - "id": "Stdlib.Int16Array.fromLength", + "id": "Stdlib.Symbol.toString", "kind": "value", - "name": "fromLength", + "name": "toString", "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." + "`toString`\n\n// Returns a string representing this symbol value.\n\n## Examples\n\n```rescript\nlet sym = Symbol.make(\"sym1\")\n\nSymbol.toString(sym)->assertEqual(\"Symbol(sym1)\")\n```" ], - "signature": "let fromLength: int => t" + "signature": "let toString: t => string" }, { - "id": "Stdlib.Int16Array.fromArrayLikeOrIterable", + "id": "Stdlib.Symbol.asyncIterator", "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "asyncIterator", + "docstrings": [], + "signature": "let asyncIterator: t" }, { - "id": "Stdlib.Int16Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Symbol.hasInstance", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" - } - ] - }, - "stdlib/int8array": { - "id": "Stdlib.Int8Array", - "name": "Int8Array", - "docstrings": [], - "items": [ + "name": "hasInstance", + "docstrings": [], + "signature": "let hasInstance: t" + }, { - "id": "Stdlib.Int8Array.t", - "kind": "type", - "name": "t", - "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)" - ], - "signature": "type t = Stdlib__TypedArray.t" + "id": "Stdlib.Symbol.isConcatSpreadable", + "kind": "value", + "name": "isConcatSpreadable", + "docstrings": [], + "signature": "let isConcatSpreadable: t" }, { - "id": "Stdlib.Int8Array.fromArray", + "id": "Stdlib.Symbol.iterator", "kind": "value", - "name": "fromArray", - "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)" - ], - "signature": "let fromArray: array => t" + "name": "iterator", + "docstrings": [], + "signature": "let iterator: t" + }, + { + "id": "Stdlib.Symbol.match", + "kind": "value", + "name": "match", + "docstrings": [], + "signature": "let match: t" + }, + { + "id": "Stdlib.Symbol.matchAll", + "kind": "value", + "name": "matchAll", + "docstrings": [], + "signature": "let matchAll: t" + }, + { + "id": "Stdlib.Symbol.replace", + "kind": "value", + "name": "replace", + "docstrings": [], + "signature": "let replace: t" }, { - "id": "Stdlib.Int8Array.fromBuffer", + "id": "Stdlib.Symbol.search", "kind": "value", - "name": "fromBuffer", - "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." - ], - "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + "name": "search", + "docstrings": [], + "signature": "let search: t" }, { - "id": "Stdlib.Int8Array.fromBufferToEnd", + "id": "Stdlib.Symbol.species", "kind": "value", - "name": "fromBufferToEnd", - "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." - ], - "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "species", + "docstrings": [], + "signature": "let species: t" }, { - "id": "Stdlib.Int8Array.fromBufferWithRange", + "id": "Stdlib.Symbol.split", "kind": "value", - "name": "fromBufferWithRange", - "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." - ], - "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "split", + "docstrings": [], + "signature": "let split: t" }, { - "id": "Stdlib.Int8Array.fromLength", + "id": "Stdlib.Symbol.toPrimitive", "kind": "value", - "name": "fromLength", - "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." - ], - "signature": "let fromLength: int => t" + "name": "toPrimitive", + "docstrings": [], + "signature": "let toPrimitive: t" }, { - "id": "Stdlib.Int8Array.fromArrayLikeOrIterable", + "id": "Stdlib.Symbol.toStringTag", "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "toStringTag", + "docstrings": [], + "signature": "let toStringTag: t" }, { - "id": "Stdlib.Int8Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.Symbol.unscopables", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "unscopables", + "docstrings": [], + "signature": "let unscopables: t" + }, + { + "id": "Stdlib.Symbol.ignore", + "kind": "value", + "name": "ignore", "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)" + "`ignore(symbol)` ignores the provided symbol and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t" + "signature": "let ignore: t => unit" } ] }, - "stdlib/float64array": { - "id": "Stdlib.Float64Array", - "name": "Float64Array", - "docstrings": [], + "stdlib/string": { + "id": "Stdlib.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": "Stdlib.Float64Array.t", + "id": "Stdlib.String.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)" + "Type representing a string." ], - "signature": "type t = Stdlib__TypedArray.t" + "signature": "type t = string" }, { - "id": "Stdlib.Float64Array.fromArray", + "id": "Stdlib.String.make", "kind": "value", - "name": "fromArray", + "name": "make", "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)" + "`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 fromArray: array => t" + "signature": "let make: 'a => string" }, { - "id": "Stdlib.Float64Array.fromBuffer", + "id": "Stdlib.String.fromCharCode", "kind": "value", - "name": "fromBuffer", + "name": "fromCharCode", "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." + "`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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let fromCharCode: int => string" }, { - "id": "Stdlib.Float64Array.fromBufferToEnd", + "id": "Stdlib.String.fromCharCodeMany", "kind": "value", - "name": "fromBufferToEnd", + "name": "fromCharCodeMany", "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." + "`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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let fromCharCodeMany: array => string" }, { - "id": "Stdlib.Float64Array.fromBufferWithRange", + "id": "Stdlib.String.fromCodePoint", "kind": "value", - "name": "fromBufferWithRange", + "name": "fromCodePoint", "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." + "`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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let fromCodePoint: int => string" }, { - "id": "Stdlib.Float64Array.fromLength", + "id": "Stdlib.String.fromCodePointMany", "kind": "value", - "name": "fromLength", + "name": "fromCodePointMany", "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." + "`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 fromLength: int => t" + "signature": "let fromCodePointMany: array => string" }, { - "id": "Stdlib.Float64Array.fromArrayLikeOrIterable", + "id": "Stdlib.String.equal", "kind": "value", - "name": "fromArrayLikeOrIterable", - "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)" - ], - "signature": "let fromArrayLikeOrIterable: 'a => t" + "name": "equal", + "docstrings": [], + "signature": "let equal: (string, string) => bool" }, { - "id": "Stdlib.Float64Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.String.compare", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", - "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)" - ], - "signature": "let fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" - } - ] - }, - "stdlib/float32array": { - "id": "Stdlib.Float32Array", - "name": "Float32Array", - "docstrings": [], - "items": [ - { - "id": "Stdlib.Float32Array.t", - "kind": "type", - "name": "t", - "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)" - ], - "signature": "type t = Stdlib__TypedArray.t" + "name": "compare", + "docstrings": [], + "signature": "let compare: (string, string) => Ordering.t" }, { - "id": "Stdlib.Float32Array.fromArray", + "id": "Stdlib.String.length", "kind": "value", - "name": "fromArray", + "name": "length", "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)" + "`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 fromArray: array => t" + "signature": "let length: string => int" }, { - "id": "Stdlib.Float32Array.fromBuffer", + "id": "Stdlib.String.get", "kind": "value", - "name": "fromBuffer", + "name": "get", "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." + "`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 fromBuffer: Stdlib__ArrayBuffer.t => t" + "signature": "let get: (string, int) => option" }, { - "id": "Stdlib.Float32Array.fromBufferToEnd", + "id": "Stdlib.String.getUnsafe", "kind": "value", - "name": "fromBufferToEnd", + "name": "getUnsafe", "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." + "`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 fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "signature": "let getUnsafe: (string, int) => string" }, { - "id": "Stdlib.Float32Array.fromBufferWithRange", + "id": "Stdlib.String.charAt", "kind": "value", - "name": "fromBufferWithRange", + "name": "charAt", "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." + "`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 fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "signature": "let charAt: (string, int) => string" }, { - "id": "Stdlib.Float32Array.fromLength", + "id": "Stdlib.String.charCodeAt", "kind": "value", - "name": "fromLength", + "name": "charCodeAt", "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." + "`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 fromLength: int => t" + "signature": "let charCodeAt: (string, int) => float" }, { - "id": "Stdlib.Float32Array.fromArrayLikeOrIterable", + "id": "Stdlib.String.codePointAt", "kind": "value", - "name": "fromArrayLikeOrIterable", + "name": "codePointAt", "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)" + "`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 fromArrayLikeOrIterable: 'a => t" + "signature": "let codePointAt: (string, int) => option" }, { - "id": "Stdlib.Float32Array.fromArrayLikeOrIterableWithMap", + "id": "Stdlib.String.concat", "kind": "value", - "name": "fromArrayLikeOrIterableWithMap", + "name": "concat", "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)" + "`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 fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t" - } - ] - }, - "stdlib/typedarray": { - "id": "Stdlib.TypedArray", - "name": "TypedArray", - "docstrings": [], - "items": [ - { - "id": "Stdlib.TypedArray.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'a>" + "signature": "let concat: (string, string) => string" }, { - "id": "Stdlib.TypedArray.get", + "id": "Stdlib.String.concatMany", "kind": "value", - "name": "get", - "docstrings": [], - "signature": "let get: (t<'a>, int) => option<'a>" + "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": "Stdlib.TypedArray.set", + "id": "Stdlib.String.endsWith", "kind": "value", - "name": "set", - "docstrings": [], - "signature": "let set: (t<'a>, int, 'a) => unit" + "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": "Stdlib.TypedArray.buffer", + "id": "Stdlib.String.endsWithFrom", "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t<'a> => Stdlib__ArrayBuffer.t" + "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": "Stdlib.TypedArray.byteLength", + "id": "Stdlib.String.includes", "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t<'a> => int" + "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": "Stdlib.TypedArray.byteOffset", + "id": "Stdlib.String.includesFrom", "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t<'a> => int" + "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": "Stdlib.TypedArray.setArray", + "id": "Stdlib.String.indexOf", "kind": "value", - "name": "setArray", - "docstrings": [], - "signature": "let setArray: (t<'a>, array<'a>) => unit" + "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": "Stdlib.TypedArray.setArrayFrom", + "id": "Stdlib.String.indexOfOpt", "kind": "value", - "name": "setArrayFrom", - "docstrings": [], - "signature": "let setArrayFrom: (t<'a>, array<'a>, int) => unit" + "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": "Stdlib.TypedArray.length", + "id": "Stdlib.String.indexOfFrom", "kind": "value", - "name": "length", - "docstrings": [], - "signature": "let length: t<'a> => int" + "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": "Stdlib.TypedArray.copyAllWithin", + "id": "Stdlib.String.lastIndexOf", "kind": "value", - "name": "copyAllWithin", - "docstrings": [], - "signature": "let copyAllWithin: (t<'a>, ~target: int) => array<'a>" + "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": "Stdlib.TypedArray.copyWithinToEnd", + "id": "Stdlib.String.lastIndexOfOpt", "kind": "value", - "name": "copyWithinToEnd", - "docstrings": [], - "signature": "let copyWithinToEnd: (t<'a>, ~target: int, ~start: int) => array<'a>" + "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": "Stdlib.TypedArray.copyWithin", + "id": "Stdlib.String.lastIndexOfFrom", "kind": "value", - "name": "copyWithin", - "docstrings": [], - "signature": "let copyWithin: (t<'a>, ~target: int, ~start: int, ~end: int) => array<'a>" + "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": "Stdlib.TypedArray.fillAll", + "id": "Stdlib.String.match", "kind": "value", - "name": "fillAll", - "docstrings": [], - "signature": "let fillAll: (t<'a>, 'a) => t<'a>" + "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": "Stdlib.TypedArray.fillToEnd", + "id": "Stdlib.String.normalize", "kind": "value", - "name": "fillToEnd", - "docstrings": [], - "signature": "let fillToEnd: (t<'a>, 'a, ~start: int) => t<'a>" + "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": "Stdlib.TypedArray.fill", - "kind": "value", - "name": "fill", - "docstrings": [], - "signature": "let fill: (t<'a>, 'a, ~start: int, ~end: int) => t<'a>" + "id": "Stdlib.String.normalizeForm", + "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]" }, { - "id": "Stdlib.TypedArray.reverse", + "id": "Stdlib.String.normalizeByForm", "kind": "value", - "name": "reverse", + "name": "normalizeByForm", "docstrings": [], - "signature": "let reverse: t<'a> => unit" + "signature": "let normalizeByForm: (string, normalizeForm) => string" }, { - "id": "Stdlib.TypedArray.toReversed", + "id": "Stdlib.String.repeat", "kind": "value", - "name": "toReversed", - "docstrings": [], - "signature": "let toReversed: t<'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": "Stdlib.TypedArray.sort", + "id": "Stdlib.String.replace", "kind": "value", - "name": "sort", - "docstrings": [], - "signature": "let sort: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => unit" + "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": "Stdlib.TypedArray.toSorted", + "id": "Stdlib.String.replaceRegExp", "kind": "value", - "name": "toSorted", - "docstrings": [], - "signature": "let toSorted: (t<'a>, ('a, 'a) => Stdlib__Ordering.t) => t<'a>" + "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, RegExp.t, string) => string" }, { - "id": "Stdlib.TypedArray.with", + "id": "Stdlib.String.replaceAll", "kind": "value", - "name": "with", - "docstrings": [], - "signature": "let with: (t<'a>, int, 'a) => t<'a>" + "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" }, { - "id": "Stdlib.TypedArray.includes", + "id": "Stdlib.String.replaceAllRegExp", "kind": "value", - "name": "includes", - "docstrings": [], - "signature": "let includes: (t<'a>, 'a) => bool" + "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, RegExp.t, string) => string" }, { - "id": "Stdlib.TypedArray.indexOf", + "id": "Stdlib.String.unsafeReplaceRegExpBy0", "kind": "value", - "name": "indexOf", - "docstrings": [], - "signature": "let indexOf: (t<'a>, 'a) => int" + "name": "unsafeReplaceRegExpBy0", + "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```" + ], + "signature": "let unsafeReplaceRegExpBy0: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string", + "deprecated": "Use `replaceRegExpBy0Unsafe` instead" }, { - "id": "Stdlib.TypedArray.indexOfFrom", + "id": "Stdlib.String.unsafeReplaceRegExpBy1", "kind": "value", - "name": "indexOfFrom", - "docstrings": [], - "signature": "let indexOfFrom: (t<'a>, 'a, int) => int" + "name": "unsafeReplaceRegExpBy1", + "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```" + ], + "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": "Stdlib.TypedArray.joinWith", + "id": "Stdlib.String.unsafeReplaceRegExpBy2", "kind": "value", - "name": "joinWith", - "docstrings": [], - "signature": "let joinWith: (t<'a>, string) => string" + "name": "unsafeReplaceRegExpBy2", + "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```" + ], + "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": "Stdlib.TypedArray.lastIndexOf", + "id": "Stdlib.String.unsafeReplaceRegExpBy3", "kind": "value", - "name": "lastIndexOf", - "docstrings": [], - "signature": "let lastIndexOf: (t<'a>, 'a) => int" + "name": "unsafeReplaceRegExpBy3", + "docstrings": [ + "`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 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": "Stdlib.TypedArray.lastIndexOfFrom", + "id": "Stdlib.String.replaceRegExpBy0Unsafe", "kind": "value", - "name": "lastIndexOfFrom", - "docstrings": [], - "signature": "let lastIndexOfFrom: (t<'a>, 'a, int) => int" + "name": "replaceRegExpBy0Unsafe", + "docstrings": [ + "`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 replaceRegExpBy0Unsafe: (\n string,\n RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" }, { - "id": "Stdlib.TypedArray.slice", + "id": "Stdlib.String.replaceRegExpBy1Unsafe", "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (t<'a>, ~start: int, ~end: int) => t<'a>" + "name": "replaceRegExpBy1Unsafe", + "docstrings": [ + "`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 replaceRegExpBy1Unsafe: (\n string,\n RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" }, { - "id": "Stdlib.TypedArray.sliceToEnd", + "id": "Stdlib.String.replaceRegExpBy2Unsafe", "kind": "value", - "name": "sliceToEnd", - "docstrings": [], - "signature": "let sliceToEnd: (t<'a>, ~start: int) => t<'a>" + "name": "replaceRegExpBy2Unsafe", + "docstrings": [ + "`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 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": "Stdlib.TypedArray.copy", + "id": "Stdlib.String.replaceRegExpBy3Unsafe", "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: t<'a> => t<'a>" + "name": "replaceRegExpBy3Unsafe", + "docstrings": [ + "`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 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": "Stdlib.TypedArray.subarray", + "id": "Stdlib.String.search", "kind": "value", - "name": "subarray", - "docstrings": [], - "signature": "let subarray: (t<'a>, ~start: int, ~end: int) => t<'a>" + "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": "Stdlib.TypedArray.subarrayToEnd", + "id": "Stdlib.String.searchOpt", "kind": "value", - "name": "subarrayToEnd", - "docstrings": [], - "signature": "let subarrayToEnd: (t<'a>, ~start: int) => t<'a>" + "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": "Stdlib.TypedArray.toString", + "id": "Stdlib.String.slice", "kind": "value", - "name": "toString", - "docstrings": [], - "signature": "let toString: t<'a> => string" + "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": "Stdlib.TypedArray.toLocaleString", + "id": "Stdlib.String.sliceToEnd", "kind": "value", - "name": "toLocaleString", - "docstrings": [], - "signature": "let toLocaleString: t<'a> => string" + "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": "Stdlib.TypedArray.every", + "id": "Stdlib.String.split", "kind": "value", - "name": "every", - "docstrings": [], - "signature": "let every: (t<'a>, 'a => bool) => bool" + "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": "Stdlib.TypedArray.everyWithIndex", - "kind": "value", - "name": "everyWithIndex", - "docstrings": [], - "signature": "let everyWithIndex: (t<'a>, ('a, int) => bool) => bool" + "id": "Stdlib.String.splitAtMost", + "kind": "value", + "name": "splitAtMost", + "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```" + ], + "signature": "let splitAtMost: (string, string, ~limit: int) => array" }, { - "id": "Stdlib.TypedArray.filter", + "id": "Stdlib.String.splitByRegExp", "kind": "value", - "name": "filter", - "docstrings": [], - "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + "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, RegExp.t) => array>" }, { - "id": "Stdlib.TypedArray.filterWithIndex", + "id": "Stdlib.String.splitByRegExpAtMost", "kind": "value", - "name": "filterWithIndex", - "docstrings": [], - "signature": "let filterWithIndex: (t<'a>, ('a, int) => bool) => t<'a>" + "name": "splitByRegExpAtMost", + "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?\", / /, ~limit=3) ==\n [Some(\"Hello\"), Some(\"World.\"), Some(\"How\")]\n```" + ], + "signature": "let splitByRegExpAtMost: (\n string,\n RegExp.t,\n ~limit: int,\n) => array>" }, { - "id": "Stdlib.TypedArray.find", + "id": "Stdlib.String.startsWith", "kind": "value", - "name": "find", - "docstrings": [], - "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + "name": "startsWith", + "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```" + ], + "signature": "let startsWith: (string, string) => bool" }, { - "id": "Stdlib.TypedArray.findWithIndex", + "id": "Stdlib.String.startsWithFrom", "kind": "value", - "name": "findWithIndex", - "docstrings": [], - "signature": "let findWithIndex: (t<'a>, ('a, int) => bool) => option<'a>" + "name": "startsWithFrom", + "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```" + ], + "signature": "let startsWithFrom: (string, string, int) => bool" }, { - "id": "Stdlib.TypedArray.findIndex", + "id": "Stdlib.String.substring", "kind": "value", - "name": "findIndex", - "docstrings": [], - "signature": "let findIndex: (t<'a>, 'a => bool) => int" + "name": "substring", + "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```" + ], + "signature": "let substring: (string, ~start: int, ~end: int) => string" }, { - "id": "Stdlib.TypedArray.findIndexWithIndex", + "id": "Stdlib.String.substringToEnd", "kind": "value", - "name": "findIndexWithIndex", - "docstrings": [], - "signature": "let findIndexWithIndex: (t<'a>, ('a, int) => bool) => int" + "name": "substringToEnd", + "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```" + ], + "signature": "let substringToEnd: (string, ~start: int) => string" }, { - "id": "Stdlib.TypedArray.forEach", + "id": "Stdlib.String.toLowerCase", "kind": "value", - "name": "forEach", - "docstrings": [], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "name": "toLowerCase", + "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```" + ], + "signature": "let toLowerCase: string => string" }, { - "id": "Stdlib.TypedArray.forEachWithIndex", + "id": "Stdlib.String.toLocaleLowerCase", "kind": "value", - "name": "forEachWithIndex", - "docstrings": [], - "signature": "let forEachWithIndex: (t<'a>, ('a, int) => unit) => unit" + "name": "toLocaleLowerCase", + "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." + ], + "signature": "let toLocaleLowerCase: string => string" }, { - "id": "Stdlib.TypedArray.map", + "id": "Stdlib.String.toUpperCase", "kind": "value", - "name": "map", - "docstrings": [], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "name": "toUpperCase", + "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```" + ], + "signature": "let toUpperCase: string => string" }, { - "id": "Stdlib.TypedArray.mapWithIndex", + "id": "Stdlib.String.toLocaleUpperCase", "kind": "value", - "name": "mapWithIndex", - "docstrings": [], - "signature": "let mapWithIndex: (t<'a>, ('a, int) => 'b) => t<'b>" + "name": "toLocaleUpperCase", + "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." + ], + "signature": "let toLocaleUpperCase: string => string" }, { - "id": "Stdlib.TypedArray.reduce", + "id": "Stdlib.String.trim", "kind": "value", - "name": "reduce", - "docstrings": [], - "signature": "let reduce: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + "name": "trim", + "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```" + ], + "signature": "let trim: string => string" }, { - "id": "Stdlib.TypedArray.reduceWithIndex", + "id": "Stdlib.String.trimStart", "kind": "value", - "name": "reduceWithIndex", - "docstrings": [], - "signature": "let reduceWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + "name": "trimStart", + "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```" + ], + "signature": "let trimStart: string => string" }, { - "id": "Stdlib.TypedArray.reduceRight", + "id": "Stdlib.String.trimEnd", "kind": "value", - "name": "reduceRight", - "docstrings": [], - "signature": "let reduceRight: (t<'a>, ('b, 'a) => 'b, 'b) => 'b" + "name": "trimEnd", + "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```" + ], + "signature": "let trimEnd: string => string" }, { - "id": "Stdlib.TypedArray.reduceRightWithIndex", + "id": "Stdlib.String.padStart", "kind": "value", - "name": "reduceRightWithIndex", - "docstrings": [], - "signature": "let reduceRightWithIndex: (t<'a>, ('b, 'a, int) => 'b, 'b) => 'b" + "name": "padStart", + "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```" + ], + "signature": "let padStart: (string, int, string) => string" }, { - "id": "Stdlib.TypedArray.some", + "id": "Stdlib.String.padEnd", "kind": "value", - "name": "some", - "docstrings": [], - "signature": "let some: (t<'a>, 'a => bool) => bool" + "name": "padEnd", + "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```" + ], + "signature": "let padEnd: (string, int, string) => string" }, { - "id": "Stdlib.TypedArray.someWithIndex", + "id": "Stdlib.String.getSymbol", "kind": "value", - "name": "someWithIndex", - "docstrings": [], - "signature": "let someWithIndex: (t<'a>, ('a, int) => bool) => bool" - } - ] - }, - "stdlib/arraybuffer": { - "id": "Stdlib.ArrayBuffer", - "name": "ArrayBuffer", - "docstrings": [], - "items": [ - { - "id": "Stdlib.ArrayBuffer.t", - "kind": "type", - "name": "t", + "name": "getSymbol", "docstrings": [], - "signature": "type t = Js.TypedArray2.ArrayBuffer.t" + "signature": "let getSymbol: (string, Symbol.t) => option<'a>" }, { - "id": "Stdlib.ArrayBuffer.make", + "id": "Stdlib.String.getSymbolUnsafe", "kind": "value", - "name": "make", + "name": "getSymbolUnsafe", "docstrings": [], - "signature": "let make: int => t" + "signature": "let getSymbolUnsafe: (string, Symbol.t) => 'a" }, { - "id": "Stdlib.ArrayBuffer.byteLength", + "id": "Stdlib.String.setSymbol", "kind": "value", - "name": "byteLength", + "name": "setSymbol", "docstrings": [], - "signature": "let byteLength: t => int" + "signature": "let setSymbol: (string, Symbol.t, 'a) => unit" }, { - "id": "Stdlib.ArrayBuffer.slice", + "id": "Stdlib.String.localeCompare", "kind": "value", - "name": "slice", - "docstrings": [], - "signature": "let slice: (t, ~start: int, ~end: int) => t" + "name": "localeCompare", + "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```" + ], + "signature": "let localeCompare: (string, string) => float" }, { - "id": "Stdlib.ArrayBuffer.sliceToEnd", + "id": "Stdlib.String.ignore", "kind": "value", - "name": "sliceToEnd", - "docstrings": [], - "signature": "let sliceToEnd: (t, ~start: int) => t" + "name": "ignore", + "docstrings": [ + "`ignore(string)` ignores the provided string and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: string => unit" } ] }, - "stdlib/weakset": { - "id": "Stdlib.WeakSet", - "name": "WeakSet", + "stdlib/result": { + "id": "Stdlib.Result", + "name": "Result", "docstrings": [], "items": [ { - "id": "Stdlib.WeakSet.t", + "id": "Stdlib.Result.t", "kind": "type", "name": "t", - "docstrings": [], - "signature": "type t<'a> = Js.WeakSet.t<'a>" + "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": "type t<'res, 'err> = result<'res, 'err> =\n | Ok('res)\n | Error('err)" }, { - "id": "Stdlib.WeakSet.make", + "id": "Stdlib.Result.getExn", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: unit => t<'a>" + "name": "getExn", + "docstrings": [ + "`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": "let getExn: result<'a, 'b> => 'a" }, { - "id": "Stdlib.WeakSet.add", + "id": "Stdlib.Result.mapOr", "kind": "value", - "name": "add", - "docstrings": [], - "signature": "let add: (t<'a>, 'a) => t<'a>" + "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": "Stdlib.WeakSet.delete", + "id": "Stdlib.Result.mapWithDefault", "kind": "value", - "name": "delete", + "name": "mapWithDefault", "docstrings": [], - "signature": "let delete: (t<'a>, 'a) => bool" + "signature": "let mapWithDefault: (result<'a, 'c>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Stdlib.WeakSet.has", + "id": "Stdlib.Result.map", "kind": "value", - "name": "has", - "docstrings": [], - "signature": "let has: (t<'a>, 'a) => bool" - } - ] - }, - "stdlib/set": { - "id": "Stdlib.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": "Stdlib.Set.t", - "kind": "type", - "name": "t", - "docstrings": ["Type representing an instance of `Set`."], - "signature": "type t<'a> = Js.Set.t<'a>" + "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": "Stdlib.Set.make", + "id": "Stdlib.Result.flatMap", "kind": "value", - "name": "make", + "name": "flatMap", "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`." + "`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": "let make: unit => t<'a>" + "signature": "let flatMap: (result<'a, 'c>, 'a => result<'b, 'c>) => result<'b, 'c>" }, { - "id": "Stdlib.Set.fromArray", + "id": "Stdlib.Result.getOr", "kind": "value", - "name": "fromArray", + "name": "getOr", "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```" + "`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 fromArray: array<'a> => t<'a>" + "signature": "let getOr: (result<'a, 'b>, 'a) => 'a" }, { - "id": "Stdlib.Set.fromIterator", + "id": "Stdlib.Result.getWithDefault", "kind": "value", - "name": "fromIterator", + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (result<'a, 'b>, 'a) => 'a", + "deprecated": "Use getOr instead" + }, + { + "id": "Stdlib.Result.isOk", + "kind": "value", + "name": "isOk", "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```" + "`isOk(res)`: Returns `true` if `res` is of the form `Ok(n)`, `false` if it is the `Error(e)` variant." ], - "signature": "let fromIterator: Stdlib__Iterator.t<'a> => t<'a>" + "signature": "let isOk: result<'a, 'b> => bool" }, { - "id": "Stdlib.Set.size", + "id": "Stdlib.Result.isError", "kind": "value", - "name": "size", + "name": "isError", "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```" + "`isError(res)`: Returns `true` if `res` is of the form `Error(e)`, `false` if it is the `Ok(n)` variant." ], - "signature": "let size: t<'a> => int" + "signature": "let isError: result<'a, 'b> => bool" }, { - "id": "Stdlib.Set.clear", + "id": "Stdlib.Result.equal", "kind": "value", - "name": "clear", + "name": "equal", "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```" + "`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 clear: t<'a> => unit" + "signature": "let equal: (result<'a, 'c>, result<'b, 'd>, ('a, 'b) => bool) => bool" }, { - "id": "Stdlib.Set.add", + "id": "Stdlib.Result.compare", "kind": "value", - "name": "add", + "name": "compare", "docstrings": [ - "Adds a new value to the set.\n\n## Examples\n```rescript\nlet set = Set.make()\nset->Set.add(\"someValue\")\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 add: (t<'a>, 'a) => unit" + "signature": "let compare: (\n result<'a, 'c>,\n result<'b, 'd>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Stdlib.Set.delete", + "id": "Stdlib.Result.forEach", "kind": "value", - "name": "delete", + "name": "forEach", "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```" + "`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 delete: (t<'a>, 'a) => bool" + "signature": "let forEach: (result<'a, 'b>, 'a => unit) => unit" }, { - "id": "Stdlib.Set.has", + "id": "Stdlib.Result.mapError", "kind": "value", - "name": "has", + "name": "mapError", "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```" + "`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 has: (t<'a>, 'a) => bool" + "signature": "let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>" }, { - "id": "Stdlib.Set.forEach", + "id": "Stdlib.Result.all", "kind": "value", - "name": "forEach", + "name": "all", "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```" + "`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 forEach: (t<'a>, 'a => unit) => unit" + "signature": "let all: array> => result, 'b>" }, { - "id": "Stdlib.Set.values", + "id": "Stdlib.Result.all2", "kind": "value", - "name": "values", + "name": "all2", "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```" + "`all2((r1, r2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let values: t<'a> => Stdlib__Iterator.t<'a>" - } - ] - }, - "stdlib/weakmap": { - "id": "Stdlib.WeakMap", - "name": "WeakMap", - "docstrings": [], - "items": [ - { - "id": "Stdlib.WeakMap.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t<'k, 'v> = Js.WeakMap.t<'k, 'v>" + "signature": "let all2: (\n (result<'r1, 'e>, result<'r2, 'e>),\n) => result<('r1, 'r2), 'e>" }, { - "id": "Stdlib.WeakMap.make", + "id": "Stdlib.Result.all3", "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: unit => t<'k, 'v>" + "name": "all3", + "docstrings": [ + "`all3((r1, r2, r3))`. Like `all()`, but with a fixed size tuple of 2" + ], + "signature": "let all3: (\n (result<'r1, 'e>, result<'r2, 'e>, result<'r3, 'e>),\n) => result<('r1, 'r2, 'r3), 'e>" }, { - "id": "Stdlib.WeakMap.get", + "id": "Stdlib.Result.all4", "kind": "value", - "name": "get", - "docstrings": [], - "signature": "let get: (t<'k, 'v>, 'k) => option<'v>" + "name": "all4", + "docstrings": [ + "`all4((r1, r2, r3, r4))`. Like `all()`, but with a fixed size tuple of 2" + ], + "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": "Stdlib.WeakMap.has", + "id": "Stdlib.Result.all5", "kind": "value", - "name": "has", - "docstrings": [], - "signature": "let has: (t<'k, 'v>, 'k) => bool" + "name": "all5", + "docstrings": [ + "`all5((r1, r2, r3, r4, r5))`. Like `all()`, but with a fixed size tuple of 2" + ], + "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": "Stdlib.WeakMap.set", + "id": "Stdlib.Result.all6", "kind": "value", - "name": "set", - "docstrings": [], - "signature": "let set: (t<'k, 'v>, 'k, 'v) => t<'k, 'v>" + "name": "all6", + "docstrings": [ + "`all6((r1, r2, r3, r4, r5, r6))`. Like `all()`, but with a fixed size tuple of 2" + ], + "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>" }, { - "id": "Stdlib.WeakMap.delete", + "id": "Stdlib.Result.ignore", "kind": "value", - "name": "delete", - "docstrings": [], - "signature": "let delete: (t<'k, 'v>, 'k) => bool" + "name": "ignore", + "docstrings": [ + "`ignore(result)` ignores the provided result and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: result<'res, 'err> => unit" } ] }, - "stdlib/map": { - "id": "Stdlib.Map", - "name": "Map", + "stdlib/regexp": { + "id": "Stdlib.RegExp", + "name": "RegExp", "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." + "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": "Stdlib.Map.t", + "id": "Stdlib.RegExp.t", "kind": "type", "name": "t", - "docstrings": ["Type representing an instance of `Map`."], - "signature": "type t<'k, 'v> = Js.Map.t<'k, 'v>" + "docstrings": [ + "Type representing an instantiated `RegExp`." + ], + "signature": "type t" }, { - "id": "Stdlib.Map.make", + "id": "Stdlib.RegExp.fromString", "kind": "value", - "name": "make", + "name": "fromString", "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`." + "`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\n// Match 'foo' with case insensitive flag\nlet regexp = RegExp.fromString(\"foo\", ~flags=\"i\")\n\nswitch regexp->RegExp.exec(\"FOO\") {\n| None => Console.log(\"Nope, no match...\")\n| Some(result) => Console.log(result->RegExp.Result.fullMatch) // Prints \"FOO\"\n}\n```" ], - "signature": "let make: unit => t<'k, 'v>" + "signature": "let fromString: (string, ~flags: string=?) => t" }, { - "id": "Stdlib.Map.fromArray", + "id": "Stdlib.RegExp.fromStringWithFlags", "kind": "value", - "name": "fromArray", + "name": "fromStringWithFlags", "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```" + "`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 fromArray: array<('k, 'v)> => t<'k, 'v>" + "signature": "let fromStringWithFlags: (string, ~flags: string) => t", + "deprecated": "Use `fromString` instead" }, { - "id": "Stdlib.Map.fromIterator", + "id": "Stdlib.RegExp.test", "kind": "value", - "name": "fromIterator", + "name": "test", "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```" + "`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 fromIterator: Stdlib__Iterator.t<('k, 'v)> => t<'k, 'v>" + "signature": "let test: (t, string) => bool" }, { - "id": "Stdlib.Map.size", + "id": "Stdlib.RegExp.exec", "kind": "value", - "name": "size", + "name": "exec", "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```" + "`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 size: t<'k, 'v> => int" + "signature": "let exec: (t, string) => option" }, { - "id": "Stdlib.Map.clear", + "id": "Stdlib.RegExp.lastIndex", "kind": "value", - "name": "clear", + "name": "lastIndex", "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```" + "`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 clear: t<'k, 'v> => unit" + "signature": "let lastIndex: t => int" }, { - "id": "Stdlib.Map.forEach", + "id": "Stdlib.RegExp.setLastIndex", "kind": "value", - "name": "forEach", + "name": "setLastIndex", "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```" + "`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 forEach: (t<'k, 'v>, 'v => unit) => unit" + "signature": "let setLastIndex: (t, int) => unit" }, { - "id": "Stdlib.Map.forEachWithKey", + "id": "Stdlib.RegExp.ignoreCase", "kind": "value", - "name": "forEachWithKey", + "name": "ignoreCase", "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```" + "`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 forEachWithKey: (t<'k, 'v>, ('v, 'k) => unit) => unit" + "signature": "let ignoreCase: t => bool" }, { - "id": "Stdlib.Map.get", + "id": "Stdlib.RegExp.global", "kind": "value", - "name": "get", + "name": "global", "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```" + "`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 get: (t<'k, 'v>, 'k) => option<'v>" + "signature": "let global: t => bool" }, { - "id": "Stdlib.Map.has", + "id": "Stdlib.RegExp.multiline", "kind": "value", - "name": "has", + "name": "multiline", "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```" + "`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 has: (t<'k, 'v>, 'k) => bool" + "signature": "let multiline: t => bool" }, { - "id": "Stdlib.Map.set", + "id": "Stdlib.RegExp.source", "kind": "value", - "name": "set", + "name": "source", "docstrings": [ - "Sets the provided `value` to the provided `key`.\n\n## Examples\n```rescript\nlet map = Map.make()\nmap->Map.set(\"someKey\", \"someValue\")\n```" + "`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 set: (t<'k, 'v>, 'k, 'v) => unit" + "signature": "let source: t => string" }, { - "id": "Stdlib.Map.delete", + "id": "Stdlib.RegExp.sticky", "kind": "value", - "name": "delete", + "name": "sticky", "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```" + "`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 delete: (t<'k, 'v>, 'k) => bool" + "signature": "let sticky: t => bool" }, { - "id": "Stdlib.Map.keys", + "id": "Stdlib.RegExp.unicode", "kind": "value", - "name": "keys", + "name": "unicode", "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```" + "`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 keys: t<'k, 'v> => Stdlib__Iterator.t<'k>" + "signature": "let unicode: t => bool" }, { - "id": "Stdlib.Map.values", + "id": "Stdlib.RegExp.flags", "kind": "value", - "name": "values", + "name": "flags", "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```" + "`flags(regexp)` returns a string consisting of all the flags set on this `RegExp`.\n\nSee [`RegExp.flags`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/flags) on MDN.\n\n## Examples\n```rescript\nlet regexp = RegExp.fromString(\"\\\\w+\", ~flags=\"gi\")\nConsole.log(regexp->RegExp.flags) // Logs \"gi\", all the flags set on the RegExp\n```" ], - "signature": "let values: t<'k, 'v> => Stdlib__Iterator.t<'v>" + "signature": "let flags: t => string" }, { - "id": "Stdlib.Map.entries", + "id": "Stdlib.RegExp.ignore", "kind": "value", - "name": "entries", + "name": "ignore", "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```" + "`ignore(regExp)` ignores the provided regExp and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let entries: t<'k, 'v> => Stdlib__Iterator.t<('k, 'v)>" + "signature": "let ignore: t => unit" } ] }, - "stdlib/asynciterator": { - "id": "Stdlib.AsyncIterator", - "name": "AsyncIterator", + "stdlib/promise": { + "id": "Stdlib.Promise", + "name": "Promise", "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." + "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." ], "items": [ { - "id": "Stdlib.AsyncIterator.t", + "id": "Stdlib.Promise.t", "kind": "type", "name": "t", - "docstrings": ["The type representing an async iterator."], - "signature": "type t<'a>" + "docstrings": [], + "signature": "type t<'a> = promise<'a>" }, { - "id": "Stdlib.AsyncIterator.value", - "kind": "type", - "name": "value", - "docstrings": [], - "signature": "type value<'a> = {done: bool, value: option<'a>}" + "id": "Stdlib.Promise.resolve", + "kind": "value", + "name": "resolve", + "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```" + ], + "signature": "let resolve: 'a => t<'a>" }, { - "id": "Stdlib.AsyncIterator.next", + "id": "Stdlib.Promise.reject", "kind": "value", - "name": "next", + "name": "reject", "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```" + "`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 next: t<'a> => promise>" + "signature": "let reject: exn => t<'a>" }, { - "id": "Stdlib.AsyncIterator.forEach", + "id": "Stdlib.Promise.make", "kind": "value", - "name": "forEach", + "name": "make", "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```" + "`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 forEach: (t<'a>, option<'a> => unit) => promise" - } - ] - }, - "stdlib/iterator": { - "id": "Stdlib.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": "Stdlib.Iterator.t", - "kind": "type", - "name": "t", - "docstrings": ["The type representing an iterator."], - "signature": "type t<'a>" + "signature": "let make: (('a => unit, 'e => unit) => unit) => t<'a>" }, { - "id": "Stdlib.Iterator.value", + "id": "Stdlib.Promise.promiseAndResolvers", "kind": "type", - "name": "value", - "docstrings": ["The current value of an iterator."], - "signature": "type value<'a> = {done: bool, value: option<'a>}" + "name": "promiseAndResolvers", + "docstrings": [], + "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" }, { - "id": "Stdlib.Iterator.next", + "id": "Stdlib.Promise.withResolvers", "kind": "value", - "name": "next", + "name": "withResolvers", "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```" + "`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)->TimeoutId.ignore\n\npromise\n->thenResolve(str => {\n Console.log(str)\n})\n->ignore\n```" ], - "signature": "let next: t<'a> => value<'a>" + "signature": "let withResolvers: unit => promiseAndResolvers<'a>" }, { - "id": "Stdlib.Iterator.toArray", + "id": "Stdlib.Promise.catch", "kind": "value", - "name": "toArray", + "name": "catch", "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```" + "`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 | JsExn(obj) =>\n switch JsExn.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 toArray: t<'a> => array<'a>" + "signature": "let catch: (t<'a>, exn => t<'a>) => t<'a>" }, { - "id": "Stdlib.Iterator.toArrayWithMapper", + "id": "Stdlib.Promise.then", "kind": "value", - "name": "toArrayWithMapper", + "name": "then", "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```" + "`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 toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b>" + "signature": "let then: (t<'a>, 'a => t<'b>) => t<'b>" }, { - "id": "Stdlib.Iterator.forEach", + "id": "Stdlib.Promise.thenResolve", "kind": "value", - "name": "forEach", + "name": "thenResolve", "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```" + "`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 forEach: (t<'a>, option<'a> => unit) => unit" - } - ] - }, - "stdlib/json": { - "id": "Stdlib.JSON", - "name": "JSON", - "docstrings": ["Functions for interacting with JSON."], - "items": [ - { - "id": "Stdlib.JSON.t", - "kind": "type", - "name": "t", - "docstrings": ["A type representing a JSON object."], - "signature": "type t = Js.Json.t =\n | Boolean(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Stdlib__Dict.t)\n | Array(array)" + "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Stdlib.JSON.replacer", - "kind": "type", - "name": "replacer", - "docstrings": [], - "signature": "type replacer =\n | Keys(array)\n | Replacer((string, t) => t)" + "id": "Stdlib.Promise.finally", + "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>" }, { - "id": "Stdlib.JSON.parseExn", + "id": "Stdlib.Promise.race", "kind": "value", - "name": "parseExn", + "name": "race", "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." + "`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)->TimeoutId.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 parseExn: (string, ~reviver: (string, t) => t=?) => t" + "signature": "let race: array> => t<'a>" }, { - "id": "Stdlib.JSON.parseExnWithReviver", + "id": "Stdlib.Promise.any", "kind": "value", - "name": "parseExnWithReviver", + "name": "any", "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." + "`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)->TimeoutId.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 parseExnWithReviver: (string, (string, t) => t) => t", - "deprecated": "Use `parseExn` with optional parameter instead" + "signature": "let any: array> => t<'a>" }, { - "id": "Stdlib.JSON.stringify", + "id": "Stdlib.Promise.all", "kind": "value", - "name": "stringify", + "name": "all", "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```" + "`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 stringify: (t, ~replacer: replacer=?, ~space: int=?) => string" + "signature": "let all: array> => t>" }, { - "id": "Stdlib.JSON.stringifyWithIndent", + "id": "Stdlib.Promise.all2", "kind": "value", - "name": "stringifyWithIndent", + "name": "all2", "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```" + "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyWithIndent: (t, int) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" }, { - "id": "Stdlib.JSON.stringifyWithReplacer", + "id": "Stdlib.Promise.all3", "kind": "value", - "name": "stringifyWithReplacer", + "name": "all3", "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```" + "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" ], - "signature": "let stringifyWithReplacer: (t, (string, t) => t) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" }, { - "id": "Stdlib.JSON.stringifyWithReplacerAndIndent", + "id": "Stdlib.Promise.all4", "kind": "value", - "name": "stringifyWithReplacerAndIndent", + "name": "all4", "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```" + "`all4((p1, p2, p3, p4))`. Like `all()`, but with a fixed size tuple of 4" ], - "signature": "let stringifyWithReplacerAndIndent: (t, (string, t) => t, int) => string", - "deprecated": "Use `stringify` with optional parameters instead" + "signature": "let all4: ((t<'a>, t<'b>, t<'c>, t<'d>)) => t<('a, 'b, 'c, 'd)>" }, { - "id": "Stdlib.JSON.stringifyWithFilter", + "id": "Stdlib.Promise.all5", "kind": "value", - "name": "stringifyWithFilter", + "name": "all5", "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```" + "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" ], - "signature": "let stringifyWithFilter: (t, array) => string", - "deprecated": "Use `stringify` with optional parameter instead" + "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" }, { - "id": "Stdlib.JSON.stringifyWithFilterAndIndent", + "id": "Stdlib.Promise.all6", "kind": "value", - "name": "stringifyWithFilterAndIndent", + "name": "all6", "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```" + "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\n\")" ], - "signature": "let stringifyWithFilterAndIndent: (t, array, int) => string", - "deprecated": "Use `stringify` with optional parameters instead" + "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": "Stdlib.JSON.stringifyAny", + "id": "Stdlib.Promise.settledResult", + "kind": "type", + "name": "settledResult", + "docstrings": [], + "signature": "type settledResult<'a> =\n | Fulfilled({value: 'a})\n | Rejected({reason: exn})" + }, + { + "id": "Stdlib.Promise.allSettled", "kind": "value", - "name": "stringifyAny", + "name": "allSettled", "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." + "`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 stringifyAny: ('a, ~replacer: replacer=?, ~space: int=?) => option" + "signature": "let allSettled: array> => t>>" }, { - "id": "Stdlib.JSON.stringifyAnyWithIndent", + "id": "Stdlib.Promise.allSettled2", "kind": "value", - "name": "stringifyAnyWithIndent", + "name": "allSettled2", "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." + "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" ], - "signature": "let stringifyAnyWithIndent: ('a, int) => option", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" }, { - "id": "Stdlib.JSON.stringifyAnyWithReplacer", + "id": "Stdlib.Promise.allSettled3", "kind": "value", - "name": "stringifyAnyWithReplacer", + "name": "allSettled3", "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." + "`allSettled3((p1, p2, p3))`. Like `allSettled()`, but with a fixed size tuple of 3" ], - "signature": "let stringifyAnyWithReplacer: ('a, (string, t) => t) => option", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "signature": "let allSettled3: (\n (t<'a>, t<'b>, t<'c>),\n) => t<\n (settledResult<'a>, settledResult<'b>, settledResult<'c>),\n>" }, { - "id": "Stdlib.JSON.stringifyAnyWithReplacerAndIndent", + "id": "Stdlib.Promise.allSettled4", "kind": "value", - "name": "stringifyAnyWithReplacerAndIndent", + "name": "allSettled4", "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." + "`allSettled4((p1, p2, p3, p4))`. Like `allSettled()`, but with a fixed size tuple of 4" ], - "signature": "let stringifyAnyWithReplacerAndIndent: ('a, (string, t) => t, int) => option", - "deprecated": "Use `stringifyAny` with optional parameters instead" + "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": "Stdlib.JSON.stringifyAnyWithFilter", + "id": "Stdlib.Promise.allSettled5", "kind": "value", - "name": "stringifyAnyWithFilter", + "name": "allSettled5", "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." + "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" ], - "signature": "let stringifyAnyWithFilter: ('a, array) => string", - "deprecated": "Use `stringifyAny` with optional parameter instead" + "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": "Stdlib.JSON.stringifyAnyWithFilterAndIndent", + "id": "Stdlib.Promise.allSettled6", "kind": "value", - "name": "stringifyAnyWithFilterAndIndent", + "name": "allSettled6", "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." + "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\n\")" ], - "signature": "let stringifyAnyWithFilterAndIndent: ('a, array, int) => string", - "deprecated": "Use `stringifyAny` with optional parameters instead" - } - ] - }, - "stdlib/type": { - "id": "Stdlib.Type", - "name": "Type", - "docstrings": [ - "Utilities for classifying the type of JavaScript values at runtime." - ], - "items": [ + "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": "Stdlib.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": "Stdlib.Promise.done", + "kind": "value", + "name": "done", + "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." + ], + "signature": "let done: promise<'a> => unit", + "deprecated": "Please use `Promise.ignore` instead" }, { - "id": "Stdlib.Type.typeof", + "id": "Stdlib.Promise.ignore", "kind": "value", - "name": "typeof", + "name": "ignore", "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```" + "`ignore(promise)` ignores the provided promise and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let typeof: 'a => t" + "signature": "let ignore: promise<'a> => unit" } ] }, - "stdlib/symbol": { - "id": "Stdlib.Symbol", - "name": "Symbol", - "docstrings": [], + "stdlib/pair": { + "id": "Stdlib.Pair", + "name": "Pair", + "docstrings": [ + "This module provides functions to work with pairs, which are 2-element tuples." + ], "items": [ { - "id": "Stdlib.Symbol.t", + "id": "Stdlib.Pair.t", "kind": "type", "name": "t", "docstrings": [], - "signature": "type t = Js.Types.symbol" - }, - { - "id": "Stdlib.Symbol.make", - "kind": "value", - "name": "make", - "docstrings": [], - "signature": "let make: string => t" - }, - { - "id": "Stdlib.Symbol.getFor", - "kind": "value", - "name": "getFor", - "docstrings": [], - "signature": "let getFor: string => t" + "signature": "type t<'a, 'b> = ('a, 'b)" }, { - "id": "Stdlib.Symbol.keyFor", + "id": "Stdlib.Pair.first", "kind": "value", - "name": "keyFor", - "docstrings": [], - "signature": "let keyFor: t => option" + "name": "first", + "docstrings": [ + "`first(pair)` returns the first element of a pair.\n\n## Examples\n\n```rescript\nPair.first((1, 2))->assertEqual(1)\n```" + ], + "signature": "let first: (('a, 'b)) => 'a" }, { - "id": "Stdlib.Symbol.asyncIterator", + "id": "Stdlib.Pair.second", "kind": "value", - "name": "asyncIterator", - "docstrings": [], - "signature": "let asyncIterator: t" + "name": "second", + "docstrings": [ + "`second(pair)` returns the second element of a pair.\n\n## Examples\n\n```rescript\nPair.second((1, 2))->assertEqual(2)\n```" + ], + "signature": "let second: (('a, 'b)) => 'b" }, { - "id": "Stdlib.Symbol.hasInstance", + "id": "Stdlib.Pair.ignore", "kind": "value", - "name": "hasInstance", - "docstrings": [], - "signature": "let hasInstance: t" + "name": "ignore", + "docstrings": [ + "`ignore(pair)` ignores the provided pair and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: ('a, 'b) => unit" }, { - "id": "Stdlib.Symbol.isConcatSpreadable", + "id": "Stdlib.Pair.equal", "kind": "value", - "name": "isConcatSpreadable", - "docstrings": [], - "signature": "let isConcatSpreadable: t" + "name": "equal", + "docstrings": [ + "`equal(pair1, pair2, f1, f2)` check equality of `pair2` and `pair2` using `f1` for\nequality on the first element and `f2` for equality on the second element.\n\n## Examples\n\n```rescript\nPair.equal((1, \"test\"), (1, \"test\"), Int.equal, String.equal)->assertEqual(true)\n\nPair.equal((1, \"test\"), (2, \"test\"), Int.equal, String.equal)->assertEqual(false)\n```" + ], + "signature": "let equal: (\n ('a, 'b),\n ('c, 'd),\n ('a, 'c) => bool,\n ('b, 'd) => bool,\n) => bool" }, { - "id": "Stdlib.Symbol.iterator", + "id": "Stdlib.Pair.compare", "kind": "value", - "name": "iterator", + "name": "compare", + "docstrings": [ + "`compare(pair1, pair2, f1, f2)` compares two pairs, using `f1` to compare the first element\nand `f2` to compare the second element. Ordering is based on the first element,\nif they are equal, the second element is compared.\n\n## Examples\n\n```rescript\nPair.compare((1, \"a\"), (1, \"a\"), Int.compare, String.compare)->assertEqual(Ordering.equal)\nPair.compare((1, \"a\"), (1, \"b\"), Int.compare, String.compare)->assertEqual(Ordering.less)\nPair.compare((2, \"a\"), (1, \"b\"), Int.compare, String.compare)->assertEqual(Ordering.greater)\n```" + ], + "signature": "let compare: (\n ('a, 'b),\n ('c, 'd),\n ('a, 'c) => float,\n ('b, 'd) => float,\n) => float" + } + ] + }, + "stdlib/ordering": { + "id": "Stdlib.Ordering", + "name": "Ordering", + "docstrings": [], + "items": [ + { + "id": "Stdlib.Ordering.t", + "kind": "type", + "name": "t", "docstrings": [], - "signature": "let iterator: t" + "signature": "type t = float" }, { - "id": "Stdlib.Symbol.match", + "id": "Stdlib.Ordering.less", "kind": "value", - "name": "match", + "name": "less", "docstrings": [], - "signature": "let match: t" + "signature": "let less: float" }, { - "id": "Stdlib.Symbol.matchAll", + "id": "Stdlib.Ordering.equal", "kind": "value", - "name": "matchAll", + "name": "equal", "docstrings": [], - "signature": "let matchAll: t" + "signature": "let equal: float" }, { - "id": "Stdlib.Symbol.replace", + "id": "Stdlib.Ordering.greater", "kind": "value", - "name": "replace", + "name": "greater", "docstrings": [], - "signature": "let replace: t" + "signature": "let greater: float" }, { - "id": "Stdlib.Symbol.search", + "id": "Stdlib.Ordering.isLess", "kind": "value", - "name": "search", + "name": "isLess", "docstrings": [], - "signature": "let search: t" + "signature": "let isLess: float => bool" }, { - "id": "Stdlib.Symbol.species", + "id": "Stdlib.Ordering.isEqual", "kind": "value", - "name": "species", + "name": "isEqual", "docstrings": [], - "signature": "let species: t" + "signature": "let isEqual: float => bool" }, { - "id": "Stdlib.Symbol.split", + "id": "Stdlib.Ordering.isGreater", "kind": "value", - "name": "split", + "name": "isGreater", "docstrings": [], - "signature": "let split: t" + "signature": "let isGreater: float => bool" }, { - "id": "Stdlib.Symbol.toPrimitive", + "id": "Stdlib.Ordering.invert", "kind": "value", - "name": "toPrimitive", + "name": "invert", "docstrings": [], - "signature": "let toPrimitive: t" + "signature": "let invert: float => float" }, { - "id": "Stdlib.Symbol.toStringTag", + "id": "Stdlib.Ordering.fromInt", "kind": "value", - "name": "toStringTag", + "name": "fromInt", "docstrings": [], - "signature": "let toStringTag: t" + "signature": "let fromInt: int => float" }, { - "id": "Stdlib.Symbol.unscopables", + "id": "Stdlib.Ordering.ignore", "kind": "value", - "name": "unscopables", - "docstrings": [], - "signature": "let unscopables: t" + "name": "ignore", + "docstrings": [ + "`ignore(ordering)` ignores the provided ordering and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, - "stdlib/string": { - "id": "Stdlib.String", - "name": "String", + "stdlib/option": { + "id": "Stdlib.Option", + "name": "Option", "docstrings": [ - "Functions for interacting with JavaScript strings.\nSee: [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)." + "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": "Stdlib.String.make", - "kind": "value", - "name": "make", + "id": "Stdlib.Option.t", + "kind": "type", + "name": "t", "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```" + "Type representing an option of type 'a." ], - "signature": "let make: 'a => string" + "signature": "type t<'a> = option<'a> = None | Some('a)" }, { - "id": "Stdlib.String.fromCharCode", + "id": "Stdlib.Option.filter", "kind": "value", - "name": "fromCharCode", + "name": "filter", "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```" + "`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 fromCharCode: int => string" + "signature": "let filter: (option<'a>, 'a => bool) => option<'a>" }, { - "id": "Stdlib.String.fromCharCodeMany", + "id": "Stdlib.Option.forEach", "kind": "value", - "name": "fromCharCodeMany", + "name": "forEach", "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```" + "`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 fromCharCodeMany: array => string" + "signature": "let forEach: (option<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.String.fromCodePoint", + "id": "Stdlib.Option.getExn", "kind": "value", - "name": "fromCodePoint", + "name": "getExn", "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)`." + "`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 fromCodePoint: int => string" + "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" }, { - "id": "Stdlib.String.fromCodePointMany", + "id": "Stdlib.Option.getUnsafe", "kind": "value", - "name": "fromCodePointMany", + "name": "getUnsafe", "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])`." + "`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 fromCodePointMany: array => string" - }, - { - "id": "Stdlib.String.equal", - "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (string, string) => bool" - }, - { - "id": "Stdlib.String.compare", - "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (string, string) => Stdlib__Ordering.t" + "signature": "let getUnsafe: option<'a> => 'a" }, { - "id": "Stdlib.String.length", + "id": "Stdlib.Option.mapOr", "kind": "value", - "name": "length", + "name": "mapOr", "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```" + "`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 length: string => int" + "signature": "let mapOr: (option<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Stdlib.String.get", + "id": "Stdlib.Option.mapWithDefault", "kind": "value", - "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" + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (option<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Stdlib.String.getUnsafe", + "id": "Stdlib.Option.map", "kind": "value", - "name": "getUnsafe", + "name": "map", "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```" + "`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 getUnsafe: (string, int) => string" + "signature": "let map: (option<'a>, 'a => 'b) => option<'b>" }, { - "id": "Stdlib.String.charAt", + "id": "Stdlib.Option.flatMap", "kind": "value", - "name": "charAt", + "name": "flatMap", "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```" + "`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 charAt: (string, int) => string" + "signature": "let flatMap: (option<'a>, 'a => option<'b>) => option<'b>" }, { - "id": "Stdlib.String.charCodeAt", + "id": "Stdlib.Option.getOr", "kind": "value", - "name": "charCodeAt", + "name": "getOr", "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```" + "`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 charCodeAt: (string, int) => float" + "signature": "let getOr: (option<'a>, 'a) => 'a" }, { - "id": "Stdlib.String.codePointAt", + "id": "Stdlib.Option.getWithDefault", "kind": "value", - "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" + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (option<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Stdlib.String.concat", + "id": "Stdlib.Option.orElse", "kind": "value", - "name": "concat", + "name": "orElse", "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```" + "`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 concat: (string, string) => string" + "signature": "let orElse: (option<'a>, option<'a>) => option<'a>" }, { - "id": "Stdlib.String.concatMany", + "id": "Stdlib.Option.isSome", "kind": "value", - "name": "concatMany", + "name": "isSome", "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```" + "`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 concatMany: (string, array) => string" + "signature": "let isSome: option<'a> => bool" }, { - "id": "Stdlib.String.endsWith", + "id": "Stdlib.Option.isNone", "kind": "value", - "name": "endsWith", + "name": "isNone", "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```" + "`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 endsWith: (string, string) => bool" + "signature": "let isNone: option<'a> => bool" }, { - "id": "Stdlib.String.endsWithFrom", + "id": "Stdlib.Option.equal", "kind": "value", - "name": "endsWithFrom", + "name": "equal", "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```" + "`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 endsWithFrom: (string, string, int) => bool" + "signature": "let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Stdlib.String.includes", + "id": "Stdlib.Option.compare", "kind": "value", - "name": "includes", + "name": "compare", "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```" + "`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 includes: (string, string) => bool" + "signature": "let compare: (\n option<'a>,\n option<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Stdlib.String.includesFrom", + "id": "Stdlib.Option.all", "kind": "value", - "name": "includesFrom", + "name": "all", "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```" + "`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 includesFrom: (string, string, int) => bool" + "signature": "let all: array> => option>" }, { - "id": "Stdlib.String.indexOf", + "id": "Stdlib.Option.all2", "kind": "value", - "name": "indexOf", + "name": "all2", "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```" + "`all2((o1, o2))`. Like `all()`, but with a fixed size tuple of 2" ], - "signature": "let indexOf: (string, string) => int" + "signature": "let all2: ((option<'a>, option<'b>)) => option<('a, 'b)>" }, { - "id": "Stdlib.String.indexOfOpt", + "id": "Stdlib.Option.all3", "kind": "value", - "name": "indexOfOpt", + "name": "all3", "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```" + "`all3((o1, o2, o3))`. Like `all()`, but with a fixed size tuple of 3" ], - "signature": "let indexOfOpt: (string, string) => option" + "signature": "let all3: (\n (option<'a>, option<'b>, option<'c>),\n) => option<('a, 'b, 'c)>" }, { - "id": "Stdlib.String.indexOfFrom", + "id": "Stdlib.Option.all4", "kind": "value", - "name": "indexOfFrom", + "name": "all4", "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```" + "`all4((o1, o2, o3, o4))`. Like `all()`, but with a fixed size tuple of 4" ], - "signature": "let indexOfFrom: (string, string, int) => int" + "signature": "let all4: (\n (option<'a>, option<'b>, option<'c>, option<'d>),\n) => option<('a, 'b, 'c, 'd)>" }, { - "id": "Stdlib.String.lastIndexOf", + "id": "Stdlib.Option.all5", "kind": "value", - "name": "lastIndexOf", + "name": "all5", "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```" + "`all5((o1, o2, o3, o4, o5))`. Like `all()`, but with a fixed size tuple of 5" ], - "signature": "let lastIndexOf: (string, string) => int" + "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": "Stdlib.String.lastIndexOfOpt", + "id": "Stdlib.Option.all6", "kind": "value", - "name": "lastIndexOfOpt", + "name": "all6", "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```" + "`all6((o1, o2, o3, o4, o5, o6))`. Like `all()`, but with a fixed size tuple of 6" ], - "signature": "let lastIndexOfOpt: (string, string) => option" + "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)>" }, { - "id": "Stdlib.String.lastIndexOfFrom", + "id": "Stdlib.Option.ignore", "kind": "value", - "name": "lastIndexOfFrom", + "name": "ignore", "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```" + "`ignore(option)` ignores the provided option and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let lastIndexOfFrom: (string, string, int) => int" - }, + "signature": "let ignore: option<'a> => unit" + } + ] + }, + "stdlib/object": { + "id": "Stdlib.Object", + "name": "Object", + "docstrings": [], + "items": [ { - "id": "Stdlib.String.match", + "id": "Stdlib.Object.make", "kind": "value", - "name": "match", + "name": "make", "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```" + "`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 match: (string, Stdlib__RegExp.t) => option" + "signature": "let make: unit => {..}" }, { - "id": "Stdlib.String.normalize", + "id": "Stdlib.Object.is", "kind": "value", - "name": "normalize", + "name": "is", "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```" + "`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 normalize: string => string" + "signature": "let is: ('a, 'a) => bool" }, { - "id": "Stdlib.String.normalizeForm", - "kind": "type", - "name": "normalizeForm", + "id": "Stdlib.Object.create", + "kind": "value", + "name": "create", "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```" + "`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": "type normalizeForm = [#NFC | #NFD | #NFKC | #NFKD]" + "signature": "let create: {..} => {..}" }, { - "id": "Stdlib.String.normalizeByForm", + "id": "Stdlib.Object.createWithProperties", "kind": "value", - "name": "normalizeByForm", + "name": "createWithProperties", "docstrings": [], - "signature": "let normalizeByForm: (string, normalizeForm) => string" + "signature": "let createWithProperties: ({..}, {..}) => {..}" }, { - "id": "Stdlib.String.repeat", + "id": "Stdlib.Object.createWithNull", "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": "createWithNull", + "docstrings": [], + "signature": "let createWithNull: unit => {..}" }, { - "id": "Stdlib.String.replace", + "id": "Stdlib.Object.createWithNullAndProperties", "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": "createWithNullAndProperties", + "docstrings": [], + "signature": "let createWithNullAndProperties: {..} => {..}" }, { - "id": "Stdlib.String.replaceRegExp", + "id": "Stdlib.Object.assign", "kind": "value", - "name": "replaceRegExp", + "name": "assign", "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```" + "`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 replaceRegExp: (string, Stdlib__RegExp.t, string) => string" + "signature": "let assign: ({..}, {..}) => {..}" }, { - "id": "Stdlib.String.replaceAll", + "id": "Stdlib.Object.assignMany", "kind": "value", - "name": "replaceAll", + "name": "assignMany", "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```" + "`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": "let replaceAll: (string, string, string) => string" + "signature": "let assignMany: ({..}, array<{..}>) => {..}" }, { - "id": "Stdlib.String.replaceAllRegExp", + "id": "Stdlib.Object.copy", "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, Stdlib__RegExp.t, string) => string" + "name": "copy", + "docstrings": [], + "signature": "let copy: ({..} as 'a) => 'a" }, { - "id": "Stdlib.String.unsafeReplaceRegExpBy0", + "id": "Stdlib.Object.get", "kind": "value", - "name": "unsafeReplaceRegExpBy0", + "name": "get", "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```" + "`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 unsafeReplaceRegExpBy0: (\n string,\n Stdlib__RegExp.t,\n (~match: string, ~offset: int, ~input: string) => string,\n) => string" + "signature": "let get: ({..}, string) => option<'a>" }, { - "id": "Stdlib.String.unsafeReplaceRegExpBy1", + "id": "Stdlib.Object.getSymbol", "kind": "value", - "name": "unsafeReplaceRegExpBy1", + "name": "getSymbol", "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```" + "`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 unsafeReplaceRegExpBy1: (\n string,\n Stdlib__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + "signature": "let getSymbol: ({..}, Symbol.t) => option<'a>" }, { - "id": "Stdlib.String.unsafeReplaceRegExpBy2", + "id": "Stdlib.Object.getSymbolUnsafe", "kind": "value", - "name": "unsafeReplaceRegExpBy2", - "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```" - ], - "signature": "let unsafeReplaceRegExpBy2: (\n string,\n Stdlib__RegExp.t,\n (\n ~match: string,\n ~group1: string,\n ~group2: string,\n ~offset: int,\n ~input: string,\n ) => string,\n) => string" + "name": "getSymbolUnsafe", + "docstrings": [], + "signature": "let getSymbolUnsafe: ({..}, Symbol.t) => 'a" }, { - "id": "Stdlib.String.unsafeReplaceRegExpBy3", + "id": "Stdlib.Object.set", "kind": "value", - "name": "unsafeReplaceRegExpBy3", + "name": "set", "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." + "`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 unsafeReplaceRegExpBy3: (\n string,\n Stdlib__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 set: ({..}, string, 'a) => unit" }, { - "id": "Stdlib.String.search", + "id": "Stdlib.Object.setSymbol", "kind": "value", - "name": "search", + "name": "setSymbol", + "docstrings": [], + "signature": "let setSymbol: ({..}, Symbol.t, 'a) => unit" + }, + { + "id": "Stdlib.Object.keysToArray", + "kind": "value", + "name": "keysToArray", "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```" + "`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 search: (string, Stdlib__RegExp.t) => int" + "signature": "let keysToArray: {..} => array" }, { - "id": "Stdlib.String.searchOpt", + "id": "Stdlib.Object.hasOwnProperty", "kind": "value", - "name": "searchOpt", + "name": "hasOwnProperty", "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```" + "`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 searchOpt: (string, Stdlib__RegExp.t) => option" + "signature": "let hasOwnProperty: ({..}, string) => bool" }, { - "id": "Stdlib.String.slice", + "id": "Stdlib.Object.seal", "kind": "value", - "name": "slice", + "name": "seal", "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```" + "`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| JsExn(_) => assert(true)\n| _ => assert(false)\n}\n\npoint->Object.set(\"x\", 13) // succeeds\n```" ], - "signature": "let slice: (string, ~start: int, ~end: int) => string" + "signature": "let seal: ({..} as 'a) => 'a" }, { - "id": "Stdlib.String.sliceToEnd", + "id": "Stdlib.Object.preventExtensions", "kind": "value", - "name": "sliceToEnd", + "name": "preventExtensions", "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```" + "`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| JsExn(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let sliceToEnd: (string, ~start: int) => string" + "signature": "let preventExtensions: ({..} as 'a) => 'a" }, { - "id": "Stdlib.String.split", + "id": "Stdlib.Object.freeze", "kind": "value", - "name": "split", + "name": "freeze", "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```" + "`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| JsExn(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let split: (string, string) => array" + "signature": "let freeze: ({..} as 'a) => 'a" }, { - "id": "Stdlib.String.splitAtMost", + "id": "Stdlib.Object.isSealed", "kind": "value", - "name": "splitAtMost", + "name": "isSealed", "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```" + "`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 splitAtMost: (string, string, ~limit: int) => array" + "signature": "let isSealed: 'a => bool" }, { - "id": "Stdlib.String.splitByRegExp", + "id": "Stdlib.Object.isFrozen", "kind": "value", - "name": "splitByRegExp", + "name": "isFrozen", "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```" + "`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 splitByRegExp: (string, Stdlib__RegExp.t) => array>" + "signature": "let isFrozen: 'a => bool" }, { - "id": "Stdlib.String.splitByRegExpAtMost", + "id": "Stdlib.Object.isExtensible", "kind": "value", - "name": "splitByRegExpAtMost", + "name": "isExtensible", "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```" + "`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 splitByRegExpAtMost: (\n string,\n Stdlib__RegExp.t,\n ~limit: int,\n) => array>" + "signature": "let isExtensible: 'a => bool" }, { - "id": "Stdlib.String.startsWith", + "id": "Stdlib.Object.ignore", "kind": "value", - "name": "startsWith", + "name": "ignore", "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```" + "`ignore(object)` ignores the provided object and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let startsWith: (string, string) => bool" + "signature": "let ignore: {..} => unit" + } + ] + }, + "stdlib/nullable": { + "id": "Stdlib.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": [ + { + "id": "Stdlib.Nullable.t", + "kind": "type", + "name": "t", + "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": "Stdlib.String.startsWithFrom", + "id": "Stdlib.Nullable.null", "kind": "value", - "name": "startsWithFrom", + "name": "null", "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```" + "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 startsWithFrom: (string, string, int) => bool" + "signature": "let null: t<'a>" }, { - "id": "Stdlib.String.substring", + "id": "Stdlib.Nullable.undefined", "kind": "value", - "name": "substring", + "name": "undefined", "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```" + "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 substring: (string, ~start: int, ~end: int) => string" + "signature": "let undefined: t<'a>" }, { - "id": "Stdlib.String.substringToEnd", + "id": "Stdlib.Nullable.isNullable", "kind": "value", - "name": "substringToEnd", + "name": "isNullable", "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```" + "`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 substringToEnd: (string, ~start: int) => string" + "signature": "let isNullable: t<'a> => bool" }, { - "id": "Stdlib.String.toLowerCase", + "id": "Stdlib.Nullable.make", "kind": "value", - "name": "toLowerCase", + "name": "make", "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```" + "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 toLowerCase: string => string" + "signature": "let make: 'a => t<'a>" + }, + { + "id": "Stdlib.Nullable.equal", + "kind": "value", + "name": "equal", + "docstrings": [], + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + }, + { + "id": "Stdlib.Nullable.compare", + "kind": "value", + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Stdlib.String.toLocaleLowerCase", + "id": "Stdlib.Nullable.toOption", "kind": "value", - "name": "toLocaleLowerCase", + "name": "toOption", "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." + "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 toLocaleLowerCase: string => string" + "signature": "let toOption: t<'a> => option<'a>" }, { - "id": "Stdlib.String.toUpperCase", + "id": "Stdlib.Nullable.fromOption", "kind": "value", - "name": "toUpperCase", + "name": "fromOption", "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```" + "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 toUpperCase: string => string" + "signature": "let fromOption: option<'a> => t<'a>" }, { - "id": "Stdlib.String.toLocaleUpperCase", + "id": "Stdlib.Nullable.getOr", "kind": "value", - "name": "toLocaleUpperCase", + "name": "getOr", "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." + "`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 toLocaleUpperCase: string => string" + "signature": "let getOr: (t<'a>, 'a) => 'a" }, { - "id": "Stdlib.String.trim", + "id": "Stdlib.Nullable.getWithDefault", "kind": "value", - "name": "trim", - "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```" - ], - "signature": "let trim: string => string" + "name": "getWithDefault", + "docstrings": [], + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Stdlib.String.trimStart", + "id": "Stdlib.Nullable.getExn", "kind": "value", - "name": "trimStart", + "name": "getExn", "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```" + "`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 trimStart: string => string" + "signature": "let getExn: t<'a> => 'a" }, { - "id": "Stdlib.String.trimEnd", + "id": "Stdlib.Nullable.getUnsafe", "kind": "value", - "name": "trimEnd", + "name": "getUnsafe", "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```" + "`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 trimEnd: string => string" + "signature": "let getUnsafe: t<'a> => 'a" }, { - "id": "Stdlib.String.padStart", + "id": "Stdlib.Nullable.forEach", "kind": "value", - "name": "padStart", + "name": "forEach", "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```" + "`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 padStart: (string, int, string) => string" + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.String.padEnd", + "id": "Stdlib.Nullable.map", "kind": "value", - "name": "padEnd", + "name": "map", "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```" + "`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 padEnd: (string, int, string) => string" + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Stdlib.String.getSymbol", + "id": "Stdlib.Nullable.mapOr", "kind": "value", - "name": "getSymbol", - "docstrings": [], - "signature": "let getSymbol: (string, Stdlib__Symbol.t) => option<'a>" + "name": "mapOr", + "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```" + ], + "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Stdlib.String.getSymbolUnsafe", + "id": "Stdlib.Nullable.mapWithDefault", "kind": "value", - "name": "getSymbolUnsafe", + "name": "mapWithDefault", "docstrings": [], - "signature": "let getSymbolUnsafe: (string, Stdlib__Symbol.t) => 'a" + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Stdlib.String.setSymbol", + "id": "Stdlib.Nullable.flatMap", "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: (string, Stdlib__Symbol.t, 'a) => unit" + "name": "flatMap", + "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```" + ], + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" }, { - "id": "Stdlib.String.localeCompare", + "id": "Stdlib.Nullable.ignore", "kind": "value", - "name": "localeCompare", + "name": "ignore", "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```" + "`ignore(nullable)` ignores the provided nullable and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let localeCompare: (string, string) => float" + "signature": "let ignore: t<'a> => unit" } ] }, - "stdlib/regexp": { - "id": "Stdlib.RegExp", - "name": "RegExp", + "stdlib/null": { + "id": "Stdlib.Null", + "name": "Null", "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." + "Functions for handling values that could be `null`.\n\nIf you also need to cover `undefined`, check out `Nullable` instead." ], "items": [ { - "id": "Stdlib.RegExp.t", + "id": "Stdlib.Null.t", "kind": "type", "name": "t", - "docstrings": ["Type representing an instantiated `RegExp`."], - "signature": "type t = Js.Re.t" - }, - { - "id": "Stdlib.RegExp.fromString", - "kind": "value", - "name": "fromString", - "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```" - ], - "signature": "let fromString: string => t" - }, - { - "id": "Stdlib.RegExp.fromStringWithFlags", - "kind": "value", - "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": "Stdlib.RegExp.test", - "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```" + "A type representing a value that can be either `'a` or `null`." ], - "signature": "let test: (t, string) => bool" + "signature": "@unboxed\ntype t<'a> = null<'a> =\n | Value('a)\n | @as(null) Null" }, { - "id": "Stdlib.RegExp.exec", + "id": "Stdlib.Null.asNullable", "kind": "value", - "name": "exec", + "name": "asNullable", "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```" + "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 exec: (t, string) => option" + "signature": "let asNullable: t<'a> => Nullable.t<'a>" }, { - "id": "Stdlib.RegExp.lastIndex", + "id": "Stdlib.Null.null", "kind": "value", - "name": "lastIndex", + "name": "null", "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```" + "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 lastIndex: t => int" + "signature": "let null: t<'a>" }, { - "id": "Stdlib.RegExp.setLastIndex", + "id": "Stdlib.Null.make", "kind": "value", - "name": "setLastIndex", + "name": "make", "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```" + "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 setLastIndex: (t, int) => unit" + "signature": "let make: 'a => t<'a>" }, { - "id": "Stdlib.RegExp.ignoreCase", + "id": "Stdlib.Null.equal", "kind": "value", - "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" + "name": "equal", + "docstrings": [], + "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Stdlib.RegExp.global", + "id": "Stdlib.Null.compare", "kind": "value", - "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" + "name": "compare", + "docstrings": [], + "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Ordering.t,\n) => Ordering.t" }, { - "id": "Stdlib.RegExp.multiline", + "id": "Stdlib.Null.toOption", "kind": "value", - "name": "multiline", + "name": "toOption", "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```" + "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 multiline: t => bool" + "signature": "let toOption: t<'a> => option<'a>" }, { - "id": "Stdlib.RegExp.source", + "id": "Stdlib.Null.fromOption", "kind": "value", - "name": "source", + "name": "fromOption", "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```" + "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 source: t => string" + "signature": "let fromOption: option<'a> => t<'a>" }, { - "id": "Stdlib.RegExp.sticky", + "id": "Stdlib.Null.getOr", "kind": "value", - "name": "sticky", + "name": "getOr", "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```" + "`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 sticky: t => bool" + "signature": "let getOr: (t<'a>, 'a) => 'a" }, { - "id": "Stdlib.RegExp.unicode", + "id": "Stdlib.Null.getWithDefault", "kind": "value", - "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" - } - ] - }, - "stdlib/promise": { - "id": "Stdlib.Promise", - "name": "Promise", - "docstrings": [ - "Functions for interacting with JavaScript Promise.\nSee: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)." - ], - "items": [ - { - "id": "Stdlib.Promise.t", - "kind": "type", - "name": "t", + "name": "getWithDefault", "docstrings": [], - "signature": "type t<'a> = promise<'a>" - }, - { - "id": "Stdlib.Promise.resolve", - "kind": "value", - "name": "resolve", - "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```" - ], - "signature": "let resolve: 'a => t<'a>" + "signature": "let getWithDefault: (t<'a>, 'a) => 'a", + "deprecated": "Use getOr instead" }, { - "id": "Stdlib.Promise.reject", + "id": "Stdlib.Null.getExn", "kind": "value", - "name": "reject", + "name": "getExn", "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```" + "`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 reject: exn => t<'a>" + "signature": "let getExn: t<'a> => 'a" }, { - "id": "Stdlib.Promise.make", + "id": "Stdlib.Null.getUnsafe", "kind": "value", - "name": "make", + "name": "getUnsafe", "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```" + "`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 make: (('a => unit, 'e => unit) => unit) => t<'a>" - }, - { - "id": "Stdlib.Promise.promiseAndResolvers", - "kind": "type", - "name": "promiseAndResolvers", - "docstrings": [], - "signature": "type promiseAndResolvers<'a> = {\n promise: t<'a>,\n resolve: 'a => unit,\n reject: exn => unit,\n}" + "signature": "let getUnsafe: t<'a> => 'a" }, { - "id": "Stdlib.Promise.withResolvers", + "id": "Stdlib.Null.forEach", "kind": "value", - "name": "withResolvers", + "name": "forEach", "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```" + "`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 withResolvers: unit => promiseAndResolvers<'a>" + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.Promise.catch", + "id": "Stdlib.Null.map", "kind": "value", - "name": "catch", + "name": "map", "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." + "`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 catch: (t<'a>, exn => t<'a>) => t<'a>" + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" }, { - "id": "Stdlib.Promise.then", + "id": "Stdlib.Null.mapOr", "kind": "value", - "name": "then", + "name": "mapOr", "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```" + "`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 then: (t<'a>, 'a => t<'b>) => t<'b>" + "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" }, { - "id": "Stdlib.Promise.thenResolve", + "id": "Stdlib.Null.mapWithDefault", "kind": "value", - "name": "thenResolve", - "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." - ], - "signature": "let thenResolve: (t<'a>, 'a => 'b) => t<'b>" + "name": "mapWithDefault", + "docstrings": [], + "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", + "deprecated": "Use mapOr instead" }, { - "id": "Stdlib.Promise.finally", + "id": "Stdlib.Null.flatMap", "kind": "value", - "name": "finally", + "name": "flatMap", "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```" + "`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 finally: (t<'a>, unit => unit) => t<'a>" + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" }, { - "id": "Stdlib.Promise.race", + "id": "Stdlib.Null.ignore", "kind": "value", - "name": "race", + "name": "ignore", "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```" + "`ignore(null)` ignores the provided null and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let race: array> => t<'a>" - }, + "signature": "let ignore: t<'a> => unit" + } + ] + }, + "stdlib/math": { + "id": "Stdlib.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": "Stdlib.Promise.any", + "id": "Stdlib.Math.abs", "kind": "value", - "name": "any", + "name": "abs", "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```" + "`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\nassertEqual(Math.abs(-2.0), 2.0)\nassertEqual(Math.abs(3.0), 3.0)\n```" ], - "signature": "let any: array> => t<'a>" + "signature": "let abs: float => float" }, { - "id": "Stdlib.Promise.all", + "id": "Stdlib.Math.acos", "kind": "value", - "name": "all", + "name": "acos", "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```" + "`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\nassertEqual(Math.acos(-1.0), 3.141592653589793)\nassertEqual(Math.acos(-3.0)->Float.isNaN, true)\n```" ], - "signature": "let all: array> => t>" + "signature": "let acos: float => float" }, { - "id": "Stdlib.Promise.all2", + "id": "Stdlib.Math.acosh", "kind": "value", - "name": "all2", + "name": "acosh", "docstrings": [ - "`all2((p1, p2))`. Like `all()`, but with a fixed size tuple of 2" + "`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\nassertEqual(Math.acosh(1.0), 0.0)\nassertEqual(Math.acosh(0.5)->Float.isNaN, true)\n```" ], - "signature": "let all2: ((t<'a>, t<'b>)) => t<('a, 'b)>" + "signature": "let acosh: float => float" }, { - "id": "Stdlib.Promise.all3", + "id": "Stdlib.Math.asin", "kind": "value", - "name": "all3", + "name": "asin", "docstrings": [ - "`all3((p1, p2, p3))`. Like `all()`, but with a fixed size tuple of 3" + "`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\nassertEqual(Math.asin(-1.0), -1.5707963267948966)\nassertEqual(Math.asin(-2.0)->Float.isNaN, true)\n```" ], - "signature": "let all3: ((t<'a>, t<'b>, t<'c>)) => t<('a, 'b, 'c)>" + "signature": "let asin: float => float" }, { - "id": "Stdlib.Promise.all4", + "id": "Stdlib.Math.asinh", "kind": "value", - "name": "all4", + "name": "asinh", "docstrings": [ - "`all4((p1, p2, p3, p4))`. Like `all()`, but with a fixed size tuple of 4" + "`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\nassertEqual(Math.asinh(-1.0), -0.881373587019543)\nassertEqual(Math.asinh(-0.0), -0.0)\n```" ], - "signature": "let all4: ((t<'a>, t<'b>, t<'c>, t<'d>)) => t<('a, 'b, 'c, 'd)>" + "signature": "let asinh: float => float" }, { - "id": "Stdlib.Promise.all5", + "id": "Stdlib.Math.atan", "kind": "value", - "name": "all5", + "name": "atan", "docstrings": [ - "`all5((p1, p2, p3, p4, p5))`. Like `all()`, but with a fixed size tuple of 5" + "`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\nassertEqual(Math.atan(-0.0), -0.0)\nassertEqual(Math.atan(0.0), 0.0)\nassertEqual(Math.atan(1.0), 0.7853981633974483)\n```" ], - "signature": "let all5: (\n (t<'a>, t<'b>, t<'c>, t<'d>, t<'e>),\n) => t<('a, 'b, 'c, 'd, 'e)>" + "signature": "let atan: float => float" }, { - "id": "Stdlib.Promise.all6", + "id": "Stdlib.Math.atanh", "kind": "value", - "name": "all6", + "name": "atanh", "docstrings": [ - "`all6((p1, p2, p4, p5, p6))`. Like `all()`, but with a fixed size tuple of 6\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\nassertEqual(Math.atanh(-2.0)->Float.isNaN, true)\nassertEqual(Math.atanh(-1.0)->Float.isFinite, false)\nassertEqual(Math.atanh(-0.0), -0.0)\nassertEqual(Math.atanh(0.0), 0.0)\nassertEqual(Math.atanh(0.5), 0.5493061443340548)\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)>" - }, - { - "id": "Stdlib.Promise.settledResult", - "kind": "type", - "name": "settledResult", - "docstrings": [], - "signature": "type settledResult<'a> =\n | Fulfilled({value: 'a})\n | Rejected({reason: exn})" + "signature": "let atanh: float => float" }, { - "id": "Stdlib.Promise.allSettled", + "id": "Stdlib.Math.atan2", "kind": "value", - "name": "allSettled", + "name": "atan2", "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```" + "`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\nassertEqual(Math.atan2(~y=0.0, ~x=10.0), 0.0)\nassertEqual(Math.atan2(~x=5.0, ~y=5.0), Math.Constants.pi /. 4.0)\nassertEqual(Math.atan2(~x=90.0, ~y=15.0),0.16514867741462683)\nassertEqual(Math.atan2(~x=15.0, ~y=90.0), 1.4056476493802699)\n```" ], - "signature": "let allSettled: array> => t>>" + "signature": "let atan2: (~y: float, ~x: float) => float" }, { - "id": "Stdlib.Promise.allSettled2", + "id": "Stdlib.Math.cbrt", "kind": "value", - "name": "allSettled2", + "name": "cbrt", "docstrings": [ - "`allSettled2((p1, p2))`. Like `allSettled()`, but with a fixed size tuple of 2" + "`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\nassertEqual(Math.cbrt(-1.0), -1.0)\nassertEqual(Math.cbrt(-0.0), -0.0)\nassertEqual(Math.cbrt(0.0), 0.0)\n```" ], - "signature": "let allSettled2: (\n (t<'a>, t<'b>),\n) => t<(settledResult<'a>, settledResult<'b>)>" + "signature": "let cbrt: float => float" }, { - "id": "Stdlib.Promise.allSettled3", + "id": "Stdlib.Math.ceil", "kind": "value", - "name": "allSettled3", + "name": "ceil", "docstrings": [ - "`allSettled3((p1, p2, p3))`. Like `allSettled()`, but with a fixed size tuple of 3" + "`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\nassertEqual(Math.ceil(3.1), 4.0)\nassertEqual(Math.ceil(3.0), 3.0)\nassertEqual(Math.ceil(-3.1), -3.0)\nassertEqual(Math.ceil(2_150_000_000.3), 2_150_000_001.0)\n```" ], - "signature": "let allSettled3: (\n (t<'a>, t<'b>, t<'c>),\n) => t<\n (settledResult<'a>, settledResult<'b>, settledResult<'c>),\n>" + "signature": "let ceil: float => float" }, { - "id": "Stdlib.Promise.allSettled4", + "id": "Stdlib.Math.cos", "kind": "value", - "name": "allSettled4", + "name": "cos", "docstrings": [ - "`allSettled4((p1, p2, p3, p4))`. Like `allSettled()`, but with a fixed size tuple of 4" + "`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\nassertEqual(Math.cos(-0.0), 1.0)\nassertEqual(Math.cos(0.0), 1.0)\nassertEqual(Math.cos(1.0), 0.5403023058681398)\n```" ], - "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>" + "signature": "let cos: float => float" }, { - "id": "Stdlib.Promise.allSettled5", + "id": "Stdlib.Math.cosh", "kind": "value", - "name": "allSettled5", + "name": "cosh", "docstrings": [ - "`allSettled5((p1, p2, p3, p4, p5))`. Like `allSettled()`, but with a fixed size tuple of 5" + "`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\nassertEqual(Math.cosh(-1.0), 1.5430806348152437)\nassertEqual(Math.cosh(-0.0), 1.0)\nassertEqual(Math.cosh(0.0), 1.0)\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 cosh: float => float" }, { - "id": "Stdlib.Promise.allSettled6", + "id": "Stdlib.Math.exp", "kind": "value", - "name": "allSettled6", + "name": "exp", "docstrings": [ - "`allSettled6((p1, p2, p4, p5, p6))`. Like `allSettled()`, but with a fixed size tuple of 6\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\nassertEqual(Math.exp(-1.0), 0.36787944117144233)\nassertEqual(Math.exp(0.0), 1.0)\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 exp: float => float" }, { - "id": "Stdlib.Promise.done", + "id": "Stdlib.Math.expm1", "kind": "value", - "name": "done", + "name": "expm1", "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." + "`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\nassertEqual(Math.expm1(-1.0), -0.6321205588285577)\nassertEqual(Math.expm1(-0.0), -0.0)\n```" ], - "signature": "let done: promise<'a> => unit" - } - ] - }, - "stdlib/ordering": { - "id": "Stdlib.Ordering", - "name": "Ordering", - "docstrings": [], - "items": [ - { - "id": "Stdlib.Ordering.t", - "kind": "type", - "name": "t", - "docstrings": [], - "signature": "type t = float" + "signature": "let expm1: float => float" }, { - "id": "Stdlib.Ordering.less", + "id": "Stdlib.Math.floor", "kind": "value", - "name": "less", - "docstrings": [], - "signature": "let less: float" + "name": "floor", + "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\nassertEqual(Math.floor(-45.95), -46.0)\nassertEqual(Math.floor(-45.05), -46.0)\nassertEqual(Math.floor(-0.0), -0.0)\n```" + ], + "signature": "let floor: float => float" }, { - "id": "Stdlib.Ordering.equal", + "id": "Stdlib.Math.fround", "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: float" + "name": "fround", + "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\nassertEqual(Math.fround(5.5), 5.5)\nassertEqual(Math.fround(5.05), 5.050000190734863)\n```" + ], + "signature": "let fround: float => float" }, { - "id": "Stdlib.Ordering.greater", + "id": "Stdlib.Math.hypot", "kind": "value", - "name": "greater", - "docstrings": [], - "signature": "let greater: float" + "name": "hypot", + "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\nassertEqual(Math.hypot(3.0, 4.0), 5.0)\nassertEqual(Math.hypot(3.0, 5.0), 5.8309518948453)\n```" + ], + "signature": "let hypot: (float, float) => float" }, { - "id": "Stdlib.Ordering.isLess", + "id": "Stdlib.Math.hypotMany", "kind": "value", - "name": "isLess", - "docstrings": [], - "signature": "let isLess: float => bool" + "name": "hypotMany", + "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\nassertEqual(Math.hypotMany([3.0, 4.0, 5.0]), 7.0710678118654755)\nassertEqual(Math.hypotMany([]), 0.0)\n```" + ], + "signature": "let hypotMany: array => float" }, { - "id": "Stdlib.Ordering.isEqual", + "id": "Stdlib.Math.log", "kind": "value", - "name": "isEqual", - "docstrings": [], - "signature": "let isEqual: float => bool" + "name": "log", + "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\nassertEqual(Math.log(-1.0)->Float.isNaN, true)\nassertEqual(Math.log(-0.0)->Float.isFinite, false)\nassertEqual(Math.log(0.0)->Float.isFinite, false)\nassertEqual(Math.log(1.0), 0.0)\n```" + ], + "signature": "let log: float => float" }, { - "id": "Stdlib.Ordering.isGreater", + "id": "Stdlib.Math.log1p", "kind": "value", - "name": "isGreater", - "docstrings": [], - "signature": "let isGreater: float => bool" + "name": "log1p", + "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\nassertEqual(Math.log1p(-2.0)->Float.isNaN, true)\nassertEqual(Math.log1p(-1.0)->Float.isFinite, false)\nassertEqual(Math.log1p(-0.0), -0.0)\n```" + ], + "signature": "let log1p: float => float" }, { - "id": "Stdlib.Ordering.invert", + "id": "Stdlib.Math.log10", "kind": "value", - "name": "invert", - "docstrings": [], - "signature": "let invert: float => float" + "name": "log10", + "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\nassertEqual(Math.log10(-2.0)->Float.isNaN, true)\nassertEqual(Math.log10(-0.0)->Float.isFinite, false)\nassertEqual(Math.log10(0.0)->Float.isFinite, false)\nassertEqual(Math.log10(1.0), 0.0)\n```" + ], + "signature": "let log10: float => float" }, { - "id": "Stdlib.Ordering.fromInt", - "kind": "value", - "name": "fromInt", - "docstrings": [], - "signature": "let fromInt: int => float" - } - ] - }, - "stdlib/object": { - "id": "Stdlib.Object", - "name": "Object", - "docstrings": [], - "items": [ - { - "id": "Stdlib.Object.make", + "id": "Stdlib.Math.log2", "kind": "value", - "name": "make", + "name": "log2", "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```" + "`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\nassertEqual(Math.log2(-2.0)->Float.isNaN, true)\nassertEqual(Math.log2(-0.0)->Float.isFinite, false)\nassertEqual(Math.log2(0.0)->Float.isFinite, false)\nassertEqual(Math.log2(1.0), 0.0)\n```" ], - "signature": "let make: unit => {..}" + "signature": "let log2: float => float" }, { - "id": "Stdlib.Object.is", + "id": "Stdlib.Math.min", "kind": "value", - "name": "is", + "name": "min", "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```" + "`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\nassertEqual(Math.min(1.0, 2.0), 1.0)\nassertEqual(Math.min(-1.0, -2.0), -2.0)\n```" ], - "signature": "let is: ('a, 'a) => bool" + "signature": "let min: (float, float) => float" }, { - "id": "Stdlib.Object.create", + "id": "Stdlib.Math.minMany", "kind": "value", - "name": "create", + "name": "minMany", "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```" + "`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\nassertEqual(Math.minMany([1.0, 2.0]), 1.0)\nassertEqual(Math.minMany([-1.0, -2.0]), -2.0)\nassertEqual(Math.minMany([])->Float.isFinite, false)\n```" ], - "signature": "let create: {..} => {..}" + "signature": "let minMany: array => float" }, { - "id": "Stdlib.Object.createWithProperties", + "id": "Stdlib.Math.max", "kind": "value", - "name": "createWithProperties", - "docstrings": [], - "signature": "let createWithProperties: ({..}, {..}) => {..}" + "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\nassertEqual(Math.max(1.0, 2.0), 2.0)\nassertEqual(Math.max(-1.0, -2.0), -1.0)\n```" + ], + "signature": "let max: (float, float) => float" }, { - "id": "Stdlib.Object.createWithNull", + "id": "Stdlib.Math.maxMany", "kind": "value", - "name": "createWithNull", - "docstrings": [], - "signature": "let createWithNull: unit => {..}" + "name": "maxMany", + "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\nassertEqual(Math.maxMany([1.0, 2.0]), 2.0)\nassertEqual(Math.maxMany([-1.0, -2.0]), -1.0)\nassertEqual(Math.maxMany([])->Float.isFinite, false)\n```" + ], + "signature": "let maxMany: array => float" }, { - "id": "Stdlib.Object.createWithNullAndProperties", + "id": "Stdlib.Math.pow", "kind": "value", - "name": "createWithNullAndProperties", - "docstrings": [], - "signature": "let createWithNullAndProperties: {..} => {..}" + "name": "pow", + "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\nassertEqual(Math.pow(2.0, ~exp=4.0), 16.0)\nassertEqual(Math.pow(3.0, ~exp=4.0), 81.0)\n```" + ], + "signature": "let pow: (float, ~exp: float) => float" }, { - "id": "Stdlib.Object.assign", + "id": "Stdlib.Math.random", "kind": "value", - "name": "assign", + "name": "random", "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```" + "`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 assign: ({..}, {..}) => {..}" + "signature": "let random: unit => float" }, { - "id": "Stdlib.Object.assignMany", + "id": "Stdlib.Math.round", "kind": "value", - "name": "assignMany", + "name": "round", "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)." + "`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\nassertEqual(Math.round(-20.5), -20.0)\nassertEqual(Math.round(-0.1), -0.0)\nassertEqual(Math.round(0.0), 0.0)\nassertEqual(Math.round(-0.0), -0.0)\n```" ], - "signature": "let assignMany: ({..}, array<{..}>) => {..}" + "signature": "let round: float => float" }, { - "id": "Stdlib.Object.copy", + "id": "Stdlib.Math.sign", "kind": "value", - "name": "copy", - "docstrings": [], - "signature": "let copy: ({..} as 'a) => 'a" + "name": "sign", + "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\nassertEqual(Math.sign(3.0), 1.0)\nassertEqual(Math.sign(-3.0), -1.0)\nassertEqual(Math.sign(0.0), 0.0)\n```" + ], + "signature": "let sign: float => float" }, { - "id": "Stdlib.Object.get", + "id": "Stdlib.Math.sin", "kind": "value", - "name": "get", + "name": "sin", "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```" + "`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\nassertEqual(Math.sin(-0.0), -0.0)\nassertEqual(Math.sin(0.0), 0.0)\nassertEqual(Math.sin(1.0), 0.8414709848078965)\n```" ], - "signature": "let get: ({..}, string) => option<'a>" + "signature": "let sin: float => float" }, { - "id": "Stdlib.Object.getSymbol", + "id": "Stdlib.Math.sinh", "kind": "value", - "name": "getSymbol", + "name": "sinh", "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```" + "`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\nassertEqual(Math.sinh(-0.0), -0.0)\nassertEqual(Math.sinh(0.0), 0.0)\nassertEqual(Math.sinh(1.0), 1.1752011936438014)\n```" ], - "signature": "let getSymbol: ({..}, Stdlib__Symbol.t) => option<'a>" + "signature": "let sinh: float => float" }, { - "id": "Stdlib.Object.getSymbolUnsafe", + "id": "Stdlib.Math.sqrt", "kind": "value", - "name": "getSymbolUnsafe", - "docstrings": [], - "signature": "let getSymbolUnsafe: ({..}, Stdlib__Symbol.t) => 'a" + "name": "sqrt", + "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\nassertEqual(Math.sqrt(-1.0)->Float.isNaN, true)\nassertEqual(Math.sqrt(-0.0), -0.0)\nassertEqual(Math.sqrt(0.0), 0.0)\nassertEqual(Math.sqrt(1.0), 1.0)\nassertEqual(Math.sqrt(9.0), 3.0)\n```" + ], + "signature": "let sqrt: float => float" }, { - "id": "Stdlib.Object.set", + "id": "Stdlib.Math.tan", "kind": "value", - "name": "set", + "name": "tan", "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```" + "`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\nassertEqual(Math.tan(-0.0), -0.0)\nassertEqual(Math.tan(0.0), 0.0)\nassertEqual(Math.tan(1.0), 1.5574077246549023)\n```" ], - "signature": "let set: ({..}, string, 'a) => unit" + "signature": "let tan: float => float" }, { - "id": "Stdlib.Object.setSymbol", + "id": "Stdlib.Math.tanh", "kind": "value", - "name": "setSymbol", - "docstrings": [], - "signature": "let setSymbol: ({..}, Stdlib__Symbol.t, 'a) => unit" + "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\nassertEqual(Math.tanh(-0.0), -0.0)\nassertEqual(Math.tanh(0.0), 0.0)\nassertEqual(Math.tanh(1.0), 0.7615941559557649)\n```" + ], + "signature": "let tanh: float => float" }, { - "id": "Stdlib.Object.keysToArray", + "id": "Stdlib.Math.trunc", "kind": "value", - "name": "keysToArray", + "name": "trunc", "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```" + "`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\nassertEqual(Math.trunc(0.123), 0.0)\nassertEqual(Math.trunc(1.999), 1.0)\nassertEqual(Math.trunc(13.37), 13.0)\nassertEqual(Math.trunc(42.84), 42.0)\n```" ], - "signature": "let keysToArray: {..} => array" - }, + "signature": "let trunc: float => float" + } + ] + }, + "stdlib/list": { + "id": "Stdlib.List", + "name": "List", + "docstrings": [], + "items": [ { - "id": "Stdlib.Object.hasOwnProperty", - "kind": "value", - "name": "hasOwnProperty", + "id": "Stdlib.List.t", + "kind": "type", + "name": "t", "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```" + "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": "let hasOwnProperty: ({..}, string) => bool" + "signature": "type t<'a> = list<'a>" }, { - "id": "Stdlib.Object.seal", + "id": "Stdlib.List.length", "kind": "value", - "name": "seal", + "name": "length", "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```" + "`length(list)` returns the length of `list`.\n\n## Examples\n\n```rescript\nassertEqual(List.length(list{1, 2, 3}), 3)\n```" ], - "signature": "let seal: ({..} as 'a) => 'a" + "signature": "let length: list<'a> => int" }, { - "id": "Stdlib.Object.preventExtensions", + "id": "Stdlib.List.size", "kind": "value", - "name": "preventExtensions", + "name": "size", "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```" + "`size(list)`. See [`length`](#length)\n\n## Examples\n\n```rescript\nassertEqual(List.size(list{1, 2, 3}), 3)\n```" ], - "signature": "let preventExtensions: ({..} as 'a) => 'a" + "signature": "let size: list<'a> => int" }, { - "id": "Stdlib.Object.freeze", + "id": "Stdlib.List.head", "kind": "value", - "name": "freeze", + "name": "head", "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```" + "`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\nassertEqual(List.head(list{}), None)\nassertEqual(List.head(list{1, 2, 3}), Some(1))\n```" ], - "signature": "let freeze: ({..} as 'a) => 'a" + "signature": "let head: list<'a> => option<'a>" }, { - "id": "Stdlib.Object.isSealed", + "id": "Stdlib.List.headExn", "kind": "value", - "name": "isSealed", + "name": "headExn", "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 ```" + "`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 isSealed: 'a => bool" + "signature": "let headExn: list<'a> => 'a" }, { - "id": "Stdlib.Object.isFrozen", + "id": "Stdlib.List.tail", "kind": "value", - "name": "isFrozen", + "name": "tail", "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 ```" + "`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\nassertEqual(List.tail(list{1, 2, 3}), Some(list{2, 3}))\n\nassertEqual(List.tail(list{}), None)\n```" ], - "signature": "let isFrozen: 'a => bool" + "signature": "let tail: list<'a> => option>" }, { - "id": "Stdlib.Object.isExtensible", + "id": "Stdlib.List.tailExn", "kind": "value", - "name": "isExtensible", + "name": "tailExn", "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```" + "`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 isExtensible: 'a => bool" - } - ] - }, - "stdlib/nullable": { - "id": "Stdlib.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 tailExn: list<'a> => list<'a>" + }, { - "id": "Stdlib.Nullable.t", - "kind": "type", - "name": "t", + "id": "Stdlib.List.add", + "kind": "value", + "name": "add", "docstrings": [ - "Type representing a nullable value.\nA nullable value can be the value `'a`, `null` or `undefined`." + "`add(list, value)` adds a `value` to the beginning of list `list`.\n\n## Examples\n\n```rescript\nassertEqual(List.add(list{2, 3}, 1), list{1, 2, 3})\n\nassertEqual(List.add(list{\"World\", \"!\"}, \"Hello\"), list{\"Hello\", \"World\", \"!\"})\n```" ], - "signature": "type t<'a> = Js.Nullable.t<'a> =\n | Value('a)\n | Null\n | Undefined" + "signature": "let add: (list<'a>, 'a) => list<'a>" }, { - "id": "Stdlib.Nullable.null", + "id": "Stdlib.List.get", "kind": "value", - "name": "null", + "name": "get", "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```" + "`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\nassertEqual(abc->List.get(1), Some(\"B\"))\n\nassertEqual(abc->List.get(4), None)\n```" ], - "signature": "let null: t<'a>" + "signature": "let get: (list<'a>, int) => option<'a>" }, { - "id": "Stdlib.Nullable.undefined", + "id": "Stdlib.List.getExn", "kind": "value", - "name": "undefined", + "name": "getExn", "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```" + "`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 undefined: t<'a>" + "signature": "let getExn: (list<'a>, int) => 'a" }, { - "id": "Stdlib.Nullable.isNullable", + "id": "Stdlib.List.make", "kind": "value", - "name": "isNullable", + "name": "make", "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```" + "`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\nassertEqual(List.make(~length=3, 1), list{1, 1, 1})\n```" ], - "signature": "let isNullable: t<'a> => bool" + "signature": "let make: (~length: int, 'a) => list<'a>" }, { - "id": "Stdlib.Nullable.make", + "id": "Stdlib.List.fromInitializer", "kind": "value", - "name": "make", + "name": "fromInitializer", "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```" + "`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\nassertEqual(List.fromInitializer(~length=5, i => i), list{0, 1, 2, 3, 4})\n\nassertEqual(List.fromInitializer(~length=5, i => i * i), list{0, 1, 4, 9, 16})\n```" ], - "signature": "let make: 'a => t<'a>" + "signature": "let fromInitializer: (~length: int, int => 'a) => list<'a>" }, { - "id": "Stdlib.Nullable.equal", + "id": "Stdlib.List.shuffle", "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "name": "shuffle", + "docstrings": [ + "`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 shuffle: list<'a> => list<'a>" }, { - "id": "Stdlib.Nullable.compare", + "id": "Stdlib.List.toShuffled", "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + "name": "toShuffled", + "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```" + ], + "signature": "let toShuffled: list<'a> => list<'a>", + "deprecated": "Use `shuffle` instead" }, { - "id": "Stdlib.Nullable.toOption", + "id": "Stdlib.List.drop", "kind": "value", - "name": "toOption", + "name": "drop", "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```" + "`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\nassertEqual(list{1, 2, 3}->List.drop(2), Some(list{3}))\n\nassertEqual(list{1, 2, 3}->List.drop(3), Some(list{}))\n\nassertEqual(list{1, 2, 3}->List.drop(4), None)\n```" ], - "signature": "let toOption: t<'a> => option<'a>" + "signature": "let drop: (list<'a>, int) => option>" }, { - "id": "Stdlib.Nullable.fromOption", + "id": "Stdlib.List.take", "kind": "value", - "name": "fromOption", + "name": "take", "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```" + "`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\nassertEqual(list{1, 2, 3}->List.take(1), Some(list{1}))\n\nassertEqual(list{1, 2, 3}->List.take(2), Some(list{1, 2}))\n\nassertEqual(list{1, 2, 3}->List.take(4), None)\n```" ], - "signature": "let fromOption: option<'a> => t<'a>" + "signature": "let take: (list<'a>, int) => option>" }, { - "id": "Stdlib.Nullable.getOr", + "id": "Stdlib.List.splitAt", "kind": "value", - "name": "getOr", + "name": "splitAt", "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```" + "`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\nassertEqual(list{\"Hello\", \"World\"}->List.splitAt(1), Some((list{\"Hello\"}, list{\"World\"})))\n\nassertEqual(list{0, 1, 2, 3, 4}->List.splitAt(2), Some((list{0, 1}, list{2, 3, 4})))\n```" ], - "signature": "let getOr: (t<'a>, 'a) => 'a" + "signature": "let splitAt: (list<'a>, int) => option<(list<'a>, list<'a>)>" }, { - "id": "Stdlib.Nullable.getWithDefault", + "id": "Stdlib.List.concat", "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (t<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" + "name": "concat", + "docstrings": [ + "`concat(list1, list2)` returns the list obtained by adding `list2` after `list1`.\n\n## Examples\n\n```rescript\nList.concat(list{1, 2, 3}, list{4, 5})->assertEqual(list{1, 2, 3, 4, 5})\n```" + ], + "signature": "let concat: (list<'a>, list<'a>) => list<'a>" }, { - "id": "Stdlib.Nullable.getExn", + "id": "Stdlib.List.concatMany", "kind": "value", - "name": "getExn", + "name": "concatMany", "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`" + "`concatMany(arr)` returns the list obtained by concatenating all the lists in\narray `arr`, in order.\n\n## Examples\n\n```rescript\nassertEqual(List.concatMany([list{1, 2, 3}, list{}, list{3}]), list{1, 2, 3, 3})\n```" ], - "signature": "let getExn: t<'a> => 'a" + "signature": "let concatMany: array> => list<'a>" }, { - "id": "Stdlib.Nullable.getUnsafe", + "id": "Stdlib.List.reverseConcat", "kind": "value", - "name": "getUnsafe", + "name": "reverseConcat", "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`." + "`reverseConcat(list1, list2)` is equivalent to writing: `concat(reverse(list1, list2)`\n\n## Examples\n\n```rescript\nassertEqual(List.reverseConcat(list{1, 2}, list{3, 4}), list{2, 1, 3, 4})\n```" ], - "signature": "let getUnsafe: t<'a> => 'a" + "signature": "let reverseConcat: (list<'a>, list<'a>) => list<'a>" }, { - "id": "Stdlib.Nullable.forEach", + "id": "Stdlib.List.flat", "kind": "value", - "name": "forEach", + "name": "flat", "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```" + "`flat(list)` return the list obtained by concatenating all the lists in\n`list`, in order.\n\n## Examples\n\n```rescript\nassertEqual(List.flat(list{list{1, 2, 3}, list{}, list{3}}), list{1, 2, 3, 3})\n```" ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let flat: list> => list<'a>" }, { - "id": "Stdlib.Nullable.map", + "id": "Stdlib.List.map", "kind": "value", "name": "map", "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```" + "`map(list, f)` returns a new list with `f` applied to each element of `list`.\n\n## Examples\n\n```rescript\nassertEqual(list{1, 2}->List.map(x => x + 1), list{2, 3})\n```" ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let map: (list<'a>, 'a => 'b) => list<'b>" }, { - "id": "Stdlib.Nullable.mapOr", + "id": "Stdlib.List.zip", "kind": "value", - "name": "mapOr", + "name": "zip", "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```" + "`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\nassertEqual(List.zip(list{1, 2}, list{3, 4, 5}), list{(1, 3), (2, 4)})\n```" ], - "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" + "signature": "let zip: (list<'a>, list<'b>) => list<('a, 'b)>" }, { - "id": "Stdlib.Nullable.mapWithDefault", + "id": "Stdlib.List.zipBy", "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "name": "zipBy", + "docstrings": [ + "`zipBy(list1, list2, f)`. See [`zip`](#zip)\n\n## Examples\n\n```rescript\nassertEqual(List.zipBy(list{1, 2, 3}, list{4, 5}, (a, b) => 2 * a + b), list{6, 9})\n```" + ], + "signature": "let zipBy: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" }, { - "id": "Stdlib.Nullable.flatMap", + "id": "Stdlib.List.mapWithIndex", "kind": "value", - "name": "flatMap", + "name": "mapWithIndex", "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```" + "`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\nassertEqual(list{1, 2, 3}->List.mapWithIndex((x, index) => index + x), list{1, 3, 5})\n```" ], - "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" - } - ] - }, - "stdlib/null": { - "id": "Stdlib.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": [ + "signature": "let mapWithIndex: (list<'a>, ('a, int) => 'b) => list<'b>" + }, { - "id": "Stdlib.Null.t", - "kind": "type", - "name": "t", + "id": "Stdlib.List.fromArray", + "kind": "value", + "name": "fromArray", "docstrings": [ - "A type representing a value that can be either `'a` or `null`." + "`fromArray(arr)` converts the given array `arr` to a list.\n\n## Examples\n\n```rescript\nassertEqual(List.fromArray([1, 2, 3]), list{1, 2, 3})\n```" ], - "signature": "type t<'a> = Js.Null.t<'a> = Value('a) | Null" + "signature": "let fromArray: array<'a> => list<'a>" }, { - "id": "Stdlib.Null.asNullable", + "id": "Stdlib.List.toArray", "kind": "value", - "name": "asNullable", + "name": "toArray", "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```" + "`toArray(list)` converts the given list `list` to an array.\n\n## Examples\n\n```rescript\nassertEqual(List.toArray(list{1, 2, 3}), [1, 2, 3])\n```" ], - "signature": "let asNullable: t<'a> => Stdlib__Nullable.t<'a>" + "signature": "let toArray: list<'a> => array<'a>" }, { - "id": "Stdlib.Null.null", + "id": "Stdlib.List.reverse", "kind": "value", - "name": "null", + "name": "reverse", "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```" + "`reverse(list)` returns a new list whose elements are those of `list` in\nreversed order.\n\n## Examples\n\n```rescript\nassertEqual(List.reverse(list{1, 2, 3}), list{3, 2, 1})\n```" ], - "signature": "let null: t<'a>" + "signature": "let reverse: list<'a> => list<'a>" }, { - "id": "Stdlib.Null.make", + "id": "Stdlib.List.mapReverse", "kind": "value", - "name": "make", + "name": "mapReverse", "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```" + "`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 make: 'a => t<'a>" + "signature": "let mapReverse: (list<'a>, 'a => 'b) => list<'b>" }, { - "id": "Stdlib.Null.equal", + "id": "Stdlib.List.forEach", "kind": "value", - "name": "equal", - "docstrings": [], - "signature": "let equal: (t<'a>, t<'b>, ('a, 'b) => bool) => bool" + "name": "forEach", + "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```" + ], + "signature": "let forEach: (list<'a>, 'a => unit) => unit" }, { - "id": "Stdlib.Null.compare", + "id": "Stdlib.List.forEachWithIndex", "kind": "value", - "name": "compare", - "docstrings": [], - "signature": "let compare: (\n t<'a>,\n t<'b>,\n ('a, 'b) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + "name": "forEachWithIndex", + "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```" + ], + "signature": "let forEachWithIndex: (list<'a>, ('a, int) => unit) => unit" }, { - "id": "Stdlib.Null.toOption", + "id": "Stdlib.List.reduce", "kind": "value", - "name": "toOption", + "name": "reduce", "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```" + "`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\nassertEqual(list{1, 2, 3, 4}->List.reduce(0, (a, b) => a + b), 10)\n\n// same as\n\nassertEqual(list{1, 2, 3, 4}->List.reduce(0, (acc, item) => acc + item), 10)\n```" ], - "signature": "let toOption: t<'a> => option<'a>" + "signature": "let reduce: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" }, { - "id": "Stdlib.Null.fromOption", + "id": "Stdlib.List.reduceWithIndex", "kind": "value", - "name": "fromOption", + "name": "reduceWithIndex", "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```" + "`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\nassertEqual(list{1, 2, 3, 4}->List.reduceWithIndex(0, (acc, item, index) => acc + item + index), 16)\n```" ], - "signature": "let fromOption: option<'a> => t<'a>" + "signature": "let reduceWithIndex: (list<'a>, 'b, ('b, 'a, int) => 'b) => 'b" }, { - "id": "Stdlib.Null.getOr", + "id": "Stdlib.List.reduceReverse", "kind": "value", - "name": "getOr", + "name": "reduceReverse", "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```" + "`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\nassertEqual(list{1, 2, 3, 4}->List.reduceReverse(0, (a, b) => a + b), 10)\n\nassertEqual(list{1, 2, 3, 4}->List.reduceReverse(10, (a, b) => a - b), 0)\n\nassertEqual(list{1, 2, 3, 4}->List.reduceReverse(list{}, List.add), list{1, 2, 3, 4})\n```" ], - "signature": "let getOr: (t<'a>, 'a) => 'a" + "signature": "let reduceReverse: (list<'a>, 'b, ('b, 'a) => 'b) => 'b" }, { - "id": "Stdlib.Null.getWithDefault", + "id": "Stdlib.List.mapReverse2", "kind": "value", - "name": "getWithDefault", - "docstrings": [], - "signature": "let getWithDefault: (t<'a>, 'a) => 'a", - "deprecated": "Use getOr instead" + "name": "mapReverse2", + "docstrings": [ + "`mapReverse2(list1, list2, f)` is equivalent to `List.zipBy(list1, list2, f)->List.reverse`.\n\n## Examples\n\n```rescript\nassertEqual(List.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b), list{4, 2})\n```" + ], + "signature": "let mapReverse2: (list<'a>, list<'b>, ('a, 'b) => 'c) => list<'c>" }, { - "id": "Stdlib.Null.getExn", + "id": "Stdlib.List.forEach2", "kind": "value", - "name": "getExn", + "name": "forEach2", "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`," + "`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 getExn: t<'a> => 'a" + "signature": "let forEach2: (list<'a>, list<'b>, ('a, 'b) => 'c) => unit" }, { - "id": "Stdlib.Null.getUnsafe", + "id": "Stdlib.List.reduce2", "kind": "value", - "name": "getUnsafe", + "name": "reduce2", "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`." + "`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\nassertEqual(\n List.reduce2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y),\n 0 + (1 * 1 + 4) + (2 * 2 + 5)\n)\n```" ], - "signature": "let getUnsafe: t<'a> => 'a" + "signature": "let reduce2: (list<'b>, list<'c>, 'a, ('a, 'b, 'c) => 'a) => 'a" }, { - "id": "Stdlib.Null.forEach", + "id": "Stdlib.List.reduceReverse2", "kind": "value", - "name": "forEach", + "name": "reduceReverse2", "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```" + "`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\nassertEqual(\n List.reduceReverse2(list{1, 2, 3}, list{4, 5}, 0, (acc, x, y) => acc + x * x + y),\n 0 + (1 * 1 + 4) + (2 * 2 + 5)\n)\n```" ], - "signature": "let forEach: (t<'a>, 'a => unit) => unit" + "signature": "let reduceReverse2: (list<'a>, list<'b>, 'c, ('c, 'a, 'b) => 'c) => 'c" }, { - "id": "Stdlib.Null.map", + "id": "Stdlib.List.every", "kind": "value", - "name": "map", + "name": "every", "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```" + "`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\nassertEqual(list{1, 9, 8, 2}->List.every(isBelow10), true)\n\nassertEqual(list{1, 99, 8, 2}->List.every(isBelow10), false)\n```" ], - "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let every: (list<'a>, 'a => bool) => bool" }, { - "id": "Stdlib.Null.mapOr", + "id": "Stdlib.List.some", "kind": "value", - "name": "mapOr", + "name": "some", "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```" + "`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\nassertEqual(list{101, 1, 2, 3}->List.some(isAbove100), true)\n\nassertEqual(list{1, 2, 3, 4}->List.some(isAbove100), false)\n```" ], - "signature": "let mapOr: (t<'a>, 'b, 'a => 'b) => 'b" + "signature": "let some: (list<'a>, 'a => bool) => bool" }, { - "id": "Stdlib.Null.mapWithDefault", + "id": "Stdlib.List.every2", "kind": "value", - "name": "mapWithDefault", - "docstrings": [], - "signature": "let mapWithDefault: (t<'a>, 'b, 'a => 'b) => 'b", - "deprecated": "Use mapOr instead" + "name": "every2", + "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\nassertEqual(List.every2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b), true)\n\nassertEqual(List.every2(list{}, list{1}, (a, b) => a > b), true)\n\nassertEqual(List.every2(list{2, 3}, list{1}, (a, b) => a > b), true)\n\nassertEqual(List.every2(list{0, 1}, list{5, 0}, (a, b) => a > b), false)\n```" + ], + "signature": "let every2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" }, { - "id": "Stdlib.Null.flatMap", + "id": "Stdlib.List.some2", "kind": "value", - "name": "flatMap", + "name": "some2", "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```" + "`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\nassertEqual(List.some2(list{1, 2, 3}, list{0, 1}, (a, b) => a > b), true)\n\nassertEqual(List.some2(list{}, list{1}, (a, b) => a > b), false)\n\nassertEqual(List.some2(list{2, 3}, list{1}, (a, b) => a > b), true)\n\nassertEqual(List.some2(list{0, 1}, list{5, 0}, (a, b) => a > b), true)\n```" ], - "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" - } - ] - }, - "stdlib/math": { - "id": "Stdlib.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": [ + "signature": "let some2: (list<'a>, list<'b>, ('a, 'b) => bool) => bool" + }, { - "id": "Stdlib.Math.abs", + "id": "Stdlib.List.compareLength", "kind": "value", - "name": "abs", + "name": "compareLength", "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```" + "`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\nassertEqual(List.compareLength(list{1, 2}, list{3, 4, 5, 6}), -1.)\n\nassertEqual(List.compareLength(list{1, 2, 3}, list{4, 5, 6}), 0.)\n\nassertEqual(List.compareLength(list{1, 2, 3, 4}, list{5, 6}), 1.)\n```" ], - "signature": "let abs: float => float" + "signature": "let compareLength: (list<'a>, list<'a>) => Ordering.t" }, { - "id": "Stdlib.Math.acos", + "id": "Stdlib.List.compare", "kind": "value", - "name": "acos", + "name": "compare", "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```" + "`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\nassertEqual(List.compare(list{3}, list{3, 7}, (a, b) => Int.compare(a, b)), -1.)\nassertEqual(List.compare(list{5, 3}, list{5}, (a, b) => Int.compare(a, b)), 1.)\nassertEqual(List.compare(list{1, 3, 5}, list{1, 4, 2}, (a, b) => Int.compare(a, b)), -1.)\nassertEqual(List.compare(list{1, 3, 5}, list{1, 2, 3}, (a, b) => Int.compare(a, b)), 1.)\nassertEqual(List.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 acos: float => float" + "signature": "let compare: (\n list<'a>,\n list<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" }, { - "id": "Stdlib.Math.acosh", + "id": "Stdlib.List.equal", "kind": "value", - "name": "acosh", + "name": "equal", "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```" + "`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\nassertEqual(List.equal(list{1, 2, 3}, list{1, 2}, (a, b) => a == b), false)\n\nassertEqual(List.equal(list{1, 2}, list{1, 2}, (a, b) => a == b), true)\n\nassertEqual(List.equal(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)), true)\n```" ], - "signature": "let acosh: float => float" + "signature": "let equal: (list<'a>, list<'a>, ('a, 'a) => bool) => bool" }, { - "id": "Stdlib.Math.asin", + "id": "Stdlib.List.has", "kind": "value", - "name": "asin", + "name": "has", "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```" + "`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\nassertEqual(list{1, 2, 3}->List.has(2, (a, b) => a == b), true)\n\nassertEqual(list{1, 2, 3}->List.has(4, (a, b) => a == b), false)\n\nassertEqual(list{(-1), (-2), (-3)}->List.has(2, (a, b) => abs(a) == abs(b)), true)\n```" ], - "signature": "let asin: float => float" + "signature": "let has: (list<'a>, 'b, ('a, 'b) => bool) => bool" }, { - "id": "Stdlib.Math.asinh", + "id": "Stdlib.List.find", "kind": "value", - "name": "asinh", + "name": "find", "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```" + "`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\nassertEqual(List.find(list{1, 4, 3, 2}, x => x > 3), Some(4))\n\nassertEqual(List.find(list{1, 4, 3, 2}, x => x > 4), None)\n```" ], - "signature": "let asinh: float => float" + "signature": "let find: (list<'a>, 'a => bool) => option<'a>" }, { - "id": "Stdlib.Math.atan", + "id": "Stdlib.List.filter", "kind": "value", - "name": "atan", + "name": "filter", "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```" + "`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\nassertEqual(List.filter(list{1, 2, 3, 4}, isEven), list{2, 4})\n\nassertEqual(List.filter(list{None, Some(2), Some(3), None}, Option.isSome), list{Some(2), Some(3)})\n```" ], - "signature": "let atan: float => float" + "signature": "let filter: (list<'a>, 'a => bool) => list<'a>" }, { - "id": "Stdlib.Math.atanh", + "id": "Stdlib.List.filterWithIndex", "kind": "value", - "name": "atanh", + "name": "filterWithIndex", "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```" + "`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\nassertEqual(List.filterWithIndex(list{1, 2, 3, 4}, (_x, index) => isEven(index)), list{1, 3})\n```" ], - "signature": "let atanh: float => float" + "signature": "let filterWithIndex: (list<'a>, ('a, int) => bool) => list<'a>" }, { - "id": "Stdlib.Math.atan2", + "id": "Stdlib.List.filterMap", "kind": "value", - "name": "atan2", + "name": "filterMap", "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```" + "`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\nassertEqual(list{Some(1), Some(2), None}->List.filterMap(x => x), list{1, 2})\n```" ], - "signature": "let atan2: (~y: float, ~x: float) => float" + "signature": "let filterMap: (list<'a>, 'a => option<'b>) => list<'b>" }, { - "id": "Stdlib.Math.cbrt", + "id": "Stdlib.List.partition", "kind": "value", - "name": "cbrt", + "name": "partition", "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```" + "`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\nassertEqual(List.partition(list{1, 2, 3, 4}, x => x > 2), (list{3, 4}, list{1, 2}))\n```" ], - "signature": "let cbrt: float => float" + "signature": "let partition: (list<'a>, 'a => bool) => (list<'a>, list<'a>)" }, { - "id": "Stdlib.Math.ceil", + "id": "Stdlib.List.unzip", "kind": "value", - "name": "ceil", + "name": "unzip", "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```" + "`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\nassertEqual(\n List.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)\n```" ], - "signature": "let ceil: float => float" + "signature": "let unzip: list<('a, 'b)> => (list<'a>, list<'b>)" }, { - "id": "Stdlib.Math.cos", + "id": "Stdlib.List.getAssoc", "kind": "value", - "name": "cos", + "name": "getAssoc", "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```" + "`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\nassertEqual(\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n ->List.getAssoc(15, (k, item) => k /* 15 */ == item /* 9, 5, 22 */),\n Some(\"afternoon\")\n)\n```" ], - "signature": "let cos: float => float" + "signature": "let getAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => option<'c>", + "deprecated": "Use a `Map` instead" }, { - "id": "Stdlib.Math.cosh", + "id": "Stdlib.List.hasAssoc", "kind": "value", - "name": "cosh", + "name": "hasAssoc", "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```" + "`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\nassertEqual(\n list{(9, \"morning\"), (15, \"afternoon\"), (22, \"night\")}\n ->List.hasAssoc(25, (k, item) => k /* 25 */ == item /* 9, 5, 22 */),\n false\n)\n```" ], - "signature": "let cosh: float => float" + "signature": "let hasAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => bool", + "deprecated": "Use a `Map` instead" }, { - "id": "Stdlib.Math.exp", + "id": "Stdlib.List.removeAssoc", "kind": "value", - "name": "exp", + "name": "removeAssoc", "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```" + "`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\nassertEqual(\n list{(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)\n```" ], - "signature": "let exp: float => float" + "signature": "let removeAssoc: (list<('a, 'c)>, 'b, ('a, 'b) => bool) => list<('a, 'c)>", + "deprecated": "Use a `Map` instead" }, { - "id": "Stdlib.Math.expm1", + "id": "Stdlib.List.setAssoc", "kind": "value", - "name": "expm1", + "name": "setAssoc", "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```" + "`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\nassertEqual(\n list{(1, \"a\"), (2, \"b\"), (3, \"c\")}->List.setAssoc(2, \"x\", (a, b) => a == b),\n list{(1, \"a\"), (2, \"x\"), (3, \"c\")}\n)\n\nassertEqual(\n list{(1, \"a\"), (3, \"c\")}->List.setAssoc(2, \"b\", (a, b) => a == b),\n list{(2, \"b\"), (1, \"a\"), (3, \"c\")}\n)\n\nassertEqual(\n list{(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\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 expm1: float => float" + "signature": "let setAssoc: (list<('a, 'c)>, 'a, 'c, ('a, 'a) => bool) => list<('a, 'c)>", + "deprecated": "Use a `Map` instead" }, { - "id": "Stdlib.Math.floor", + "id": "Stdlib.List.sort", "kind": "value", - "name": "floor", + "name": "sort", "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```" + "`sort(list, f)` returns a sorted list.\n\n## Examples\n\n```rescript\nassertEqual(\n List.sort(list{5, 4, 9, 3, 7}, Int.compare),\n list{3, 4, 5, 7, 9}\n)\n```" ], - "signature": "let floor: float => float" + "signature": "let sort: (list<'a>, ('a, 'a) => Ordering.t) => list<'a>" }, { - "id": "Stdlib.Math.fround", + "id": "Stdlib.List.ignore", "kind": "value", - "name": "fround", + "name": "ignore", "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```" + "`ignore(list)` ignores the provided list and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let fround: float => float" + "signature": "let ignore: list<'a> => unit" + } + ] + }, + "stdlib/lazy": { + "id": "Stdlib.Lazy", + "name": "Lazy", + "docstrings": [ + "This module provides a type `Lazy.t` and functions to create and\n manipulate lazy values. A lazy value is a value that is not\n computed until it is needed. This is useful for deferring\n computations that may be expensive or unnecessary." + ], + "items": [ + { + "id": "Stdlib.Lazy.t", + "kind": "type", + "name": "t", + "docstrings": [ + "The type of a lazy value. `Lazy.t<'a>` represents a lazy value\n that will eventually yield a value of type `'a` when accessed.\n The value is computed only once, and the result is cached for\n subsequent accesses. If the computation raises an exception,\n the same exception is raised again on subsequent accesses." + ], + "signature": "type t<+'a>" }, { - "id": "Stdlib.Math.hypot", + "id": "Stdlib.Lazy.make", "kind": "value", - "name": "hypot", + "name": "make", "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```" + "`Lazy.make(f)` creates a lazy value from `f` which is the\n computation to be deferred of type `unit => 'a`. \n The function returns a lazy value of type `Lazy.t<'a>`. \n The computation is not executed until the lazy value is accessed.\n\n ## Examples \n ```rescript \n let lazyValue = Lazy.make(() => {\n // Some expensive computation\n Console.log(\"Computing...\")\n 42\n });\n lazyValue->Lazy.get->assertEqual(42)\n ```" ], - "signature": "let hypot: (float, float) => float" + "signature": "let make: (unit => 'a) => t<'a>" }, { - "id": "Stdlib.Math.hypotMany", + "id": "Stdlib.Lazy.get", "kind": "value", - "name": "hypotMany", + "name": "get", "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```" + "`Lazy.get(x)` forces the suspension `x` and returns its result.\n If `x` has already been forced, `Lazy.get(x)` returns the\n same value again without recomputing it. If it raised an\n exception, the same exception is raised again.\n Raise `Undefined` if the forcing of `x` tries to force `x` itself\n recursively. This is a runtime error." ], - "signature": "let hypotMany: array => float" + "signature": "let get: t<'a> => 'a" }, { - "id": "Stdlib.Math.log", + "id": "Stdlib.Lazy.isEvaluated", "kind": "value", - "name": "log", + "name": "isEvaluated", "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```" + "`Lazy.isEvaluated(x)` returns `true` if the suspension `x` has\n already been forced and did not raise an exception. Otherwise, \n it returns `false`. This is useful for checking if a lazy value\n has been computed before accessing it.\n\n ## Examples\n ```rescript \n let lazyValue = Lazy.make(() => {\n // Some expensive computation\n Console.log(\"Computing...\")\n 42\n })\n Lazy.isEvaluated(lazyValue)->assertEqual(false)\n lazyValue->Lazy.get->assertEqual(42)\n lazyValue->Lazy.isEvaluated->assertEqual(true)\n ```" ], - "signature": "let log: float => float" + "signature": "let isEvaluated: t<'a> => bool" }, { - "id": "Stdlib.Math.log1p", + "id": "Stdlib.Lazy.force", "kind": "value", - "name": "log1p", + "name": "force", "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```" + "`force(x)` forces the suspension `x` and returns its result.\n If `x` has already been forced, `Lazy.force(x)` returns the\n same value again without recomputing it. If it raised an exception,\n the same exception is raised again.\n Raise `Undefined` if the forcing of `x` tries to force `x` itself\n recursively." ], - "signature": "let log1p: float => float" + "signature": "let force: t<'a> => 'a", + "deprecated": "Use `Lazy.get` instead" }, { - "id": "Stdlib.Math.log10", + "id": "Stdlib.Lazy.force_val", "kind": "value", - "name": "log10", + "name": "force_val", "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```" + "`force_val(x)` forces the suspension `x` and returns its\n result. If `x` has already been forced, `force_val(x)`\n returns the same value again without recomputing it.\n Raise `Undefined` if the forcing of `x` tries to force `x` itself\n recursively.\n If the computation of `x` raises an exception, it is unspecified\n whether `force_val(x)` raises the same exception or `Undefined`." ], - "signature": "let log10: float => float" + "signature": "let force_val: t<'a> => 'a", + "deprecated": "Use `Lazy.get` instead" }, { - "id": "Stdlib.Math.log2", + "id": "Stdlib.Lazy.from_fun", "kind": "value", - "name": "log2", + "name": "from_fun", "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```" + "`Lazy.from_fun(f)` creates a lazy value from `f` which is the\n computation to be deferred of type `unit => 'a`. \n The function returns a lazy value of type `Lazy.t<'a>`. \n The computation is not executed until the lazy value is accessed." ], - "signature": "let log2: float => float" + "signature": "let from_fun: (unit => 'a) => t<'a>", + "deprecated": "Use `Lazy.make` instead" }, { - "id": "Stdlib.Math.min", + "id": "Stdlib.Lazy.from_val", "kind": "value", - "name": "min", + "name": "from_val", "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```" + "`from_val(v)` returns an already-forced suspension of `v`.\n This is for special purposes only." ], - "signature": "let min: (float, float) => float" + "signature": "let from_val: 'a => t<'a>", + "deprecated": "Use `Lazy.make` instead" }, { - "id": "Stdlib.Math.minMany", + "id": "Stdlib.Lazy.is_val", "kind": "value", - "name": "minMany", + "name": "is_val", "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```" + "`is_val(x)` returns `true` if `x has already been forced and\n did not raise an exception." ], - "signature": "let minMany: array => float" - }, + "signature": "let is_val: t<'a> => bool", + "deprecated": "Use `Lazy.isEvaluated` instead" + } + ] + }, + "stdlib/json": { + "id": "Stdlib.JSON", + "name": "JSON", + "docstrings": [ + "Functions for interacting with JSON." + ], + "items": [ { - "id": "Stdlib.Math.max", - "kind": "value", - "name": "max", + "id": "Stdlib.JSON.t", + "kind": "type", + "name": "t", "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```" + "A type representing a JSON object." ], - "signature": "let max: (float, float) => float" + "signature": "@unboxed\ntype t =\n | Boolean(bool)\n | @as(null) Null\n | String(string)\n | Number(float)\n | Object(dict)\n | Array(array)" }, { - "id": "Stdlib.Math.maxMany", + "id": "Stdlib.JSON.replacer", + "kind": "type", + "name": "replacer", + "docstrings": [], + "signature": "@unboxed\ntype replacer =\n | Keys(array)\n | Replacer((string, t) => t)" + }, + { + "id": "Stdlib.JSON.parseOrThrow", "kind": "value", - "name": "maxMany", + "name": "parseOrThrow", "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```" + "`parseOrThrow(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.parseOrThrow(`{\"foo\":\"bar\",\"hello\":\"world\"}`)\n // { foo: 'bar', hello: 'world' }\n\n let _ = JSON.parseOrThrow(\"\")\n // error\n} catch {\n| JsExn(_) => 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.parseOrThrow(jsonString, ~reviver)->Console.log\n // { hello: 'WORLD', someNumber: 42 }\n\n JSON.parseOrThrow(\"\", ~reviver)->Console.log\n // error\n} catch {\n| JsExn(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError (Exn.t) if the string isn't valid JSON." ], - "signature": "let maxMany: array => float" + "signature": "let parseOrThrow: (string, ~reviver: (string, t) => t=?) => t" }, { - "id": "Stdlib.Math.pow", + "id": "Stdlib.JSON.parseExn", "kind": "value", - "name": "pow", + "name": "parseExn", "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```" + "`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| JsExn(_) => 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| JsExn(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError (Exn.t) if the string isn't valid JSON." ], - "signature": "let pow: (float, ~exp: float) => float" + "signature": "let parseExn: (string, ~reviver: (string, t) => t=?) => t", + "deprecated": "Use `parseOrThrow` instead" }, { - "id": "Stdlib.Math.random", + "id": "Stdlib.JSON.parseExnWithReviver", "kind": "value", - "name": "random", + "name": "parseExnWithReviver", "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```" + "`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\nJSON.parseExnWithReviver(jsonString, reviver)->Console.log\n// { hello: 'WORLD', someNumber: 42 }\n\ntry {\n JSON.parseExnWithReviver(\"\", reviver)->Console.log\n // error\n} catch {\n| JsExn(_) => Console.log(\"error\")\n}\n```\n\n## Exceptions \n\n- Raises a SyntaxError if the string is not a valid JSON." ], - "signature": "let random: unit => float" + "signature": "let parseExnWithReviver: (string, (string, t) => t) => t", + "deprecated": "Use `parseOrThrow` with optional parameter instead" }, { - "id": "Stdlib.Math.round", + "id": "Stdlib.JSON.stringify", "kind": "value", - "name": "round", + "name": "stringify", "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```" + "`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 round: float => float" + "signature": "let stringify: (t, ~replacer: replacer=?, ~space: int=?) => string" }, { - "id": "Stdlib.Math.sign", + "id": "Stdlib.JSON.stringifyWithIndent", "kind": "value", - "name": "sign", + "name": "stringifyWithIndent", "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```" + "`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 sign: float => float" + "signature": "let stringifyWithIndent: (t, int) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Stdlib.Math.sin", + "id": "Stdlib.JSON.stringifyWithReplacer", "kind": "value", - "name": "sin", + "name": "stringifyWithReplacer", "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```" + "`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 sin: float => float" + "signature": "let stringifyWithReplacer: (t, (string, t) => t) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Stdlib.Math.sinh", + "id": "Stdlib.JSON.stringifyWithReplacerAndIndent", "kind": "value", - "name": "sinh", + "name": "stringifyWithReplacerAndIndent", "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```" + "`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 sinh: float => float" + "signature": "let stringifyWithReplacerAndIndent: (t, (string, t) => t, int) => string", + "deprecated": "Use `stringify` with optional parameters instead" }, { - "id": "Stdlib.Math.sqrt", + "id": "Stdlib.JSON.stringifyWithFilter", "kind": "value", - "name": "sqrt", + "name": "stringifyWithFilter", "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```" + "`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 sqrt: float => float" + "signature": "let stringifyWithFilter: (t, array) => string", + "deprecated": "Use `stringify` with optional parameter instead" }, { - "id": "Stdlib.Math.tan", + "id": "Stdlib.JSON.stringifyWithFilterAndIndent", "kind": "value", - "name": "tan", + "name": "stringifyWithFilterAndIndent", "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```" + "`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 tan: float => float" + "signature": "let stringifyWithFilterAndIndent: (t, array, int) => string", + "deprecated": "Use `stringify` with optional parameters instead" }, { - "id": "Stdlib.Math.tanh", + "id": "Stdlib.JSON.stringifyAny", "kind": "value", - "name": "tanh", + "name": "stringifyAny", "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```" + "`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 tanh: float => float" + "signature": "let stringifyAny: ('a, ~replacer: replacer=?, ~space: int=?) => option" }, { - "id": "Stdlib.Math.trunc", + "id": "Stdlib.JSON.stringifyAnyWithIndent", "kind": "value", - "name": "trunc", + "name": "stringifyAnyWithIndent", "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```" + "`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 trunc: float => float" - } - ] - }, - "stdlib/bigint": { - "id": "Stdlib.BigInt", - "name": "BigInt", - "docstrings": [], - "items": [ - { - "id": "Stdlib.BigInt.asIntN", - "kind": "value", - "name": "asIntN", - "docstrings": [], - "signature": "let asIntN: (~width: int, bigint) => bigint" + "signature": "let stringifyAnyWithIndent: ('a, int) => option", + "deprecated": "Use `stringifyAny` with optional parameter instead" }, { - "id": "Stdlib.BigInt.asUintN", + "id": "Stdlib.JSON.stringifyAnyWithReplacer", "kind": "value", - "name": "asUintN", - "docstrings": [], - "signature": "let asUintN: (~width: int, 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": "Stdlib.BigInt.fromString", + "id": "Stdlib.JSON.stringifyAnyWithReplacerAndIndent", "kind": "value", - "name": "fromString", - "docstrings": [], - "signature": "let fromString: string => 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": "Stdlib.BigInt.fromStringExn", + "id": "Stdlib.JSON.stringifyAnyWithFilter", "kind": "value", - "name": "fromStringExn", + "name": "stringifyAnyWithFilter", "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```" + "`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 fromStringExn: string => bigint" + "signature": "let stringifyAnyWithFilter: ('a, array) => string", + "deprecated": "Use `stringifyAny` with optional parameter instead" }, { - "id": "Stdlib.BigInt.fromInt", + "id": "Stdlib.JSON.stringifyAnyWithFilterAndIndent", "kind": "value", - "name": "fromInt", - "docstrings": [], - "signature": "let fromInt: int => 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" }, { - "id": "Stdlib.BigInt.fromFloat", + "id": "Stdlib.JSON.ignore", "kind": "value", - "name": "fromFloat", - "docstrings": [], - "signature": "let fromFloat: float => bigint" - }, + "name": "ignore", + "docstrings": [ + "`ignore(json)` ignores the provided json and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/jsexn": { + "id": "Stdlib.JsExn", + "name": "JsExn", + "docstrings": [ + "Provide utilities for dealing with JS exceptions.\n\nJS exceptions can be of any type, even though they *should* be of type `Error` of one of its subclasses.\n\nSee [`throw`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw) on MDN." + ], + "items": [ { - "id": "Stdlib.BigInt.toString", - "kind": "value", - "name": "toString", + "id": "Stdlib.JsExn.t", + "kind": "type", + "name": "t", "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```" + "Represents a JS exception" ], - "signature": "let toString: (bigint, ~radix: int=?) => string" + "signature": "type t = unknown" }, { - "id": "Stdlib.BigInt.toStringWithRadix", + "id": "Stdlib.JsExn.fromException", "kind": "value", - "name": "toStringWithRadix", + "name": "fromException", "docstrings": [], - "signature": "let toStringWithRadix: (bigint, ~radix: int) => string", - "deprecated": "Use `toString` with `~radix` instead" + "signature": "let fromException: exn => option" }, { - "id": "Stdlib.BigInt.toLocaleString", + "id": "Stdlib.JsExn.anyToExnInternal", "kind": "value", - "name": "toLocaleString", + "name": "anyToExnInternal", "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```" + "`anyToExnInternal(obj)` will take any value `obj` and wrap it\nin a JsExn 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 toLocaleString: bigint => string" + "signature": "let anyToExnInternal: 'a => exn" }, { - "id": "Stdlib.BigInt.toFloat", + "id": "Stdlib.JsExn.stack", "kind": "value", - "name": "toFloat", - "docstrings": [], - "signature": "let toFloat: bigint => float" + "name": "stack", + "docstrings": [ + "`stack(jsExn)` retrieves the `stack` property of the exception, if it exists. The stack is a list of what functions were called, and what files they are defined in, prior to the error happening.\n\nSee [`Error.prototype.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) on MDN.\n\n## Example\n```rescript\ntry {JsError.make(\"error\")->JsError.throw} catch {\n| JsExn(e) => Console.log(JsExn.stack(e)) // Logs `stack`\n| _ => assert(false)\n}\n```" + ], + "signature": "let stack: t => option" }, { - "id": "Stdlib.BigInt.toInt", + "id": "Stdlib.JsExn.message", "kind": "value", - "name": "toInt", - "docstrings": [], - "signature": "let toInt: bigint => int" + "name": "message", + "docstrings": [ + "`message(error)` retrieves the `message` property of the error, if it exists.\n\nSee [`Error.prototype.message`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message) on MDN.\n\n## Example\n```rescript\ntry {JsError.SyntaxError.throwWithMessage(\"Some message here\")} catch {\n| JsExn(e) => e->JsExn.message->Option.getExn->assertEqual(\"Some message here\")\n| _ => assert(false)\n}\n```" + ], + "signature": "let message: t => option" }, { - "id": "Stdlib.BigInt.+", + "id": "Stdlib.JsExn.name", "kind": "value", - "name": "+", - "docstrings": [], - "signature": "let +: (bigint, bigint) => bigint" + "name": "name", + "docstrings": [ + "`name(error)` retrieves the `name` property of the error, if it exists.\n\nSee [`Error.prototype.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) on MDN.\n\n## Example\n```rescript\ntry {JsError.SyntaxError.throwWithMessage(\"Some message here\")} catch {\n| JsExn(e) => e->JsExn.name->Option.getExn->assertEqual(\"SyntaxError\")\n| _ => assert(false)\n}\n```" + ], + "signature": "let name: t => option" }, { - "id": "Stdlib.BigInt.-", + "id": "Stdlib.JsExn.fileName", "kind": "value", - "name": "-", - "docstrings": [], - "signature": "let -: (bigint, bigint) => bigint" + "name": "fileName", + "docstrings": [ + "`fileName(error)` retrieves the `fileName` property of the error, if it exists.\n\nSee [`Error.prototype.fileName`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName) on MDN." + ], + "signature": "let fileName: t => option" }, { - "id": "Stdlib.BigInt.*", + "id": "Stdlib.JsExn.throw", "kind": "value", - "name": "*", - "docstrings": [], - "signature": "let *: (bigint, bigint) => bigint" + "name": "throw", + "docstrings": [ + "Throws the given value, terminating execution unless caught by a surrounding try/catch block.\n\nThis is meant to be used when a JS API is based on throwing values that are not of type `Error` or its subclasses." + ], + "signature": "let throw: 'a => 'b" }, { - "id": "Stdlib.BigInt./", + "id": "Stdlib.JsExn.ignore", "kind": "value", - "name": "/", - "docstrings": [], - "signature": "let /: (bigint, bigint) => bigint" - }, + "name": "ignore", + "docstrings": [ + "`ignore(jsExn)` ignores the provided JS exception and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/jserror": { + "id": "Stdlib.JsError", + "name": "JsError", + "docstrings": [ + "Functions for working with JavaScript errors.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) on MDN." + ], + "items": [ { - "id": "Stdlib.BigInt.~-", - "kind": "value", - "name": "~-", - "docstrings": [], - "signature": "let ~-: bigint => bigint" + "id": "Stdlib.JsError.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Represents a JavaScript error." + ], + "signature": "type t" }, { - "id": "Stdlib.BigInt.~+", + "id": "Stdlib.JsError.stack", "kind": "value", - "name": "~+", - "docstrings": [], - "signature": "let ~+: bigint => bigint" + "name": "stack", + "docstrings": [ + "`stack(error)` retrieves the `stack` property of the error, if it exists. The stack is a list of what functions were called, and what files they are defined in, prior to the error happening.\n\nSee [`Error.prototype.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) on MDN.\n\n## Example\n```rescript\nlet error = JsError.make(\"error\")\nConsole.log(error->JsError.stack) // Logs `stack` if it exists on `someError`\n```" + ], + "signature": "let stack: t => option" }, { - "id": "Stdlib.BigInt.**", + "id": "Stdlib.JsError.message", "kind": "value", - "name": "**", - "docstrings": [], - "signature": "let **: (bigint, bigint) => bigint" + "name": "message", + "docstrings": [ + "`message(error)` retrieves the `message` property of the error.\n\nSee [`Error.prototype.message`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message) on MDN.\n\n## Example\n```rescript\nlet error = JsError.SyntaxError.make(\"Some message here\")\nerror->JsError.message->assertEqual(\"Some message here\") \n```" + ], + "signature": "let message: t => string" }, { - "id": "Stdlib.BigInt.add", + "id": "Stdlib.JsError.name", "kind": "value", - "name": "add", - "docstrings": [], - "signature": "let add: (bigint, bigint) => bigint" + "name": "name", + "docstrings": [ + "`name(error)` retrieves the `name` property of the error.\n\nSee [`Error.prototype.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) on MDN.\n\n## Example\n```rescript\nlet error = JsError.SyntaxError.make(\"Some message here\")\nerror->JsError.name->assertEqual(\"SyntaxError\")\n```" + ], + "signature": "let name: t => string" }, { - "id": "Stdlib.BigInt.sub", + "id": "Stdlib.JsError.fileName", "kind": "value", - "name": "sub", - "docstrings": [], - "signature": "let sub: (bigint, bigint) => bigint" + "name": "fileName", + "docstrings": [ + "`fileName(error)` retrieves the `fileName` property of the error, if it exists.\n\nSee [`Error.prototype.fileName`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName) on MDN." + ], + "signature": "let fileName: t => option" }, { - "id": "Stdlib.BigInt.mul", + "id": "Stdlib.JsError.make", "kind": "value", - "name": "mul", - "docstrings": [], - "signature": "let mul: (bigint, bigint) => bigint" + "name": "make", + "docstrings": [ + "`make(message)` creates a new error, setting its `message` to the provided value.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) on MDN.\n\n## Example\n```rescript\nlet error = JsError.make(\"Some message here\")\nerror->JsError.message->assertEqual(\"Some message here\") \nerror->JsError.name->assertEqual(\"Error\") \n````" + ], + "signature": "let make: string => t" }, { - "id": "Stdlib.BigInt.div", + "id": "Stdlib.JsError.throw", "kind": "value", - "name": "div", - "docstrings": [], - "signature": "let div: (bigint, bigint) => bigint" + "name": "throw", + "docstrings": [ + "Throws the given error, terminating execution unless caught by a surrounding try/catch block.\n\n## Examples\n\n```rescript\nlet error = JsError.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n JsError.throw(error)\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```" + ], + "signature": "let throw: t => 'a" }, { - "id": "Stdlib.BigInt.mod", + "id": "Stdlib.JsError.throwWithMessage", "kind": "value", - "name": "mod", - "docstrings": [], - "signature": "let mod: (bigint, bigint) => bigint" + "name": "throwWithMessage", + "docstrings": [ + "Creates a new `Error` with the provided `message` and throws it.\n\n`JsError.throwWithMessage(\"message\")` is equivalent to `JsError.make(\"message\")->JsError.throw`." + ], + "signature": "let throwWithMessage: string => 'a" }, { - "id": "Stdlib.BigInt.land", + "id": "Stdlib.JsError.panic", "kind": "value", - "name": "land", - "docstrings": [], - "signature": "let land: (bigint, bigint) => bigint" + "name": "panic", + "docstrings": [ + "Throws 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 JsError.panic(\"Uh oh. This was unexpected!\")\n} catch {\n| JsExn(obj) =>\n switch JsExn.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" }, { - "id": "Stdlib.BigInt.lor", + "id": "Stdlib.JsError.toJsExn", "kind": "value", - "name": "lor", - "docstrings": [], - "signature": "let lor: (bigint, bigint) => bigint" + "name": "toJsExn", + "docstrings": [ + "Casts a `JsError.t` to a `JsExn.t`. \n\nThis is useful when you want to compare a JS exception and a JS error." + ], + "signature": "let toJsExn: t => JsExn.t" }, { - "id": "Stdlib.BigInt.lxor", + "id": "Stdlib.JsError.ignore", "kind": "value", - "name": "lxor", - "docstrings": [], - "signature": "let lxor: (bigint, bigint) => bigint" - }, + "name": "ignore", + "docstrings": [ + "`ignore(error)` ignores the provided error and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/intl": { + "id": "Stdlib.Intl", + "name": "Intl", + "docstrings": [], + "items": [ { - "id": "Stdlib.BigInt.lsl", + "id": "Stdlib.Intl.getCanonicalLocalesExn", "kind": "value", - "name": "lsl", - "docstrings": [], - "signature": "let lsl: (bigint, bigint) => bigint" + "name": "getCanonicalLocalesExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let getCanonicalLocalesExn: string => array" }, { - "id": "Stdlib.BigInt.asr", + "id": "Stdlib.Intl.getCanonicalLocalesManyExn", "kind": "value", - "name": "asr", - "docstrings": [], - "signature": "let asr: (bigint, bigint) => bigint" + "name": "getCanonicalLocalesManyExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let getCanonicalLocalesManyExn: array => array" }, { - "id": "Stdlib.BigInt.lnot", + "id": "Stdlib.Intl.supportedValuesOfExn", "kind": "value", - "name": "lnot", - "docstrings": [], - "signature": "let lnot: bigint => bigint" + "name": "supportedValuesOfExn", + "docstrings": [ + "@throws RangeError" + ], + "signature": "let supportedValuesOfExn: string => array" } ] }, @@ -7164,6 +8284,15 @@ "Functions for interacting with JavaScript Number.\nSee: [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)." ], "items": [ + { + "id": "Stdlib.Int.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing an int." + ], + "signature": "type t = int" + }, { "id": "Stdlib.Int.equal", "kind": "value", @@ -7176,7 +8305,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (int, int) => Stdlib__Ordering.t" + "signature": "let compare: (int, int) => Ordering.t" }, { "id": "Stdlib.Int.toExponential", @@ -7303,7 +8432,9 @@ "id": "Stdlib.Int.rangeOptions", "kind": "type", "name": "rangeOptions", - "docstrings": ["The options for `range`."], + "docstrings": [ + "The options for `range`." + ], "signature": "type rangeOptions = {step?: int, inclusive?: bool}" }, { @@ -7333,14 +8464,97 @@ "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nInt.clamp(42) == 42\nInt.clamp(42, ~min=50) == 50\nInt.clamp(42, ~max=40) == 40\nInt.clamp(42, ~min=50, ~max=40) == 50\n```" ], "signature": "let clamp: (~min: int=?, ~max: int=?, int) => int" + }, + { + "id": "Stdlib.Int.bitwiseAnd", + "kind": "value", + "name": "bitwiseAnd", + "docstrings": [ + "`bitwiseAnd(n1, n2)` calculates the bitwise AND of two integers.\n\n## Examples\n\n```rescript\nInt.bitwiseAnd(7, 4) == 4\n```" + ], + "signature": "let bitwiseAnd: (int, int) => int" + }, + { + "id": "Stdlib.Int.bitwiseOr", + "kind": "value", + "name": "bitwiseOr", + "docstrings": [ + "`bitwiseOr(n1, n2)` calculates the bitwise OR of two integers.\n\n## Examples\n\n```rescript\nInt.bitwiseOr(7, 4) == 7\n```" + ], + "signature": "let bitwiseOr: (int, int) => int" + }, + { + "id": "Stdlib.Int.bitwiseXor", + "kind": "value", + "name": "bitwiseXor", + "docstrings": [ + "`bigwiseXor(n1, n2)` calculates the bitwise XOR of two integers.\n\n## Examples\n\n```rescript\nInt.bitwiseXor(7, 4) == 3\n```" + ], + "signature": "let bitwiseXor: (int, int) => int" + }, + { + "id": "Stdlib.Int.bitwiseNot", + "kind": "value", + "name": "bitwiseNot", + "docstrings": [ + "`bitwiseNot(n)` calculates the bitwise NOT of an integer.\n\n## Examples\n\n```rescript\nInt.bitwiseNot(2) == -3\n```" + ], + "signature": "let bitwiseNot: int => int" + }, + { + "id": "Stdlib.Int.shiftLeft", + "kind": "value", + "name": "shiftLeft", + "docstrings": [ + "`shiftLeft(n, length)` calculates the shifted value of an integer `n` by `length` bits to the left.\n\n## Examples\n\n```rescript\nInt.shiftLeft(4, 1) == 8\n```" + ], + "signature": "let shiftLeft: (int, int) => int" + }, + { + "id": "Stdlib.Int.shiftRight", + "kind": "value", + "name": "shiftRight", + "docstrings": [ + "`shiftRight(n, length)` calculates the shifted value of an integer `n` by `length` bits to the right.\n\nAlso known as \"arithmetic right shift\" operation.\n\n## Examples\n\n```rescript\nInt.shiftRight(8, 1) == 4\n```" + ], + "signature": "let shiftRight: (int, int) => int" + }, + { + "id": "Stdlib.Int.shiftRightUnsigned", + "kind": "value", + "name": "shiftRightUnsigned", + "docstrings": [ + "`shiftRightUnsigned(n, length)` calculates the shifted value of an integer `n` by `length` bits to the right.\nExcess bits shifted off to the right are discarded, and zero bits are shifted in from the left.\n\nAlso known as \"zero-filling right shift\" operation.\n\n## Examples\n\n```rescript\nInt.shiftRightUnsigned(4, 1) == 2\n```" + ], + "signature": "let shiftRightUnsigned: (int, int) => int" + }, + { + "id": "Stdlib.Int.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(int)` ignores the provided int and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: int => unit" } ] }, "stdlib/float": { "id": "Stdlib.Float", "name": "Float", - "docstrings": ["Functions for interacting with float."], + "docstrings": [ + "Functions for interacting with float." + ], "items": [ + { + "id": "Stdlib.Float.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing a float." + ], + "signature": "type t = float" + }, { "id": "Stdlib.Float.equal", "kind": "value", @@ -7353,7 +8567,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (float, float) => Stdlib__Ordering.t" + "signature": "let compare: (float, float) => Ordering.t" }, { "id": "Stdlib.Float.isNaN", @@ -7530,6 +8744,15 @@ "`clamp(~min=?, ~max=?, value)` returns `value`, optionally bounded by `min` and `max`.\n\nif `max` < `min` returns `min`.\n\n## Examples\n\n```rescript\nFloat.clamp(4.2) == 4.2\nFloat.clamp(4.2, ~min=4.3) == 4.3\nFloat.clamp(4.2, ~max=4.1) == 4.1\nFloat.clamp(4.2, ~min=4.3, ~max=4.1) == 4.3\n```" ], "signature": "let clamp: (~min: float=?, ~max: float=?, float) => float" + }, + { + "id": "Stdlib.Float.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(float)` ignores the provided float and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: float => unit" } ] }, @@ -7544,15 +8767,19 @@ "id": "Stdlib.Error.t", "kind": "type", "name": "t", - "docstrings": ["Represents a JavaScript exception."], - "signature": "type t = Js.Exn.t" + "docstrings": [ + "Represents a JavaScript exception." + ], + "signature": "type t = Exn.t", + "deprecated": "Use `JsError.t` instead" }, { "id": "Stdlib.Error.fromException", "kind": "value", "name": "fromException", "docstrings": [], - "signature": "let fromException: exn => option" + "signature": "let fromException: exn => option", + "deprecated": "Use `JsExn.fromException` instead" }, { "id": "Stdlib.Error.toException", @@ -7561,7 +8788,8 @@ "docstrings": [ "Turns an `Error.t` into an `exn`.\n\n## Examples\n```rescript\nlet error = Error.make(\"Something went wrong.\")\n\nlet asExn = error->Error.toException // `asExn` is now type `exn`\n```" ], - "signature": "let toException: t => exn" + "signature": "let toException: t => exn", + "deprecated": "Use functions from `JsExn` instead" }, { "id": "Stdlib.Error.stack", @@ -7570,7 +8798,8 @@ "docstrings": [ "`stack(error)` retrieves the `stack` property of the error, if it exists. The stack is a list of what functions were called, and what files they are defined in, prior to the error happening.\n\nSee [`Error.prototype.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"error\")\nConsole.log(error->Error.stack) // Logs `stack` if it exists on `someError`\n```" ], - "signature": "let stack: t => option" + "signature": "let stack: t => option", + "deprecated": "Use `JsError.stack` instead" }, { "id": "Stdlib.Error.message", @@ -7579,7 +8808,8 @@ "docstrings": [ "`message(error)` retrieves the `message` property of the error, if it exists.\n\nSee [`Error.prototype.message`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\n```" ], - "signature": "let message: t => option" + "signature": "let message: t => option", + "deprecated": "Use `JsError.message` instead" }, { "id": "Stdlib.Error.name", @@ -7588,7 +8818,8 @@ "docstrings": [ "`name(error)` retrieves the `name` property of the error, if it exists.\n\nSee [`Error.prototype.name`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) on MDN.\n\n## Example\n```rescript\nlet error = Error.SyntaxError.make(\"Some message here\")\nConsole.log(error->Error.name) // Logs \"SyntaxError\" to the console\n```" ], - "signature": "let name: t => option" + "signature": "let name: t => option", + "deprecated": "Use `JsError.name` instead" }, { "id": "Stdlib.Error.fileName", @@ -7597,7 +8828,8 @@ "docstrings": [ "`fileName(error)` retrieves the `fileName` property of the error, if it exists.\n\nSee [`Error.prototype.fileName`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName) on MDN." ], - "signature": "let fileName: t => option" + "signature": "let fileName: t => option", + "deprecated": "Use `JsError.fileName` instead" }, { "id": "Stdlib.Error.make", @@ -7606,7 +8838,8 @@ "docstrings": [ "`make(message)` creates a new error, setting its `message` to the provided value.\n\nSee [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) on MDN.\n\n## Example\n```rescript\nlet error = Error.make(\"Some message here\")\nConsole.log(error->Error.message) // Logs \"Some message here\" to the console\nConsole.log(error->Error.name) // Logs \"Error\" to the console, because this is a regular error\n```" ], - "signature": "let make: string => t" + "signature": "let make: string => t", + "deprecated": "Use `JsError.make` instead" }, { "id": "Stdlib.Error.raise", @@ -7615,16 +8848,175 @@ "docstrings": [ "Raises (throws in JavaScript language) the provided `Error.t`, which will stop execution.\n\n## Examples\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->Error.raise\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```" ], - "signature": "let raise: t => 'a" + "signature": "let raise: t => 'a", + "deprecated": "`raise` has been renamed to `throw` to align with JavaScript vocabulary. Please use `JsError.throw` instead" + }, + { + "id": "Stdlib.Error.throw", + "kind": "value", + "name": "throw", + "docstrings": [ + "Raises the given exception, terminating execution unless caught by a surrounding try/catch block.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n Error.throw(error)\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```" + ], + "signature": "let throw: t => 'a", + "deprecated": "Use `JsError.throw` instead" }, { "id": "Stdlib.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```rescript\nError.panic(\"Uh oh. This was unexpected!\")\n```" + "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" + "signature": "let panic: string => 'a", + "deprecated": "Use `JsError.panic` instead" + }, + { + "id": "Stdlib.Error.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(error)` ignores the provided error and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit", + "deprecated": "Use `JsError.ignore` instead" + } + ] + }, + "stdlib/exn": { + "id": "Stdlib.Exn", + "name": "Exn", + "docstrings": [ + "Provide utilities for dealing with JS exceptions." + ], + "items": [ + { + "id": "Stdlib.Exn.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Represents a JS exception" + ], + "signature": "type t", + "deprecated": "Use `JsExn.t` instead" + }, + { + "id": "Stdlib.Exn.asJsExn", + "kind": "value", + "name": "asJsExn", + "docstrings": [], + "signature": "let asJsExn: exn => option", + "deprecated": "Use `JsExn.fromException` instead" + }, + { + "id": "Stdlib.Exn.stack", + "kind": "value", + "name": "stack", + "docstrings": [], + "signature": "let stack: t => option", + "deprecated": "Use `JsExn.stack` instead" + }, + { + "id": "Stdlib.Exn.message", + "kind": "value", + "name": "message", + "docstrings": [], + "signature": "let message: t => option", + "deprecated": "Use `JsExn.message` instead" + }, + { + "id": "Stdlib.Exn.name", + "kind": "value", + "name": "name", + "docstrings": [], + "signature": "let name: t => option", + "deprecated": "Use `JsExn.name` instead" + }, + { + "id": "Stdlib.Exn.fileName", + "kind": "value", + "name": "fileName", + "docstrings": [], + "signature": "let fileName: t => option", + "deprecated": "Use `JsExn.fileName` instead" + }, + { + "id": "Stdlib.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", + "deprecated": "Use `JsExn.anyToExnInternal` instead" + }, + { + "id": "Stdlib.Exn.raiseError", + "kind": "value", + "name": "raiseError", + "docstrings": [ + "Raise Js exception Error object with stacktrace" + ], + "signature": "let raiseError: string => 'a", + "deprecated": "Use `JsError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseEvalError", + "kind": "value", + "name": "raiseEvalError", + "docstrings": [], + "signature": "let raiseEvalError: string => 'a", + "deprecated": "Use `JsError.EvalError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseRangeError", + "kind": "value", + "name": "raiseRangeError", + "docstrings": [], + "signature": "let raiseRangeError: string => 'a", + "deprecated": "Use `JsError.RangeError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseReferenceError", + "kind": "value", + "name": "raiseReferenceError", + "docstrings": [], + "signature": "let raiseReferenceError: string => 'a", + "deprecated": "Use `JsError.ReferenceError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseSyntaxError", + "kind": "value", + "name": "raiseSyntaxError", + "docstrings": [], + "signature": "let raiseSyntaxError: string => 'a", + "deprecated": "Use `JsError.SyntaxError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseTypeError", + "kind": "value", + "name": "raiseTypeError", + "docstrings": [], + "signature": "let raiseTypeError: string => 'a", + "deprecated": "Use `JsError.TypeError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.raiseUriError", + "kind": "value", + "name": "raiseUriError", + "docstrings": [], + "signature": "let raiseUriError: string => 'a", + "deprecated": "Use `JsError.URIError.throwWithMessage` instead" + }, + { + "id": "Stdlib.Exn.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(exn)` ignores the provided exn and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit", + "deprecated": "Use `JsExn.ignore` instead" } ] }, @@ -7639,26 +9031,28 @@ "id": "Stdlib.Dict.t", "kind": "type", "name": "t", - "docstrings": ["Type representing a dictionary of value `'a`."], - "signature": "type t<'a> = Js.Dict.t<'a>" + "docstrings": [ + "Type representing a dictionary of value `'a`." + ], + "signature": "type t<'a> = dict<'a>" }, { "id": "Stdlib.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": "Stdlib.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": "Stdlib.Dict.set", @@ -7667,25 +9061,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": "Stdlib.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": "Stdlib.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": "Stdlib.Dict.fromArray", @@ -7694,16 +9088,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": "Stdlib.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: Stdlib__Iterator.t<(string, 'a)> => t<'a>" + "signature": "let fromIterator: Iterator.t<(string, 'a)> => dict<'a>" }, { "id": "Stdlib.Dict.toArray", @@ -7712,7 +9106,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": "Stdlib.Dict.keysToArray", @@ -7721,7 +9115,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": "Stdlib.Dict.valuesToArray", @@ -7730,7 +9124,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": "Stdlib.Dict.assign", @@ -7739,57 +9133,79 @@ "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": "Stdlib.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": "Stdlib.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": "Stdlib.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{\"key1\": \"value1\", \"key2\": \"value2\"}\n\ndict->Dict.forEachWithKey((value, key) => {\n Console.log2(value, key)\n})\n```" + ], + "signature": "let forEachWithKey: (dict<'a>, ('a, string) => unit) => unit" + }, + { + "id": "Stdlib.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{\"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": "Stdlib.Dict.forEachWithKey", + "id": "Stdlib.Dict.has", "kind": "value", - "name": "forEachWithKey", + "name": "has", "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```" + "`has(dictionary, \"key\")` returns true if the \"key\" is present in the dictionary.\n\nBe aware that it uses the JavaScript `in` operator under the hood.\n\n## Examples\n\n```rescript\nlet dict = dict{\"key1\": Some(1), \"key2\": None}\n\ndict->Dict.has(\"key1\")->assertEqual(true)\ndict->Dict.has(\"key2\")->assertEqual(true)\ndict->Dict.has(\"key3\")->assertEqual(false)\ndict->Dict.has(\"toString\")->assertEqual(true)\n```" ], - "signature": "let forEachWithKey: (t<'a>, ('a, string) => unit) => unit" + "signature": "let has: (dict<'a>, string) => bool" }, { - "id": "Stdlib.Dict.mapValues", + "id": "Stdlib.Dict.ignore", "kind": "value", - "name": "mapValues", + "name": "ignore", "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```" + "`ignore(dict)` ignores the provided dict and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let mapValues: (t<'a>, 'a => 'b) => t<'b>" + "signature": "let ignore: dict<'a> => unit" } ] }, "stdlib/date": { "id": "Stdlib.Date", "name": "Date", - "docstrings": ["Functions for interacting with JavaScript Dates."], + "docstrings": [ + "Functions for interacting with JavaScript Dates." + ], "items": [ { "id": "Stdlib.Date.t", "kind": "type", "name": "t", - "docstrings": ["A type representing a JavaScript date."], - "signature": "type t = Js.Date.t" + "docstrings": [ + "A type representing a JavaScript date." + ], + "signature": "type t" }, { "id": "Stdlib.Date.msSinceEpoch", @@ -7850,45 +9266,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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.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": "Stdlib.Date.now", @@ -7911,7 +9327,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (t, t) => Stdlib__Ordering.t" + "signature": "let compare: (t, t) => Ordering.t" }, { "id": "Stdlib.Date.getTime", @@ -8026,9 +9442,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": "Stdlib.Date.setMonth", @@ -8233,9 +9649,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": "Stdlib.Date.setUTCMonth", @@ -8479,6 +9895,15 @@ "`toJSON(date)`\n\nConverts a JavaScript date to a string.\nIf the date is valid, the function will return the same result as `Date.toISOString`.\nInvalid dates will return `None`.\n\n## Examples\n```rescript\nDate.fromString(\"2023-01-01T00:00:00.00+00:00\")->Date.toJSON\n// Some(\"2023-01-01T00:00:00.000Z\")\n\nDate.fromString(\"\")->Date.toJSON\n// None\n```" ], "signature": "let toJSON: t => option" + }, + { + "id": "Stdlib.Date.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(date)` ignores the provided date and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" } ] }, @@ -8495,727 +9920,1083 @@ "signature": "type t" }, { - "id": "Stdlib.DataView.fromBuffer", + "id": "Stdlib.DataView.fromBuffer", + "kind": "value", + "name": "fromBuffer", + "docstrings": [], + "signature": "let fromBuffer: ArrayBuffer.t => t" + }, + { + "id": "Stdlib.DataView.fromBufferToEnd", + "kind": "value", + "name": "fromBufferToEnd", + "docstrings": [], + "signature": "let fromBufferToEnd: (ArrayBuffer.t, ~byteOffset: int) => t" + }, + { + "id": "Stdlib.DataView.fromBufferWithRange", + "kind": "value", + "name": "fromBufferWithRange", + "docstrings": [], + "signature": "let fromBufferWithRange: (ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + }, + { + "id": "Stdlib.DataView.buffer", + "kind": "value", + "name": "buffer", + "docstrings": [], + "signature": "let buffer: t => ArrayBuffer.t" + }, + { + "id": "Stdlib.DataView.byteLength", + "kind": "value", + "name": "byteLength", + "docstrings": [], + "signature": "let byteLength: t => int" + }, + { + "id": "Stdlib.DataView.byteOffset", + "kind": "value", + "name": "byteOffset", + "docstrings": [], + "signature": "let byteOffset: t => int" + }, + { + "id": "Stdlib.DataView.getInt8", + "kind": "value", + "name": "getInt8", + "docstrings": [], + "signature": "let getInt8: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getUint8", + "kind": "value", + "name": "getUint8", + "docstrings": [], + "signature": "let getUint8: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getInt16", + "kind": "value", + "name": "getInt16", + "docstrings": [], + "signature": "let getInt16: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getUint16", + "kind": "value", + "name": "getUint16", + "docstrings": [], + "signature": "let getUint16: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getInt32", + "kind": "value", + "name": "getInt32", + "docstrings": [], + "signature": "let getInt32: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getUint32", + "kind": "value", + "name": "getUint32", + "docstrings": [], + "signature": "let getUint32: (t, int) => int" + }, + { + "id": "Stdlib.DataView.getFloat32", + "kind": "value", + "name": "getFloat32", + "docstrings": [], + "signature": "let getFloat32: (t, int) => float" + }, + { + "id": "Stdlib.DataView.getFloat64", + "kind": "value", + "name": "getFloat64", + "docstrings": [], + "signature": "let getFloat64: (t, int) => float" + }, + { + "id": "Stdlib.DataView.getBigInt64", + "kind": "value", + "name": "getBigInt64", + "docstrings": [], + "signature": "let getBigInt64: (t, int) => bigint" + }, + { + "id": "Stdlib.DataView.getBigUint64", + "kind": "value", + "name": "getBigUint64", + "docstrings": [], + "signature": "let getBigUint64: (t, int) => bigint" + }, + { + "id": "Stdlib.DataView.setInt8", + "kind": "value", + "name": "setInt8", + "docstrings": [], + "signature": "let setInt8: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint8", + "kind": "value", + "name": "setUint8", + "docstrings": [], + "signature": "let setUint8: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setInt16", + "kind": "value", + "name": "setInt16", + "docstrings": [], + "signature": "let setInt16: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint16", + "kind": "value", + "name": "setUint16", + "docstrings": [], + "signature": "let setUint16: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setInt32", + "kind": "value", + "name": "setInt32", + "docstrings": [], + "signature": "let setInt32: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setUint32", + "kind": "value", + "name": "setUint32", + "docstrings": [], + "signature": "let setUint32: (t, int, int) => unit" + }, + { + "id": "Stdlib.DataView.setFloat32", + "kind": "value", + "name": "setFloat32", + "docstrings": [], + "signature": "let setFloat32: (t, int, float) => unit" + }, + { + "id": "Stdlib.DataView.setFloat64", + "kind": "value", + "name": "setFloat64", + "docstrings": [], + "signature": "let setFloat64: (t, int, float) => unit" + }, + { + "id": "Stdlib.DataView.setBigInt64", + "kind": "value", + "name": "setBigInt64", + "docstrings": [], + "signature": "let setBigInt64: (t, int, bigint) => unit" + }, + { + "id": "Stdlib.DataView.setBigUint64", + "kind": "value", + "name": "setBigUint64", + "docstrings": [], + "signature": "let setBigUint64: (t, int, bigint) => unit" + }, + { + "id": "Stdlib.DataView.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(dataView)` ignores the provided dataView and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: t => unit" + } + ] + }, + "stdlib/console": { + "id": "Stdlib.Console", + "name": "Console", + "docstrings": [ + "Functions for interacting with JavaScript console.\n\nSee: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console)." + ], + "items": [ + { + "id": "Stdlib.Console.assert_", + "kind": "value", + "name": "assert_", + "docstrings": [ + "`assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`.\n\nSee [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert)\non MDN.\n\n## Examples\n\n```rescript\nConsole.assert_(false, \"Hello World!\")\nConsole.assert_(42 === 42, \"The answer\")\n```" + ], + "signature": "let assert_: (bool, 'a) => unit" + }, + { + "id": "Stdlib.Console.assert2", + "kind": "value", + "name": "assert2", + "docstrings": [ + "`assert2(v1, v2)`. Like `assert_`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.assert2(false, \"Hello\", \"World\")\nConsole.assert2(42 === 42, [1, 2, 3], '4')\n```" + ], + "signature": "let assert2: (bool, 'a, 'b) => unit" + }, + { + "id": "Stdlib.Console.assert3", + "kind": "value", + "name": "assert3", + "docstrings": [ + "`assert3(v1, v2, v3)`. Like `assert_`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.assert3(false, \"Hello\", \"World\", \"ReScript\")\nConsole.assert3(42 === 42, \"One\", 2, #3)\n```" + ], + "signature": "let assert3: (bool, 'a, 'b, 'c) => unit" + }, + { + "id": "Stdlib.Console.assert4", + "kind": "value", + "name": "assert4", + "docstrings": [ + "`assert4(v1, v2, v3, v4)`. Like `assert_`, but with four arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert4(false, \"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.assert4(value === 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + ], + "signature": "let assert4: (bool, 'a, 'b, 'c, 'd) => unit" + }, + { + "id": "Stdlib.Console.assert5", + "kind": "value", + "name": "assert5", + "docstrings": [ + "`assert5(v1, v2, v3, v4, v5)`. Like `assert_`, but with five arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert5(false, \"Hello\", \"World\", \"JS\", '!', '!')\nConsole.assert5(value === 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit" + }, + { + "id": "Stdlib.Console.assert6", + "kind": "value", + "name": "assert6", + "docstrings": [ + "`assert6(v1, v2)`. Like `assert_`, but with six arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert6(false, \"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.assert6(value === 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit" + }, + { + "id": "Stdlib.Console.assertMany", + "kind": "value", + "name": "assertMany", + "docstrings": [ + "`assertMany(assertion, arr)`. Like `assert_`, but variadic.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assertMany(false, [\"Hello\", \"World\"])\nConsole.assertMany(value === 42, [1, 2, 3])\n```" + ], + "signature": "let assertMany: (bool, array<'a>) => unit" + }, + { + "id": "Stdlib.Console.clear", + "kind": "value", + "name": "clear", + "docstrings": [ + "`clear()` clears the console, if allowed.\n\nSee [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear)\non MDN.\n\n## Examples\n\n```rescript\nConsole.clear()\n```" + ], + "signature": "let clear: unit => unit" + }, + { + "id": "Stdlib.Console.count", + "kind": "value", + "name": "count", + "docstrings": [ + "`count(label)` prints to the console the number of times it's been called with the given label.\n\nSee [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count)\non MDN.\n\n## Examples\n\n```rescript\nConsole.count(\"rescript\")\n```" + ], + "signature": "let count: string => unit" + }, + { + "id": "Stdlib.Console.countReset", "kind": "value", - "name": "fromBuffer", - "docstrings": [], - "signature": "let fromBuffer: Stdlib__ArrayBuffer.t => t" + "name": "countReset", + "docstrings": [ + "`countReset(label)` resets the count for the given label to 0.\n\nSee [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset)\non MDN.\n\n## Examples\n\n```rescript\nConsole.countReset(\"rescript\")\n```" + ], + "signature": "let countReset: string => unit" }, { - "id": "Stdlib.DataView.fromBufferToEnd", + "id": "Stdlib.Console.debug", "kind": "value", - "name": "fromBufferToEnd", - "docstrings": [], - "signature": "let fromBufferToEnd: (Stdlib__ArrayBuffer.t, ~byteOffset: int) => t" + "name": "debug", + "docstrings": [ + "`debug(value)` print a debug message to console.\n\nSee [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug)\non MDN.\n\n## Examples\n\n```rescript\nConsole.debug(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.debug(obj)\n```" + ], + "signature": "let debug: 'a => unit" }, { - "id": "Stdlib.DataView.fromBufferWithRange", + "id": "Stdlib.Console.debug2", "kind": "value", - "name": "fromBufferWithRange", - "docstrings": [], - "signature": "let fromBufferWithRange: (Stdlib__ArrayBuffer.t, ~byteOffset: int, ~length: int) => t" + "name": "debug2", + "docstrings": [ + "`debug2(v1, v2)`. Like `debug`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.debug2(\"Hello\", \"World\")\nConsole.debug2([1, 2, 3], '4')\n```" + ], + "signature": "let debug2: ('a, 'b) => unit" }, { - "id": "Stdlib.DataView.buffer", + "id": "Stdlib.Console.debug3", "kind": "value", - "name": "buffer", - "docstrings": [], - "signature": "let buffer: t => Stdlib__ArrayBuffer.t" + "name": "debug3", + "docstrings": [ + "`debug3(v1, v2, v3)`. Like `debug`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.debug3(\"Hello\", \"World\", \"ReScript\")\nConsole.debug3(\"One\", 2, #3)\n```" + ], + "signature": "let debug3: ('a, 'b, 'c) => unit" }, { - "id": "Stdlib.DataView.byteLength", + "id": "Stdlib.Console.debug4", "kind": "value", - "name": "byteLength", - "docstrings": [], - "signature": "let byteLength: t => int" + "name": "debug4", + "docstrings": [ + "`debug4(v1, v2, v3, v4)`. Like `debug`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.debug4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.debug4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + ], + "signature": "let debug4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Stdlib.DataView.byteOffset", + "id": "Stdlib.Console.debug5", "kind": "value", - "name": "byteOffset", - "docstrings": [], - "signature": "let byteOffset: t => int" + "name": "debug5", + "docstrings": [ + "`debug5(v1, v2, v3, v4, v5)`. Like `debug`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.debug5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.debug5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let debug5: ('a, 'b, 'c, 'd, 'e) => unit" }, { - "id": "Stdlib.DataView.getInt8", + "id": "Stdlib.Console.debug6", "kind": "value", - "name": "getInt8", - "docstrings": [], - "signature": "let getInt8: t => int" + "name": "debug6", + "docstrings": [ + "`debug6(v1, v2, v3, v4, v5, v6)`. Like `debug`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.debug6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.debug6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" }, { - "id": "Stdlib.DataView.getUint8", + "id": "Stdlib.Console.debugMany", "kind": "value", - "name": "getUint8", + "name": "debugMany", + "docstrings": [ + "`debugMany(arr)`. Like `debug`, but variadic.\n\n## Examples\n\n```rescript\nConsole.debugMany([\"Hello\", \"World\"])\nConsole.debugMany([1, 2, 3])\n```" + ], + "signature": "let debugMany: array<'a> => unit" + }, + { + "id": "Stdlib.Console.dirOptions", + "kind": "type", + "name": "dirOptions", "docstrings": [], - "signature": "let getUint8: t => int" + "signature": "type dirOptions = {\n colors?: bool,\n depth?: Nullable.t,\n showHidden?: bool,\n}" }, { - "id": "Stdlib.DataView.getInt16", + "id": "Stdlib.Console.dir", "kind": "value", - "name": "getInt16", - "docstrings": [], - "signature": "let getInt16: t => int" + "name": "dir", + "docstrings": [ + "`dir(object, options)` displays an interactive view of the object in the console.\n\nSee [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir)\non MDN.\n\n## Examples\n\n```rescript\nConsole.dir({\"language\": \"rescript\", \"version\": \"10.1.2\"})\nConsole.dir({\"language\": \"rescript\", \"version\": {\"major\": \"10\", \"minor\": \"1\", \"patch\": \"2\"}}, ~options={depth: null})\n```" + ], + "signature": "let dir: ('a, ~options: dirOptions=?) => unit" }, { - "id": "Stdlib.DataView.getUint16", + "id": "Stdlib.Console.dirxml", "kind": "value", - "name": "getUint16", - "docstrings": [], - "signature": "let getUint16: t => int" + "name": "dirxml", + "docstrings": [ + "`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console.\n\nSee [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml)\non MDN." + ], + "signature": "let dirxml: 'a => unit" }, { - "id": "Stdlib.DataView.getInt32", + "id": "Stdlib.Console.error", "kind": "value", - "name": "getInt32", - "docstrings": [], - "signature": "let getInt32: t => int" + "name": "error", + "docstrings": [ + "`error(value)` prints an error message to console.\n\nSee [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\non MDN.\n\n## Examples\n\n```rescript\nConsole.error(\"error message\")\nConsole.error((\"error\", \"invalid value\"))\n```" + ], + "signature": "let error: 'a => unit" }, { - "id": "Stdlib.DataView.getUint32", + "id": "Stdlib.Console.error2", "kind": "value", - "name": "getUint32", - "docstrings": [], - "signature": "let getUint32: t => int" + "name": "error2", + "docstrings": [ + "`error(v1, v2)`. Like `error`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.error2(\"Error\", \"here\")\nConsole.error2((\"log\", \"error\"), \"message\")\n```" + ], + "signature": "let error2: ('a, 'b) => unit" }, { - "id": "Stdlib.DataView.getFloat32", + "id": "Stdlib.Console.error3", "kind": "value", - "name": "getFloat32", - "docstrings": [], - "signature": "let getFloat32: t => float" + "name": "error3", + "docstrings": [ + "`error3(v1, v2, v3)`. Like `error`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.error3(\"Hello\", \"World\", \"!!!\")\nConsole.error3(#first, #second, #third)\n```" + ], + "signature": "let error3: ('a, 'b, 'c) => unit" }, { - "id": "Stdlib.DataView.getFloat64", + "id": "Stdlib.Console.error4", "kind": "value", - "name": "getFloat64", - "docstrings": [], - "signature": "let getFloat64: t => float" + "name": "error4", + "docstrings": [ + "`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.error4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.error4(#first, #second, #third, (\"fourth\"))\n```" + ], + "signature": "let error4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Stdlib.DataView.getBigInt64", + "id": "Stdlib.Console.error5", "kind": "value", - "name": "getBigInt64", - "docstrings": [], - "signature": "let getBigInt64: t => bigint" + "name": "error5", + "docstrings": [ + "`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.error5('e', 'r', 'r', 'o', 'r')\nConsole.error5(1, #second, #third, (\"fourth\"), 'c')\n```" + ], + "signature": "let error5: ('a, 'b, 'c, 'd, 'e) => unit" }, { - "id": "Stdlib.DataView.getBigUint64", + "id": "Stdlib.Console.error6", "kind": "value", - "name": "getBigUint64", - "docstrings": [], - "signature": "let getBigUint64: t => bigint" + "name": "error6", + "docstrings": [ + "`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.error6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.error6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" }, { - "id": "Stdlib.DataView.setInt8", + "id": "Stdlib.Console.group", "kind": "value", - "name": "setInt8", - "docstrings": [], - "signature": "let setInt8: (t, int) => unit" + "name": "group", + "docstrings": [ + "`group(label)` creates a new \"group\" level with the given label.\n\nSee [`console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group)\non MDN.\n\n## Example\n\n```rescript\nConsole.group(\"first group\")\nConsole.group(\"second group\")\nConsole.log(\"a message on the second level\")\nConsole.groupEnd()\nConsole.log(\"a message message on the first level\")\nConsole.groupEnd()\n```" + ], + "signature": "let group: string => unit" }, { - "id": "Stdlib.DataView.setUint8", + "id": "Stdlib.Console.groupCollapsed", "kind": "value", - "name": "setUint8", - "docstrings": [], - "signature": "let setUint8: (t, int) => unit" + "name": "groupCollapsed", + "docstrings": [ + "`groupCollapsed(label)`. Like `group` but collapses the group initially.\n\nSee [`console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed)\non MDN." + ], + "signature": "let groupCollapsed: string => unit" }, { - "id": "Stdlib.DataView.setInt16", + "id": "Stdlib.Console.groupEnd", "kind": "value", - "name": "setInt16", - "docstrings": [], - "signature": "let setInt16: (t, int) => unit" + "name": "groupEnd", + "docstrings": [ + "`groupEnd()` ends the current group.\n\nSee [`console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd)\non MDN." + ], + "signature": "let groupEnd: unit => unit" }, { - "id": "Stdlib.DataView.setUint16", + "id": "Stdlib.Console.errorMany", "kind": "value", - "name": "setUint16", - "docstrings": [], - "signature": "let setUint16: (t, int) => unit" + "name": "errorMany", + "docstrings": [ + "`errorMany(arr)`. Like `error`, but variadic.\n\n## Examples\n\n```rescript\nConsole.errorMany([\"Hello\", \"World\"])\nConsole.errorMany([1, 2, 3])\n```" + ], + "signature": "let errorMany: array<'a> => unit" }, { - "id": "Stdlib.DataView.setInt32", + "id": "Stdlib.Console.info", "kind": "value", - "name": "setInt32", - "docstrings": [], - "signature": "let setInt32: (t, int) => unit" + "name": "info", + "docstrings": [ + "`info(value)` print an informational message to console.\n\nSee [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info)\non MDN.\n\n## Examples\n\n```rescript\nConsole.info(\"Information\")\nConsole.info((\"Hello\", \"JS\"))\n```" + ], + "signature": "let info: 'a => unit" }, { - "id": "Stdlib.DataView.setUint32", + "id": "Stdlib.Console.info2", "kind": "value", - "name": "setUint32", - "docstrings": [], - "signature": "let setUint32: (t, int) => unit" + "name": "info2", + "docstrings": [ + "`info2(v1, v2)`. Like `info`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.info2(\"Info\", \"failed to download\")\nConsole.info2(#info, {\"name\": \"ReScript\"})\n```" + ], + "signature": "let info2: ('a, 'b) => unit" }, { - "id": "Stdlib.DataView.setFloat32", + "id": "Stdlib.Console.info3", "kind": "value", - "name": "setFloat32", - "docstrings": [], - "signature": "let setFloat32: (t, float) => unit" + "name": "info3", + "docstrings": [ + "`info3(v1, v2, v3)`. Like `info`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.info3(\"Hello\", \"World\", \"ReScript\")\nConsole.info3([1, 2, 3], #4, #5)\n```" + ], + "signature": "let info3: ('a, 'b, 'c) => unit" }, { - "id": "Stdlib.DataView.setFloat64", + "id": "Stdlib.Console.info4", "kind": "value", - "name": "setFloat64", - "docstrings": [], - "signature": "let setFloat64: (t, float) => unit" + "name": "info4", + "docstrings": [ + "`info4(v1, v2, v3, v4)`. Like `info`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.info4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.info4([1, 2, 3], #4, #5, #lastinfo)\n```" + ], + "signature": "let info4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Stdlib.DataView.setBigInt64", + "id": "Stdlib.Console.info5", "kind": "value", - "name": "setBigInt64", - "docstrings": [], - "signature": "let setBigInt64: (t, bigint) => unit" + "name": "info5", + "docstrings": [ + "`info5(v1, v2, v3, v4, v5)`. Like `info`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.info5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.info5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + ], + "signature": "let info5: ('a, 'b, 'c, 'd, 'e) => unit" }, { - "id": "Stdlib.DataView.setBigUint64", + "id": "Stdlib.Console.info6", "kind": "value", - "name": "setBigUint64", - "docstrings": [], - "signature": "let setBigUint64: (t, bigint) => unit" - } - ] - }, - "stdlib/console": { - "id": "Stdlib.Console", - "name": "Console", - "docstrings": [ - "Functions for interacting with JavaScript console.\n\nSee: [`console`](https://developer.mozilla.org/en-US/docs/Web/API/Console)." - ], - "items": [ + "name": "info6", + "docstrings": [ + "`info6(v1, v2, v3, v4, v5, v6)`. Like `info`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.info6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.info6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + ], + "signature": "let info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + }, { - "id": "Stdlib.Console.assert_", + "id": "Stdlib.Console.infoMany", "kind": "value", - "name": "assert_", + "name": "infoMany", "docstrings": [ - "`assert_(assertion, value)` print a message to console if `assertion` evaluates `false`. Does nothing if it's `true`.\n\nSee [`console.assert`](https://developer.mozilla.org/en-US/docs/Web/API/console/assert)\non MDN.\n\n## Examples\n\n```rescript\nConsole.assert_(false, \"Hello World!\")\nConsole.assert_(42 == 42, \"The answer\")\n```" + "`infoMany(arr)`. Like `info`, but variadic.\n\n## Examples\n\n```rescript\nConsole.infoMany([\"Hello\", \"World\"])\nConsole.infoMany([1, 2, 3])\n```" ], - "signature": "let assert_: (bool, 'a) => unit" + "signature": "let infoMany: array<'a> => unit" }, { - "id": "Stdlib.Console.assert2", + "id": "Stdlib.Console.log", "kind": "value", - "name": "assert2", + "name": "log", "docstrings": [ - "`assert2(v1, v2)`. Like `assert_`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.assert2(false, \"Hello\", \"World\")\nConsole.assert2(42 == 42, [1, 2, 3], '4')\n```" + "`log(value)` print a message to console.\n\nSee [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log)\non MDN.\n\n## Examples\n\n```rescript\nConsole.log(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.log(obj)\n```" ], - "signature": "let assert2: (bool, 'a, 'b) => unit" + "signature": "let log: 'a => unit" }, { - "id": "Stdlib.Console.assert3", + "id": "Stdlib.Console.log2", "kind": "value", - "name": "assert3", + "name": "log2", "docstrings": [ - "`assert3(v1, v2, v3)`. Like `assert_`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.assert3(false, \"Hello\", \"World\", \"ReScript\")\nConsole.assert3(42 == 42, \"One\", 2, #3)\n```" + "`log2(v1, v2)`. Like `log`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.log2(\"Hello\", \"World\")\nConsole.log2([1, 2, 3], '4')\n```" ], - "signature": "let assert3: (bool, 'a, 'b, 'c) => unit" + "signature": "let log2: ('a, 'b) => unit" }, { - "id": "Stdlib.Console.assert4", + "id": "Stdlib.Console.log3", "kind": "value", - "name": "assert4", + "name": "log3", "docstrings": [ - "`assert4(v1, v2, v3, v4)`. Like `assert_`, but with four arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert4(false, \"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.assert4(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + "`log3(v1, v2, v3)`. Like `log`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.log3(\"Hello\", \"World\", \"ReScript\")\nConsole.log3(\"One\", 2, #3)\n```" ], - "signature": "let assert4: (bool, 'a, 'b, 'c, 'd) => unit" + "signature": "let log3: ('a, 'b, 'c) => unit" }, { - "id": "Stdlib.Console.assert5", + "id": "Stdlib.Console.log4", "kind": "value", - "name": "assert5", + "name": "log4", "docstrings": [ - "`assert5(v1, v2, v3, v4, v5)`. Like `assert_`, but with five arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert5(false, \"Hello\", \"World\", \"JS\", '!', '!')\nConsole.assert5(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + "`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.log4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.log4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" ], - "signature": "let assert5: (bool, 'a, 'b, 'c, 'd, 'e) => unit" + "signature": "let log4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Stdlib.Console.assert6", + "id": "Stdlib.Console.log5", "kind": "value", - "name": "assert6", + "name": "log5", "docstrings": [ - "`assert6(v1, v2)`. Like `assert_`, but with six arguments.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assert6(false, \"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.assert6(value == 42, [1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + "`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.log5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.log5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" ], - "signature": "let assert6: (bool, 'a, 'b, 'c, 'd, 'e, 'f) => unit" + "signature": "let log5: ('a, 'b, 'c, 'd, 'e) => unit" }, { - "id": "Stdlib.Console.assertMany", + "id": "Stdlib.Console.log6", "kind": "value", - "name": "assertMany", + "name": "log6", "docstrings": [ - "`assertMany(assertion, arr)`. Like `assert_`, but variadic.\n\n## Examples\n\n```rescript\nlet value = 42\nConsole.assertMany(false, [\"Hello\", \"World\"])\nConsole.assertMany(value == 42, [1, 2, 3])\n```" + "`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.log6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.log6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" ], - "signature": "let assertMany: (bool, array<'a>) => unit" + "signature": "let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" }, { - "id": "Stdlib.Console.clear", + "id": "Stdlib.Console.logMany", "kind": "value", - "name": "clear", + "name": "logMany", "docstrings": [ - "`clear()` clears the console, if allowed.\n\nSee [`console.clear`](https://developer.mozilla.org/en-US/docs/Web/API/console/clear)\non MDN.\n\n## Examples\n\n```rescript\nConsole.clear()\n```" + "`logMany(arr)`. Like `log`, but variadic.\n\n## Examples\n\n```rescript\nConsole.logMany([\"Hello\", \"World\"])\nConsole.logMany([1, 2, 3])\n```" ], - "signature": "let clear: unit => unit" + "signature": "let logMany: array<'a> => unit" }, { - "id": "Stdlib.Console.count", + "id": "Stdlib.Console.table", "kind": "value", - "name": "count", + "name": "table", "docstrings": [ - "`count(label)` prints to the console the number of times it's been called with the given label.\n\nSee [`console.count`](https://developer.mozilla.org/en-US/docs/Web/API/console/count)\non MDN.\n\n## Examples\n\n```rescript\nConsole.count(\"rescript\")\n```" + "`table(object)` displays an tabular view of the object in the console.\n\nSee [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table)\non MDN.\n\n## Examples\n\n```rescript\nConsole.table({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" ], - "signature": "let count: string => unit" + "signature": "let table: 'a => unit" }, { - "id": "Stdlib.Console.countReset", + "id": "Stdlib.Console.time", "kind": "value", - "name": "countReset", + "name": "time", "docstrings": [ - "`countReset(label)` resets the count for the given label to 0.\n\nSee [`console.countReset`](https://developer.mozilla.org/en-US/docs/Web/API/console/countReset)\non MDN.\n\n## Examples\n\n```rescript\nConsole.countReset(\"rescript\")\n```" + "`time(label)` creates a timer to measure how long an operation takes. `label`\nmust be a unique name. Call `console.timeEnd` with the same `label` to print\noutput time.\n\nSee [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" ], - "signature": "let countReset: string => unit" + "signature": "let time: string => unit" }, { - "id": "Stdlib.Console.debug", + "id": "Stdlib.Console.timeEnd", "kind": "value", - "name": "debug", + "name": "timeEnd", "docstrings": [ - "`debug(value)` print a debug message to console.\n\nSee [`console.debug`](https://developer.mozilla.org/en-US/docs/Web/API/console/debug)\non MDN.\n\n## Examples\n\n```rescript\nConsole.debug(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.debug(obj)\n```" + "`timeEnd(label)` stops a timer created by `time`.\n\nSee [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" ], - "signature": "let debug: 'a => unit" + "signature": "let timeEnd: string => unit" }, { - "id": "Stdlib.Console.debug2", + "id": "Stdlib.Console.timeLog", "kind": "value", - "name": "debug2", + "name": "timeLog", "docstrings": [ - "`debug2(v1, v2)`. Like `debug`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.debug2(\"Hello\", \"World\")\nConsole.debug2([1, 2, 3], '4')\n```" + "`timeLog(label)` prints the current elapsed time of the given timer to the console.\n\nSee [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" ], - "signature": "let debug2: ('a, 'b) => unit" + "signature": "let timeLog: string => unit" }, { - "id": "Stdlib.Console.debug3", + "id": "Stdlib.Console.trace", "kind": "value", - "name": "debug3", + "name": "trace", "docstrings": [ - "`debug3(v1, v2, v3)`. Like `debug`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.debug3(\"Hello\", \"World\", \"ReScript\")\nConsole.debug3(\"One\", 2, #3)\n```" + "`trace()` print a stack trace to console.\n\nSee [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace)\non MDN.\n\n## Examples\n\n```rescript\nlet main = () => {\n Console.trace()\n}\nmain()\n// In the console, the following trace will be displayed:\n// main\n// \n```" ], - "signature": "let debug3: ('a, 'b, 'c) => unit" + "signature": "let trace: unit => unit" }, { - "id": "Stdlib.Console.debug4", + "id": "Stdlib.Console.warn", "kind": "value", - "name": "debug4", + "name": "warn", "docstrings": [ - "`debug4(v1, v2, v3, v4)`. Like `debug`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.debug4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.debug4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" + "`warn(value)` print a warning message to console.\n\nSee [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn)\non MDN.\n\n## Examples\n\n```rescript\nConsole.warn(\"Warning\")\nConsole.warn((\"Warning\", \"invalid number\"))\n```" ], - "signature": "let debug4: ('a, 'b, 'c, 'd) => unit" + "signature": "let warn: 'a => unit" }, { - "id": "Stdlib.Console.debug5", + "id": "Stdlib.Console.warn2", "kind": "value", - "name": "debug5", + "name": "warn2", "docstrings": [ - "`debug5(v1, v2, v3, v4, v5)`. Like `debug`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.debug5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.debug5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" + "`warn2(v1, v2)`. Like `warn`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.warn2(\"Hello\", \"World\")\nConsole.warn2([1, 2, 3], 4)\n```" ], - "signature": "let debug5: ('a, 'b, 'c, 'd, 'e) => unit" + "signature": "let warn2: ('a, 'b) => unit" }, { - "id": "Stdlib.Console.debug6", + "id": "Stdlib.Console.warn3", "kind": "value", - "name": "debug6", + "name": "warn3", "docstrings": [ - "`debug6(v1, v2, v3, v4, v5, v6)`. Like `debug`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.debug6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.debug6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + "`warn3(v1, v2, v3)`. Like `warn`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.warn3(\"Hello\", \"World\", \"ReScript\")\nConsole.warn3([1, 2, 3], #4, #5)\n```" ], - "signature": "let debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + "signature": "let warn3: ('a, 'b, 'c) => unit" }, { - "id": "Stdlib.Console.debugMany", + "id": "Stdlib.Console.warn4", "kind": "value", - "name": "debugMany", + "name": "warn4", "docstrings": [ - "`debugMany(arr)`. Like `debug`, but variadic.\n\n## Examples\n\n```rescript\nConsole.debugMany([\"Hello\", \"World\"])\nConsole.debugMany([1, 2, 3])\n```" + "`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.warn4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.warn4(#first, #second, #third, (\"fourth\"))\n```" ], - "signature": "let debugMany: array<'a> => unit" + "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" }, { - "id": "Stdlib.Console.dir", + "id": "Stdlib.Console.warn5", "kind": "value", - "name": "dir", + "name": "warn5", "docstrings": [ - "`dir(object)` displays an interactive view of the object in the console.\n\nSee [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir)\non MDN.\n\n## Examples\n\n```rescript\nConsole.dir({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" + "`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.warn5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.warn5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" ], - "signature": "let dir: 'a => unit" + "signature": "let warn5: ('a, 'b, 'c, 'd, 'e) => unit" }, { - "id": "Stdlib.Console.dirxml", + "id": "Stdlib.Console.warn6", "kind": "value", - "name": "dirxml", + "name": "warn6", "docstrings": [ - "`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console.\n\nSee [`console.dirxml`](https://developer.mozilla.org/en-US/docs/Web/API/console/dirxml)\non MDN." + "`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.warn6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.warn6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" ], - "signature": "let dirxml: 'a => unit" + "signature": "let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" }, { - "id": "Stdlib.Console.error", + "id": "Stdlib.Console.warnMany", "kind": "value", - "name": "error", + "name": "warnMany", "docstrings": [ - "`error(value)` prints an error message to console.\n\nSee [`console.error`](https://developer.mozilla.org/en-US/docs/Web/API/console/error)\non MDN.\n\n## Examples\n\n```rescript\nConsole.error(\"error message\")\nConsole.error((\"error\", \"invalid value\"))\n```" + "`warnMany(arr)`. Like `warn`, but variadic.\n\n## Examples\n\n```rescript\nConsole.warnMany([\"Hello\", \"World\"])\nConsole.warnMany([1, 2, 3])\n```" ], - "signature": "let error: 'a => unit" - }, + "signature": "let warnMany: array<'a> => unit" + } + ] + }, + "stdlib/bool": { + "id": "Stdlib.Bool", + "name": "Bool", + "docstrings": [ + "Functions for interacting with JavaScript booleans.\nSee: [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)" + ], + "items": [ { - "id": "Stdlib.Console.error2", - "kind": "value", - "name": "error2", + "id": "Stdlib.Bool.t", + "kind": "type", + "name": "t", "docstrings": [ - "`error(v1, v2)`. Like `error`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.error2(\"Error\", \"here\")\nConsole.error2((\"log\", \"error\"), \"message\")\n```" + "Type representing a boolean." ], - "signature": "let error2: ('a, 'b) => unit" + "signature": "type t = bool" }, { - "id": "Stdlib.Console.error3", + "id": "Stdlib.Bool.toString", "kind": "value", - "name": "error3", + "name": "toString", "docstrings": [ - "`error3(v1, v2, v3)`. Like `error`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.error3(\"Hello\", \"World\", \"!!!\")\nConsole.error3(#first, #second, #third)\n```" + "Converts a boolean to a string.\n\n## Examples\n```rescript\nBool.toString(true)->assertEqual(\"true\")\nBool.toString(false)->assertEqual(\"false\")\n```" ], - "signature": "let error3: ('a, 'b, 'c) => unit" + "signature": "let toString: bool => string" }, { - "id": "Stdlib.Console.error4", + "id": "Stdlib.Bool.fromString", "kind": "value", - "name": "error4", + "name": "fromString", "docstrings": [ - "`error4(v1, v2, v3, v4)`. Like `error`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.error4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.error4(#first, #second, #third, (\"fourth\"))\n```" + "Converts a string to a boolean.\n\n## Examples\n```rescript\nBool.fromString(\"true\")->assertEqual(Some(true))\nBool.fromString(\"false\")->assertEqual(Some(false))\nBool.fromString(\"notAValidBoolean\")->assertEqual(None)\n```" ], - "signature": "let error4: ('a, 'b, 'c, 'd) => unit" + "signature": "let fromString: string => option" }, { - "id": "Stdlib.Console.error5", + "id": "Stdlib.Bool.fromStringOrThrow", "kind": "value", - "name": "error5", + "name": "fromStringOrThrow", "docstrings": [ - "`error5(v1, v2, v3, v4, v5)`. Like `error`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.error5('e', 'r', 'r', 'o', 'r')\nConsole.error5(1, #second, #third, (\"fourth\"), 'c')\n```" + "Converts a string to a boolean.\nThrows an `Invalid_argument` exception if the string is not a valid boolean.\n\n## Examples\n```rescript\nBool.fromStringOrThrow(\"true\")->assertEqual(true)\nBool.fromStringOrThrow(\"false\")->assertEqual(false)\nswitch Bool.fromStringOrThrow(\"notAValidBoolean\") {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let error5: ('a, 'b, 'c, 'd, 'e) => unit" + "signature": "let fromStringOrThrow: string => bool" }, { - "id": "Stdlib.Console.error6", + "id": "Stdlib.Bool.fromStringExn", "kind": "value", - "name": "error6", + "name": "fromStringExn", "docstrings": [ - "`error6(v1, v2, v3, v4, v5, v6)`. Like `error`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.error6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.error6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + "Converts a string to a boolean.\nBeware, this function will throw an `Invalid_argument` exception \nif the string is not a valid boolean.\n\n## Examples\n```rescript\nBool.fromStringExn(\"true\")->assertEqual(true)\nBool.fromStringExn(\"false\")->assertEqual(false)\nswitch Bool.fromStringExn(\"notAValidBoolean\") {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```" ], - "signature": "let error6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + "signature": "let fromStringExn: string => bool", + "deprecated": "Use `fromStringOrThrow` instead" }, { - "id": "Stdlib.Console.group", + "id": "Stdlib.Bool.compare", "kind": "value", - "name": "group", - "docstrings": [ - "`group(label)` creates a new \"group\" level with the given label.\n\nSee [`console.group`](https://developer.mozilla.org/en-US/docs/Web/API/console/group)\non MDN.\n\n## Example\n\n```rescript\nConsole.group(\"first group\")\nConsole.group(\"second group\")\nConsole.log(\"a message on the second level\")\nConsole.groupEnd()\nConsole.log(\"a message message on the first level\")\nConsole.groupEnd()\n```" - ], - "signature": "let group: string => unit" + "name": "compare", + "docstrings": [], + "signature": "let compare: (bool, bool) => Ordering.t" }, { - "id": "Stdlib.Console.groupCollapsed", + "id": "Stdlib.Bool.equal", "kind": "value", - "name": "groupCollapsed", + "name": "equal", + "docstrings": [], + "signature": "let equal: (bool, bool) => bool" + } + ] + }, + "stdlib/bigint": { + "id": "Stdlib.BigInt", + "name": "BigInt", + "docstrings": [], + "items": [ + { + "id": "Stdlib.BigInt.t", + "kind": "type", + "name": "t", "docstrings": [ - "`groupCollapsed(label)`. Like `group` but collapses the group initially.\n\nSee [`console.groupCollapsed`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupCollapsed)\non MDN." + "Type representing a bigint." ], - "signature": "let groupCollapsed: string => unit" + "signature": "type t = bigint" }, { - "id": "Stdlib.Console.groupEnd", + "id": "Stdlib.BigInt.asIntN", "kind": "value", - "name": "groupEnd", - "docstrings": [ - "`groupEnd()` ends the current group.\n\nSee [`console.groupEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/groupEnd)\non MDN." - ], - "signature": "let groupEnd: unit => unit" + "name": "asIntN", + "docstrings": [], + "signature": "let asIntN: (~width: int, bigint) => bigint" }, { - "id": "Stdlib.Console.errorMany", + "id": "Stdlib.BigInt.asUintN", "kind": "value", - "name": "errorMany", - "docstrings": [ - "`errorMany(arr)`. Like `error`, but variadic.\n\n## Examples\n\n```rescript\nConsole.errorMany([\"Hello\", \"World\"])\nConsole.errorMany([1, 2, 3])\n```" - ], - "signature": "let errorMany: array<'a> => unit" + "name": "asUintN", + "docstrings": [], + "signature": "let asUintN: (~width: int, bigint) => bigint" }, { - "id": "Stdlib.Console.info", + "id": "Stdlib.BigInt.fromStringOrThrow", "kind": "value", - "name": "info", + "name": "fromStringOrThrow", "docstrings": [ - "`info(value)` print an informational message to console.\n\nSee [`console.info`](https://developer.mozilla.org/en-US/docs/Web/API/console/info)\non MDN.\n\n## Examples\n\n```rescript\nConsole.info(\"Information\")\nConsole.info((\"Hello\", \"JS\"))\n```" + "Parses the given `string` into a `bigint` using JavaScript semantics. Return the\nnumber as a `bigint` if successfully parsed. Throws a syntax exception otherwise.\n\n## Examples\n\n```rescript\nBigInt.fromStringOrThrow(\"123\")->assertEqual(123n)\n\nBigInt.fromStringOrThrow(\"\")->assertEqual(0n)\n\nBigInt.fromStringOrThrow(\"0x11\")->assertEqual(17n)\n\nBigInt.fromStringOrThrow(\"0b11\")->assertEqual(3n)\n\nBigInt.fromStringOrThrow(\"0o11\")->assertEqual(9n)\n\n/* catch exception */\nswitch BigInt.fromStringOrThrow(\"a\") {\n| exception JsExn(_error) => assert(true)\n| _bigInt => assert(false)\n}\n```" ], - "signature": "let info: 'a => unit" + "signature": "let fromStringOrThrow: string => bigint" }, { - "id": "Stdlib.Console.info2", + "id": "Stdlib.BigInt.fromString", "kind": "value", - "name": "info2", + "name": "fromString", "docstrings": [ - "`info2(v1, v2)`. Like `info`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.info2(\"Info\", \"failed to download\")\nConsole.info2(#info, {\"name\": \"ReScript\"})\n```" + "Parses the given `string` into a `bigint` using JavaScript semantics. Returns \n`Some(bigint)` if the string can be parsed, `None` otherwise.\n\n## Examples\n\n```rescript\nBigInt.fromString(\"123\")->assertEqual(Some(123n))\n\nBigInt.fromString(\"\")->assertEqual(Some(0n))\n\nBigInt.fromString(\"0x11\")->assertEqual(Some(17n))\n\nBigInt.fromString(\"0b11\")->assertEqual(Some(3n))\n\nBigInt.fromString(\"0o11\")->assertEqual(Some(9n))\n\nBigInt.fromString(\"invalid\")->assertEqual(None)\n```" ], - "signature": "let info2: ('a, 'b) => unit" + "signature": "let fromString: string => option" }, { - "id": "Stdlib.Console.info3", + "id": "Stdlib.BigInt.fromStringExn", "kind": "value", - "name": "info3", + "name": "fromStringExn", + "docstrings": [], + "signature": "let fromStringExn: string => bigint", + "deprecated": "Use `fromStringOrThrow` instead" + }, + { + "id": "Stdlib.BigInt.fromInt", + "kind": "value", + "name": "fromInt", + "docstrings": [], + "signature": "let fromInt: int => bigint" + }, + { + "id": "Stdlib.BigInt.fromFloatOrThrow", + "kind": "value", + "name": "fromFloatOrThrow", "docstrings": [ - "`info3(v1, v2, v3)`. Like `info`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.info3(\"Hello\", \"World\", \"ReScript\")\nConsole.info3([1, 2, 3], #4, #5)\n```" + "Converts a `float` to a `bigint` using JavaScript semantics. \nThrows an exception if the float is not an integer or is infinite/NaN.\n\n## Examples\n\n```rescript\nBigInt.fromFloatOrThrow(123.0)->assertEqual(123n)\n\nBigInt.fromFloatOrThrow(0.0)->assertEqual(0n)\n\nBigInt.fromFloatOrThrow(-456.0)->assertEqual(-456n)\n\n/* This will throw an exception */\nswitch BigInt.fromFloatOrThrow(123.5) {\n| exception JsExn(_error) => assert(true)\n| _bigInt => assert(false)\n}\n```" ], - "signature": "let info3: ('a, 'b, 'c) => unit" + "signature": "let fromFloatOrThrow: float => bigint" + }, + { + "id": "Stdlib.BigInt.fromFloat", + "kind": "value", + "name": "fromFloat", + "docstrings": [], + "signature": "let fromFloat: float => option" }, { - "id": "Stdlib.Console.info4", + "id": "Stdlib.BigInt.toString", "kind": "value", - "name": "info4", + "name": "toString", "docstrings": [ - "`info4(v1, v2, v3, v4)`. Like `info`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.info4(\"Hello\", \"World\", \"ReScript\", '!')\nConsole.info4([1, 2, 3], #4, #5, #lastinfo)\n```" + "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 info4: ('a, 'b, 'c, 'd) => unit" + "signature": "let toString: (bigint, ~radix: int=?) => string" }, { - "id": "Stdlib.Console.info5", + "id": "Stdlib.BigInt.toStringWithRadix", "kind": "value", - "name": "info5", - "docstrings": [ - "`info5(v1, v2, v3, v4, v5)`. Like `info`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.info5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.info5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let info5: ('a, 'b, 'c, 'd, 'e) => unit" + "name": "toStringWithRadix", + "docstrings": [], + "signature": "let toStringWithRadix: (bigint, ~radix: int) => string", + "deprecated": "Use `toString` with `~radix` instead" }, { - "id": "Stdlib.Console.info6", + "id": "Stdlib.BigInt.toLocaleString", "kind": "value", - "name": "info6", + "name": "toLocaleString", "docstrings": [ - "`info6(v1, v2, v3, v4, v5, v6)`. Like `info`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.info6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.info6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" + "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 info6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + "signature": "let toLocaleString: bigint => string" }, { - "id": "Stdlib.Console.infoMany", + "id": "Stdlib.BigInt.toFloat", "kind": "value", - "name": "infoMany", - "docstrings": [ - "`infoMany(arr)`. Like `info`, but variadic.\n\n## Examples\n\n```rescript\nConsole.infoMany([\"Hello\", \"World\"])\nConsole.infoMany([1, 2, 3])\n```" - ], - "signature": "let infoMany: array<'a> => unit" + "name": "toFloat", + "docstrings": [], + "signature": "let toFloat: bigint => float" }, { - "id": "Stdlib.Console.log", + "id": "Stdlib.BigInt.toInt", "kind": "value", - "name": "log", - "docstrings": [ - "`log(value)` print a message to console.\n\nSee [`console.log`](https://developer.mozilla.org/en-US/docs/Web/API/console/log)\non MDN.\n\n## Examples\n\n```rescript\nConsole.log(\"Hello\")\nlet obj = {\"name\": \"ReScript\", \"version\": 10}\nConsole.log(obj)\n```" - ], - "signature": "let log: 'a => unit" + "name": "toInt", + "docstrings": [], + "signature": "let toInt: bigint => int" }, { - "id": "Stdlib.Console.log2", + "id": "Stdlib.BigInt.add", "kind": "value", - "name": "log2", - "docstrings": [ - "`log2(v1, v2)`. Like `log`, but with two arguments.\n\n## Examples\n\n```rescript\nConsole.log2(\"Hello\", \"World\")\nConsole.log2([1, 2, 3], '4')\n```" - ], - "signature": "let log2: ('a, 'b) => unit" + "name": "add", + "docstrings": [], + "signature": "let add: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.log3", + "id": "Stdlib.BigInt.sub", "kind": "value", - "name": "log3", - "docstrings": [ - "`log3(v1, v2, v3)`. Like `log`, but with three arguments.\n\n## Examples\n\n```rescript\nConsole.log3(\"Hello\", \"World\", \"ReScript\")\nConsole.log3(\"One\", 2, #3)\n```" - ], - "signature": "let log3: ('a, 'b, 'c) => unit" + "name": "sub", + "docstrings": [], + "signature": "let sub: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.log4", + "id": "Stdlib.BigInt.mul", "kind": "value", - "name": "log4", - "docstrings": [ - "`log4(v1, v2, v3, v4)`. Like `log`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.log4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.log4([1, 2], (3, 4), [#5, #6], #\"polyvar\")\n```" - ], - "signature": "let log4: ('a, 'b, 'c, 'd) => unit" + "name": "mul", + "docstrings": [], + "signature": "let mul: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.log5", + "id": "Stdlib.BigInt.div", "kind": "value", - "name": "log5", - "docstrings": [ - "`log5(v1, v2, v3, v4, v5)`. Like `log`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.log5(\"Hello\", \"World\", \"JS\", '!', '!')\nConsole.log5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let log5: ('a, 'b, 'c, 'd, 'e) => unit" + "name": "div", + "docstrings": [], + "signature": "let div: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.log6", + "id": "Stdlib.BigInt.mod", "kind": "value", - "name": "log6", - "docstrings": [ - "`log6(v1, v2, v3, v4, v5, v6)`. Like `log`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.log6(\"Hello\", \"World\", \"JS\", '!', '!', '?')\nConsole.log6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let log6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + "name": "mod", + "docstrings": [], + "signature": "let mod: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.logMany", + "id": "Stdlib.BigInt.bitwiseAnd", "kind": "value", - "name": "logMany", - "docstrings": [ - "`logMany(arr)`. Like `log`, but variadic.\n\n## Examples\n\n```rescript\nConsole.logMany([\"Hello\", \"World\"])\nConsole.logMany([1, 2, 3])\n```" - ], - "signature": "let logMany: array<'a> => unit" + "name": "bitwiseAnd", + "docstrings": [], + "signature": "let bitwiseAnd: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.table", + "id": "Stdlib.BigInt.bitwiseOr", "kind": "value", - "name": "table", - "docstrings": [ - "`table(object)` displays an tabular view of the object in the console.\n\nSee [`console.table`](https://developer.mozilla.org/en-US/docs/Web/API/console/table)\non MDN.\n\n## Examples\n\n```rescript\nConsole.table({\"language\": \"rescript\", \"version\": \"10.1.2\"})\n```" - ], - "signature": "let table: 'a => unit" + "name": "bitwiseOr", + "docstrings": [], + "signature": "let bitwiseOr: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.time", + "id": "Stdlib.BigInt.bitwiseXor", "kind": "value", - "name": "time", - "docstrings": [ - "`time(label)` creates a timer to measure how long an operation takes. `label`\nmust be a unique name. Call `console.timeEnd` with the same `label` to print\noutput time.\n\nSee [`console.time`](https://developer.mozilla.org/en-US/docs/Web/API/console/time)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let time: string => unit" + "name": "bitwiseXor", + "docstrings": [], + "signature": "let bitwiseXor: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.timeEnd", + "id": "Stdlib.BigInt.bitwiseNot", "kind": "value", - "name": "timeEnd", - "docstrings": [ - "`timeEnd(label)` stops a timer created by `time`.\n\nSee [`console.timeEnd`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeEnd)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let timeEnd: string => unit" + "name": "bitwiseNot", + "docstrings": [], + "signature": "let bitwiseNot: bigint => bigint" }, { - "id": "Stdlib.Console.timeLog", + "id": "Stdlib.BigInt.shiftLeft", "kind": "value", - "name": "timeLog", - "docstrings": [ - "`timeLog(label)` prints the current elapsed time of the given timer to the console.\n\nSee [`console.timeLog`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeLog)\non MDN.\n\n## Examples\n\n```rescript\nConsole.time(\"for_time\")\nfor x in 3 downto 1 {\n Console.log(x)\n Console.timeLog(\"for_time\")\n}\nConsole.timeEnd(\"for_time\")\n```" - ], - "signature": "let timeLog: string => unit" + "name": "shiftLeft", + "docstrings": [], + "signature": "let shiftLeft: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.trace", + "id": "Stdlib.BigInt.shiftRight", "kind": "value", - "name": "trace", - "docstrings": [ - "`trace()` print a stack trace to console.\n\nSee [`console.trace`](https://developer.mozilla.org/en-US/docs/Web/API/console/trace)\non MDN.\n\n## Examples\n\n```rescript\nlet main = () => {\n Console.trace()\n}\nmain()\n// In the console, the following trace will be displayed:\n// main\n// \n```" - ], - "signature": "let trace: unit => unit" + "name": "shiftRight", + "docstrings": [], + "signature": "let shiftRight: (bigint, bigint) => bigint" }, { - "id": "Stdlib.Console.warn", + "id": "Stdlib.BigInt.ignore", "kind": "value", - "name": "warn", + "name": "ignore", "docstrings": [ - "`warn(value)` print a warning message to console.\n\nSee [`console.warn`](https://developer.mozilla.org/en-US/docs/Web/API/console/warn)\non MDN.\n\n## Examples\n\n```rescript\nConsole.warn(\"Warning\")\nConsole.warn((\"Warning\", \"invalid number\"))\n```" + "`ignore(bigint)` ignores the provided bigint and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], - "signature": "let warn: 'a => unit" + "signature": "let ignore: bigint => unit" }, { - "id": "Stdlib.Console.warn2", + "id": "Stdlib.BigInt.land", "kind": "value", - "name": "warn2", - "docstrings": [ - "`warn2(v1, v2)`. Like `warn`, but two arguments.\n\n## Examples\n\n```rescript\nConsole.warn2(\"Hello\", \"World\")\nConsole.warn2([1, 2, 3], 4)\n```" - ], - "signature": "let warn2: ('a, 'b) => unit" + "name": "land", + "docstrings": [], + "signature": "let land: (bigint, bigint) => bigint", + "deprecated": "Use `&` operator or `bitwiseAnd` instead." }, { - "id": "Stdlib.Console.warn3", + "id": "Stdlib.BigInt.lor", "kind": "value", - "name": "warn3", - "docstrings": [ - "`warn3(v1, v2, v3)`. Like `warn`, but three arguments.\n\n## Examples\n\n```rescript\nConsole.warn3(\"Hello\", \"World\", \"ReScript\")\nConsole.warn3([1, 2, 3], #4, #5)\n```" - ], - "signature": "let warn3: ('a, 'b, 'c) => unit" + "name": "lor", + "docstrings": [], + "signature": "let lor: (bigint, bigint) => bigint", + "deprecated": "Use `bitwiseOr` instead." }, { - "id": "Stdlib.Console.warn4", + "id": "Stdlib.BigInt.lxor", "kind": "value", - "name": "warn4", - "docstrings": [ - "`warn4(v1, v2, v3, v4)`. Like `warn`, but with four arguments.\n\n## Examples\n\n```rescript\nConsole.warn4(\"Hello\", \"World\", \"ReScript\", \"!!!\")\nConsole.warn4(#first, #second, #third, (\"fourth\"))\n```" - ], - "signature": "let warn4: ('a, 'b, 'c, 'd) => unit" + "name": "lxor", + "docstrings": [], + "signature": "let lxor: (bigint, bigint) => bigint", + "deprecated": "Use `^` operator or `bitwiseXor` instead." }, { - "id": "Stdlib.Console.warn5", + "id": "Stdlib.BigInt.lnot", "kind": "value", - "name": "warn5", - "docstrings": [ - "`warn5(v1, v2, v3, v4, v5)`. Like `warn`, but with five arguments.\n\n## Examples\n\n```rescript\nConsole.warn5(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\")\nConsole.warn5([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"})\n```" - ], - "signature": "let warn5: ('a, 'b, 'c, 'd, 'e) => unit" + "name": "lnot", + "docstrings": [], + "signature": "let lnot: bigint => bigint", + "deprecated": "Use `~` operator or `bitwiseNot` instead." }, { - "id": "Stdlib.Console.warn6", + "id": "Stdlib.BigInt.lsl", "kind": "value", - "name": "warn6", - "docstrings": [ - "`warn6(v1, v2, v3, v4, v5, v6)`. Like `warn`, but with six arguments.\n\n## Examples\n\n```rescript\nConsole.warn6(\"Hello\", \"World\", \"from\", \"JS\", \"!!!\", '!')\nConsole.warn6([1, 2], (3, 4), [#5, #6], #\"polyvar\", {\"name\": \"ReScript\"}, 42)\n```" - ], - "signature": "let warn6: ('a, 'b, 'c, 'd, 'e, 'f) => unit" + "name": "lsl", + "docstrings": [], + "signature": "let lsl: (bigint, bigint) => bigint", + "deprecated": "Use `<<` operator or `shiftLeft` instead." }, { - "id": "Stdlib.Console.warnMany", + "id": "Stdlib.BigInt.asr", "kind": "value", - "name": "warnMany", - "docstrings": [ - "`warnMany(arr)`. Like `warn`, but variadic.\n\n## Examples\n\n```rescript\nConsole.warnMany([\"Hello\", \"World\"])\nConsole.warnMany([1, 2, 3])\n```" - ], - "signature": "let warnMany: array<'a> => unit" + "name": "asr", + "docstrings": [], + "signature": "let asr: (bigint, bigint) => bigint", + "deprecated": "Use `>>` operator or `shiftRight` instead." } ] }, "stdlib/array": { "id": "Stdlib.Array", "name": "Array", - "docstrings": [], + "docstrings": [ + "A mutable array.\n\nCompiles to a regular JavaScript array." + ], "items": [ + { + "id": "Stdlib.Array.t", + "kind": "type", + "name": "t", + "docstrings": [ + "Type representing an array of value `'a`." + ], + "signature": "type t<'a> = array<'a>" + }, + { + "id": "Stdlib.Array.arrayLike", + "kind": "type", + "name": "arrayLike", + "docstrings": [], + "signature": "type arrayLike<'a>" + }, { "id": "Stdlib.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: Stdlib__Iterator.t<'a> => array<'a>" + "signature": "let fromIterator: Iterator.t<'a> => array<'a>" }, { "id": "Stdlib.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": "Stdlib.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": "Stdlib.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>" }, @@ -9224,7 +11005,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>" }, @@ -9240,7 +11021,7 @@ "kind": "value", "name": "compare", "docstrings": [], - "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Stdlib__Ordering.t,\n) => Stdlib__Ordering.t" + "signature": "let compare: (\n array<'a>,\n array<'a>,\n ('a, 'a) => Ordering.t,\n) => Ordering.t" }, { "id": "Stdlib.Array.isArray", @@ -9254,7 +11035,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" }, @@ -9284,7 +11065,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" }, @@ -9293,7 +11074,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" }, @@ -9302,7 +11083,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" }, @@ -9311,7 +11092,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>" }, @@ -9320,7 +11101,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" }, @@ -9329,7 +11110,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" }, @@ -9338,7 +11119,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" }, @@ -9347,7 +11128,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>" }, @@ -9356,18 +11137,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) => Stdlib__Ordering.t) => array<'a>" + "signature": "let toSorted: (array<'a>, ('a, 'a) => Ordering.t) => array<'a>" }, { "id": "Stdlib.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) => Stdlib__Ordering.t) => unit" + "signature": "let sort: (array<'a>, ('a, 'a) => Ordering.t) => unit" }, { "id": "Stdlib.Array.splice", @@ -9383,6 +11164,15 @@ "docstrings": [], "signature": "let toSpliced: (\n array<'a>,\n ~start: int,\n ~remove: int,\n ~insert: array<'a>,\n) => array<'a>" }, + { + "id": "Stdlib.Array.removeInPlace", + "kind": "value", + "name": "removeInPlace", + "docstrings": [ + "`removeInPlace(array, index)` removes the item at the specified `index` from `array`.\n\nBeware this will *mutate* the array.\n\n## Examples\n\n```rescript\nlet array = []\narray->Array.removeInPlace(0)\nassertEqual(array, []) // Removing from an empty array does nothing\n\nlet array2 = [\"Hello\", \"Hi\", \"Good bye\"]\narray2->Array.removeInPlace(1)\nassertEqual(array2, [\"Hello\", \"Good bye\"]) // Removes the item at index 1\n```" + ], + "signature": "let removeInPlace: (array<'a>, int) => unit" + }, { "id": "Stdlib.Array.with", "kind": "value", @@ -9395,7 +11185,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" }, @@ -9404,7 +11194,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" }, @@ -9413,7 +11203,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>" }, @@ -9431,7 +11221,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>" }, @@ -9440,7 +11230,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" }, @@ -9449,7 +11239,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" }, @@ -9458,7 +11248,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" }, @@ -9474,7 +11264,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" }, @@ -9483,7 +11273,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" @@ -9493,7 +11283,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" }, @@ -9502,7 +11292,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" @@ -9533,7 +11323,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>" }, @@ -9542,7 +11332,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>" }, @@ -9551,7 +11341,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>" }, @@ -9560,7 +11350,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" }, @@ -9576,7 +11366,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" }, @@ -9585,7 +11375,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" }, @@ -9594,7 +11384,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>" }, @@ -9603,7 +11393,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>" }, @@ -9612,7 +11402,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>" }, @@ -9621,16 +11411,34 @@ "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>" }, + { + "id": "Stdlib.Array.findLast", + "kind": "value", + "name": "findLast", + "docstrings": [ + "`findLast(array, checker)` returns the last element of `array` where the provided `checker` function returns true.\n\nSee [`Array.findLast`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast) on MDN.\n\n## Examples\n\n```rescript\nlet array = [1, 2, 3]\n\narray\n->Array.findLast(item => item > 0)\n->assertEqual(Some(3))\n```" + ], + "signature": "let findLast: (array<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.Array.findLastWithIndex", + "kind": "value", + "name": "findLastWithIndex", + "docstrings": [ + "`findLastWithIndex(array, checker)` returns the last element of `array` where the provided `checker` function returns true.\n\nSee [`Array.findLast`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast) on MDN.\n\n## Examples\n\n```rescript\nlet array = [1, 2, 3]\n\narray\n->Array.findLastWithIndex((item, index) => index < 2 && item > 0)\n->assertEqual(Some(2))\n```" + ], + "signature": "let findLastWithIndex: (array<'a>, ('a, int) => bool) => option<'a>" + }, { "id": "Stdlib.Array.findIndex", "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" }, @@ -9639,10 +11447,28 @@ "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" }, + { + "id": "Stdlib.Array.findLastIndex", + "kind": "value", + "name": "findLastIndex", + "docstrings": [ + "`findLastIndex(array, checker)` returns the index of the last element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findLastIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findLastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript, ReScript]\n\narray\n->Array.findLastIndex(item => item == ReScript)\n->assertEqual(2)\n\narray->Array.findLastIndex(item => item == TypeScript)\n->assertEqual(-1)\n```" + ], + "signature": "let findLastIndex: (array<'a>, 'a => bool) => int" + }, + { + "id": "Stdlib.Array.findLastIndexWithIndex", + "kind": "value", + "name": "findLastIndexWithIndex", + "docstrings": [ + "`findLastIndexWithIndex(array, checker)` returns the index of the last element of `array` where the provided `checker` function returns true.\n\nReturns `-1` if the item does not exist. Consider using `Array.findLastIndexOpt` if you want an option instead (where `-1` would be `None`).\n\nSee [`Array.findLastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex) on MDN.\n\n## Examples\n\n```rescript\ntype languages = ReScript | TypeScript | JavaScript\n\nlet array = [ReScript, JavaScript, JavaScript, ReScript]\n\nlet isReScriptLast = array->Array.findLastIndexWithIndex((item, index) => index === 3 && item == ReScript)\nlet isTypeScriptLast = array->Array.findLastIndexWithIndex((item, index) => index === 3 && item == TypeScript)\n\nassertEqual(isReScriptLast, 3)\nassertEqual(isTypeScriptLast, -1)\n```" + ], + "signature": "let findLastIndexWithIndex: (array<'a>, ('a, int) => bool) => int" + }, { "id": "Stdlib.Array.forEach", "kind": "value", @@ -9657,7 +11483,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" }, @@ -9666,7 +11492,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>" }, @@ -9675,7 +11501,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>" }, @@ -9684,7 +11510,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" }, @@ -9693,7 +11519,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" }, @@ -9702,7 +11528,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" }, @@ -9711,7 +11537,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" }, @@ -9720,7 +11546,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" }, @@ -9729,7 +11555,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" }, @@ -9738,7 +11564,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>" }, @@ -9747,7 +11573,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" }, @@ -9756,21 +11582,21 @@ "kind": "value", "name": "getSymbol", "docstrings": [], - "signature": "let getSymbol: (array<'a>, Stdlib__Symbol.t) => option<'b>" + "signature": "let getSymbol: (array<'a>, Symbol.t) => option<'b>" }, { "id": "Stdlib.Array.getSymbolUnsafe", "kind": "value", "name": "getSymbolUnsafe", "docstrings": [], - "signature": "let getSymbolUnsafe: (array<'a>, Stdlib__Symbol.t) => 'b" + "signature": "let getSymbolUnsafe: (array<'a>, Symbol.t) => 'b" }, { "id": "Stdlib.Array.setSymbol", "kind": "value", "name": "setSymbol", "docstrings": [], - "signature": "let setSymbol: (array<'a>, Stdlib__Symbol.t, 'b) => unit" + "signature": "let setSymbol: (array<'a>, Symbol.t, 'b) => unit" }, { "id": "Stdlib.Array.getUnsafe", @@ -9781,12 +11607,22 @@ ], "signature": "let getUnsafe: (array<'a>, int) => 'a" }, + { + "id": "Stdlib.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": "Stdlib.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" }, @@ -9795,16 +11631,25 @@ "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" }, + { + "id": "Stdlib.Array.findLastIndexOpt", + "kind": "value", + "name": "findLastIndexOpt", + "docstrings": [ + "`findIndexOpt(array, checker)` returns the index of the last element of `array` where the provided `checker` function returns true.\n\nReturns `None` if no item matches.\n\nSee [`Array.findLastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex) on MDN.\n\n## Examples\n\n```rescript\nlet array = [\"hello\", \"world\", \"!\"]\n\narray\n->Array.findLastIndexOpt(item => item->String.includes(\"o\"))\n->assertEqual(Some(1))\n```" + ], + "signature": "let findLastIndexOpt: (array<'a>, 'a => bool) => option" + }, { "id": "Stdlib.Array.toReversed", "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>" }, @@ -9813,7 +11658,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>" }, @@ -9822,7 +11667,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>" }, @@ -9831,7 +11676,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>" }, @@ -9840,7 +11685,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" }, @@ -9849,7 +11694,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>" }, @@ -9858,7 +11703,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>" }, @@ -9867,7 +11712,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>" }, @@ -9876,7 +11721,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>" }, @@ -9885,10 +11730,31 @@ "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>" + }, + { + "id": "Stdlib.Array.ignore", + "kind": "value", + "name": "ignore", + "docstrings": [ + "`ignore(array)` ignores the provided array and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." + ], + "signature": "let ignore: array<'a> => unit" } ] + }, + "stdlib/intervalid": { + "id": "Stdlib.IntervalId", + "name": "IntervalId", + "docstrings": [], + "items": [] + }, + "stdlib/timeoutid": { + "id": "Stdlib.TimeoutId", + "name": "TimeoutId", + "docstrings": [], + "items": [] } -} +} \ No newline at end of file diff --git a/data/api/v12.0.0/toc_tree.json b/data/api/v12.0.0/toc_tree.json index 4ab479b89..509e0d55b 100644 --- a/data/api/v12.0.0/toc_tree.json +++ b/data/api/v12.0.0/toc_tree.json @@ -1 +1 @@ -{"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 +{"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":[]}]},"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":"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":[]}]},"stdlib":{"name":"Stdlib","path":["stdlib"],"children":[{"name":"BigUint64Array","path":["stdlib","biguint64array"],"children":[{"name":"Constants","path":["stdlib","biguint64array","constants"],"children":[]}]},{"name":"BigInt64Array","path":["stdlib","bigint64array"],"children":[{"name":"Constants","path":["stdlib","bigint64array","constants"],"children":[]}]},{"name":"Uint8ClampedArray","path":["stdlib","uint8clampedarray"],"children":[{"name":"Constants","path":["stdlib","uint8clampedarray","constants"],"children":[]}]},{"name":"Uint32Array","path":["stdlib","uint32array"],"children":[{"name":"Constants","path":["stdlib","uint32array","constants"],"children":[]}]},{"name":"Uint16Array","path":["stdlib","uint16array"],"children":[{"name":"Constants","path":["stdlib","uint16array","constants"],"children":[]}]},{"name":"Uint8Array","path":["stdlib","uint8array"],"children":[{"name":"Constants","path":["stdlib","uint8array","constants"],"children":[]}]},{"name":"Int32Array","path":["stdlib","int32array"],"children":[{"name":"Constants","path":["stdlib","int32array","constants"],"children":[]}]},{"name":"Int16Array","path":["stdlib","int16array"],"children":[{"name":"Constants","path":["stdlib","int16array","constants"],"children":[]}]},{"name":"Int8Array","path":["stdlib","int8array"],"children":[{"name":"Constants","path":["stdlib","int8array","constants"],"children":[]}]},{"name":"Float64Array","path":["stdlib","float64array"],"children":[{"name":"Constants","path":["stdlib","float64array","constants"],"children":[]}]},{"name":"Float32Array","path":["stdlib","float32array"],"children":[{"name":"Constants","path":["stdlib","float32array","constants"],"children":[]}]},{"name":"TypedArray","path":["stdlib","typedarray"],"children":[]},{"name":"ArrayBuffer","path":["stdlib","arraybuffer"],"children":[]},{"name":"WeakSet","path":["stdlib","weakset"],"children":[]},{"name":"Set","path":["stdlib","set"],"children":[]},{"name":"WeakMap","path":["stdlib","weakmap"],"children":[]},{"name":"Map","path":["stdlib","map"],"children":[]},{"name":"AsyncIterator","path":["stdlib","asynciterator"],"children":[]},{"name":"Iterator","path":["stdlib","iterator"],"children":[]},{"name":"Type","path":["stdlib","type"],"children":[{"name":"Classify","path":["stdlib","type","classify"],"children":[]}]},{"name":"Symbol","path":["stdlib","symbol"],"children":[]},{"name":"String","path":["stdlib","string"],"children":[]},{"name":"Result","path":["stdlib","result"],"children":[]},{"name":"RegExp","path":["stdlib","regexp"],"children":[{"name":"Result","path":["stdlib","regexp","result"],"children":[]}]},{"name":"Promise","path":["stdlib","promise"],"children":[]},{"name":"Pair","path":["stdlib","pair"],"children":[]},{"name":"Ordering","path":["stdlib","ordering"],"children":[]},{"name":"Option","path":["stdlib","option"],"children":[]},{"name":"Object","path":["stdlib","object"],"children":[]},{"name":"Nullable","path":["stdlib","nullable"],"children":[]},{"name":"Null","path":["stdlib","null"],"children":[]},{"name":"Math","path":["stdlib","math"],"children":[{"name":"Int","path":["stdlib","math","int"],"children":[]},{"name":"Constants","path":["stdlib","math","constants"],"children":[]}]},{"name":"List","path":["stdlib","list"],"children":[]},{"name":"Lazy","path":["stdlib","lazy"],"children":[]},{"name":"JSON","path":["stdlib","json"],"children":[{"name":"Decode","path":["stdlib","json","decode"],"children":[]},{"name":"Encode","path":["stdlib","json","encode"],"children":[]},{"name":"Classify","path":["stdlib","json","classify"],"children":[]}]},{"name":"JsExn","path":["stdlib","jsexn"],"children":[]},{"name":"JsError","path":["stdlib","jserror"],"children":[{"name":"URIError","path":["stdlib","jserror","urierror"],"children":[]},{"name":"TypeError","path":["stdlib","jserror","typeerror"],"children":[]},{"name":"SyntaxError","path":["stdlib","jserror","syntaxerror"],"children":[]},{"name":"ReferenceError","path":["stdlib","jserror","referenceerror"],"children":[]},{"name":"RangeError","path":["stdlib","jserror","rangeerror"],"children":[]},{"name":"EvalError","path":["stdlib","jserror","evalerror"],"children":[]}]},{"name":"Intl","path":["stdlib","intl"],"children":[{"name":"Segments","path":["stdlib","intl","segments"],"children":[]},{"name":"Segmenter","path":["stdlib","intl","segmenter"],"children":[]},{"name":"RelativeTimeFormat","path":["stdlib","intl","relativetimeformat"],"children":[]},{"name":"PluralRules","path":["stdlib","intl","pluralrules"],"children":[]},{"name":"NumberFormat","path":["stdlib","intl","numberformat"],"children":[{"name":"Grouping","path":["stdlib","intl","numberformat","grouping"],"children":[]}]},{"name":"Locale","path":["stdlib","intl","locale"],"children":[]},{"name":"ListFormat","path":["stdlib","intl","listformat"],"children":[]},{"name":"DateTimeFormat","path":["stdlib","intl","datetimeformat"],"children":[]},{"name":"Collator","path":["stdlib","intl","collator"],"children":[]},{"name":"Common","path":["stdlib","intl","common"],"children":[]}]},{"name":"Int","path":["stdlib","int"],"children":[{"name":"Ref","path":["stdlib","int","ref"],"children":[]},{"name":"Constants","path":["stdlib","int","constants"],"children":[]}]},{"name":"Float","path":["stdlib","float"],"children":[{"name":"Constants","path":["stdlib","float","constants"],"children":[]}]},{"name":"Error","path":["stdlib","error"],"children":[{"name":"URIError","path":["stdlib","error","urierror"],"children":[]},{"name":"TypeError","path":["stdlib","error","typeerror"],"children":[]},{"name":"SyntaxError","path":["stdlib","error","syntaxerror"],"children":[]},{"name":"ReferenceError","path":["stdlib","error","referenceerror"],"children":[]},{"name":"RangeError","path":["stdlib","error","rangeerror"],"children":[]},{"name":"EvalError","path":["stdlib","error","evalerror"],"children":[]}]},{"name":"Exn","path":["stdlib","exn"],"children":[]},{"name":"Dict","path":["stdlib","dict"],"children":[]},{"name":"Date","path":["stdlib","date"],"children":[{"name":"UTC","path":["stdlib","date","utc"],"children":[]}]},{"name":"DataView","path":["stdlib","dataview"],"children":[]},{"name":"Console","path":["stdlib","console"],"children":[]},{"name":"Bool","path":["stdlib","bool"],"children":[]},{"name":"BigInt","path":["stdlib","bigint"],"children":[]},{"name":"Array","path":["stdlib","array"],"children":[]},{"name":"IntervalId","path":["stdlib","intervalid"],"children":[]},{"name":"TimeoutId","path":["stdlib","timeoutid"],"children":[]}]}} \ No newline at end of file diff --git a/scripts/gendocs.res b/scripts/gendocs.res index 1fe4b484e..3dba18a88 100644 --- a/scripts/gendocs.res +++ b/scripts/gendocs.res @@ -50,8 +50,7 @@ if Fs.existsSync(dirVersion) { Fs.mkdirSync(dirVersion) } -// "Js.res" does not work for some reason -let entryPointFiles = ["Belt.res", "Dom.res", "Stdlib.res"] +let entryPointFiles = ["Belt.res", "Dom.res", "Js.res", "Stdlib.res"] let hiddenModules = ["Js.Internal", "Js.MapperRt"] @@ -72,23 +71,32 @@ type section = { let env = Process.env -let docsDecoded = entryPointFiles->Array.map(libFile => { - let entryPointFile = Path.join2(compilerLibPath, libFile) +let docsDecoded = entryPointFiles->Array.map(libFile => + try { + let entryPointFile = Path.join2(compilerLibPath, libFile) - Dict.set(env, "FROM_COMPILER", "false") + Dict.set(env, "FROM_COMPILER", "false") - let output = - ChildProcess.execSync( + let output = ChildProcess.execSync( `./node_modules/.bin/rescript-tools doc ${entryPointFile}`, + ~options={ + maxBuffer: 30_000_000., + }, )->Buffer.toString - output - ->JSON.parseExn - ->Docgen.decodeFromJson -}) - -let isStdlib = (id: string) => String.startsWith(id, "Stdlib") -let replaceIdWithStdlib = (id: string) => isStdlib(id) ? String.replace(id, "Stdlib", "Core") : id + output + ->JSON.parseExn + ->Docgen.decodeFromJson + } catch { + | Exn.Error(error) => + Console.error( + `Error while generating docs from ${libFile}: ${error + ->Error.message + ->Option.getOr("[no message]")}`, + ) + Error.raise(error) + } +) let removeStdlibOrPrimitive = s => s->String.replaceAllRegExp(/Stdlib_|Primitive_js_extern\./g, "") @@ -111,7 +119,6 @@ let docs = docsDecoded->Array.map(doc => { if Array.includes(hiddenModules, id) { getModules(rest, moduleNames) } else { - let id = replaceIdWithStdlib(id) getModules( list{...rest, ...List.fromArray(items)}, list{{id, items, name, docstrings}, ...moduleNames}, @@ -121,7 +128,7 @@ let docs = docsDecoded->Array.map(doc => { | list{} => moduleNames } - let id = replaceIdWithStdlib(doc.name) + let id = doc.name let top = {id, name: id, docstrings: doc.docstrings, items: topLevelItems} let submodules = getModules(doc.items->List.fromArray, list{})->List.toArray @@ -135,7 +142,6 @@ let allModules = { let encodeItem = (docItem: Docgen.item) => { switch docItem { | Value({id, name, docstrings, signature, ?deprecated}) => { - let id = replaceIdWithStdlib(id) let dict = Dict.fromArray( [ ("id", id->String), @@ -164,7 +170,6 @@ let allModules = { } | Type({id, name, docstrings, signature, ?deprecated}) => - let id = replaceIdWithStdlib(id) let dict = Dict.fromArray( [ ("id", id->String), @@ -194,10 +199,8 @@ let allModules = { ->Array.filterMap(item => encodeItem(item)) ->Array - let id = replaceIdWithStdlib(mod.id) - let rest = Dict.fromArray([ - ("id", id->String), + ("id", mod.id->String), ("name", mod.name->String), ("docstrings", mod.docstrings->Array.map(s => s->String)->Array), ("items", items), @@ -220,8 +223,6 @@ let () = { allModules->Array.forEach(((topLevelName, mod)) => { let json = JSON.Object(mod) - let topLevelName = replaceIdWithStdlib(topLevelName) - Fs.writeFileSync( Path.join([dirVersion, `${topLevelName->String.toLowerCase}.json`]), json->JSON.stringify(~space=2), @@ -264,7 +265,6 @@ let () = { } let tocTree = docsDecoded->Array.map(({name, items}) => { - let name = replaceIdWithStdlib(name) let path = name->String.toLowerCase ( path, diff --git a/src/bindings/Node.res b/src/bindings/Node.res index 44bcd522b..c6133d6ff 100644 --- a/src/bindings/Node.res +++ b/src/bindings/Node.res @@ -35,6 +35,7 @@ module Buffer = { } module ChildProcess = { + type options = {maxBuffer?: float} @module("child_process") - external execSync: string => Buffer.t = "execSync" + external execSync: (string, ~options: options=?) => Buffer.t = "execSync" } From 3caf7f91553f55040709b1472d11617867aefdba Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 12:43:58 +0200 Subject: [PATCH 04/10] fix version selector for core/stdlib --- src/ApiDocs.res | 5 +++++ src/common/Constants.res | 3 ++- src/components/VersionSelect.res | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ApiDocs.res b/src/ApiDocs.res index 39c127788..ba489e623 100644 --- a/src/ApiDocs.res +++ b/src/ApiDocs.res @@ -172,6 +172,11 @@ module SidebarTree = { ReactEvent.Form.preventDefault(evt) let version = (evt->ReactEvent.Form.target)["value"] let url = Url.parse(router.asPath) + if version < "v12.0.0" { + url.pagepath[1] = "core" + } else { + url.pagepath[1] = "stdlib" + } let targetUrl = "/" ++ diff --git a/src/common/Constants.res b/src/common/Constants.res index 80af04d4f..cb69e1547 100644 --- a/src/common/Constants.res +++ b/src/common/Constants.res @@ -25,7 +25,8 @@ let nextVersion = ? None : Some(versions.next, versions.next->Semver.tryGetMajorString) -let coreVersions = [latestVersion] +let stdlibVersions = + versions.latest === "v11.0.0" ? [latestVersion] : [("v11.0.0", "v11"), latestVersion] let allReactVersions = [("latest", "v0.12.0"), ("v0.11.0", "v0.11.0"), ("v0.10.0", "v0.10.0")] diff --git a/src/components/VersionSelect.res b/src/components/VersionSelect.res index 696f064a9..e6ce5d0d4 100644 --- a/src/components/VersionSelect.res +++ b/src/components/VersionSelect.res @@ -26,7 +26,10 @@ let make = ( <> - + {switch availableVersions { + | [] => React.null + | _ => + }} }} {React.array(children)} From 3a4c9889785da0d1ff50d4118d1fc1b85adf61b5 Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 12:44:12 +0200 Subject: [PATCH 05/10] add missing react keys --- src/ApiDocs.res | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ApiDocs.res b/src/ApiDocs.res index ba489e623..a6b09bf33 100644 --- a/src/ApiDocs.res +++ b/src/ApiDocs.res @@ -62,7 +62,7 @@ module RightSidebar = { } let title = `${Option.isSome(deprecatedIcon) ? "Deprecated " : ""}` ++ name let result = -
  • +
  • let open_ = - node.path->Array.join("/") === + href === moduleRoute ->Array.slice(~start=0, ~end=Array.length(moduleRoute) - 1) ->Array.join("/") -
    +
    {node.name->React.string} @@ -148,7 +148,7 @@ module SidebarTree = { }}
    | false => -
  • +
  • {node.name->React.string} @@ -189,9 +189,10 @@ module SidebarTree = { + | None => React.null }} @@ -314,21 +315,21 @@ let default = (props: props) => { | Value({name, signature, docstrings, deprecated}) => let code = String.replaceRegExp(signature, /\\n/g, "\n") let slugPrefix = "value-" ++ name - <> +

    {name->React.string}

    - +
    | Type({name, signature, docstrings, deprecated}) => let code = String.replaceRegExp(signature, /\\n/g, "\n") let slugPrefix = "type-" ++ name - <> +

    {name->React.string}

    - +
    } }) From b99b3a5cbd71723f1292eb1e50b5ca42d9e8610b Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 13:09:01 +0200 Subject: [PATCH 06/10] update stdlib.json --- data/api/v12.0.0/stdlib.json | 109 +++++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 5 deletions(-) diff --git a/data/api/v12.0.0/stdlib.json b/data/api/v12.0.0/stdlib.json index 0d02ba655..72ee56b8c 100644 --- a/data/api/v12.0.0/stdlib.json +++ b/data/api/v12.0.0/stdlib.json @@ -4534,7 +4534,7 @@ "id": "Stdlib.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." + "Bindings to JavaScript iterators.\n\nSee [`Iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator) on MDN." ], "items": [ { @@ -4569,7 +4569,7 @@ "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```" + "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.prototype.toArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) 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\nmapKeysAsArray->assertEqual([\"someKey\", \"someKey2\"])\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n```" ], "signature": "let toArray: t<'a> => array<'a>" }, @@ -4578,7 +4578,7 @@ "kind": "value", "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```" + "`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.prototype.toArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) 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\nmapKeysAsArray->assertEqual([7, 8])\n```" ], "signature": "let toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b>" }, @@ -4587,9 +4587,9 @@ "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\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```" + "`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 = [\"a\", \"b\", \"c\"]->Array.values\nlet acc = ref(\"\")\niterator->Iterator.forEach(v => {\n acc := acc.contents ++ v\n})\n\nacc.contents->assertEqual(\"abc\")\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." ], - "signature": "let forEach: (t<'a>, option<'a> => unit) => unit" + "signature": "let forEach: (t<'a>, 'a => unit) => unit" }, { "id": "Stdlib.Iterator.ignore", @@ -4599,6 +4599,87 @@ "`ignore(iterator)` ignores the provided iterator and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], "signature": "let ignore: t<'a> => unit" + }, + { + "id": "Stdlib.Iterator.drop", + "kind": "value", + "name": "drop", + "docstrings": [ + "`drop((iterator, n))` returns a new iterator helper object that skips the given number of elements at the start of this iterator.\n\nSee [Iterator.prototype.drop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/drop) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.drop(2)\nseq->Iterator.next->assertEqual({done: false, value: Some(2)})\nseq->Iterator.next->assertEqual({done: false, value: Some(3)})\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n```" + ], + "signature": "let drop: (t<'a>, int) => t<'a>" + }, + { + "id": "Stdlib.Iterator.every", + "kind": "value", + "name": "every", + "docstrings": [ + "`every(iterator, fn)` tests whether all elements in the iterator pass the test implemented by the provided function.\n\nSee [Iterator.prototype.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/every) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet areAllEven = fibonacci->Iterator.every(n => n % 2 == 0)\nareAllEven->assertEqual(false)\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let every: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.Iterator.filter", + "kind": "value", + "name": "filter", + "docstrings": [ + "`filter(iterator, fn)` returns a new iterator helper object that contains the elements of the original iterator that pass the test implemented by the provided function.\n\nSee [Iterator.prototype.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/filter) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.filter(n => n % 2 == 0)\nseq->Iterator.next->assertEqual({done: false, value: Some(2)})\nseq->Iterator.next->assertEqual({done: false, value: Some(8)})\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let filter: (t<'a>, 'a => bool) => t<'a>" + }, + { + "id": "Stdlib.Iterator.find", + "kind": "value", + "name": "find", + "docstrings": [ + "`find(iterator, fn)` returns the value of the first element in the iterator that satisfies the provided testing function.\n\nSee [Iterator.prototype.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/find) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.find(n => n % 2 == 0)\nseq->assertEqual(Some(2))\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let find: (t<'a>, 'a => bool) => option<'a>" + }, + { + "id": "Stdlib.Iterator.flatMap", + "kind": "value", + "name": "flatMap", + "docstrings": [ + "`flatMap(iterator, fn)` returns a new iterator helper object that contains the elements of the original iterator that pass the test implemented by the provided function.\n\nSee [Iterator.prototype.flatMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/flatMap) on MDN.\n\n## Examples\n```rescript\nlet map1 = Map.fromArray([(\"a\", 1), (\"b\", 2), (\"c\", 3)])\nlet map2 = Map.fromArray([(\"d\", 4), (\"e\", 5), (\"f\", 6)])\n\nlet letters =\n [map1, map2]\n ->Array.values\n ->Iterator.flatMap(m => Map.keys(m))\n ->Array.fromIterator\nletters->assertEqual([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"])\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let flatMap: (t<'a>, 'a => t<'b>) => t<'b>" + }, + { + "id": "Stdlib.Iterator.map", + "kind": "value", + "name": "map", + "docstrings": [ + "`map(iterator, fn)` returns a new iterator helper object that yields elements of the iterator, each transformed by a mapping function.\n\nSee [Iterator.prototype.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/map) on MDN.\n\n## Examples\n```rescript\nlet map = Map.fromArray([(\"a\", 1), (\"b\", 2), (\"c\", 3)])\nlet letters = map->Map.keys->Iterator.map(v => v->String.toUpperCase)->Array.fromIterator\nletters->assertEqual([\"A\", \"B\", \"C\"])\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let map: (t<'a>, 'a => 'b) => t<'b>" + }, + { + "id": "Stdlib.Iterator.reduce", + "kind": "value", + "name": "reduce", + "docstrings": [ + "`reduce(iterator, fn, initialValue)` applies a function against an accumulator and each element in the iterator (from left to right) to reduce it to a single value.\n\nSee [Iterator.prototype.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/reduce) on MDN.\n\n## Examples\n```rescript\nlet numbers: Iterator.t = [ 1, 2, 3 ]->Array.values\n\nlet sum = numbers->Iterator.reduce((acc, n) => acc + n, ~initialValue=0)\nsum->assertEqual(6)\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let reduce: (t<'a>, ('acc, 'a) => 'acc, ~initialValue: 'acc=?) => 'acc" + }, + { + "id": "Stdlib.Iterator.some", + "kind": "value", + "name": "some", + "docstrings": [ + "`some(iterator, fn)` The some() method of Iterator instances is similar to Array.some: \nit tests whether at least one element produced by the iterator passes the test implemented by the provided function. \nIt returns a boolean value.\n\nSee [Iterator.prototype.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/some) on MDN.\n\n## Examples\n```rescript\nlet numbers: Iterator.t = [ 1, 2, 3 ]->Array.values\n\nlet hasEven = numbers->Iterator.some(n => n % 2 == 0)\nhasEven->assertEqual(true)\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let some: (t<'a>, 'a => bool) => bool" + }, + { + "id": "Stdlib.Iterator.take", + "kind": "value", + "name": "take", + "docstrings": [ + "`take((iterator, n))` returns a new iterator helper object that contains the first `n` elements of this iterator.\n\nSee [Iterator.prototype.take](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/take) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.take(2)\nseq->Iterator.next->assertEqual({done: false, value: Some(1)})\nseq->Iterator.next->assertEqual({done: false, value: Some(1)})\nseq->Iterator.next->assertEqual({done: true, value: None})\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers." + ], + "signature": "let take: (t<'a>, int) => t<'a>" } ] }, @@ -11742,6 +11823,24 @@ "`ignore(array)` ignores the provided array and returns unit.\n\n This helper is useful when you want to discard a value (for example, the result of an operation with side effects)\n without having to store or process it further." ], "signature": "let ignore: array<'a> => unit" + }, + { + "id": "Stdlib.Array.entries", + "kind": "value", + "name": "entries", + "docstrings": [ + "`entries(array)` returns a new array iterator object that contains the key/value pairs for each index in the array.\n\nSee [Array.prototype.entries](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries) on MDN.\n\n## Examples\n\n```rescript\nlet array = [5, 6, 7]\nlet iterator : Iterator.t<(int, int)> = array->Array.entries\niterator->Iterator.next->assertEqual({done: false, value: Some((0, 5))})\niterator->Iterator.next->assertEqual({done: false, value: Some((1, 6))})\n```" + ], + "signature": "let entries: array<'a> => Iterator.t<(int, 'a)>" + }, + { + "id": "Stdlib.Array.values", + "kind": "value", + "name": "values", + "docstrings": [ + "`values(array)` returns a new array iterator object that contains the values for each index in the array.\n\nSee [Array.prototype.values](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/values) on MDN.\n\n## Examples\n\n```rescript\nlet array = [5, 6, 7]\nlet iterator : Iterator.t = array->Array.values\niterator->Iterator.next->assertEqual({done: false, value: Some(5)})\niterator->Iterator.next->assertEqual({done: false, value: Some(6)})\n```" + ], + "signature": "let values: array<'a> => Iterator.t<'a>" } ] }, From f4a99717c4a96a88cab9affb644964d47a6bc92c Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 13:15:03 +0200 Subject: [PATCH 07/10] remove unused flag --- scripts/gendocs.res | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/gendocs.res b/scripts/gendocs.res index 3dba18a88..abcb6f428 100644 --- a/scripts/gendocs.res +++ b/scripts/gendocs.res @@ -75,8 +75,6 @@ let docsDecoded = entryPointFiles->Array.map(libFile => try { let entryPointFile = Path.join2(compilerLibPath, libFile) - Dict.set(env, "FROM_COMPILER", "false") - let output = ChildProcess.execSync( `./node_modules/.bin/rescript-tools doc ${entryPointFile}`, ~options={ From c634f36dcdc41289acf9cfcbd43799c7a7de472d Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 13:44:12 +0200 Subject: [PATCH 08/10] fix selector for non core/stdlib modules --- src/ApiDocs.res | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ApiDocs.res b/src/ApiDocs.res index a6b09bf33..5f253dcfe 100644 --- a/src/ApiDocs.res +++ b/src/ApiDocs.res @@ -172,10 +172,14 @@ module SidebarTree = { ReactEvent.Form.preventDefault(evt) let version = (evt->ReactEvent.Form.target)["value"] let url = Url.parse(router.asPath) - if version < "v12.0.0" { - url.pagepath[1] = "core" - } else { - url.pagepath[1] = "stdlib" + switch url.pagepath[1] { + | Some("core") | Some("stdlib") => + if version < "v12.0.0" { + url.pagepath[1] = "core" + } else { + url.pagepath[1] = "stdlib" + } + | _ => () } let targetUrl = From 05af32120bdfb8eee942ca060ec8b52e2aa1235e Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 13:45:35 +0200 Subject: [PATCH 09/10] revert gendocs.res since it'll be moved to rescript monorepo --- scripts/gendocs.res | 95 ++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/scripts/gendocs.res b/scripts/gendocs.res index abcb6f428..23d5124fa 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-monorepo version forceReWrite +node scripts/gendocs.mjs path/to/rescript-compiler path/to/rescript-core/src/RescriptCore.res version forceReWrite ``` ## Examples ```bash -node scripts/gendocs.mjs path/to/rescript-monorepo latest true +node scripts/gendocs.mjs path/to/rescript-compiler latest true ``` */ @val @scope(("import", "meta")) external url: string = "url" @@ -25,16 +25,21 @@ let dirname = ->Path.dirname let compilerLibPath = switch args->Array.get(0) { -| Some(path) => Path.join([path, "runtime"]) +| Some(path) => Path.join([path, "jscomp", "others"]) | None => failwith("First argument should be path to rescript-compiler repo") } -let version = switch args->Array.get(1) { +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) { | Some(version) => version -| None => failwith("Second argument should be a version, `latest`, `v10`") +| None => failwith("Third argument should be a version, `latest`, `v10`") } -let forceReWrite = switch args->Array.get(2) { +let forceReWrite = switch args->Array.get(3) { | Some("true") => true | _ => false } @@ -50,7 +55,7 @@ if Fs.existsSync(dirVersion) { Fs.mkdirSync(dirVersion) } -let entryPointFiles = ["Belt.res", "Dom.res", "Js.res", "Stdlib.res"] +let entryPointFiles = ["js.ml", "belt.res", "dom.res"] let hiddenModules = ["Js.Internal", "Js.MapperRt"] @@ -71,32 +76,33 @@ type section = { let env = Process.env -let docsDecoded = entryPointFiles->Array.map(libFile => - try { - let entryPointFile = Path.join2(compilerLibPath, libFile) +let docsDecoded = entryPointFiles->Array.map(libFile => { + let entryPointFile = Path.join2(compilerLibPath, libFile) - let output = ChildProcess.execSync( + Dict.set(env, "FROM_COMPILER", "true") + + let output = + ChildProcess.execSync( `./node_modules/.bin/rescript-tools doc ${entryPointFile}`, - ~options={ - maxBuffer: 30_000_000., - }, )->Buffer.toString - output - ->JSON.parseExn - ->Docgen.decodeFromJson - } catch { - | Exn.Error(error) => - Console.error( - `Error while generating docs from ${libFile}: ${error - ->Error.message - ->Option.getOr("[no message]")}`, - ) - Error.raise(error) - } -) + output + ->JSON.parseExn + ->Docgen.decodeFromJson +}) + +let coreDocs = { + Dict.set(env, "FROM_COMPILER", "false") -let removeStdlibOrPrimitive = s => s->String.replaceAllRegExp(/Stdlib_|Primitive_js_extern\./g, "") + 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 docs = docsDecoded->Array.map(doc => { let topLevelItems = doc.items->Array.filterMap(item => @@ -117,6 +123,9 @@ 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 getModules( list{...rest, ...List.fromArray(items)}, list{{id, items, name, docstrings}, ...moduleNames}, @@ -126,7 +135,9 @@ let docs = docsDecoded->Array.map(doc => { | list{} => moduleNames } - let id = doc.name + let id = String.startsWith(doc.name, "RescriptCore") + ? String.replace(doc.name, "RescriptCore", "Core") + : doc.name let top = {id, name: id, docstrings: doc.docstrings, items: topLevelItems} let submodules = getModules(doc.items->List.fromArray, list{})->List.toArray @@ -140,6 +151,9 @@ 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 dict = Dict.fromArray( [ ("id", id->String), @@ -148,15 +162,10 @@ let allModules = { ( "docstrings", docstrings - ->Array.map(s => s->removeStdlibOrPrimitive->String) + ->Array.map(s => s->String) ->Array, ), - ( - "signature", - signature - ->removeStdlibOrPrimitive - ->String, - ), + ("signature", signature->String), ]->Array.concat( switch deprecated { | Some(v) => [("deprecated", v->String)] @@ -168,13 +177,16 @@ let allModules = { } | Type({id, name, docstrings, signature, ?deprecated}) => + let id = String.startsWith(id, "RescriptCore") + ? String.replace(id, "RescriptCore", "Core") + : id let dict = Dict.fromArray( [ ("id", id->String), ("kind", "type"->String), ("name", name->String), - ("docstrings", docstrings->Array.map(s => s->removeStdlibOrPrimitive->String)->Array), - ("signature", signature->removeStdlibOrPrimitive->String), + ("docstrings", docstrings->Array.map(s => s->String)->Array), + ("signature", signature->String), ]->Array.concat( switch deprecated { | Some(v) => [("deprecated", v->String)] @@ -197,8 +209,10 @@ let allModules = { ->Array.filterMap(item => encodeItem(item)) ->Array + let id = String.startsWith(mod.id, "RescriptCore") ? "Core" : mod.id + let rest = Dict.fromArray([ - ("id", mod.id->String), + ("id", id->String), ("name", mod.name->String), ("docstrings", mod.docstrings->Array.map(s => s->String)->Array), ("items", items), @@ -221,6 +235,8 @@ let () = { allModules->Array.forEach(((topLevelName, mod)) => { let json = JSON.Object(mod) + let topLevelName = String.startsWith(topLevelName, "RescriptCore") ? "Core" : topLevelName + Fs.writeFileSync( Path.join([dirVersion, `${topLevelName->String.toLowerCase}.json`]), json->JSON.stringify(~space=2), @@ -263,6 +279,7 @@ let () = { } let tocTree = docsDecoded->Array.map(({name, items}) => { + let name = String.startsWith(name, "RescriptCore") ? "Core" : name let path = name->String.toLowerCase ( path, From 9adeb35a295631fad7cd8c73710586d4bf6230f6 Mon Sep 17 00:00:00 2001 From: tsnobip Date: Mon, 16 Jun 2025 15:15:54 +0200 Subject: [PATCH 10/10] fix iterator docstrings --- data/api/v12.0.0/stdlib.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/api/v12.0.0/stdlib.json b/data/api/v12.0.0/stdlib.json index 72ee56b8c..72d67d901 100644 --- a/data/api/v12.0.0/stdlib.json +++ b/data/api/v12.0.0/stdlib.json @@ -4569,7 +4569,7 @@ "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.prototype.toArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) 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\nmapKeysAsArray->assertEqual([\"someKey\", \"someKey2\"])\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n```" + "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.prototype.toArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/toArray) 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\nmapKeysAsArray->assertEqual([\"someKey\", \"someKey2\"])\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n" ], "signature": "let toArray: t<'a> => array<'a>" }, @@ -4605,7 +4605,7 @@ "kind": "value", "name": "drop", "docstrings": [ - "`drop((iterator, n))` returns a new iterator helper object that skips the given number of elements at the start of this iterator.\n\nSee [Iterator.prototype.drop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/drop) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.drop(2)\nseq->Iterator.next->assertEqual({done: false, value: Some(2)})\nseq->Iterator.next->assertEqual({done: false, value: Some(3)})\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n```" + "`drop(iterator, n)` returns a new iterator helper object that skips the given number of elements at the start of this iterator.\n\nSee [Iterator.prototype.drop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/drop) on MDN.\n\n## Examples\n```rescript\nlet fibonacci: Iterator.t = [ 1, 1, 2, 3, 5, 8, 13, 21 ]->Array.values\n\nlet seq = fibonacci->Iterator.drop(2)\nseq->Iterator.next->assertEqual({done: false, value: Some(2)})\nseq->Iterator.next->assertEqual({done: false, value: Some(3)})\n```\n\n## Remark\n\nSince March 2025, this feature works across the latest devices and browser versions.\nThis feature might not work in older devices or browsers.\n" ], "signature": "let drop: (t<'a>, int) => t<'a>" },