hosted-git-info
Advanced tools
Comparing version 2.8.3 to 3.0.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="3.0.0"></a> | ||
# [3.0.0](https://github.com/npm/hosted-git-info/compare/v2.8.3...v3.0.0) (2019-08-12) | ||
### Bug Fixes | ||
* **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([37c2891](https://github.com/npm/hosted-git-info/commit/37c2891)), closes [#38](https://github.com/npm/hosted-git-info/issues/38) | ||
### BREAKING CHANGES | ||
* **cache:** Drop support for node 0.x | ||
<a name="2.8.3"></a> | ||
@@ -7,0 +22,0 @@ ## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12) |
10
index.js
@@ -5,2 +5,4 @@ 'use strict' | ||
var GitHost = module.exports = require('./git-host.js') | ||
var LRU = require('lru-cache') | ||
var cache = new LRU({max: 1000}) | ||
@@ -26,4 +28,2 @@ var protocolToRepresentationMap = { | ||
var cache = {} | ||
module.exports.fromUrl = function (giturl, opts) { | ||
@@ -33,7 +33,7 @@ if (typeof giturl !== 'string') return | ||
if (!(key in cache)) { | ||
cache[key] = fromUrl(giturl, opts) | ||
if (!cache.has(key)) { | ||
cache.set(key, fromUrl(giturl, opts)) | ||
} | ||
return cache[key] | ||
return cache.get(key) | ||
} | ||
@@ -40,0 +40,0 @@ |
{ | ||
"name": "hosted-git-info", | ||
"version": "2.8.3", | ||
"version": "3.0.0", | ||
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", | ||
@@ -29,2 +29,5 @@ "main": "index.js", | ||
}, | ||
"dependencies": { | ||
"lru-cache": "^5.1.1" | ||
}, | ||
"devDependencies": { | ||
@@ -31,0 +34,0 @@ "standard": "^11.0.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23065
327
1
+ Addedlru-cache@^5.1.1
+ Addedlru-cache@5.1.1(transitive)
+ Addedyallist@3.1.1(transitive)