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

final-form-persist

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

final-form-persist - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

7

dist/index.d.ts
import { Decorator } from "final-form";
export interface FinalFormPersistOptions {
export interface FinalFormPersistOptions<FormValues = object> {
name: string;
debounceTime?: number;
whitelist?: string[];
whitelist?: Array<keyof FormValues>;
blacklist?: Array<keyof FormValues>;
storage?: Storage;

@@ -13,2 +14,2 @@ }

}
export declare const createPersistDecorator: <FormValues = object>(options: FinalFormPersistOptions) => FinalFormPersistDecorator<FormValues>;
export declare const createPersistDecorator: <FormValues = object>(options: FinalFormPersistOptions<FormValues>) => FinalFormPersistDecorator<FormValues>;

@@ -408,3 +408,3 @@ /*! *****************************************************************************

var persistDecorator = function (options) { return function (form) {
var name = options.name, _a = options.debounceTime, debounceTime = _a === void 0 ? 0 : _a, _b = options.whitelist, whitelist = _b === void 0 ? [] : _b, _c = options.storage, storage = _c === void 0 ? localStorage : _c;
var name = options.name, _a = options.debounceTime, debounceTime = _a === void 0 ? 0 : _a, _b = options.whitelist, whitelist = _b === void 0 ? [] : _b, _c = options.storage, storage = _c === void 0 ? localStorage : _c, _d = options.blacklist, blacklist = _d === void 0 ? [] : _d;
var persistedValues = storage.getItem(name) || "{}";

@@ -416,7 +416,8 @@ var initialValues = form.getState().initialValues;

var valuesKeys = Object.keys(values);
if (whitelist.length > 0) {
valuesKeys = Object.keys(values).filter(function (value) {
return whitelist.includes(value);
});
if (whitelist.length > 0 && !blacklist.length) {
valuesKeys = Object.keys(values).filter(function (value) { return whitelist.includes(value); });
}
if (blacklist.length > 0) {
valuesKeys = Object.keys(values).filter(function (value) { return !blacklist.includes(value); });
}
var valuesObject = valuesKeys.reduce(function (acc, key) {

@@ -423,0 +424,0 @@ var _a;

@@ -412,3 +412,3 @@ 'use strict';

var persistDecorator = function (options) { return function (form) {
var name = options.name, _a = options.debounceTime, debounceTime = _a === void 0 ? 0 : _a, _b = options.whitelist, whitelist = _b === void 0 ? [] : _b, _c = options.storage, storage = _c === void 0 ? localStorage : _c;
var name = options.name, _a = options.debounceTime, debounceTime = _a === void 0 ? 0 : _a, _b = options.whitelist, whitelist = _b === void 0 ? [] : _b, _c = options.storage, storage = _c === void 0 ? localStorage : _c, _d = options.blacklist, blacklist = _d === void 0 ? [] : _d;
var persistedValues = storage.getItem(name) || "{}";

@@ -420,7 +420,8 @@ var initialValues = form.getState().initialValues;

var valuesKeys = Object.keys(values);
if (whitelist.length > 0) {
valuesKeys = Object.keys(values).filter(function (value) {
return whitelist.includes(value);
});
if (whitelist.length > 0 && !blacklist.length) {
valuesKeys = Object.keys(values).filter(function (value) { return whitelist.includes(value); });
}
if (blacklist.length > 0) {
valuesKeys = Object.keys(values).filter(function (value) { return !blacklist.includes(value); });
}
var valuesObject = valuesKeys.reduce(function (acc, key) {

@@ -427,0 +428,0 @@ var _a;

{
"name": "final-form-persist",
"version": "1.0.3",
"version": "1.0.4",
"description": "Persist your form values into a storage",

@@ -5,0 +5,0 @@ "author": "premieroctet",

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