es6-class-prototype
Version:
get prototype from es6 class, like old way
1 lines • 1.64 kB
Source Map (JSON)
{"version":3,"file":"index.umd.production.min.cjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * Created by user on 2018/3/16/016.\n */\n\nimport { IClassProxyStatic } from 'class-proxy';\nexport { IClassProxyStatic } from 'class-proxy';\n\nexport function classPrototype<T>(target: IClassProxyStatic<T>, all?: boolean): T\n{\n\t// @ts-ignore\n\tlet desc = Object.getOwnPropertyDescriptors(target.prototype);\n\n\tlet prototype = Object.keys(desc).reduce(function (a, b)\n\t{\n\t\tif (all || !desc[b].get && !desc[b].set)\n\t\t{\n\t\t\t// @ts-ignore\n\t\t\ta[b] = target.prototype[b];\n\t\t}\n\n\t\treturn a;\n\t}, {});\n\n\t// @ts-ignore\n\treturn Object.assign({}, target.prototype, prototype);\n}\n\nexport default classPrototype\n\n// @ts-ignore\nif (process.env.TSDX_FORMAT !== 'esm')\n{\n\tObject.defineProperty(classPrototype, \"__esModule\", { value: true });\n\n\tObject.defineProperty(classPrototype, 'classPrototype', { value: classPrototype });\n\tObject.defineProperty(classPrototype, 'default', { value: classPrototype });\n}\n"],"names":["classPrototype","target","all","desc","Object","getOwnPropertyDescriptors","prototype","keys","reduce","a","b","get","set","assign","defineProperty","value"],"mappings":";;;;EAOgB,SAAAA,eAAkBC,GAA8BC;IAG/D,IAAIC,IAAOC,OAAOC,0BAA0BJ,EAAOK,YAE/CA,IAAYF,OAAOG,KAAKJ,GAAMK,QAAO,SAAUC,GAAGC;MAQrD,QANIR,MAAQC,EAAKO,GAAGC,QAAQR,EAAKO,GAAGE,SAGnCH,EAAEC,KAAKT,EAAOK,UAAUI,KAGlBD;AACP,QAAE,CAAE;IAGL,OAAOL,OAAOS,OAAO,CAAA,GAAIZ,EAAOK,WAAWA;AAC5C;EAOCF,OAAOU,eAAed,gBAAgB,cAAc;IAAEe,QAAO;MAE7DX,OAAOU,eAAed,gBAAgB,kBAAkB;IAAEe,OAAOf;MACjEI,OAAOU,eAAed,gBAAgB,WAAW;IAAEe,OAAOf;;;;"}