# Class Store

Class
Module
import { Store } from "@tsed/core"
Source/packages/core/src/domain/Store.ts

# Overview

class Store {
    #private;
<span class="token keyword">static</span> <span class="token keyword">from</span><span class="token punctuation">(</span>...args<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Store<span class="token punctuation">;</span>

<span class="token keyword">static</span> <span class="token function">fromMethod</span><span class="token punctuation">(</span>target<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> propertyKey<span class="token punctuation">:</span> <span class="token keyword">string</span> | symbol<span class="token punctuation">)</span><span class="token punctuation">:</span> Store<span class="token punctuation">;</span>

get&lt;T<span class="token punctuation"> = </span><span class="token keyword">any</span>&gt;<span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> defaultValue?<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> T<span class="token punctuation">;</span>

<span class="token function">has</span><span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

<span class="token function">set</span><span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> metadata<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Store<span class="token punctuation">;</span>

<span class="token function">delete</span><span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

<span class="token function">merge</span><span class="token punctuation">(</span>key<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> value<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> inverse?<span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Store<span class="token punctuation">;</span>

}

# Members

#private;

static from(...args: any[]): Store;

Create or get a Store from args {target + methodName + descriptor}


static fromMethod(target: any, propertyKey: string | symbol): Store;

Create store on the method.


get<T = any>(key: any, defaultValue?: any): T;
Param Type Description
key any Required. The key of the element to return from the Map object.

The get() method returns a specified element from a Map object.


has(key: any): boolean;

The has() method returns a boolean indicating whether an element with the specified key exists or not.


set(key: any, metadata: any): Store;
Param Type Description
key any Required. The key of the element to add to the Map object. metadata

The set() method adds or updates an element with a specified key and value to a Map object.


delete(key: string): boolean;
Param Type Description
key string Required. The key of the element to remove from the Map object.

The delete() method removes the specified element from a Map object.


merge(key: any, value: any, inverse?: boolean): Store;
Param Type Description
inverse boolean Optional. Change the merge order. Get the existing value and apply over given value

Merge given value with existing value.

Other topics