UNPKG

eslint-plugin-de-morgan

Version:

ESLint plugin for transforming negated boolean expressions via De Morgan’s laws

12 lines (11 loc) 320 B
/** * Wraps a string in parentheses. * * @param text - The string to wrap. * @param [condition] - Whether to apply the wrapping. * @returns The string, wrapped in parentheses if condition is true. */ function parenthesize(text, condition = true) { return condition ? `(${text})` : text } export { parenthesize }