UNPKG

es6-class-prototype

Version:
1 lines 2.13 kB
{"version":3,"file":"index.umd.development.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":";;;;;;CAOgB,SAAAA,cAAc,CAAIC,MAA4B,EAAEC,GAAa,EAAA;GAG5E,IAAIC,IAAI,GAAGC,MAAM,CAACC,yBAAyB,CAACJ,MAAM,CAACK,SAAS,CAAC,CAAA;CAE7D,EAAA,IAAIA,SAAS,GAAGF,MAAM,CAACG,IAAI,CAACJ,IAAI,CAAC,CAACK,MAAM,CAAC,UAAUC,CAAC,EAAEC,CAAC,EAAA;CAEtD,IAAA,IAAIR,GAAG,IAAI,CAACC,IAAI,CAACO,CAAC,CAAC,CAACC,GAAG,IAAI,CAACR,IAAI,CAACO,CAAC,CAAC,CAACE,GAAG,EACvC;OAECH,CAAC,CAACC,CAAC,CAAC,GAAGT,MAAM,CAACK,SAAS,CAACI,CAAC,CAAC,CAAA;CAC1B,KAAA;CAED,IAAA,OAAOD,CAAC,CAAA;IACR,EAAE,EAAE,CAAC,CAAA;CAGN,EAAA,OAAOL,MAAM,CAACS,MAAM,CAAC,EAAE,EAAEZ,MAAM,CAACK,SAAS,EAAEA,SAAS,CAAC,CAAA;CACtD,CAAA;CAMA;CACCF,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,YAAY,EAAE;CAAEe,IAAAA,KAAK,EAAE,IAAA;CAAI,GAAE,CAAC,CAAA;CAEpEX,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,gBAAgB,EAAE;CAAEe,IAAAA,KAAK,EAAEf,cAAAA;CAAc,GAAE,CAAC,CAAA;CAClFI,EAAAA,MAAM,CAACU,cAAc,CAACd,cAAc,EAAE,SAAS,EAAE;CAAEe,IAAAA,KAAK,EAAEf,cAAAA;CAAc,GAAE,CAAC,CAAA;CAC3E;;;;;;;;;;;"}