@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
20 lines (19 loc) • 1.03 kB
TypeScript
import { DefaultExtraParams } from "../types/index.js";
/**
* Returns first element from param object at paramName key. Parameter can be string or array of strings
* @param paramName name of array parameter to extract from extraParams
* @param params the object containing parameters
* @returns the first element ih the parameter or undefined if not found
* @throws if required = true and param is missing or its array is empty
*/
export declare const getFirstFromParam: <P extends DefaultExtraParams>(paramName: string, params: P, options?: {
required?: boolean;
}) => string | undefined;
/**
* Validates and returns string[] parameter from extraParams. If param missing it returns an empty array
* @param paramName name of array parameter to extract from extraParams
* @param params parameter object
* @returns string[]
* @throws Error if parameter contains non-string values
*/
export declare const getParamStringArray: <P extends DefaultExtraParams>(paramName: string, params: P) => string[] | undefined;