Foreign.Object
- Package
- purescript-foreign-object
- Repository
- purescript/purescript-foreign-object
This module defines a type of native homogeneous Javascript Objects.
To maximize performance, Javascript objects are not wrapped, and some native code is used even when it's not necessary.
#Object Source
#toUnfoldable Source
toUnfoldable :: forall f a. Unfoldable f => Object a -> f (Tuple String a)
Unfolds a map into a list of key/value pairs
#toAscUnfoldable Source
toAscUnfoldable :: forall f a. Unfoldable f => Object a -> f (Tuple String a)
Unfolds a map into a list of key/value pairs which is guaranteed to be sorted by key
#fromFoldable Source
fromFoldable :: forall f a. Foldable f => f (Tuple String a) -> Object a
Create an Object a
from a foldable collection of key/value pairs
#fromFoldableWith Source
fromFoldableWith :: forall f a. Foldable f => (a -> a -> a) -> f (Tuple String a) -> Object a
Create an Object a
from a foldable collection of key/value pairs, using the
specified function to combine values for duplicate keys.
#fromHomogeneous Source
fromHomogeneous :: forall r a. Homogeneous r a => Record r -> Object a
Create an Object a
from a homogeneous record, i.e. all of the record
fields are of the same type.
#mapWithKey Source
mapWithKey :: forall a b. (String -> a -> b) -> Object a -> Object b
Apply a function of two arguments to each key/value pair, producing a new map
#filterWithKey Source
filterWithKey :: forall a. (String -> a -> Boolean) -> Object a -> Object a
Filter out those key/value pairs of a map for which a predicate fails to hold.
#runST Source
runST :: forall a. (forall r. ST r (STObject r a)) -> Object a
Freeze a mutable Object, creating an immutable Object. Use this function as you would use
Control.Monad.ST.run
(from the purescript-st
package) to freeze a mutable reference.
The rank-2 type prevents the Object from escaping the scope of runST
.