Skip to content
Permalink
Browse files

fix never called errors

  • Loading branch information...
rhalff committed Feb 4, 2018
1 parent c9aa24a commit 77be9fb64413f608bfa7a0139499e976488c9be4
@@ -1,3 +1,5 @@
import * as _ from 'lodash';

/**
* 'convertSchemaToDraft6' function
*
@@ -311,13 +313,7 @@ export function convertSchemaToDraft6(schema, options: OptionObject = {}) {
) {
newSchema[key] = convertSchemaToDraft6(newSchema[key], { changed, draft });
} else {
const clone = object => typeof clone !== 'object' ? object :
typeof object.map === 'function' ?
[ ...object.map(item => clone(item)) ] :
Object.keys(object).reduce((objClone, objKey) =>
Object.assign(objClone, { [objKey]: clone(object[objKey]) }), {}
);
newSchema[key] = clone(newSchema[key]);
newSchema[key] = _.cloneDeep(newSchema[key]);
}
});

@@ -128,7 +128,7 @@ export function forEachCopy(
errors = false
): any {
if (!hasValue(object)) { return; }
if ((isObject(object) || isArray(object)) && typeof fn !== 'function') {
if ((isObject(object) || isArray(object)) && typeof object !== 'function') {
let newObject: any = isArray(object) ? [] : {};
for (let key of Object.keys(object)) {
newObject[key] = fn(object[key], key, object);

0 comments on commit 77be9fb

Please sign in to comment.
You can’t perform that action at this time.