* Force parsing value with coerce option. * * @param {*} value * @param {Object} options * @return {*}
(prop, value, vm)
| 6291 | */ |
| 6292 | |
| 6293 | function coerceProp(prop, value, vm) { |
| 6294 | var coerce = prop.options.coerce; |
| 6295 | if (!coerce) { |
| 6296 | return value; |
| 6297 | } |
| 6298 | if (typeof coerce === 'function') { |
| 6299 | return coerce(value); |
| 6300 | } else { |
| 6301 | 'development' !== 'production' && warn('Invalid coerce for prop "' + prop.name + '": expected function, got ' + typeof coerce + '.', vm); |
| 6302 | return value; |
| 6303 | } |
| 6304 | } |
| 6305 | |
| 6306 | /** |
| 6307 | * Assert the type of a value |
no test coverage detected