From 1f9e43b7bbb848c7ee2aaa89ffece17002b2c915 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 16 一月 2026 17:31:08 +0800
Subject: [PATCH] 2026.1.16
---
miniprogram_npm/tdesign-miniprogram/common/src/flatTool.js | 58 +---------------------------------------------------------
1 files changed, 1 insertions(+), 57 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/common/src/flatTool.js b/miniprogram_npm/tdesign-miniprogram/common/src/flatTool.js
index 045abd7..021f4ee 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/src/flatTool.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/src/flatTool.js
@@ -1,57 +1 @@
-export const getPrototypeOf = function (obj) {
- return Object.getPrototypeOf ? Object.getPrototypeOf(obj) : obj.__proto__;
-};
-export const isObject = function isObject(something) {
- const type = typeof something;
- return something !== null && (type === 'function' || type === 'object');
-};
-export const iterateInheritedPrototype = function iterateInheritedPrototype(callback, fromCtor, toCtor, includeToCtor = true) {
- let proto = fromCtor.prototype || fromCtor;
- const toProto = toCtor.prototype || toCtor;
- while (proto) {
- if (!includeToCtor && proto === toProto)
- break;
- if (callback(proto) === false)
- break;
- if (proto === toProto)
- break;
- proto = getPrototypeOf(proto);
- }
-};
-export const toObject = function toObject(something, options = {}) {
- const obj = {};
- if (!isObject(something))
- return obj;
- const excludes = options.excludes || ['constructor'];
- const { enumerable = true, configurable = 0, writable = 0 } = options;
- const defaultDesc = {};
- if (enumerable !== 0)
- defaultDesc.enumerable = enumerable;
- if (configurable !== 0)
- defaultDesc.configurable = configurable;
- if (writable !== 0)
- defaultDesc.writable = writable;
- iterateInheritedPrototype((proto) => {
- Object.getOwnPropertyNames(proto).forEach((key) => {
- if (excludes.indexOf(key) >= 0)
- return;
- if (Object.prototype.hasOwnProperty.call(obj, key))
- return;
- const desc = Object.getOwnPropertyDescriptor(proto, key);
- const fnKeys = ['get', 'set', 'value'];
- fnKeys.forEach((k) => {
- if (typeof desc[k] === 'function') {
- const oldFn = desc[k];
- desc[k] = function (...args) {
- return oldFn.apply(Object.prototype.hasOwnProperty.call(options, 'bindTo') ? options.bindTo : this, args);
- };
- }
- });
- Object.defineProperty(obj, key, Object.assign(Object.assign({}, desc), defaultDesc));
- });
- }, something, options.till || Object, false);
- return obj;
-};
-export const isPlainObject = function isPlainObject(something) {
- return Object.prototype.toString.call(something) === '[object Object]';
-};
+import{isObject}from"../../common/validator";export const getPrototypeOf=function(t){return Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__};export const iterateInheritedPrototype=function(t,e,o,r=!0){let n=e.prototype||e;const c=o.prototype||o;for(;n&&(r||n!==c)&&!1!==t(n)&&n!==c;)n=getPrototypeOf(n)};export const toObject=function(t,e={}){const o={};if(!isObject(t))return o;const r=e.excludes||["constructor"],{enumerable:n=!0,configurable:c=0,writable:i=0}=e,p={};return 0!==n&&(p.enumerable=n),0!==c&&(p.configurable=c),0!==i&&(p.writable=i),iterateInheritedPrototype(t=>{Object.getOwnPropertyNames(t).forEach(n=>{if(r.indexOf(n)>=0)return;if(Object.prototype.hasOwnProperty.call(o,n))return;const c=Object.getOwnPropertyDescriptor(t,n);["get","set","value"].forEach(t=>{if("function"==typeof c[t]){const o=c[t];c[t]=function(...t){return o.apply(Object.prototype.hasOwnProperty.call(e,"bindTo")?e.bindTo:this,t)}}}),Object.defineProperty(o,n,Object.assign(Object.assign({},c),p))})},t,e.till||Object,!1),o};
\ No newline at end of file
--
Gitblit v1.9.3