12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- "use strict";
- const createHash = require("./util/createHash");
- class DependencyTemplates {
-
- constructor(hashFunction = "md4") {
-
- this._map = new Map();
-
- this._hash = "31d6cfe0d16ae931b73c59d7e0c089c0";
- this._hashFunction = hashFunction;
- }
-
- get(dependency) {
- return this._map.get(dependency);
- }
-
- set(dependency, dependencyTemplate) {
- this._map.set(dependency, dependencyTemplate);
- }
-
- updateHash(part) {
- const hash = createHash(this._hashFunction);
- hash.update(`${this._hash}${part}`);
- this._hash = (hash.digest("hex"));
- }
- getHash() {
- return this._hash;
- }
- clone() {
- const newInstance = new DependencyTemplates(this._hashFunction);
- newInstance._map = new Map(this._map);
- newInstance._hash = this._hash;
- return newInstance;
- }
- }
- module.exports = DependencyTemplates;
|