Comparing version 2.0.2 to 2.0.3
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="2.0.3"></a> | ||
## [2.0.3](https://github.com/zerkalica/lom_atom/compare/v2.0.2...v2.0.3) (2017-10-23) | ||
<a name="2.0.2"></a> | ||
@@ -7,0 +12,0 @@ ## [2.0.2](https://github.com/zerkalica/lom_atom/compare/v2.0.1...v2.0.2) (2017-10-21) |
@@ -93,3 +93,3 @@ // eslint-disable-line | ||
for (var i = 0; i < target.length; ++i) { | ||
var conformed = target[i] = conform(target[i], source[i], stack); | ||
var conformed = target[i] = conform(target[i], source[i], false, stack); | ||
if (equal && conformed !== source[i]) equal = false; | ||
@@ -104,3 +104,3 @@ } | ||
for (var key in target) { | ||
var conformed = target[key] = conform(target[key], source[key], stack); | ||
var conformed = target[key] = conform(target[key], source[key], false, stack); | ||
if (equal && conformed !== source[key]) equal = false; | ||
@@ -120,8 +120,6 @@ ++count; | ||
}]]); | ||
function conform(target, source) { | ||
var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
function conform(target, source, isComponent) { | ||
var stack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
if (target === source) return source; | ||
if (!target || _typeof(target) !== 'object') return target; | ||
if (!source || _typeof(source) !== 'object') return target; | ||
if (target.constructor !== source.constructor) return target; | ||
if (isComponent || !target || _typeof(target) !== 'object' || !source || _typeof(source) !== 'object' || target.constructor !== source.constructor) return target; | ||
var conformHandler = handlers.get(target.constructor); | ||
@@ -235,3 +233,3 @@ if (!conformHandler) return target; | ||
if (force) return this._push(next); | ||
var normalized = conform(next, this._ignore); | ||
var normalized = conform(next, this._ignore, this.isComponent); | ||
@@ -242,3 +240,3 @@ if (normalized === this._ignore) { | ||
normalized = conform(next, this.value); | ||
normalized = conform(next, this.value, this.isComponent); | ||
if (normalized === this.value) return this.value; | ||
@@ -283,3 +281,3 @@ this._ignore = this._next = normalized; | ||
if (nextRaw === undefined) return prev; | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev); | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev, this.isComponent); | ||
@@ -286,0 +284,0 @@ if (prev !== next) { |
@@ -97,3 +97,3 @@ 'use strict'; | ||
for (var i = 0; i < target.length; ++i) { | ||
var conformed = target[i] = conform(target[i], source[i], stack); | ||
var conformed = target[i] = conform(target[i], source[i], false, stack); | ||
if (equal && conformed !== source[i]) equal = false; | ||
@@ -108,3 +108,3 @@ } | ||
for (var key in target) { | ||
var conformed = target[key] = conform(target[key], source[key], stack); | ||
var conformed = target[key] = conform(target[key], source[key], false, stack); | ||
if (equal && conformed !== source[key]) equal = false; | ||
@@ -124,8 +124,6 @@ ++count; | ||
}]]); | ||
function conform(target, source) { | ||
var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
function conform(target, source, isComponent) { | ||
var stack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
if (target === source) return source; | ||
if (!target || _typeof(target) !== 'object') return target; | ||
if (!source || _typeof(source) !== 'object') return target; | ||
if (target.constructor !== source.constructor) return target; | ||
if (isComponent || !target || _typeof(target) !== 'object' || !source || _typeof(source) !== 'object' || target.constructor !== source.constructor) return target; | ||
var conformHandler = handlers.get(target.constructor); | ||
@@ -239,3 +237,3 @@ if (!conformHandler) return target; | ||
if (force) return this._push(next); | ||
var normalized = conform(next, this._ignore); | ||
var normalized = conform(next, this._ignore, this.isComponent); | ||
@@ -246,3 +244,3 @@ if (normalized === this._ignore) { | ||
normalized = conform(next, this.value); | ||
normalized = conform(next, this.value, this.isComponent); | ||
if (normalized === this.value) return this.value; | ||
@@ -287,3 +285,3 @@ this._ignore = this._next = normalized; | ||
if (nextRaw === undefined) return prev; | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev); | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev, this.isComponent); | ||
@@ -290,0 +288,0 @@ if (prev !== next) { |
@@ -99,3 +99,3 @@ (function (global, factory) { | ||
for (var i = 0; i < target.length; ++i) { | ||
var conformed = target[i] = conform(target[i], source[i], stack); | ||
var conformed = target[i] = conform(target[i], source[i], false, stack); | ||
if (equal && conformed !== source[i]) equal = false; | ||
@@ -110,3 +110,3 @@ } | ||
for (var key in target) { | ||
var conformed = target[key] = conform(target[key], source[key], stack); | ||
var conformed = target[key] = conform(target[key], source[key], false, stack); | ||
if (equal && conformed !== source[key]) equal = false; | ||
@@ -126,8 +126,6 @@ ++count; | ||
}]]); | ||
function conform(target, source) { | ||
var stack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
function conform(target, source, isComponent) { | ||
var stack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
if (target === source) return source; | ||
if (!target || _typeof(target) !== 'object') return target; | ||
if (!source || _typeof(source) !== 'object') return target; | ||
if (target.constructor !== source.constructor) return target; | ||
if (isComponent || !target || _typeof(target) !== 'object' || !source || _typeof(source) !== 'object' || target.constructor !== source.constructor) return target; | ||
var conformHandler = handlers.get(target.constructor); | ||
@@ -241,3 +239,3 @@ if (!conformHandler) return target; | ||
if (force) return this._push(next); | ||
var normalized = conform(next, this._ignore); | ||
var normalized = conform(next, this._ignore, this.isComponent); | ||
@@ -248,3 +246,3 @@ if (normalized === this._ignore) { | ||
normalized = conform(next, this.value); | ||
normalized = conform(next, this.value, this.isComponent); | ||
if (normalized === this.value) return this.value; | ||
@@ -289,3 +287,3 @@ this._ignore = this._next = normalized; | ||
if (nextRaw === undefined) return prev; | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev); | ||
var next = nextRaw instanceof Error ? createMock(nextRaw) : prev instanceof Error ? nextRaw : conform(nextRaw, prev, this.isComponent); | ||
@@ -292,0 +290,0 @@ if (prev !== next) { |
{ | ||
"name": "lom_atom", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Alternative implementation of eigenmethod mol_atom state management library", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -141,3 +141,3 @@ // @flow | ||
let normalized: V | Error = conform(next, this._ignore) | ||
let normalized: V | Error = conform(next, this._ignore, this.isComponent) | ||
if (normalized === this._ignore) { | ||
@@ -147,3 +147,3 @@ return (this.value: any) | ||
normalized = conform(next, this.value) | ||
normalized = conform(next, this.value, this.isComponent) | ||
if (normalized === this.value) return (this.value: any) | ||
@@ -189,3 +189,3 @@ | ||
? createMock(nextRaw) | ||
: (prev instanceof Error ? nextRaw : conform(nextRaw, prev)) | ||
: (prev instanceof Error ? nextRaw : conform(nextRaw, prev, this.isComponent)) | ||
@@ -192,0 +192,0 @@ if (prev !== next) { |
@@ -10,3 +10,3 @@ // @flow | ||
for(let i = 0; i < target.length; ++i) { | ||
const conformed = target[i] = conform(target[i], source[i], stack) | ||
const conformed = target[i] = conform(target[i], source[i], false, stack) | ||
if (equal && conformed !== source[i]) equal = false | ||
@@ -25,3 +25,3 @@ } | ||
for (let key in target) { | ||
const conformed = target[key] = conform(target[key], source[key], stack) | ||
const conformed = target[key] = conform(target[key], source[key], false, stack) | ||
if (equal && conformed !== source[key]) equal = false | ||
@@ -50,14 +50,16 @@ ++count | ||
export default function conform<Target, Source>(target: Target, source: Source, stack: any[] = []): Target { | ||
export default function conform<Target, Source>(target: Target, source: Source, isComponent: boolean, stack: any[] = []): Target { | ||
if (target === source) return (source: any) | ||
if (!target || typeof target !== 'object' ) return target | ||
if (!source || typeof source !== 'object' ) return target | ||
if ( | ||
isComponent | ||
|| !target || typeof target !== 'object' | ||
|| !source || typeof source !== 'object' | ||
|| target.constructor !== source.constructor | ||
) return target | ||
if( target.constructor !== source.constructor ) return target | ||
const conformHandler = handlers.get(target.constructor) | ||
if (!conformHandler) return target | ||
if (stack.indexOf( target ) !== -1) return target | ||
if (stack.indexOf(target) !== -1) return target | ||
stack.push(target) | ||
@@ -64,0 +66,0 @@ const res = conformHandler(target, source, stack) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
292592
3515