UNPKG

dumi

Version:

📖 Documentation Generator of React Component

19 lines (18 loc) • 1.27 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function isRecord(value) { return _typeof(value) === 'object' && value !== null && !Array.isArray(value); } /** Only trust messages from the expected window on this site's origin. */ export function isLiveDemoMessage(event, source, type) { var origin = window.location.origin; return origin !== 'null' && event.origin === origin && event.source === source && isRecord(event.data) && event.data.type === type; } export function isLiveDemoSource(value, entryFileName) { return isRecord(value) && entryFileName !== undefined && Object.prototype.hasOwnProperty.call(value, entryFileName) && typeof value[entryFileName] === 'string' && Object.values(value).every(function (source) { return typeof source === 'string'; }); } export function isLiveDemoCompileResult(value) { // Preserve arbitrary compiler throw values, including errors from other realms. return isRecord(value) && Object.prototype.hasOwnProperty.call(value, 'err'); }