MCPcopy Index your code
hub / github.com/TruthHun/BookStack / assertType

Function assertType

static/vuejs/vue.runtime.esm.js:1387–1409  ·  view source on GitHub ↗

* Assert the type of a value

(value, type)

Source from the content-addressed store, hash-verified

1385 * Assert the type of a value
1386 */
1387function assertType (value, type) {
1388 var valid;
1389 var expectedType = getType(type);
1390 if (expectedType === 'String') {
1391 valid = typeof value === (expectedType = 'string');
1392 } else if (expectedType === 'Number') {
1393 valid = typeof value === (expectedType = 'number');
1394 } else if (expectedType === 'Boolean') {
1395 valid = typeof value === (expectedType = 'boolean');
1396 } else if (expectedType === 'Function') {
1397 valid = typeof value === (expectedType = 'function');
1398 } else if (expectedType === 'Object') {
1399 valid = isPlainObject(value);
1400 } else if (expectedType === 'Array') {
1401 valid = Array.isArray(value);
1402 } else {
1403 valid = value instanceof type;
1404 }
1405 return {
1406 valid: valid,
1407 expectedType: expectedType
1408 }
1409}
1410
1411/**
1412 * Use function string name to check built-in types,

Callers 1

assertPropFunction · 0.70

Calls 2

getTypeFunction · 0.70
isPlainObjectFunction · 0.70

Tested by

no test coverage detected