Alex Fandrianto | b18ef96 | 2015-01-09 11:47:05 -0800 | [diff] [blame] | 1 | var h = require('mercury').h; |
| 2 | |
Alex Fandrianto | 3844bec | 2014-09-30 11:29:24 -0700 | [diff] [blame] | 3 | module.exports = { |
| 4 | 'shouldFormat': shouldFormat, |
| 5 | 'format': format |
| 6 | }; |
| 7 | |
| 8 | /* |
| 9 | * The input is empty in various cases. |
| 10 | */ |
| 11 | function shouldFormat(input) { |
| 12 | return input === undefined || input === null || input === '' || |
| 13 | (input instanceof Array && input.length === 0); |
| 14 | } |
| 15 | |
| 16 | /* |
| 17 | * Indicate that nothing was there. |
| 18 | */ |
| 19 | function format(input) { |
Alex Fandrianto | b18ef96 | 2015-01-09 11:47:05 -0800 | [diff] [blame] | 20 | return h('span', '<no data>'); |
Alex Fandrianto | 3844bec | 2014-09-30 11:29:24 -0700 | [diff] [blame] | 21 | } |