lotta/object
Types
Functions
pub fn assign(target: Object, source: Object) -> Bool
Copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
pub fn entries(object: Object) -> Array(#(String, Dynamic))
Returns an array of a given object’s own enumerable string-keyed property key-value pairs.
pub fn freeze(object: Object) -> Object
Freezes an object. Freezing an object prevents extensions and makes existing properties
non-writable and non-configurable. A frozen object can no longer be changed: new
properties cannot be added, existing properties cannot be removed, their enumerability,
configurability, writability, or value cannot be changed, and the object’s prototype cannot
be re-assigned. freeze()
returns the same object that was passed in.
pub fn from_entries(entries: List(#(String, Dynamic))) -> Object
Transforms a list of key-value pairs into an object.
pub fn get(
object: Object,
attribute: String,
) -> Result(Dynamic, List(DecodeError))
Get an attribute from an Object
if it exists
pub fn get_own_property_names(object: Object) -> Array(String)
Returns an array of all properties (including non-enumerable properties except for those which use Symbol found directly in a given object.
pub fn get_own_property_symbols(object: Object) -> Array(Symbol)
Returns an array of all symbol properties found directly upon a given object.
pub fn has_own(object: Object, property: String) -> Bool
Returns True
if the specified object has the indicated property as its own property.
If the property is inherited, or does not exist, the method returns False
.
pub fn is_extensible(object: Object) -> Bool
Determines if an object is extensible (whether it can have new properties added to it).
pub fn keys(object: Object) -> Array(String)
Returns an array of a given object’s own enumerable string-keyed property names.
pub fn prevent_extensions(object: Object) -> Object
Prevents new properties from ever being added to an object (i.e. prevents future extensions to the object). It also prevents the object’s prototype from being re-assigned.
pub fn seal(object: Object) -> Object
Seals an object. Sealing an object prevents extensions and makes existing properties
non-configurable. A sealed object has a fixed set of properties: new properties cannot
be added, existing properties cannot be removed, their enumerability and configurability
cannot be changed, and its prototype cannot be re-assigned. Values of existing
properties can still be changed as long as they are writable. seal()
returns the same
object that was passed in.
pub fn to_object(a: a) -> Result(Object, Nil)
Converts the value into an Object type if it is an object