UNPKG

text-constant-case

Version:

Convert into upper case text with an underscore between words

13 lines (12 loc) 329 B
import { noCase } from "text-no-case"; import { upperCase } from "text-upper-case"; export function constantCase(input, options = {}) { // Handle null/undefined inputs gracefully if (!input) return ""; return noCase(input, { delimiter: "_", transform: upperCase, ...options, }); }