export function makeFunction(varName: string) { return `\n@function get-${varName}($levels...) { $fetched: $${varName}; @each $level in $levels { @if map-has-key($fetched, $level) { $fetched: map-get($fetched, $level); } @else { @error "There is no \`#{$level}\` in the \`#{$${varName}}\` map"; } } @if type-of($fetched) != map { @error "Non usable value. Got \`#{$${varName}}\`"; } @return $fetched; }`; }