UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

70 lines (69 loc) 2.3 kB
/** * @packageDocumentation * * A transformer that combines multiple transformers. */ import { Transformer } from './Transformer.cjs'; /** * A transformer that combines multiple transformers. */ export declare class GroupTransformer extends Transformer { private readonly transformers; /** * An id of the transformer. * * @returns `group`. */ get id(): string; /** * Transformers to combine. * * @param transformers - The transformers to combine. */ constructor(transformers: Transformer[]); /** * Determines if the value can be transformed by any of the transformers. * * @param value - The value to check. * @param key - The key of the value to check. * @returns A boolean indicating if the value can be transformed. */ canTransform(value: unknown, key: string): boolean; /** * Gets the transformer with the given id. * * @param transformerId - The id of the transformer to get. * @returns The transformer with the given id. */ getTransformer(transformerId: string): Transformer; /** * Transforms the value using the first transformer that can transform it. * * @param value - The value to transform. * @param key - The key of the value to transform. * @returns The transformed value. */ transformValue(value: unknown, key: string): unknown; /** * Gets the id of the transformer that can transform the given value. * * @param value - The value to get the transformer id for. * @param key - The key of the value to get the transformer id for. * @returns The id of the transformer that can transform the given value. */ protected getTransformerId(value: unknown, key: string): null | string; /** * This transformer does not support restoring values. * * @throws */ protected restoreValue(): never; /** * Gets the first transformer that can transform the given value. * * @param value - The value to get the first transformer for. * @param key - The key of the value to get the first transformer for. * @returns The first transformer that can transform the given value. */ private getFirstTransformerThatCanTransform; }