{"version":3,"sources":["../src/classs/getClassMethods.ts"],"names":["getClassMethods","obj","options","excludes","includePrototype","assignObject","methods","proto","name"],"mappings":";;;;AAcO,SAASA,CAAgBC,CAAAA,CAAAA,CAAaC,CAAkC,CAAA,CAC3E,GAAM,CAAE,QAAA,CAAAC,CAAU,CAAA,gBAAA,CAAAC,CAAiB,CAAIC,CAAAA,CAAAA,CACnC,CACI,QAAA,CAAU,CAAC,aAAa,CAAA,CACxB,gBAAkB,CAAA,IACtB,EACAH,CACJ,CAAA,CACKC,CAAS,CAAA,QAAA,CAAS,aAAa,CAAGA,EAAAA,CAAAA,CAAS,IAAK,CAAA,aAAa,EAClE,IAAMG,CAAAA,CAA+B,EAAC,CAClCC,EAASN,CAAY,CAAA,SAAA,CACzB,KAAOM,CAAAA,EAAS,CAAC,MAAO,CAAA,EAAA,CAAGA,CAAO,CAAA,MAAA,CAAO,SAAS,CAC9CD,GAAAA,CAAAA,CAAQ,IAAK,CAAA,GAAG,QAAQ,OAAQC,CAAAA,CAAM,CAAC,CAAA,CACvCA,EAAQA,CAAM,CAAA,SAAA,CACV,CAACH,CAAAA,CAAAA,CAAAA,EAAL,CAEJ,OAAO,CAAC,GAAG,IAAI,IAAIE,CAAO,CAAC,CAAE,CAAA,MAAA,CAAQE,GAAS,CAACL,CAAAA,CAAS,QAASK,CAAAA,CAAI,CAAC,CAC1E","file":"chunk-FXE6WFAA.mjs","sourcesContent":["/**\n *\n *\n * 获取类方法列表\n *\n *\n */\nimport { assignObject } from '../object/assignObject'\n\nexport interface GetClassMethodsOptions {\n    includePrototype?: boolean // 是否包含原型链上的所有方法\n    excludes?: (string | symbol)[] | ((name: string | symbol) => boolean) // 排除\n}\n\nexport function getClassMethods(obj: object, options?: GetClassMethodsOptions) {\n    const { excludes, includePrototype } = assignObject(\n        {\n            excludes: ['constructor'],\n            includePrototype: true,\n        },\n        options,\n    )\n    if (!excludes.includes('constructor')) excludes.push('constructor')\n    const methods: (string | symbol)[] = []\n    let proto = (obj as any).__proto__\n    while (proto && !Object.is(proto, Object.prototype)) {\n        methods.push(...Reflect.ownKeys(proto!))\n        proto = proto.__proto__\n        if (!includePrototype) break\n    }\n    return [...new Set(methods)].filter((name) => !excludes.includes(name))\n}\n\n// class A{\n//     x=1\n//     y=2\n//     #xx=1\n//     private p1(){}\n//     a1(){\n\n//     }\n//     a2(){\n\n//     }\n//     a3(){\n\n//     }\n// }\n\n// class AA extends A{\n//     xx=1\n//     yy=2\n//     aa1(){}\n//     aa2(){}\n// }\n\n// console.log(getClassMethods(new A()))\n// console.log(getClassMethods(new AA()))\n// console.log(getClassMethods(new AA(),{includePrototype:false}))\n"]}