UNPKG

@jecloud/utils

Version:

JECloud 工具库

1 lines 953 B
import{isBoolean as _,isFunction as t}from"lodash-es";var r=Object.defineProperty;function e(_){return t(_)&&0===_.name.indexOf("bound ")&&!_.hasOwnProperty("prototype")}function o(t){return void 0===t&&(t={__IS_BOUND_FUNCTION__:!1}),_(t.__IS_BOUND_FUNCTION__)?t.__IS_BOUND_FUNCTION__:t.__IS_BOUND_FUNCTION__=e(t)}function n(t){var r;if(void 0===t&&(t={__IS_CONSTRUCTOR__:!1}),_(t.__IS_CONSTRUCTOR__))return t.__IS_CONSTRUCTOR__;var e=t.toString(),o=(null===(r=t.prototype)||void 0===r?void 0:r.constructor)===t&&Object.getOwnPropertyNames(t.prototype).length>1||/^function\s+[A-Z]/.test(e)||/^class\s+/.test(e);return t.__IS_CONSTRUCTOR__=o}export default function O(_,t){if(t.__BOUND_WINDOW_FUNCTION__)return t.__BOUND_WINDOW_FUNCTION__;if(!n(t)&&!o(t)){var e=t.bind(_);for(var O in t)e[O]=t[O];return t.hasOwnProperty("prototype")&&r(e,"prototype",{value:t.prototype,configurable:!0,enumerable:!1,writable:!0}),t.__BOUND_WINDOW_FUNCTION__=e}return t}