Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/doktordirk/metadata into…
Browse files Browse the repository at this point in the history
… doktordirk-patch-1
  • Loading branch information
EisenbergEffect committed May 9, 2016
2 parents a9a3e59 + fa861f7 commit a290d81
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ interface MetadataType {
* @param target The target to lookup the metadata on.
* @param targetKey The member on the target to lookup the metadata on.
*/
get(metadataKey: string, target: Function, targetKey: string): Object;
get(metadataKey: string, target: Function, targetKey?: string): Object;
/**
* Gets metadata specified by a key on a target, only searching the own instance.
* @param metadataKey The key for the metadata to lookup.
* @param target The target to lookup the metadata on.
* @param targetKey The member on the target to lookup the metadata on.
*/
getOwn(metadataKey: string, target: Function, targetKey: string): Object;
getOwn(metadataKey: string, target: Function, targetKey?: string): Object;
/**
* Defines metadata specified by a key on a target.
* @param metadataKey The key for the metadata to define.
* @param target The target to set the metadata on.
* @param targetKey The member on the target to set the metadata on.
*/
define(metadataKey: string, metadataValue: Object, target: Function, targetKey: string): void;
define(metadataKey: string, metadataValue: Object, target: Function, targetKey?: string): void;
/**
* Gets metadata specified by a key on a target, or creates an instance of the specified metadata if not found.
* @param metadataKey The key for the metadata to lookup or create.
* @param Type The type of metadata to create if existing metadata is not found.
* @param target The target to lookup or create the metadata on.
* @param targetKey The member on the target to lookup or create the metadata on.
*/
getOrCreateOwn(metadataKey: string, Type: Function, target: Function, targetKey: string): Object;
getOrCreateOwn(metadataKey: string, Type: Function, target: Function, targetKey?: string): Object;
}

/**
Expand All @@ -52,19 +52,19 @@ export const metadata: MetadataType = {
resource: 'aurelia:resource',
paramTypes: 'design:paramtypes',
properties: 'design:properties',
get(metadataKey: string, target: Function, targetKey: string): Object {
get(metadataKey: string, target: Function, targetKey?: string): Object {
if (!target) { return undefined; }
let result = metadata.getOwn(metadataKey, target, targetKey);
return result === undefined ? metadata.get(metadataKey, Object.getPrototypeOf(target), targetKey) : result;
},
getOwn(metadataKey: string, target: Function, targetKey: string): Object {
getOwn(metadataKey: string, target: Function, targetKey?: string): Object {
if (!target) { return undefined; }
return Reflect.getOwnMetadata(metadataKey, target, targetKey);
},
define(metadataKey: string, metadataValue: Object, target: Function, targetKey: string): void {
define(metadataKey: string, metadataValue: Object, target: Function, targetKey?: string): void {
Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);
},
getOrCreateOwn(metadataKey: string, Type: Function, target: Function, targetKey: string): Object {
getOrCreateOwn(metadataKey: string, Type: Function, target: Function, targetKey?: string): Object {
let result = metadata.getOwn(metadataKey, target, targetKey);

if (result === undefined) {
Expand Down

0 comments on commit a290d81

Please sign in to comment.