(str, obj)
| 16 | } |
| 17 | |
| 18 | export function substitute(str, obj) { |
| 19 | if (typeof str === 'string') { |
| 20 | return str.replace((/\\?\{([^{}]+)\}/g), function(match, name){ |
| 21 | if (match.charAt(0) === '\\') { |
| 22 | return match.slice(1); |
| 23 | } |
| 24 | return (obj[name] === null || obj[name] === undefined) ? '' : obj[name]; |
| 25 | }); |
| 26 | } else if (typeof str === 'function') { |
| 27 | return str(obj); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export function toArray(value, sep) { |
| 32 | if (value === null || value === undefined) { |
no outgoing calls
no test coverage detected
searching dependent graphs…