(skipUndefined: boolean)
| 22 | } |
| 23 | |
| 24 | function resolveFn(skipUndefined: boolean): (path: string, scope: Scope) => any { |
| 25 | return (path, scope) => { |
| 26 | const value = get(scope, path); |
| 27 | |
| 28 | if (value !== undefined || !skipUndefined) { |
| 29 | return typeof value === 'object' ? JSON.stringify(value) : value; |
| 30 | } else { |
| 31 | return `{{ ${path} }}`; |
| 32 | } |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | function renderMustache<T extends JsonValue>(item: T, scope: Scope, skipUndefined: boolean): Mustache<T> { |
| 37 | if (typeof item === 'string') { |