npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@geeko/meta

v1.4.4

Published

Geeko metadata library for decorators & dependency injection

Downloads

34

Readme

Geeko Meta

image

Simple dependancy injection library written for Typescript

License Downloads

Part of the Geeko ecosystem, this library allows for automatic dependancy injection & context building.

Resolve

Below is an example of how to resolve an instance which has the @Injectable decorator.

import { Reflector } from '@geeko/meta';

const instance: Test = Reflector.get(Test);

Test class & @Injectable definition below:

/**
 * @public
 */
export interface Encoder {
       encode(value: any): string;
       decode(value: string): any;
}

/**
 * Native @see JSON encoder/decoder
 *
 * @public
 */
@Injectable('JSON_ENCODER')
export class JsonEncoder implements Encoder {
       encode(value: any): string {
              return JSON.stringify(value);
       }

       decode(value: string): any {
              return JSON.parse(value);
       }
}

/**
 * @public
 */
@Injectable()
export class Test {
       /**
        * Expects @see Encoder interface - in this case the @see JsonEncoder
        *
        * @public
        * @param {Encoder} encoder
        */
       public constructor(@Inject('JSON_ENCODER') public encoder: Encoder) {}
}

Application Context

Application contexts can be created to fine tune the dependancy output by adding custom factory functions/values & injection tokens, As seen below:

import { Reflector } from '@geeko/meta';

const context: ApplicationContext = Reflector.createApplicationContext({
       providers: [Test, {
              token: "JSON_ENCODER",
              useFactory: (): Encoder => {
                     return new JsonEncoder();
              }
       }],
});

const instance: Test = context.get(Test);

Custom Injectables

Below is an example of how to create a custom injectable using the SetMetadata:

import { SetMetadata, CustomDecorator, MetadataOptions } from '@geeko/meta';

/**
 * Custom @see Encoder based injection declaration.
 *
 * @public
 * @param {InjectableOptions | String} options
 * @returns {CustomDecorator<T>}
 */
export const Encoding = (
       options?: string | InjectableOptions,
): CustomDecorator => {
       let metadata: MetadataOptions = Object.assign(
              typeof options === 'string'
                     ? { token: options }
                     : (options ?? {}),
              {
                     injectable: true,
              },
       );

       return SetMetadata(ENCODER_INJECTABLE_TOKEN, true, metadata);
};

/**
 * Custom hex encoder definition
 *
 * @public
 */
@Encoding('hex')
export class HexEncoder implements Encoder {
       encode(value: any): string {
              return toHex(value);
       }

       decode(value: string): any {
              return fromHex(value);
       }
}

Get Specific Injectables

Below is an example of how to get all injectables with a specific token, in this case the Encoding token seen above:

import { Reflector } from '@geeko/meta';

const injectables: Array<any> = Reflector.getFor(ENCODER_INJECTABLE_TOKEN);

If the injectable is a function or member of a class

const injectables: Array<any> | undefined = Reflector.getFor(GET_INJECTABLE_TOKEN, {
       isProperty: true,
});

The response will look like the following:

[
  {
    metadata: { path: '/test' },
    target: [class Test],
    token: 'GET_INJECTABLE_TOKEN',
    key: 'get'
  }
]

Get Metadata

Below code will fetch the raw metadata passed to the @Injectable decorator for the Test class example as seen below:

const metadata: any = Reflector.getMetadata(Test);

Note: By default the resolver will automatically collect metadata ready for injection on startup, however, if you wish to only use the 'createApplicationContext' method, you can disable the automatic resolver by setting the following process environment variable GEEKO_AUTO_INJECT to 0, e.g:

 set GEEKO_AUTO_INJECT 0 node ./app.js

Installation

NPM

npm i @geeko/meta