UNPKG

@clickup/pg-microsharding

Version:
13 lines (11 loc) 356 B
import escapeRegExp from "lodash/escapeRegExp"; import { ident } from "./quote"; /** * Returns true if an SQL clause includes a properly quoted identifier (like * index name). */ export function isNameInSql(name: string, sql: string): boolean { return !!sql.match( new RegExp("(\\W|^)" + escapeRegExp(ident(name).toString()) + "(\\W|$)"), ); }