Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including reflect-helper with all npm packages installed. Try it out:

var reflect = require("reflect-helper"); // declare the EntityAnnotation and FieldAnnotation types function EntityAnnotation(collection) { this.collection = collection; } function FieldAnnotation() { } // create decorators from the types var Entity = reflect.makeDecorator(EntityAnnotation), Field = reflect.makeDecorator(FieldAnnotation); // declare the Person type and decorate it using the Entity and Field decorators function Person(age) { this.age = age; } reflect.decorate(Person, new Entity("people"), { age: Field() }); // get metadata for the Person type var personType = reflect.getType(Person); console.log(personType.getAnnotations(EntityAnnotation)[0].collection); console.log(personType.properties[0].name);

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

reflect-helper v1.1.1

A utility library to for working with Angular2-style annotations and type information provided by TypeScript emitDecoratorMetadata.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free