deep-state-observer
Advanced tools
Comparing version 1.0.3 to 1.0.4
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _isPlaceholder(a) { | ||
@@ -1344,4 +1346,8 @@ return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true; | ||
} | ||
var wildcard = { scanObject, match, wildcardToRegex }; | ||
class Store { | ||
const scanObject$1 = wildcard.scanObject; | ||
const match$1 = wildcard.match; | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.' }) { | ||
@@ -1364,3 +1370,3 @@ this.listeners = {}; | ||
if (this.isWildcard(first)) { | ||
return match(first, second, this.options.delimeter); | ||
return match$1(first, second, this.options.delimeter); | ||
} | ||
@@ -1407,3 +1413,3 @@ return false; | ||
if (isWildcard) { | ||
const paths = scanObject(this.data, this.options.delimeter).get(userPath); | ||
const paths = scanObject$1(this.data, this.options.delimeter).get(userPath); | ||
for (const path in paths) { | ||
@@ -1459,4 +1465,8 @@ fn(paths[path], path); | ||
} | ||
var index = { scanObject, match, wildcardToRegex, Store }; | ||
const Store = DeepStore; | ||
module.exports = index; | ||
exports.Store = Store; | ||
exports.default = DeepStore; | ||
exports.match = match$1; | ||
exports.scanObject = scanObject$1; | ||
exports.wildcardToRegex = wildcardToRegex$1; |
15
index.js
@@ -1342,4 +1342,8 @@ function _isPlaceholder(a) { | ||
} | ||
var wildcard = { scanObject, match, wildcardToRegex }; | ||
class Store { | ||
const scanObject$1 = wildcard.scanObject; | ||
const match$1 = wildcard.match; | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.' }) { | ||
@@ -1362,3 +1366,3 @@ this.listeners = {}; | ||
if (this.isWildcard(first)) { | ||
return match(first, second, this.options.delimeter); | ||
return match$1(first, second, this.options.delimeter); | ||
} | ||
@@ -1405,3 +1409,3 @@ return false; | ||
if (isWildcard) { | ||
const paths = scanObject(this.data, this.options.delimeter).get(userPath); | ||
const paths = scanObject$1(this.data, this.options.delimeter).get(userPath); | ||
for (const path in paths) { | ||
@@ -1457,4 +1461,5 @@ fn(paths[path], path); | ||
} | ||
var index = { scanObject, match, wildcardToRegex, Store }; | ||
const Store = DeepStore; | ||
export default index; | ||
export default DeepStore; | ||
export { Store, match$1 as match, scanObject$1 as scanObject, wildcardToRegex$1 as wildcardToRegex }; |
10
index.ts
import { path, set, view, lensPath } from 'ramda'; | ||
import clone from 'fast-copy'; | ||
import { scanObject, match, wildcardToRegex } from './wildcard-object-scan'; | ||
import wildcard from './wildcard-object-scan'; | ||
@@ -13,3 +13,7 @@ export type Listener = (value: any, path: string) => {}; | ||
class Store { | ||
export const scanObject = wildcard.scanObject; | ||
export const match = wildcard.match; | ||
export const wildcardToRegex = wildcard.wildcardToRegex; | ||
export default class DeepStore { | ||
listeners: IListeners; | ||
@@ -142,2 +146,2 @@ data: any; | ||
export default { scanObject, match, wildcardToRegex, Store }; | ||
export const Store = DeepStore; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = global || self, global['svelte-deep-store'] = factory()); | ||
}(this, function () { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global['svelte-deep-store'] = {})); | ||
}(this, function (exports) { 'use strict'; | ||
@@ -1348,4 +1348,8 @@ function _isPlaceholder(a) { | ||
} | ||
var wildcard = { scanObject, match, wildcardToRegex }; | ||
class Store { | ||
const scanObject$1 = wildcard.scanObject; | ||
const match$1 = wildcard.match; | ||
const wildcardToRegex$1 = wildcard.wildcardToRegex; | ||
class DeepStore { | ||
constructor(data = {}, options = { delimeter: '.' }) { | ||
@@ -1368,3 +1372,3 @@ this.listeners = {}; | ||
if (this.isWildcard(first)) { | ||
return match(first, second, this.options.delimeter); | ||
return match$1(first, second, this.options.delimeter); | ||
} | ||
@@ -1411,3 +1415,3 @@ return false; | ||
if (isWildcard) { | ||
const paths = scanObject(this.data, this.options.delimeter).get(userPath); | ||
const paths = scanObject$1(this.data, this.options.delimeter).get(userPath); | ||
for (const path in paths) { | ||
@@ -1463,6 +1467,12 @@ fn(paths[path], path); | ||
} | ||
var index = { scanObject, match, wildcardToRegex, Store }; | ||
const Store = DeepStore; | ||
return index; | ||
exports.Store = Store; | ||
exports.default = DeepStore; | ||
exports.match = match$1; | ||
exports.scanObject = scanObject$1; | ||
exports.wildcardToRegex = wildcardToRegex$1; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
{ | ||
"name": "deep-state-observer", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"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", |
@@ -17,3 +17,3 @@ [![GitHub license](https://img.shields.io/github/license/neuronetio/deep-state-observer?style=flat-square)](https://github.com/neuronetio/deep-state-observer/blob/master/LICENSE) | ||
import { onDestroy } from 'svelte'; | ||
import { Store } from 'deep-state-observer'; | ||
import Store from 'deep-state-observer'; // const {Store} = require('deep-state-observer'); | ||
@@ -20,0 +20,0 @@ // first parameter is an object that hold the state, and the second one is just options (optional - for now it hold just delimeter :P ) |
@@ -109,1 +109,3 @@ export interface wildcardApi { | ||
} | ||
export default { scanObject, match, wildcardToRegex }; |
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
159903
4722