@voiceflow/common
Version:
Junk drawer of utility functions
27 lines • 1.22 kB
TypeScript
export declare const addPrebuiltEntities: <A extends {
key: string;
inputs: string[];
}>(entities: A[], prebuiltEntities: Record<string, string[]>) => A[];
export declare const getUniqueSamples: (input: string) => string[];
export declare const getAllSamples: (inputs?: string[]) => string[];
/**
* Return a tuple of synonyms, the first value being the first synonym, the next being the remaining synonyms
*/
export declare const getValueWithSynonyms: (input: string) => [string, string[]];
/**
* Map through all slot annotations in the given string input.
* For each annotation, the callbackFn will be called with the slot's key and name, returning a key and name.
* @param input String with slot annotations.
* @param callbackFn Map function called with the key and name of the slot.
* @returns Input with mapped slot annotations
* @example const result = mapSlotAnnotations("Hello {{[slot].id}}", ({key, name}) => ({key: key + '2', slot: slot + '2'});
* result === "Hello {{[slot2].id2}}"
*/
export declare const mapSlotAnnotations: (input: string, callbackFn: (slot: {
key: string;
name: string;
}) => {
key: string;
name: string;
}) => string;
//# sourceMappingURL=slot.d.ts.map