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

urlcache

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlcache - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

23

index.js

@@ -8,3 +8,4 @@ "use strict";

{
expiryTime: Infinity, /*3600000,*/
defaultPorts: null, // will use urlobj default value
expiryTime: Infinity,
normalizeUrls: true,

@@ -27,3 +28,3 @@ stripUrlHashes: true

{
// If specific clear
// If specific key clear
if (url != null)

@@ -49,3 +50,3 @@ {

}
// Clear all
// Clear all keys
else

@@ -80,3 +81,3 @@ {

// If value is stored
// If value has been set
if (this.cache[url] !== undefined)

@@ -86,3 +87,3 @@ {

}
// If `setting()` was called
// If value will be set -- in other words, `setting()` was called
else if (this.settingStore[url] !== undefined)

@@ -99,3 +100,3 @@ {

}
// Nothing has been set or will be set
// Nothing has been or will be set
else

@@ -168,3 +169,11 @@ {

{
url = urlobj.parse(url);
if (options.defaultPorts != null)
{
url = urlobj.parse(url, {defaultPorts:options.defaultPorts});
}
else
{
// Avoid overriding the default value of `defaultPorts` with null/undefined
url = urlobj.parse(url);
}

@@ -171,0 +180,0 @@ if (options.normalizeUrls === true)

{
"name": "urlcache",
"description": "URL key-value cache and store.",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/stevenvachon/urlcache",

@@ -21,4 +21,3 @@ # urlcache [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][david-image]][david-url]

cache.set("http://domain.com/#hash", "value");
console.log( cache.get("http://domain.com/") ); //-> "value"
cache.set("http://domain.com/path/to/something.html", {"key":"value"});
```

@@ -28,3 +27,3 @@

## Methods
Note: all instances of `url` can be either a `String` or a [`url.parse()`](https://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost)-compatible `Object`.
**Note:** all instances of `url` can be either a `String` or a [`url.parse()`](https://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost)-compatible `Object`.

@@ -40,2 +39,6 @@ ### .clear([url])

```js
cache.get("url", function(value) {
console.log(value); //-> undefined
});
cache.setting("url");

@@ -57,2 +60,7 @@ cache.get("url", function(value) {

### options.defaultPorts
Type: `Object`
Default value: see [urlobj.parse() options](https://github.com/stevenvachon/urlobj)
A map of protocol default ports for `options.normalizeUrls`.
### options.expiryTime

@@ -75,2 +83,4 @@ Type: `Number`

## Changelog
* 0.3.0 added `options.defaultPorts`, more tests
* 0.2.0 simplified API
* 0.1.0 initial release

@@ -77,0 +87,0 @@

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