UNPKG

@yookue/ts-lang-utils

Version:

Common lang utilities for typescript

5 lines 216 B
import { isEmpty } from "./isEmpty"; import { startsWith } from "./startsWith"; export function prependIfMissing(text, prefix) { return !text || isEmpty(prefix) || startsWith(text, prefix) ? text : prefix + text; }