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

formulr

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formulr - npm Package Compare versions

Comparing version 0.2.0-beta.42 to 0.2.0-beta.43

2

lib/field-utils.d.ts
import { FieldModel } from './models/field';
import { ValidateOption } from './validate';
export declare function useMAppendWith<Value>(model: FieldModel<Value>, ...args: ((model: FieldModel<Value>) => (value: Value) => void)[]): (value: Value) => void;
export declare function useMAppend<T>(...fns: ((t: T) => void)[]): (t: T) => void;
export declare function usePipe<T0, T1, T2>(fn0: (t0: T0) => T1, fn1: (t1: T1) => T2): (t0: T0) => T2;

@@ -5,0 +5,0 @@ export declare function usePipe<T0, T1, T2, T3>(fn0: (t0: T0) => T1, fn1: (t1: T1) => T2, fn2: (t2: T2) => T3): (t0: T0) => T3;

import { useCallback, useMemo, useRef } from 'react';
import { unstable_IdlePriority as IdlePriority, unstable_scheduleCallback as scheduleCallback, } from 'scheduler';
export function useMAppendWith(model) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
export function useMAppend() {
var fns = [];
for (var _i = 0; _i < arguments.length; _i++) {
fns[_i] = arguments[_i];
}
return useMemo(function () {
var fns = args.map(function (it) { return it(model); });
return function (value) {
for (var i = 0; i < fns.length; i += 1) {
var f = fns[i];
f(value);
}
};
}, [model].concat(args));
return useCallback(function (value) {
for (var i = 0; i < fns.length; i += 1) {
var f = fns[i];
f(value);
}
}, fns);
}

@@ -24,3 +21,3 @@ export function usePipe() {

return useMemo(function () {
var fn = args.reduce(function (next, f) { return function (arg) { return next(f(arg)); }; }, function (arg) { return arg; });
var fn = args.reduceRight(function (next, f) { return function (arg) { return next(f(arg)); }; }, function (arg) { return arg; });
return function (t) { return fn(t); };

@@ -27,0 +24,0 @@ }, args);

{
"name": "formulr",
"version": "0.2.0-beta.42",
"version": "0.2.0-beta.43",
"description": "Form toolkit for React",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -10,15 +10,9 @@ import { useCallback, useMemo, useRef } from 'react';

export function useMAppendWith<Value>(
model: FieldModel<Value>,
...args: ((model: FieldModel<Value>) => (value: Value) => void)[]
): (value: Value) => void {
return useMemo(() => {
const fns = args.map(it => it(model));
return (value: Value) => {
for (let i = 0; i < fns.length; i += 1) {
const f = fns[i];
f(value);
}
};
}, [model as any].concat(args));
export function useMAppend<T>(...fns: ((t: T) => void)[]): (t: T) => void {
return useCallback((value: T) => {
for (let i = 0; i < fns.length; i += 1) {
const f = fns[i];
f(value);
}
}, fns);
}

@@ -71,3 +65,3 @@

return useMemo(() => {
const fn = args.reduce((next, f) => (arg: any) => next(f(arg)), (arg: any) => arg);
const fn = args.reduceRight((next, f) => (arg: any) => next(f(arg)), (arg: any) => arg);
return (t: T): R => fn(t);

@@ -74,0 +68,0 @@ }, args);

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