How to use @abraham/reflection - 7 common examples

To help you get started, we’ve selected a few @abraham/reflection examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hotell / rea-di / src / __tests__ / components / provide-inject.spec.tsx View on Github external
it(`should add metadata only once via wrapper`, () => {
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)

      const DecoratedEngine = optional(Engine)
      const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()

      expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
        optional: true,
      })
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
      expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
      expect(OriginalEngine).toBe(Engine)
    })
github Hotell / rea-di / src / __tests__ / components / provide-inject.spec.tsx View on Github external
it(`should add metadata only once via wrapper`, () => {
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)

      const DecoratedEngine = optional(Engine)
      const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()

      expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
        optional: true,
      })
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
      expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
      expect(OriginalEngine).toBe(Engine)
    })
github Hotell / rea-di / src / __tests__ / components / provide-inject.spec.tsx View on Github external
it(`should add metadata only once via wrapper`, () => {
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)

      const DecoratedEngine = optional(Engine)
      const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()

      expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
        optional: true,
      })
      expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
      expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
      expect(OriginalEngine).toBe(Engine)
    })
github KiranMantha / plumejs / dist / src / lib / decorators.js View on Github external
const getDeps = (target) => {
    let types = reflection_1.Reflection.getMetadata("design:paramtypes", target) || [];
    let deps = types.map((a) => {
        if (a) {
            if (a.name !== "Object") {
                return a.name;
            }
            else {
                return "props";
            }
        }
        else {
            return "";
        }
    });
    return deps;
};
const depsResolver = (options, target) => {
github KiranMantha / plumejs / dist / src / lib / decorators.js View on Github external
const Input = () => (target, key) => {
    reflection_1.Reflection.defineMetadata(utils_1.INPUT_METADATA_KEY, key, target.constructor);
};
exports.Input = Input;
github KiranMantha / plumejs / src / lib / decorators.ts View on Github external
const Input = () => (target: any, key: string) => {
	Reflect.defineMetadata(INPUT_METADATA_KEY, key, target.constructor);
};
github KiranMantha / plumejs / src / lib / decorators.ts View on Github external
const getDeps = (target: Function): Array => {
	let types:Array = Reflect.getMetadata("design:paramtypes", target) || [];
	let deps = types.map((a: Function) => {
		if (a) {
			if (a.name !== "Object") {
				return a.name;
			} else {
				return "props";
			}
		} else {
			return "";
		}
	});
	return deps;
};

@abraham/reflection

Lightweight ES Module implementation of reflect-metadata

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis