Skip to content

Commit

Permalink
add usage guide to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
disizali committed May 29, 2021
1 parent de5daa2 commit 458dd9b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

> This module is a extended version of [@abraham/reflection](https://github.com/abraham/reflection).
## Usage :

```typescript
import "https://deno.land/x/reflection/mod.ts"; // extend Reflect Object
const target = {};
Reflect.defineMetadata("key", "value", target);
Reflect.getMetadata("key", target); // Result => "value"
```

## Extended Methods :

- `Reflect.getOwnMetadataKeys`
Expand All @@ -24,7 +33,9 @@ console.log(Reflect.getOwnMetadataKeys(target));
console.log(Reflect.getOwnMetadataKeys(target, "property"));
// Result => ["firstPropKey", "secondPropKey" ]
```

- `Reflect.getMetaDataKey`

```typescript
class Parent {}
class Child extends Parent {}
Expand All @@ -37,4 +48,4 @@ console.log(Reflect.getMetadataKeys(Child));

console.log(Reflect.getMetadataKeys(Child, "property"));
//Result => ["propKey" ]
```
```

0 comments on commit 458dd9b

Please sign in to comment.