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

cachetree

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachetree - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

10

lib/hash.js

@@ -154,2 +154,4 @@ /**

children = [],
prefixType = null,
prefix = '',
create = function(key) {

@@ -189,2 +191,8 @@ var hash = new Hash(self.childKey(key), self.root);

if (def.__validate__ && typeof def.__validate__ === 'function') validateFn = true;
prefixType = typeof def.__prefix__;
if (prefixType === 'string' && def.__prefix__) {
prefix = def.__prefix__;
} else if (prefixType === 'number') {
prefix = def.__prefix__.toString();
}
this[name] = function(value) {

@@ -208,3 +216,3 @@ var isValid = false,

if (isValid !== true) throw new Error('Invalid key');
return create(value);
return create(prefix + value);
};

@@ -211,0 +219,0 @@ }

2

package.json
{
"name": "cachetree",
"description": "A scoped, fluent API for easily interacting with hierarchical, key-value data",
"version": "1.1.1",
"version": "1.2.0",
"author": "David Wood <bitprobe@gmail.com>",

@@ -6,0 +6,0 @@ "repository": {

@@ -178,2 +178,20 @@ /*global describe: true, it:true, beforeEach: true, afterEach: true, before: true, after: true */

it('should accept an object with a key prefix as a string', function() {
var cache = cachetree(),
hash,
err;
cache.add('alpha', { __prefix__: 'bravo-' });
hash = cache.alpha('charlie');
isHash(hash, ['cache', 'bravo-charlie']);
});
it('should accept an object with a key prefix as a number', function() {
var cache = cachetree(),
hash,
err;
cache.add('alpha', { __prefix__: 123 });
hash = cache.alpha('charlie');
assert.deepEqual(hash.key, ['cache', '123charlie']);
});
it('should create a child hash that can be extended', function() {

@@ -180,0 +198,0 @@ var cache = cachetree(),

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