@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
14 lines (13 loc) • 1.04 kB
TypeScript
export declare const mapObjectSkip: unique symbol;
export interface Options {
readonly deep?: boolean;
readonly includeSymbols?: boolean;
readonly target?: Record<string | symbol, unknown>;
}
export interface MapperOptions {
readonly shouldRecurse?: boolean;
}
type MapperResult<K extends string | symbol, V> = [targetKey: K, targetValue: V, mapperOptions?: MapperOptions] | typeof mapObjectSkip;
export type Mapper<SourceObjectType extends Record<string | symbol, unknown>, MappedObjectKeyType extends string | symbol, MappedObjectValueType> = (sourceKey: string, sourceValue: unknown, source: SourceObjectType) => MapperResult<MappedObjectKeyType, MappedObjectValueType>;
export default function mapObject<SourceObjectType extends Record<string | symbol, unknown>, MappedObjectKeyType extends string | symbol, MappedObjectValueType>(object: SourceObjectType, mapper: Mapper<SourceObjectType, MappedObjectKeyType, MappedObjectValueType>, options?: Options): Record<MappedObjectKeyType, MappedObjectValueType>;
export {};