Import
import { SetKeyAccessor } from '@rs-x/core';API Reference
Set accessor implementation used by the index-value-accessor pipeline. It checks membership, reads matching items, and can replace one item with another.
import { SetKeyAccessor } from '@rs-x/core';import {
InjectionContainer,
RsXCoreInjectionTokens,
RsXCoreModule,
type ISetKeyAccessor,
} from '@rs-x/core';
await InjectionContainer.load(RsXCoreModule);
const accessor = InjectionContainer.get<ISetKeyAccessor>(
RsXCoreInjectionTokens.ISetKeyAccessor,
);
const set = new Set<unknown>(['a', 'b']);
console.log(accessor.hasValue(set, 'b')); // true
console.log(accessor.getValue(set, 'b')); // 'b'
accessor.setValue(set, 'b', 'beta');
console.log(set.has('beta')); // true
console.log([...accessor.getIndexes(set)]); // ['a', 'beta']import { Inject, RsXCoreInjectionTokens, type ISetKeyAccessor } from '@rs-x/core';
class MyConsumer {
constructor(
@Inject(RsXCoreInjectionTokens.ISetKeyAccessor)
private readonly dependency: ISetKeyAccessor,
) {}
}6 members in this class.
public applies(map: unknown): booleanParameters
Returns
boolean
public getIndexes(set: Set<unknown>): IterableIterator<unknown>Parameters
Returns
IterableIterator<unknown>
public getResolvedValue(
set: Set<unknown>,
key: unknown
): unknownParameters
Returns
unknown
public getValue(
set: Set<unknown>,
key: unknown
): unknownParameters
Returns
unknown
public hasValue(
set: Set<unknown>,
key: unknown
): booleanParameters
Returns
boolean
public setValue(
set: Set<unknown>,
key: unknown,
value: unknown
): voidParameters
Returns
void