{"version":3,"sources":["jsdelivr-header.js","/npm/node-service-container@1.0.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACDA,MAAM,KAAO,QAAQ,QAErB,MAAM,UAEF,WAAA,GACI,KAAK,SAAY,IAAI,IACrB,KAAK,QAAY,IAAI,IACrB,KAAK,UAAY,IAAI,GACzB,CAEA,IAAA,CAAK,EAAK,EAAO,GAEb,MAAkB,iBAAP,EACA,KAAK,UAAU,IAAI,EAAI,KAAO,EAAI,KAAO,gBAAgB,KAAK,KAAK,QAAQ,IAAM,GAAI,GAGlF,OAAV,EACO,KAAK,SAAS,IAAI,EAAI,WAAY,IAG7C,KAAK,SAAS,IAAI,EAAK,QAEnB,GAAQ,KAAK,QAAQ,IAAI,EAAK,IACtC,CAEA,KAAA,CAAM,GACF,OAAO,KAAK,SAAS,IAAI,IAAQ,KAAK,QAAQ,IAAI,IAAQ,KAAK,UAAU,IAAI,EACjF,CAEA,IAAA,CAAK,GACD,GAAI,KAAK,SAAS,IAAI,GAClB,OAAO,KAAK,SAAS,IAAI,GACtB,GAAI,KAAK,UAAU,IAAI,GAC1B,OAAO,KAAK,UAAU,IAAI,GAE1B,MAAM,IAAI,MAAM,gCAExB,EAIJ,OAAO,QAAU","file":"/npm/node-service-container@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-service-container@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Node js service container\n *\n **/\n\nconst util = require('util');\n\nclass Container {\n\n    constructor() {\n        this.bindings  = new Map();\n        this.singles   = new Map();\n        this.instances = new Map();\n    }\n\n    bind(key, value, single) {\n\n        if (typeof key == 'object') {\n            return this.instances.set(key.name ? key.name : /([a-z0-9_]*)/i.exec(util.inspect(key))[1], key);\n        }\n\n        if (value === null) {\n            return this.bindings.set(key.toString(), key);\n        }\n\n        this.bindings.set(key, value);\n\n        if (single) this.singles.set(key, value);\n    }\n\n    bound(key) {\n        return this.bindings.has(key) || this.singles.has(key) || this.instances.has(key);\n    }\n\n    make(key) {\n        if (this.bindings.has(key)) {\n            return this.bindings.get(key);\n        } else if (this.instances.has(key)) {\n            return this.instances.get(key);\n        } else {\n            throw new Error('Entity not found to container');\n        }\n    }\n\n}\n\nmodule.exports = Container;"]}