- Preparing search index...
- The search index is not available
TESSA Web API
Class StorageHelperHelper
Methods
cleanEnumerableAndSetNullIfEmpty
- cleanEnumerableAndSetNullIfEmpty(storage: IStorage<unknown>, key: string, deep?: boolean): boolean
-
Parameters
-
storage: IStorage<unknown>
-
key: string
-
deep: boolean = true
Returns boolean
clear
- clear(storage: IStorage<unknown> | IStorageArray<unknown>): boolean
-
Returns boolean
clone
- clone<T>(storage: T): T
-
Returns T
deepFreeze
- deepFreeze(storage: undefined | null | IStorage<unknown> | IStorageArray<unknown>): boolean
-
Returns boolean
equals
- equals(storage1?: null | IStorage<unknown> | IStorageArray<unknown>, storage2?: null | IStorage<unknown> | IStorageArray<unknown>): boolean
-
Returns boolean
isPrimitiveType
- isPrimitiveType(value: unknown): value is Primitive
-
isStorage
- isStorage<T>(storage: unknown): storage is IStorage<T>
-
Returns storage is IStorage<T>
isStorageArray
- isStorageArray<T>(storage: unknown): storage is IStorageArray<T>
-
isSystemKey
- isSystemKey(key: string): boolean
-
Returns boolean
isUserKey
- isUserKey(key: string): boolean
-
Returns boolean
merge
- merge<T>(source: T, target: T): void
-
Returns void
removeEmptyEnumerableAndCheckIfEmpty
- removeEmptyEnumerableAndCheckIfEmpty(obj: unknown, deep?: boolean): boolean
-
Parameters
-
obj: unknown
-
Optional
deep: boolean
Returns boolean
- removeEmptyEnumerableAndCheckIfEmpty<T>(obj: unknown, isEmptyFunc: ((value: T) => boolean)): boolean
-
Parameters
-
obj: unknown
-
isEmptyFunc: ((value: T) => boolean)
-
- (value: T): boolean
-
Returns boolean
Returns boolean
setNullIfEmpty
- setNullIfEmpty<T>(storage: IStorage<unknown>, key: string, cleanItemAndCheckIfEmptyFunc: ((item: T) => boolean)): boolean
-
Parameters
-
storage: IStorage<unknown>
-
key: string
-
cleanItemAndCheckIfEmptyFunc: ((item: T) => boolean)
-
- (item: T): boolean
-
Returns boolean
Returns boolean
setNullIfEmptyEnumerable
- setNullIfEmptyEnumerable(storage: IStorage<unknown>, key: string): boolean
-
Returns boolean
setStorage
- setStorage<T>(source: T, target: T): void
-
Returns void
tryClone
- tryClone<T>(storage: undefined | null | T): T | null
-
Parameters
-
storage: undefined | null | T
Returns T | null
tryConvertToStorage
- tryConvertToStorage<T>(obj: unknown): T | null
-
Returns T | null
tryDeleteKey
- tryDeleteKey(storage: undefined | null | IStorage<unknown>, key: string): boolean
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
Returns boolean
tryGet
- tryGet<T>(storage: undefined | null | IStorage<unknown>, key: string, opt?: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
keepTypedField?: boolean;
}): T | null | undefined
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
-
Optional
opt: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
keepTypedField?: boolean;
}
-
Optional
checkValue?: ((value: unknown) => boolean)
-
- (value: unknown): boolean
-
Returns boolean
-
Optional
cloneContainer?: boolean
-
Optional
keepTypedField?: boolean
Returns T | null | undefined
tryGetArray
- tryGetArray<T, S>(storage: undefined | null | IStorage<unknown>, key: string, opt?: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
itemFactory?: ((storage: S, i: number) => T);
}): T[] | null | undefined
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
-
Optional
opt: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
itemFactory?: ((storage: S, i: number) => T);
}
-
Optional
checkValue?: ((value: unknown) => boolean)
-
- (value: unknown): boolean
-
Returns boolean
-
Optional
cloneContainer?: boolean
-
Optional
itemFactory?: ((storage: S, i: number) => T)
-
- (storage: S, i: number): T
-
Returns T
Returns T[] | null | undefined
tryGetMap
- tryGetMap<T, S>(storage: undefined | null | IStorage<unknown>, key: string, opt?: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
itemFactory?: ((key: string, storage: S) => T);
}): Map<string, T> | null | undefined
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
-
Optional
opt: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
itemFactory?: ((key: string, storage: S) => T);
}
-
Optional
checkValue?: ((value: unknown) => boolean)
-
- (value: unknown): boolean
-
Returns boolean
-
Optional
cloneContainer?: boolean
-
Optional
itemFactory?: ((key: string, storage: S) => T)
-
- (key: string, storage: S): T
-
Returns T
Returns Map<string, T> | null | undefined
tryGetObject
- tryGetObject<T, S>(storage: undefined | null | IStorage<unknown>, key: string, itemFactory: ((storage: S) => T), opt?: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
}): T | null | undefined
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
-
itemFactory: ((storage: S) => T)
-
- (storage: S): T
-
Returns T
-
Optional
opt: {
checkValue?: ((value: unknown) => boolean);
cloneContainer?: boolean;
}
-
Optional
checkValue?: ((value: unknown) => boolean)
-
- (value: unknown): boolean
-
Returns boolean
-
Optional
cloneContainer?: boolean
Returns T | null | undefined
tryGetValue
- tryGetValue<T>(storage: undefined | null | IStorage<unknown>, key: string, type?: T, throwOnFailValidation?: boolean): JsTypeFromFieldType<T> | null | undefined
-
Parameters
-
storage: undefined | null | IStorage<unknown>
-
key: string
-
Optional
type: T
-
throwOnFailValidation: boolean = false
tryMerge
- tryMerge<T>(source: undefined | null | T, target: undefined | null | T): boolean
-
Parameters
-
source: undefined | null | T
-
target: undefined | null | T
Returns boolean
trySetStorage
- trySetStorage<T>(source: undefined | null | T, target: undefined | null | T): boolean
-
Parameters
-
source: undefined | null | T
-
target: undefined | null | T
Returns boolean
Объект, содержащий вспомогательные методы для работы с IStorage и IStorageArray.