query
On this page

mkKeyValueDefault

lib.generators.mkKeyValueDefault

Docs pulled from | This Revision | 16 minutes ago


Generate a line of key k and value v, separated by character sep. If sep appears in k, it is escaped. Helper for synaxes with different separators.

mkValueString specifies how values should be formatted.

mkKeyValueDefault {} ":" "f:oo" "bar"
> "f\:oo:bar"

Inputs

Structured function argument
mkValueString (optional, default: mkValueStringDefault {})
Function to convert values to strings
sep

2. Function argument

k

3. Function argument

v

4. Function argument


Noogle detected

Implementation

The following is the current implementation of this function.

mkKeyValueDefault =
    {
      mkValueString ? mkValueStringDefault { },
    }:
    sep: k: v:
    "${escape [ sep ] k}${sep}${mkValueString v}";