UNPKG

@dtinsight/dt-utils

Version:

袋鼠云前端常用工具库

21 lines (20 loc) 706 B
/** * 将前端框架(如 Ant Design)中常用的排序方向术语转换为标准的 SQL 排序术语。 * * @category 转换 * * @param {string} order - 要转换的排序字符串('ascend''descend') * @returns {string | undefined} 对应的 SQL 排序字符串('asc''desc'),如果输入为空或无效则返回 undefined * * @example * ```typescript * import { toSortOrder } from 'dt-utils'; * * toSortOrder('ascend') // => 'asc' * toSortOrder('descend') // => 'desc' * toSortOrder('') // => undefined * toSortOrder('invalid') // => undefined * ``` */ declare const toSortOrder: (order: string) => 'asc' | 'desc' | undefined; export default toSortOrder;