UNPKG

es6-class-prototype

Version:
1 lines 2.31 kB
{"version":3,"file":"index.cjs.development.cjs","sources":["../src/index.ts","../src/index.cts"],"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","/**\n * Created by user on 2018/2/11/011.\n */\n\nimport _ from './index';\n\n// @ts-ignore\nexport = _;\n"],"names":["classPrototype","target","all","desc","Object","getOwnPropertyDescriptors","prototype","keys","reduce","a","b","get","set","assign","defineProperty","value","_"],"mappings":";;AAOgB,SAAAA,cAAc,CAAIC,MAA4B,EAAEC,GAAa,EAAA;EAG5E,IAAIC,IAAI,GAAGC,MAAM,CAACC,yBAAyB,CAACJ,MAAM,CAACK,SAAS,CAAC,CAAA;AAE7D,EAAA,IAAIA,SAAS,GAAGF,MAAM,CAACG,IAAI,CAACJ,IAAI,CAAC,CAACK,MAAM,CAAC,UAAUC,CAAC,EAAEC,CAAC,EAAA;AAEtD,IAAA,IAAIR,GAAG,IAAI,CAACC,IAAI,CAACO,CAAC,CAAC,CAACC,GAAG,IAAI,CAACR,IAAI,CAACO,CAAC,CAAC,CAACE,GAAG,EACvC;MAECH,CAAC,CAACC,CAAC,CAAC,GAAGT,MAAM,CAACK,SAAS,CAACI,CAAC,CAAC,CAAA;AAC1B,KAAA;AAED,IAAA,OAAOD,CAAC,CAAA;GACR,EAAE,EAAE,CAAC,CAAA;AAGN,EAAA,OAAOL,MAAM,CAACS,MAAM,CAAC,EAAE,EAAEZ,MAAM,CAACK,SAAS,EAAEA,SAAS,CAAC,CAAA;AACtD,CAAA;AAMA;AACCF,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,YAAY,EAAE;AAAEe,IAAAA,KAAK,EAAE,IAAA;AAAI,GAAE,CAAC,CAAA;AAEpEX,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,gBAAgB,EAAE;AAAEe,IAAAA,KAAK,EAAEf,cAAAA;AAAc,GAAE,CAAC,CAAA;AAClFI,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,SAAS,EAAE;AAAEe,IAAAA,KAAK,EAAEf,cAAAA;AAAc,GAAE,CAAC,CAAA;AAC3E;;ACpCD;AACA;AACA;;AAIA;AAAA,MAAA,CAAA,OAAA,GACSgB,cAAC;;"}