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

@knowark/injectarkjs

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knowark/injectarkjs - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

lib/factory.test.js

3

lib/factory.js
// Base Factory Interface
export class Factory {
/** @param {Object} config */
constructor(config = {}) {
constructor (config = {}) {
this.config = config
this.allowed = []
}

@@ -7,0 +8,0 @@

@@ -17,4 +17,12 @@ import { Factory } from './factory.js' // eslint-disable-line

get (resource) {
const allowed = this.factory.allowed
if (allowed?.length && !allowed.includes(resource)) {
throw new Error(`Direct access to "${resource}" is not allowed.`)
}
return this.resolve(resource, true)
}
/** @param {string} resource */
resolve (resource) {
resolve (resource, strict = false) {
const fetched = this._registryFetch(resource)

@@ -29,2 +37,6 @@ if (fetched) {

if (strict && !instance) {
throw new Error(`The "${resource}" resource could not be resolved.`)
}
return instance

@@ -63,3 +75,3 @@ }

let extract = this.factory.extract.bind(this.factory)
const extract = this.factory.extract.bind(this.factory)
const builder = extract(rule.method)

@@ -94,4 +106,4 @@

_parseDependencies (builder) {
const stripComments = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
const argumentNames = /([^\s,]+)/g;
const stripComments = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg
const argumentNames = /([^\s,]+)/g
const functionString = builder.toString().replace(stripComments, '')

@@ -98,0 +110,0 @@ const result = functionString.slice(functionString.indexOf(

{
"name": "@knowark/injectarkjs",
"version": "0.6.0",
"version": "0.7.0",
"description": "Dependency Injector for Javascript",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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