es6-class-prototype
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,6 +5,10 @@ /** | ||
import { ClassProxyStatic } from 'class-proxy'; | ||
declare const _classPrototype: (<T>(target: ClassProxyStatic<T>) => T) & { | ||
default: <T>(target: ClassProxyStatic<T>) => T; | ||
classPrototype: <T>(target: ClassProxyStatic<T>) => T; | ||
declare const _classPrototype: (<T>(target: _classPrototype.IClassProxyStatic<T>, all?: boolean) => T) & { | ||
default: <T>(target: _classPrototype.IClassProxyStatic<T>, all?: boolean) => T; | ||
classPrototype: <T>(target: _classPrototype.IClassProxyStatic<T>, all?: boolean) => T; | ||
}; | ||
declare module _classPrototype { | ||
interface IClassProxyStatic<T> extends ClassProxyStatic<T> { | ||
} | ||
} | ||
export = _classPrototype; |
@@ -5,7 +5,7 @@ "use strict"; | ||
*/ | ||
function classPrototype(target) { | ||
function classPrototype(target, all) { | ||
// @ts-ignore | ||
let desc = Object.getOwnPropertyDescriptors(target.prototype); | ||
let prototype = Object.keys(desc).reduce(function (a, b) { | ||
if (!desc[b].get && !desc[b].set) { | ||
if (all || !desc[b].get && !desc[b].set) { | ||
// @ts-ignore | ||
@@ -12,0 +12,0 @@ a[b] = target.prototype[b]; |
12
index.ts
@@ -7,3 +7,3 @@ /** | ||
function classPrototype<T>(target: ClassProxyStatic<T>): T | ||
function classPrototype<T>(target: _classPrototype.IClassProxyStatic<T>, all?: boolean): T | ||
{ | ||
@@ -15,3 +15,3 @@ // @ts-ignore | ||
{ | ||
if (!desc[b].get && !desc[b].set) | ||
if (all || !desc[b].get && !desc[b].set) | ||
{ | ||
@@ -34,4 +34,12 @@ // @ts-ignore | ||
module _classPrototype | ||
{ | ||
export interface IClassProxyStatic<T> extends ClassProxyStatic<T> | ||
{ | ||
} | ||
} | ||
_classPrototype.default = _classPrototype.classPrototype = _classPrototype; | ||
export = _classPrototype; |
{ | ||
"name": "es6-class-prototype", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "get prototype from es6 class, like old way", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3107
65