reflect-metadata
Advanced tools
Comparing version
{ | ||
"name": "reflect-metadata", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "Polyfill for Metadata Reflection API", | ||
"main": "Reflect.js", | ||
"typings": "reflect-metadata.d.ts", | ||
"scripts": { | ||
"build": "./node_modules/.bin/tsc.cmd" | ||
"build": "./node_modules/.bin/tsc.cmd", | ||
"build-test": "./node_modules/.bin/tsc.cmd --project ./test/", | ||
"test": "npm run-script build-test & node ./temp/test/run.js" | ||
}, | ||
@@ -9,0 +12,0 @@ "repository": { |
@@ -148,3 +148,3 @@ /*! ***************************************************************************** | ||
targetKey = ToPropertyKey(targetKey); | ||
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | ||
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | ||
} | ||
@@ -155,3 +155,3 @@ else { | ||
} | ||
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); | ||
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); | ||
} | ||
@@ -517,3 +517,3 @@ } | ||
if (IsUndefined(metadataMap)) { | ||
return undefined; | ||
return false; | ||
} | ||
@@ -520,0 +520,0 @@ if (!metadataMap.delete(metadataKey)) { |
@@ -16,5 +16,2 @@ /*! ***************************************************************************** | ||
type ClassMemberDecorator = MethodDecorator | PropertyDecorator; | ||
type Decorator = ClassDecorator | ClassMemberDecorator; | ||
module Reflect { | ||
@@ -30,3 +27,3 @@ declare var global: any; | ||
const _Map: typeof Map = typeof Map === "function" ? Map : CreateMapPolyfill(); | ||
const _Set: typeof Set = typeof Set === "function" ? Set : CreateSetPolyfill(); | ||
const _Set: typeof Set = typeof Set === "function" ? Set : CreateSetPolyfill(); | ||
const _WeakMap: typeof WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); | ||
@@ -58,2 +55,3 @@ | ||
* @param targetKey The property key to decorate. | ||
* @param descriptor A property descriptor | ||
* @remarks Decorators are applied in reverse order. | ||
@@ -88,5 +86,4 @@ * @example | ||
*/ | ||
export function decorate(decorators: ClassMemberDecorator[], target: Object, targetKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor; | ||
export function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, targetKey: string | symbol, descriptor?: PropertyDescriptor): PropertyDescriptor; | ||
/** | ||
@@ -131,3 +128,3 @@ * Applies a set of decorators to a property of a target object. | ||
*/ | ||
export function decorate(decorators: Decorator[], target: Object, targetKey?: string | symbol, targetDescriptor?: PropertyDescriptor): any { | ||
export function decorate(decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[], target: Object, targetKey?: string | symbol, targetDescriptor?: PropertyDescriptor): any { | ||
if (!IsUndefined(targetDescriptor)) { | ||
@@ -213,3 +210,3 @@ if (!IsArray(decorators)) { | ||
*/ | ||
export function metadata(metadataKey: any, metadataValue: any): Decorator { | ||
export function metadata(metadataKey: any, metadataValue: any) { | ||
function decorator(target: Function): void; | ||
@@ -224,3 +221,3 @@ function decorator(target: Object, targetKey: string | symbol): void; | ||
targetKey = ToPropertyKey(targetKey); | ||
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | ||
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); | ||
} | ||
@@ -232,3 +229,3 @@ else { | ||
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, /*targetKey*/ undefined); | ||
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, /*targetKey*/ undefined); | ||
} | ||
@@ -993,3 +990,3 @@ } | ||
if (IsUndefined(metadataMap)) { | ||
return undefined; | ||
return false; | ||
} | ||
@@ -1010,3 +1007,3 @@ | ||
} | ||
__Metadata__.delete(target); | ||
@@ -1173,3 +1170,3 @@ return true; | ||
if (metadataMap) { | ||
metadataMap.forEach((_, key) => keys.push(key)); | ||
metadataMap.forEach((_, key) => keys.push(key)); | ||
} | ||
@@ -1197,3 +1194,3 @@ | ||
function IsConstructor(x: any): boolean { | ||
return typeof x === "function"; | ||
return typeof x === "function"; | ||
} | ||
@@ -1263,4 +1260,4 @@ | ||
Map.prototype = { | ||
get size() { | ||
return this._keys.length; | ||
get size() { | ||
return this._keys.length; | ||
}, | ||
@@ -1337,4 +1334,4 @@ has(key: any): boolean { | ||
Set.prototype = { | ||
get size() { | ||
return this._map.length; | ||
get size() { | ||
return this._map.length; | ||
}, | ||
@@ -1364,5 +1361,5 @@ has(value: any): boolean { | ||
const UUID_SIZE = 16; | ||
const isNode = typeof global !== "undefined" && | ||
typeof module === "object" && | ||
typeof module.exports === "object" && | ||
const isNode = typeof global !== "undefined" && | ||
typeof module === "object" && | ||
typeof module.exports === "object" && | ||
typeof require === "function"; | ||
@@ -1373,3 +1370,3 @@ const nodeCrypto = isNode && require("crypto"); | ||
const rootKey = CreateUniqueKey(); | ||
function WeakMap() { | ||
@@ -1507,5 +1504,5 @@ this._key = CreateUniqueKey(); | ||
typeof window !== "undefined" ? window : | ||
typeof WorkerGlobalScope !== "undefined" ? self : | ||
typeof global !== "undefined" ? global : | ||
Function("return this;")()); | ||
typeof WorkerGlobalScope !== "undefined" ? self : | ||
typeof global !== "undefined" ? global : | ||
Function("return this;")()); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
506111
60.96%58
314.29%5388
110.55%2
100%