UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

25 lines (24 loc) 1.21 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const insertWrapDetails_1 = __importDefault(require("./insertWrapDetails")); const getWrapDetails_1 = __importDefault(require("./getWrapDetails")); const updateWrapDetails_1 = __importDefault(require("./updateWrapDetails")); const setToString_1 = __importDefault(require("./setToString")); /** * Sets the `toString` method of `wrapper` to mimic the source of `reference` * with wrapper details in a comment at the top of the source body. * * @private * @param {Function} wrapper The function to modify. * @param {Function} reference The reference function. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Function} Returns `wrapper`. */ function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); return (0, setToString_1.default)(wrapper, (0, insertWrapDetails_1.default)(source, (0, updateWrapDetails_1.default)((0, getWrapDetails_1.default)(source), bitmask))); } exports.default = setWrapToString;