@semantic-ui/reactivity
Advanced tools
Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "@semantic-ui/reactivity", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"type": "module", | ||
@@ -10,3 +10,3 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@semantic-ui/utils": "^0.0.10" | ||
"@semantic-ui/utils": "^0.0.11" | ||
}, | ||
@@ -13,0 +13,0 @@ "devDependencies": { |
@@ -8,3 +8,3 @@ import { clone, isObject, isEqual, wrapFunction, findIndex, unique, isNumber } from '@semantic-ui/utils'; | ||
constructor(initialValue, equalityFunction) { | ||
this.currentValue = clone(initialValue); | ||
this.currentValue = this.clone(initialValue); | ||
this.dependency = new Dependency(); | ||
@@ -25,3 +25,3 @@ this.equalityFunction = equalityFunction | ||
return (Array.isArray(value) || typeof value == 'object') | ||
? clone(value) | ||
? this.clone(value) | ||
: value | ||
@@ -31,5 +31,14 @@ ; | ||
clone(value) { | ||
if (value instanceof ReactiveVar) { | ||
const clonedInstance = new ReactiveVar(value.currentValue, value.equalityFunction); | ||
clonedInstance.dependency = value.dependency; | ||
return clonedInstance; | ||
} | ||
return clone(value); | ||
} | ||
set value(newValue) { | ||
if (!this.equalityFunction(this.currentValue, newValue)) { | ||
this.currentValue = clone(newValue); | ||
this.currentValue = this.clone(newValue); | ||
this.dependency.changed({ value: newValue, trace: new Error().stack}); // Pass context | ||
@@ -98,3 +107,3 @@ } | ||
} | ||
const newValue = clone(this.currentValue).map((object, currentIndex) => { | ||
const newValue = this.clone(this.currentValue).map((object, currentIndex) => { | ||
if(index == 'all' || currentIndex == index) { | ||
@@ -109,7 +118,7 @@ object[property] = value; | ||
changeItems(mapFunction) { | ||
const newValue = clone(this.currentValue).map(mapFunction); | ||
const newValue = this.clone(this.currentValue).map(mapFunction); | ||
this.set(newValue); | ||
} | ||
removeItems(filterFunction) { | ||
const newValue = clone(this.currentValue).filter((value) => !filterFunction(value)); | ||
const newValue = this.clone(this.currentValue).filter((value) => !filterFunction(value)); | ||
this.set(newValue); | ||
@@ -116,0 +125,0 @@ } |
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
40316
832
+ Added@semantic-ui/utils@0.0.11(transitive)
- Removed@semantic-ui/utils@0.0.10(transitive)
Updated@semantic-ui/utils@^0.0.11