Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@felte/common

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/common - npm Package Compare versions

Comparing version 1.0.0-next.9 to 1.0.0-next.10

dist/esm/utils/executeTransforms.js

62

dist/cjs/index.js

@@ -313,2 +313,34 @@ 'use strict';

function executeCustomizer(objValue, srcValue) {
if (_isPlainObject(objValue) || _isPlainObject(srcValue))
return;
if (objValue === null)
return srcValue;
if (srcValue === null)
return objValue;
if (!objValue || !srcValue)
return;
if (!Array.isArray(objValue))
objValue = [objValue];
if (!Array.isArray(srcValue))
srcValue = [srcValue];
return [...objValue, ...srcValue];
}
async function executeValidation(values, validations) {
if (!validations)
return;
if (!Array.isArray(validations))
return validations(values);
const errorArray = await Promise.all(validations.map((v) => v(values)));
return _mergeWith(...errorArray, executeCustomizer);
}
function executeTransforms(values, transforms) {
if (!transforms)
return values;
if (!Array.isArray(transforms))
return transforms(values);
return transforms.reduce((res, t) => t(res), values);
}
/**

@@ -474,32 +506,2 @@ * @ignore

}
function executeCustomizer(objValue, srcValue) {
if (_isPlainObject(objValue) || _isPlainObject(srcValue))
return;
if (objValue === null)
return srcValue;
if (srcValue === null)
return objValue;
if (!objValue || !srcValue)
return;
if (!Array.isArray(objValue))
objValue = [objValue];
if (!Array.isArray(srcValue))
srcValue = [srcValue];
return [...objValue, ...srcValue];
}
async function executeValidation(values, validations) {
if (!validations)
return;
if (!Array.isArray(validations))
return validations(values);
const errorArray = await Promise.all(validations.map((v) => v(values)));
return _mergeWith(...errorArray, executeCustomizer);
}
function executeTransforms(values, transforms) {
if (!transforms)
return values;
if (!Array.isArray(transforms))
return transforms(values);
return transforms.reduce((res, t) => t(res), values);
}

@@ -506,0 +508,0 @@ exports._cloneDeep = _cloneDeep;

@@ -21,3 +21,5 @@ export { _some } from './utils/some.js';

export { getValue } from './utils/getValue.js';
export { addAttrsFromFieldset, executeTransforms, executeValidation, getFormControls, getFormDefaultValues, getInputTextOrNumber, setControlValue, setForm } from './utils/domUtils.js';
export { executeValidation } 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
import { isFormControl, isFieldSetElement, isInputElement } from './typeGuards.js';
import { _mergeWith } from './mergeWith.js';
import { _isPlainObject } from './isPlainObject.js';
import { _get } from './get.js';

@@ -170,34 +168,4 @@ import { _set } from './set.js';

}
function executeCustomizer(objValue, srcValue) {
if (_isPlainObject(objValue) || _isPlainObject(srcValue))
return;
if (objValue === null)
return srcValue;
if (srcValue === null)
return objValue;
if (!objValue || !srcValue)
return;
if (!Array.isArray(objValue))
objValue = [objValue];
if (!Array.isArray(srcValue))
srcValue = [srcValue];
return [...objValue, ...srcValue];
}
async function executeValidation(values, validations) {
if (!validations)
return;
if (!Array.isArray(validations))
return validations(values);
const errorArray = await Promise.all(validations.map((v) => v(values)));
return _mergeWith(...errorArray, executeCustomizer);
}
function executeTransforms(values, transforms) {
if (!transforms)
return values;
if (!Array.isArray(transforms))
return transforms(values);
return transforms.reduce((res, t) => t(res), values);
}
export { addAttrsFromFieldset, executeTransforms, executeValidation, getFormControls, getFormDefaultValues, getInputTextOrNumber, setControlValue, setForm };
export { addAttrsFromFieldset, getFormControls, getFormDefaultValues, getInputTextOrNumber, setControlValue, setForm };
//# sourceMappingURL=domUtils.js.map

@@ -21,4 +21,6 @@ export { _some } from "./utils/some";

export { getValue } from "./utils/getValue";
export { executeValidation } from "./utils/executeValidation";
export { executeTransforms } from "./utils/executeTransforms";
export * from "./utils/domUtils";
export * from "./types-864d6c7a";
export * from "./types-1f3e4b02";
//# sourceMappingURL=index.d.ts.map

@@ -1,4 +0,4 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _cloneDeep<T extends Obj>(obj: T): T;
export { _cloneDeep };

@@ -1,2 +0,2 @@

import { Obj, DeepSetResult } from "../types-864d6c7a";
import { Obj, DeepSetResult } from "../types-1f3e4b02";
/**

@@ -3,0 +3,0 @@ * @category Helper

@@ -1,2 +0,2 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/**

@@ -3,0 +3,0 @@ * @category Helper

@@ -1,4 +0,4 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _defaultsDeep<T extends Obj>(...args: any[]): T;
export { _defaultsDeep };

@@ -1,2 +0,2 @@

import { FormControl, Obj, FieldValue, ValidationFunction, TransformFunction } from "../types-864d6c7a";
import { FormControl, Obj, FieldValue } from "../types-1f3e4b02";
/**

@@ -21,4 +21,2 @@ * @ignore

declare function setForm<Data extends Obj>(node: HTMLFormElement, data: Data): void;
declare function executeValidation<Data extends Obj>(values: Data, validations?: ValidationFunction<Data>[] | ValidationFunction<Data>): Promise<ReturnType<ValidationFunction<Data>>>;
declare function executeTransforms<Data extends Obj>(values: Obj, transforms?: TransformFunction<Data>[] | TransformFunction<Data>): ReturnType<TransformFunction<Data>>;
export { getFormControls, addAttrsFromFieldset, getInputTextOrNumber, getFormDefaultValues, setControlValue, setForm, executeValidation, executeTransforms };
export { getFormControls, addAttrsFromFieldset, getInputTextOrNumber, getFormDefaultValues, setControlValue, setForm };

@@ -1,4 +0,4 @@

import { Obj, FieldValue } from "../types-864d6c7a";
import { Obj, FieldValue } from "../types-1f3e4b02";
/** @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-864d6c7a";
import { FormControl } from "../types-1f3e4b02";
/**

@@ -3,0 +3,0 @@ * @category Helper

@@ -1,3 +0,3 @@

import { FormControl } from "../types-864d6c7a";
import { FormControl } from "../types-1f3e4b02";
declare function getPathFromDataset(el: FormControl): string;
export { getPathFromDataset };

@@ -1,2 +0,2 @@

declare function getValue<T, R>(storeValue: T, selectorOrPath?: ((value: T) => R) | string): string | number | boolean | File | import("../types-864d6c7a").FieldValue[] | T | R | null | undefined;
declare function getValue<T, R>(storeValue: T, selectorOrPath?: ((value: T) => R) | string): string | number | boolean | File | import("../types-1f3e4b02").FieldValue[] | T | R | null | undefined;
export { getValue };

@@ -1,4 +0,4 @@

import { FieldValue } from "../types-864d6c7a";
import { FieldValue } from "../types-1f3e4b02";
/** @category Helper */
declare function isFieldValue(value: unknown): value is FieldValue;
export { isFieldValue };

@@ -1,4 +0,4 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _mapValues(obj: Obj, updater: (value: unknown) => unknown): Obj;
export { _mapValues };

@@ -1,4 +0,4 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _merge<T extends Obj>(...args: any[]): T;
export { _merge };

@@ -1,4 +0,4 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _mergeWith<T extends Obj>(...args: any[]): T;
export { _mergeWith };

@@ -1,4 +0,4 @@

import { Obj, FieldValue } from "../types-864d6c7a";
import { Obj, FieldValue } from "../types-1f3e4b02";
/** @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-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */
declare function _some(obj: Obj, pred: (value: unknown) => boolean): boolean;
export { _some };

@@ -1,2 +0,2 @@

import { FormControl } from "../types-864d6c7a";
import { FormControl } from "../types-1f3e4b02";
/**

@@ -3,0 +3,0 @@ * @category Helper

@@ -1,2 +0,2 @@

import { Obj } from "../types-864d6c7a";
import { Obj } from "../types-1f3e4b02";
/** @ignore */

@@ -3,0 +3,0 @@ declare function _unset(obj: undefined, path: string | string[]): undefined;

@@ -1,4 +0,4 @@

import { Obj, FieldValue } from "../types-864d6c7a";
import { Obj, FieldValue } from "../types-1f3e4b02";
/** @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.9",
"version": "1.0.0-next.10",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc