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

key-tree-store

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

key-tree-store - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

17

key-tree-store.js
var slice = Array.prototype.slice;
// our constructor
function KeyTreeStore() {
function KeyTreeStore(options) {
options = options || {};
if (typeof options !== 'object') {
throw new TypeError('Options must be an object');
}
var DEFAULT_SEPARATOR = '.';
this.storage = {};
this.separator = options.separator || DEFAULT_SEPARATOR;
}
var DEFAULT_SEPARATOR = '.';
// add an object to the store

@@ -36,3 +41,3 @@ KeyTreeStore.prototype.add = function (keypath, obj) {

for (key in this.storage) {
if (!keypath || keypath === key || key.indexOf(keypath + DEFAULT_SEPARATOR) === 0) {
if (!keypath || keypath === key || key.indexOf(keypath + this.separator) === 0) {
res = res.concat(this.storage[key]);

@@ -51,3 +56,3 @@ }

for (key in this.storage) {
if (!keypath || keypath === key || key.indexOf(keypath + DEFAULT_SEPARATOR) === 0) {
if (!keypath || keypath === key || key.indexOf(keypath + this.separator) === 0) {
res[key] = slice.call(this.storage[key]);

@@ -66,3 +71,3 @@ }

for (key in this.storage) {
if (keypath === key || key.indexOf(keypath + DEFAULT_SEPARATOR) === 0) {
if (keypath === key || key.indexOf(keypath + this.separator) === 0) {
res[key] = slice.call(this.storage[key]);

@@ -69,0 +74,0 @@ }

{
"name": "key-tree-store",
"description": "Simple tool for storing/retrieving objects events based hierarchical keypaths.",
"version": "1.2.1",
"version": "1.3.0",
"author": "Henrik Joreteg <henrik@andyet.net>",
"files": [
"key-tree-store.js"
],
"bugs": {

@@ -13,3 +10,3 @@ "url": "https://github.com/HenrikJoreteg/key-tree-store/issues"

"devDependencies": {
"tape": "^3.5.0"
"tape": "^4.0.3"
},

@@ -19,7 +16,10 @@ "directories": {

},
"files": [
"key-tree-store.js"
],
"homepage": "https://github.com/HenrikJoreteg/key-tree-store",
"keywords": [
"events",
"trigger",
"keypath"
"keypath",
"trigger"
],

@@ -26,0 +26,0 @@ "license": "MIT",

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