@felte/common
Advanced tools
Comparing version 1.0.0-next.14 to 1.0.0-next.15
@@ -71,5 +71,8 @@ 'use strict'; | ||
continue; | ||
let rsValue = customizer(obj, source); | ||
if (typeof rsValue !== 'undefined') | ||
return rsValue; | ||
const keys = Object.keys(source); | ||
for (const key of keys) { | ||
const rsValue = customizer(obj[key], source[key]); | ||
rsValue = customizer(obj[key], source[key]); | ||
if (typeof rsValue !== 'undefined') { | ||
@@ -328,6 +331,2 @@ obj[key] = rsValue; | ||
} | ||
async function executeValidation(values, shape, validations) { | ||
const errors = await Promise.all(runValidations(values, validations)); | ||
return mergeErrors([shape, ...errors]); | ||
} | ||
@@ -506,3 +505,2 @@ function executeTransforms(values, transforms) { | ||
exports.executeTransforms = executeTransforms; | ||
exports.executeValidation = executeValidation; | ||
exports.getFormControls = getFormControls; | ||
@@ -509,0 +507,0 @@ exports.getFormDefaultValues = getFormDefaultValues; |
@@ -19,5 +19,5 @@ export { _some } from './utils/some.js'; | ||
export { getValue } from './utils/getValue.js'; | ||
export { executeValidation, mergeErrors, runValidations } from './utils/executeValidation.js'; | ||
export { mergeErrors, runValidations } from './utils/executeValidation.js'; | ||
export { executeTransforms } from './utils/executeTransforms.js'; | ||
export { addAttrsFromFieldset, getFormControls, getFormDefaultValues, getInputTextOrNumber, setControlValue, setForm } from './utils/domUtils.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -54,8 +54,4 @@ import { _mergeWith } from './mergeWith.js'; | ||
} | ||
async function executeValidation(values, shape, validations) { | ||
const errors = await Promise.all(runValidations(values, validations)); | ||
return mergeErrors([shape, ...errors]); | ||
} | ||
export { executeValidation, mergeErrors, runValidations }; | ||
export { mergeErrors, runValidations }; | ||
//# sourceMappingURL=executeValidation.js.map |
@@ -14,5 +14,8 @@ import { _cloneDeep } from './cloneDeep.js'; | ||
continue; | ||
let rsValue = customizer(obj, source); | ||
if (typeof rsValue !== 'undefined') | ||
return rsValue; | ||
const keys = Object.keys(source); | ||
for (const key of keys) { | ||
const rsValue = customizer(obj[key], source[key]); | ||
rsValue = customizer(obj[key], source[key]); | ||
if (typeof rsValue !== 'undefined') { | ||
@@ -19,0 +22,0 @@ obj[key] = rsValue; |
@@ -19,6 +19,6 @@ export { _some } from "./utils/some"; | ||
export { getValue } from "./utils/getValue"; | ||
export { executeValidation, mergeErrors, runValidations } from "./utils/executeValidation"; | ||
export { mergeErrors, runValidations } from "./utils/executeValidation"; | ||
export { executeTransforms } from "./utils/executeTransforms"; | ||
export * from "./utils/domUtils"; | ||
export * from "./types-49692c2c"; | ||
export * from "./types-51c9b03c"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _cloneDeep<T extends Obj>(obj: T): T; | ||
export { _cloneDeep }; |
@@ -1,2 +0,2 @@ | ||
import { Obj, DeepSetResult } from "../types-49692c2c"; | ||
import { Obj, DeepSetResult } from "../types-51c9b03c"; | ||
/** | ||
@@ -3,0 +3,0 @@ * @category Helper |
@@ -1,2 +0,2 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** | ||
@@ -3,0 +3,0 @@ * @category Helper |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _defaultsDeep<T extends Obj>(...args: any[]): T; | ||
export { _defaultsDeep }; |
@@ -1,2 +0,2 @@ | ||
import { FormControl, Obj, FieldValue, Touched } from "../types-49692c2c"; | ||
import { FormControl, Obj, FieldValue, Touched } from "../types-51c9b03c"; | ||
/** | ||
@@ -3,0 +3,0 @@ * @ignore |
@@ -1,3 +0,3 @@ | ||
import { Obj, TransformFunction } from "../types-49692c2c"; | ||
import { Obj, TransformFunction } from "../types-51c9b03c"; | ||
declare function executeTransforms<Data extends Obj>(values: Obj, transforms?: TransformFunction<Data>[] | TransformFunction<Data>): ReturnType<TransformFunction<Data>>; | ||
export { executeTransforms }; |
@@ -1,5 +0,4 @@ | ||
import { Obj, ValidationFunction, Errors, RecursivePartial } from "../types-49692c2c"; | ||
import { Obj, ValidationFunction, RecursivePartial } from "../types-51c9b03c"; | ||
declare function mergeErrors<Data extends Obj>(errors: (RecursivePartial<Data> | undefined)[]): Data; | ||
declare function runValidations<Data extends Obj>(values: Data, validationOrValidations?: ValidationFunction<Data>[] | ValidationFunction<Data>): ReturnType<ValidationFunction<Data>>[]; | ||
declare function executeValidation<Data extends Obj>(values: Data, shape: Errors<Data>, validations?: ValidationFunction<Data>[] | ValidationFunction<Data>): Promise<Errors<Data>>; | ||
export { mergeErrors, runValidations, executeValidation }; | ||
export { mergeErrors, runValidations }; |
@@ -1,4 +0,4 @@ | ||
import { Obj, FieldValue } from "../types-49692c2c"; | ||
import { Obj, FieldValue } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _get<Data extends Obj, Default = undefined>(obj: Data, path: string, defaultValue?: Default): Default | FieldValue | FieldValue[]; | ||
export { _get }; |
@@ -1,2 +0,2 @@ | ||
import { FormControl } from "../types-49692c2c"; | ||
import { FormControl } from "../types-51c9b03c"; | ||
/** | ||
@@ -3,0 +3,0 @@ * @category Helper |
@@ -1,2 +0,2 @@ | ||
import { Paths, Traverse, Obj } from "../types-49692c2c"; | ||
import { Paths, Traverse, Obj } from "../types-51c9b03c"; | ||
declare function getValue<T>(storeValue: T): T; | ||
@@ -3,0 +3,0 @@ declare function getValue<T extends Obj, R>(storeValue: T, selector: (value: T) => R): R; |
@@ -1,4 +0,4 @@ | ||
import { FieldValue } from "../types-49692c2c"; | ||
import { FieldValue } from "../types-51c9b03c"; | ||
/** @category Helper */ | ||
declare function isFieldValue(value: unknown): value is FieldValue; | ||
export { isFieldValue }; |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _mapValues(obj: Obj, updater: (value: unknown) => unknown): Obj; | ||
export { _mapValues }; |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _merge<T extends Obj>(...args: any[]): T; | ||
export { _merge }; |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _mergeWith<T extends Obj>(...args: any[]): T; | ||
export { _mergeWith }; |
@@ -1,4 +0,4 @@ | ||
import { Obj, FieldValue } from "../types-49692c2c"; | ||
import { Obj, FieldValue } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _set<Data extends Obj>(obj: Data | undefined, path: string | string[], value: FieldValue | FieldValue[]): Data; | ||
export { _set }; |
@@ -1,4 +0,4 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _some(obj: Obj, pred: (value: unknown) => boolean): boolean; | ||
export { _some }; |
@@ -1,2 +0,2 @@ | ||
import { FormControl } from "../types-49692c2c"; | ||
import { FormControl } from "../types-51c9b03c"; | ||
/** | ||
@@ -3,0 +3,0 @@ * @category Helper |
@@ -1,2 +0,2 @@ | ||
import { Obj } from "../types-49692c2c"; | ||
import { Obj } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
@@ -3,0 +3,0 @@ declare function _unset(obj: undefined, path: string | string[]): undefined; |
@@ -1,4 +0,4 @@ | ||
import { Obj, FieldValue } from "../types-49692c2c"; | ||
import { Obj, FieldValue } from "../types-51c9b03c"; | ||
/** @ignore */ | ||
declare function _update<Data extends Obj, Value = FieldValue>(obj: Data | undefined, path: string, updater: (value: Value) => Value): Data; | ||
export { _update }; |
{ | ||
"name": "@felte/common", | ||
"version": "1.0.0-next.14", | ||
"version": "1.0.0-next.15", | ||
"description": "Common utilities for Felte packages", | ||
@@ -5,0 +5,0 @@ "author": "Pablo Berganza <pablo@berganza.dev>", |
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
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
137707
1486