TreeMapNode Interface

Packages > @fluidframework/tree > TreeMapNode

A map of string keys to tree objects.

Signature

/** @sealed */
export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, TreeNode

Extends: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes <T>>, TreeNode

Type Parameters

Parameter Constraint Default Description
T ImplicitAllowedTypes ImplicitAllowedTypes

Methods

Method Return Type Description
delete(key) void Removes the specified element from this map by its key.
entries() IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> Returns an iterable of key, value pairs for every entry in the map.
forEach(callbackfn, thisArg) void Executes the provided function once per each key/value pair in this map.
keys() IterableIterator<string> Returns an iterable of keys in the map.
set(key, value) void Adds or updates an entry in the map with a specified key and a value.
values() IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> Returns an iterable of values in the map.

Method Details

delete

Removes the specified element from this map by its key.

Signature

delete(key: string): void;

Remarks

Note: unlike JavaScript’s Map API, this method does not return a flag indicating whether or not the value was deleted.

Parameters

Parameter Type Description
key string The key of the element to remove from the map.

entries

Returns an iterable of key, value pairs for every entry in the map.

Signature

entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;

Remarks

Note: no guarantees are made regarding the order of the entries returned. If your usage scenario depends on consistent ordering, you will need to sort these yourself.

Returns

Return type: IterableIterator<[string, TreeNodeFromImplicitAllowedTypes <T>]>

forEach

Executes the provided function once per each key/value pair in this map.

Signature

forEach(callbackfn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>) => void, thisArg?: any): void;

Remarks

Note: no guarantees are made regarding the order in which the function is called with respect to the map’s entries. If your usage scenario depends on consistent ordering, you will need to account for this.

Parameters

Parameter Modifiers Type Description
callbackfn (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>) => void
thisArg optional any

keys

Returns an iterable of keys in the map.

Signature

keys(): IterableIterator<string>;

Remarks

Note: no guarantees are made regarding the order of the keys returned. If your usage scenario depends on consistent ordering, you will need to sort these yourself.

Returns

Return type: IterableIterator<string>

set

Adds or updates an entry in the map with a specified key and a value.

Signature

set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;

Remarks

Setting the value at a key to undefined is equivalent to calling delete(key) with that key.

Parameters

Parameter Type Description
key string The key of the element to add to the map.
value InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined The value of the element to add to the map.

values

Returns an iterable of values in the map.

Signature

values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;

Remarks

Note: no guarantees are made regarding the order of the values returned. If your usage scenario depends on consistent ordering, you will need to sort these yourself.

Returns

Return type: IterableIterator<TreeNodeFromImplicitAllowedTypes <T>>