deep-state-observer
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -1351,7 +1351,8 @@ 'use strict'; | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
const defaultOptions = { delimeter: '.', recursiveString: '...' }; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.', recursiveWatchString: '...' }) { | ||
constructor(data = {}, options = defaultOptions) { | ||
this.listeners = {}; | ||
this.data = data; | ||
this.options = options; | ||
this.options = Object.assign({}, defaultOptions, options); | ||
} | ||
@@ -1384,6 +1385,6 @@ getListeners() { | ||
isRecursive(path) { | ||
return path.endsWith(this.options.recursiveWatchString); | ||
return path.endsWith(this.options.recursiveString); | ||
} | ||
getRecursive(path) { | ||
return path.slice(0, -this.options.recursiveWatchString.length); | ||
return path.slice(0, -this.options.recursiveString.length); | ||
} | ||
@@ -1390,0 +1391,0 @@ recursiveMatch(currentPath, userPath) { |
@@ -1347,7 +1347,8 @@ function _isPlaceholder(a) { | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
const defaultOptions = { delimeter: '.', recursiveString: '...' }; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.', recursiveWatchString: '...' }) { | ||
constructor(data = {}, options = defaultOptions) { | ||
this.listeners = {}; | ||
this.data = data; | ||
this.options = options; | ||
this.options = Object.assign({}, defaultOptions, options); | ||
} | ||
@@ -1380,6 +1381,6 @@ getListeners() { | ||
isRecursive(path) { | ||
return path.endsWith(this.options.recursiveWatchString); | ||
return path.endsWith(this.options.recursiveString); | ||
} | ||
getRecursive(path) { | ||
return path.slice(0, -this.options.recursiveWatchString.length); | ||
return path.slice(0, -this.options.recursiveString.length); | ||
} | ||
@@ -1386,0 +1387,0 @@ recursiveMatch(currentPath, userPath) { |
10
index.ts
@@ -18,2 +18,4 @@ import { path, set, view, lensPath } from 'ramda'; | ||
const defaultOptions = { delimeter: '.', recursiveString: '...' }; | ||
export default class DeepStore { | ||
@@ -24,6 +26,6 @@ listeners: IListeners; | ||
constructor(data = {}, options = { delimeter: '.', recursiveWatchString: '...' }) { | ||
constructor(data = {}, options = defaultOptions) { | ||
this.listeners = {}; | ||
this.data = data; | ||
this.options = options; | ||
this.options = { ...defaultOptions, ...options }; | ||
} | ||
@@ -62,7 +64,7 @@ | ||
isRecursive(path: string): boolean { | ||
return path.endsWith(this.options.recursiveWatchString); | ||
return path.endsWith(this.options.recursiveString); | ||
} | ||
getRecursive(path: string): string { | ||
return path.slice(0, -this.options.recursiveWatchString.length); | ||
return path.slice(0, -this.options.recursiveString.length); | ||
} | ||
@@ -69,0 +71,0 @@ |
@@ -1353,7 +1353,8 @@ (function (global, factory) { | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
const defaultOptions = { delimeter: '.', recursiveString: '...' }; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.', recursiveWatchString: '...' }) { | ||
constructor(data = {}, options = defaultOptions) { | ||
this.listeners = {}; | ||
this.data = data; | ||
this.options = options; | ||
this.options = Object.assign({}, defaultOptions, options); | ||
} | ||
@@ -1386,6 +1387,6 @@ getListeners() { | ||
isRecursive(path) { | ||
return path.endsWith(this.options.recursiveWatchString); | ||
return path.endsWith(this.options.recursiveString); | ||
} | ||
getRecursive(path) { | ||
return path.slice(0, -this.options.recursiveWatchString.length); | ||
return path.slice(0, -this.options.recursiveString.length); | ||
} | ||
@@ -1392,0 +1393,0 @@ recursiveMatch(currentPath, userPath) { |
{ | ||
"name": "deep-state-observer", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Deep state observer is an state management library that will fire listeners only when specified object node (which also can be a wildcard) was changed.", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs.js", |
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
167346
4896