sOwnProperty(importAssertions, 'type')) { // `type` wasn't specified at all. throw new ERR_IMPORT_ASSERTION_TYPE_MISSING(url, validType); } handleInvalidType(url, importAssertions.type); } } /** * Throw the correct error depending on what's wrong with the type assertion. * @param {string} url The resolved URL for the module to be imported * @param {string} type The value of the import assertion `type` property */ function handleInvalidType(url, type) { // `type` might have not been a string. validateString(type, 'type'); // `type` might not have been one of the types we understand. if (!ArrayPrototypeIncludes(supportedAssertionTypes, type)) { throw new ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED(type); } // `type` was the wrong value for this format. throw new ERR_IMPORT_ASSERTION_TYPE_FAILED(url, type); } module.exports = { kImplicitAssertType, validateAssertions, };