UNPKG

@metamask/ocap-kernel

Version:
20 lines 770 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractSingleRef = extractSingleRef; const pass_style_1 = require("@endo/pass-style"); const kernel_marshal_ts_1 = require("../../services/kernel-marshal.cjs"); /** * Obtain the KRef from a simple value represented as a CapData object. * * @param data - The data object to be examined. * @returns the single KRef that is `data`, or null if it isn't one. */ function extractSingleRef(data) { const value = (0, kernel_marshal_ts_1.kunser)(data); const style = (0, pass_style_1.passStyleOf)(value); if (style === 'remotable' || style === 'promise') { return (0, kernel_marshal_ts_1.krefOf)(value); } return null; } //# sourceMappingURL=extract-ref.cjs.map