package server-reason-react

  1. Overview
  2. Docs
Rendering React components on the server natively

Install

dune-project
 Dependency

Authors

Maintainers

Sources

server-reason-react-0.5.1.tbz
sha256=3972f64a3ec22b120b40137f74e7862629b2164e5bbf8b85489d4c7b8bc13288
sha512=24a52537c091c4b278ea5e468aa6786378f8b559ed2128e824b6f84f26c283856a30e7ef01aab6101087bd53b9bdc2ecd8152c00db10bccff67221b9c67318a0

doc/server-reason-react.js/Js/Map/index.html

Module Js.MapSource

Provides bindings for ES6 Map

Mutable, insertion-ordered map matching JS Map semantics: iteration order is insertion order, re-setting an existing key keeps its position, and deleting then re-adding a key moves it to the end.

Divergences from JavaScript:

  • Key equality is OCaml structural equality (=) instead of SameValueZero. Consequently nan keys compare unequal to themselves (has ~key:nan is false after set ~key:nan, whereas JS Maps treat NaN as a single key), and two structurally equal but physically distinct mutable keys (e.g. two arrays [|1|]) are the same key here while JS would keep them separate.
  • keys/values/entries return a snapshot iterator: mutations made after the iterator is created are not observed, whereas JS Map iterators are live.
Sourcetype ('k, 'v) t

The Map type

Sourceval make : unit -> ('k, 'v) t

make () creates a new empty map.

Sourceval fromArray : ('k * 'v) array -> ('k, 'v) t

fromArray entries creates a map from an array of (key, value) pairs. Like JS new Map(entries), a duplicated key keeps the position of its first occurrence but the value of its last one.

Sourceval toArray : ('k, 'v) t -> ('k * 'v) array

toArray map returns the (key, value) pairs in insertion order, like JS Array.from(map).

Sourceval size : ('k, 'v) t -> int

size map returns the number of entries in map.

Sourceval has : key:'k -> ('k, 'v) t -> bool

has ~key map returns whether key is present in map.

Sourceval get : key:'k -> ('k, 'v) t -> 'v option

get ~key map returns Some value if key is present, None otherwise.

Sourceval set : key:'k -> value:'v -> ('k, 'v) t -> ('k, 'v) t

set ~key ~value map sets key to value in map (mutating it) and returns map for chaining.

Sourceval clear : ('k, 'v) t -> unit

clear map removes all entries from map.

Sourceval delete : key:'k -> ('k, 'v) t -> bool

delete ~key map removes key from map; returns whether the key was present.

Sourceval forEach : f:('v -> 'k -> ('k, 'v) t -> unit) -> ('k, 'v) t -> unit

forEach ~f map calls f value key map for each entry in insertion order, like JS Map.prototype.forEach.

Sourceval keys : ('k, 'v) t -> 'k Js__.Js_iterator.t

keys map returns an iterator over the keys in insertion order.

Sourceval values : ('k, 'v) t -> 'v Js__.Js_iterator.t

values map returns an iterator over the values in insertion order.

Sourceval entries : ('k, 'v) t -> ('k * 'v) Js__.Js_iterator.t

entries map returns an iterator over the (key, value) pairs in insertion order.