Comparing version 3.5.5 to 3.6.0
@@ -1,1 +0,1 @@ | ||
export declare function changedKeys<T>(root: string, valueA?: T, valueB?: T): string[]; | ||
export declare function changedKeys(root: string, valueA?: unknown, valueB?: unknown): string[]; |
@@ -7,9 +7,12 @@ "use strict"; | ||
var joinName_1 = require("./joinName"); | ||
function isObject(value) { | ||
return !!value && value === Object(value) && !(value instanceof Date); | ||
} | ||
// eslint-disable-next-line complexity | ||
function changedKeys(root, valueA, valueB) { | ||
if (!valueA || valueA !== Object(valueA) || valueA instanceof Date) { | ||
if (!isObject(valueA) || (valueB && typeof valueA !== typeof valueB)) { | ||
return isEqual_1.default(valueA, valueB) ? [] : [root]; | ||
} | ||
var changed = [root]; | ||
if (valueB) { | ||
if (isObject(valueB)) { | ||
for (var key in valueA) { | ||
@@ -16,0 +19,0 @@ if (!(key in valueB) || !isEqual_1.default(valueA[key], valueB[key])) { |
@@ -20,3 +20,4 @@ "use strict"; | ||
_this.onValidate = _this.validate = _this.onValidate.bind(_this); | ||
_this.onValidateModel = _this.validateModel = _this.onValidateModel.bind(_this); | ||
_this.onValidateModel = _this.validateModel = | ||
_this.onValidateModel.bind(_this); | ||
return _this; | ||
@@ -23,0 +24,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare function changedKeys<T>(root: string, valueA?: T, valueB?: T): string[]; | ||
export declare function changedKeys(root: string, valueA?: unknown, valueB?: unknown): string[]; |
import isEqual from 'lodash/isEqual'; | ||
import { joinName } from './joinName'; | ||
function isObject(value) { | ||
return !!value && value === Object(value) && !(value instanceof Date); | ||
} | ||
// eslint-disable-next-line complexity | ||
export function changedKeys(root, valueA, valueB) { | ||
if (!valueA || valueA !== Object(valueA) || valueA instanceof Date) { | ||
if (!isObject(valueA) || (valueB && typeof valueA !== typeof valueB)) { | ||
return isEqual(valueA, valueB) ? [] : [root]; | ||
} | ||
const changed = [root]; | ||
if (valueB) { | ||
if (isObject(valueB)) { | ||
for (const key in valueA) { | ||
@@ -11,0 +14,0 @@ if (!(key in valueB) || !isEqual(valueA[key], valueB[key])) { |
@@ -15,3 +15,4 @@ import clone from 'lodash/clone'; | ||
this.onValidate = this.validate = this.onValidate.bind(this); | ||
this.onValidateModel = this.validateModel = this.onValidateModel.bind(this); | ||
this.onValidateModel = this.validateModel = | ||
this.onValidateModel.bind(this); | ||
} | ||
@@ -18,0 +19,0 @@ getContextError() { |
@@ -1,1 +0,1 @@ | ||
export declare function changedKeys<T>(root: string, valueA?: T, valueB?: T): string[]; | ||
export declare function changedKeys(root: string, valueA?: unknown, valueB?: unknown): string[]; |
import isEqual from 'lodash/isEqual'; | ||
import { joinName } from './joinName'; | ||
function isObject(value) { | ||
return !!value && value === Object(value) && !(value instanceof Date); | ||
} | ||
// eslint-disable-next-line complexity | ||
export function changedKeys(root, valueA, valueB) { | ||
if (!valueA || valueA !== Object(valueA) || valueA instanceof Date) { | ||
if (!isObject(valueA) || (valueB && typeof valueA !== typeof valueB)) { | ||
return isEqual(valueA, valueB) ? [] : [root]; | ||
} | ||
var changed = [root]; | ||
if (valueB) { | ||
if (isObject(valueB)) { | ||
for (var key in valueA) { | ||
@@ -11,0 +14,0 @@ if (!(key in valueB) || !isEqual(valueA[key], valueB[key])) { |
@@ -17,3 +17,4 @@ import { __assign, __extends } from "tslib"; | ||
_this.onValidate = _this.validate = _this.onValidate.bind(_this); | ||
_this.onValidateModel = _this.validateModel = _this.onValidateModel.bind(_this); | ||
_this.onValidateModel = _this.validateModel = | ||
_this.onValidateModel.bind(_this); | ||
return _this; | ||
@@ -20,0 +21,0 @@ } |
{ | ||
"name": "uniforms", | ||
"version": "3.5.5", | ||
"version": "3.6.0", | ||
"license": "MIT", | ||
@@ -48,3 +48,3 @@ "main": "./es5/index.js", | ||
}, | ||
"gitHead": "8dd2d7435d4a19c695af6e06fe0d27f97eeb7c0b" | ||
"gitHead": "8ec8ba7751b6ce4b205c49d2aca1ab460bd09e0a" | ||
} |
@@ -5,5 +5,9 @@ import isEqual from 'lodash/isEqual'; | ||
function isObject(value: unknown): value is Record<string, unknown> { | ||
return !!value && value === Object(value) && !(value instanceof Date); | ||
} | ||
// eslint-disable-next-line complexity | ||
export function changedKeys<T>(root: string, valueA?: T, valueB?: T) { | ||
if (!valueA || valueA !== Object(valueA) || valueA instanceof Date) { | ||
export function changedKeys(root: string, valueA?: unknown, valueB?: unknown) { | ||
if (!isObject(valueA) || (valueB && typeof valueA !== typeof valueB)) { | ||
return isEqual(valueA, valueB) ? [] : [root]; | ||
@@ -13,3 +17,3 @@ } | ||
const changed = [root]; | ||
if (valueB) { | ||
if (isObject(valueB)) { | ||
for (const key in valueA) { | ||
@@ -16,0 +20,0 @@ if (!(key in valueB) || !isEqual(valueA[key], valueB[key])) { |
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
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
282141
6450