MCPcopy
hub / github.com/fanmingming/live / getInvalidTypeMessage

Function getInvalidTypeMessage

m3u8/vue.js:1781–1800  ·  view source on GitHub ↗
(name, value, expectedTypes)

Source from the content-addressed store, hash-verified

1779 }
1780
1781 function getInvalidTypeMessage (name, value, expectedTypes) {
1782 var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
1783 " Expected " + (expectedTypes.map(capitalize).join(', '));
1784 var expectedType = expectedTypes[0];
1785 var receivedType = toRawType(value);
1786 var expectedValue = styleValue(value, expectedType);
1787 var receivedValue = styleValue(value, receivedType);
1788 // check if we need to specify expected value
1789 if (expectedTypes.length === 1 &&
1790 isExplicable(expectedType) &&
1791 !isBoolean(expectedType, receivedType)) {
1792 message += " with value " + expectedValue;
1793 }
1794 message += ", got " + receivedType + " ";
1795 // check if we need to specify received value
1796 if (isExplicable(receivedType)) {
1797 message += "with value " + receivedValue + ".";
1798 }
1799 return message
1800 }
1801
1802 function styleValue (value, type) {
1803 if (type === 'String') {

Callers 1

assertPropFunction · 0.85

Calls 4

toRawTypeFunction · 0.85
styleValueFunction · 0.85
isExplicableFunction · 0.85
isBooleanFunction · 0.85

Tested by

no test coverage detected