@lou.codes/test
Version:
✅ Equality test with enforced readability
17 lines (16 loc) • 512 B
JavaScript
import { foregroundCyan } from "@lou.codes/ansi";
/**
* Stringifies and colorizes an array representing a property path.
*
* @category Output
* @example
* ```typescript
* formatPropertyPath(["foo", "bar"]); // "foo.bar" (with colors)
* formatPropertyPath([]); // "it"
* ```
* @param propertyPath Path to format.
* @returns String with formatted path.
*/
export const formatPropertyPath = (propertyPath) => propertyPath
.map(property => foregroundCyan(property.toString()))
.join(".") || "it";