Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@injex/stdlib

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@injex/stdlib - npm Package Compare versions

Comparing version 4.0.0-alpha.0 to 4.0.0-alpha.1

1

lib/metadata.d.ts

@@ -1,2 +0,1 @@

import "reflect-metadata";
export declare type MetadataHandlers<T> = {

@@ -3,0 +2,0 @@ ensureMetadata: (target: any) => T;

10

lib/metadata.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMetadataHandlers = void 0;
require("reflect-metadata");
const _metadata = new WeakMap();
function createMetadataHandlers(metadataKey) {
function ensureMetadata(target) {
if (!hasMetadata(target)) {
Reflect.defineMetadata(metadataKey, {}, target);
_metadata.set(target, {
[metadataKey]: {}
});
}

@@ -17,6 +19,6 @@ return getMetadata(target);

function getMetadata(target) {
return Reflect.getOwnMetadata(metadataKey, target);
return _metadata.get(target)?.[metadataKey];
}
function hasMetadata(target) {
return Reflect.hasOwnMetadata(metadataKey, target);
return _metadata.has(target);
}

@@ -23,0 +25,0 @@ function pushMetadata(target, key, value) {

{
"name": "@injex/stdlib",
"version": "4.0.0-alpha.0",
"version": "4.0.0-alpha.1",
"description": "",

@@ -40,5 +40,2 @@ "keywords": [],

"homepage": "https://github.com/uditalias/injex#readme",
"dependencies": {
"reflect-metadata": "^0.1.13"
},
"devDependencies": {

@@ -51,3 +48,3 @@ "jest": "^26.4.2",

},
"gitHead": "c573d14be7e2530d19be7ebd7a6d4a8faf45b507"
"gitHead": "9cf3e7a273415b811e06f4c98b38bc87755872ca"
}

@@ -1,3 +0,1 @@

import "reflect-metadata";
export type MetadataHandlers<T> = {

@@ -12,6 +10,10 @@ ensureMetadata: (target: any) => T;

const _metadata = new WeakMap();
export function createMetadataHandlers<T = any>(metadataKey: symbol): MetadataHandlers<T> {
function ensureMetadata(target): T {
if (!hasMetadata(target)) {
Reflect.defineMetadata(metadataKey, {}, target);
_metadata.set(target, {
[metadataKey]: {}
});
}

@@ -28,7 +30,7 @@

function getMetadata(target): T {
return Reflect.getOwnMetadata(metadataKey, target);
return _metadata.get(target)?.[metadataKey];
}
function hasMetadata(target): boolean {
return Reflect.hasOwnMetadata(metadataKey, target);
return _metadata.has(target);
}

@@ -35,0 +37,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc