MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / coerceProp

Function coerceProp

06.Router/basic/js/vue.js:6293–6304  ·  view source on GitHub ↗

* Force parsing value with coerce option. * * @param {*} value * @param {Object} options * @return {*}

(prop, value, vm)

Source from the content-addressed store, hash-verified

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

Callers 1

processPropValueFunction · 0.70

Calls 1

warnFunction · 0.70

Tested by

no test coverage detected