UNPKG

@azure-tools/openapi

Version:
30 lines 1.54 kB
import { Dereferenced, ExtensionKey, PathReference, Refable } from "./common"; /** * Returns true if the key starts with `x-` */ export declare function isExtensionKey(key: string | ExtensionKey): key is ExtensionKey; /** * Only return properties starting with x- * @param dictionary */ export declare function includeXDashKeys<T extends Record<string | ExtensionKey, any>>(dictionary: T): Extract<keyof T, ExtensionKey>[]; /** * Only return properties NOT starting with x- * @param dictionary */ export declare function omitXDashKeys<T extends {}>(dictionary: T): Exclude<keyof T, ExtensionKey>[]; export declare function includeXDashProperties<T extends Record<string | ExtensionKey, any> | undefined>(obj: T): T extends undefined ? undefined : Pick<T, Extract<keyof T, ExtensionKey>>; export declare function omitXDashProperties<T extends {} | undefined>(obj: T): T extends undefined ? undefined : Pick<T, Exclude<keyof T, ExtensionKey>>; /** * Identifies if a given refable is a reference or an instance * @param item Check if item is a reference. */ export declare function isReference<T extends {} | undefined>(item: Refable<T>): item is PathReference; /** * Gets an object instance for the item, regardless if it's a reference or not. * @param document Entire document. * @param item Reference item. * @param stack Stack for circular dependencies. */ export declare function dereference<T extends {} | undefined>(document: any, item: Refable<T>, stack?: string[]): Dereferenced<T>; //# sourceMappingURL=utils.d.ts.map