New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jalik/form-parser

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jalik/form-parser - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

8

cjs/index.d.ts

@@ -7,3 +7,3 @@ /**

*/
export declare function buildObject(str: string, value: any, context?: Record<string, any>): Record<string, any>;
export declare function buildObject(str: string, value: any, context?: Record<string, any> | null): Record<string, any>;
/**

@@ -59,3 +59,3 @@ * Returns all fields in a form with the same name.

*/
export declare function parseBoolean(value: string): boolean | null;
export declare function parseBoolean(value: string | null): boolean | null;
/**

@@ -65,3 +65,3 @@ * Parses a number string.

*/
export declare function parseNumber(value: string): number | null;
export declare function parseNumber(value: string | null): number | null;
export type ParsingType = 'auto' | 'boolean' | 'number';

@@ -73,3 +73,3 @@ /**

*/
export declare function parseValue(value?: string, type?: ParsingType): string | number | boolean | null;
export declare function parseValue(value: string | null, type?: ParsingType): string | number | boolean | null;
export type ParsingMode = 'none' | 'type' | 'data-type' | 'auto';

@@ -76,0 +76,0 @@ export type ParseFieldOptions = {

"use strict";
/*
* The MIT License (MIT)
* Copyright (c) 2023 Karl STEIN
* Copyright (c) 2024 Karl STEIN
*/

@@ -401,3 +401,3 @@ var __assign = (this && this.__assign) || function () {

// Parse value based on "data-type" attribute.
if (dataType && (opts.parsing === 'auto' || opts.parsing === 'data-type')) {
if ((opts.parsing === 'auto' || opts.parsing === 'data-type') && dataType != null) {
if (dataType === 'auto') {

@@ -465,12 +465,10 @@ if (value instanceof Array) {

}
if (isFieldValueEditable(element)) {
// Removes extra spaces.
if (opts.trim) {
value = trim(value);
}
// Replaces empty string by null.
if (opts.nullify) {
value = nullify(value);
}
// Removes extra spaces.
if (opts.trim && isFieldValueEditable(element)) {
value = trim(value);
}
// Replaces empty string by null.
if (opts.nullify) {
value = nullify(value);
}
return value;

@@ -477,0 +475,0 @@ }

@@ -7,3 +7,3 @@ /**

*/
export declare function buildObject(str: string, value: any, context?: Record<string, any>): Record<string, any>;
export declare function buildObject(str: string, value: any, context?: Record<string, any> | null): Record<string, any>;
/**

@@ -59,3 +59,3 @@ * Returns all fields in a form with the same name.

*/
export declare function parseBoolean(value: string): boolean | null;
export declare function parseBoolean(value: string | null): boolean | null;
/**

@@ -65,3 +65,3 @@ * Parses a number string.

*/
export declare function parseNumber(value: string): number | null;
export declare function parseNumber(value: string | null): number | null;
export type ParsingType = 'auto' | 'boolean' | 'number';

@@ -73,3 +73,3 @@ /**

*/
export declare function parseValue(value?: string, type?: ParsingType): string | number | boolean | null;
export declare function parseValue(value: string | null, type?: ParsingType): string | number | boolean | null;
export type ParsingMode = 'none' | 'type' | 'data-type' | 'auto';

@@ -76,0 +76,0 @@ export type ParseFieldOptions = {

/*
* The MIT License (MIT)
* Copyright (c) 2023 Karl STEIN
* Copyright (c) 2024 Karl STEIN
*/

@@ -377,3 +377,3 @@ /**

// Parse value based on "data-type" attribute.
if (dataType && (opts.parsing === 'auto' || opts.parsing === 'data-type')) {
if ((opts.parsing === 'auto' || opts.parsing === 'data-type') && dataType != null) {
if (dataType === 'auto') {

@@ -441,12 +441,10 @@ if (value instanceof Array) {

}
if (isFieldValueEditable(element)) {
// Removes extra spaces.
if (opts.trim) {
value = trim(value);
}
// Replaces empty string by null.
if (opts.nullify) {
value = nullify(value);
}
// Removes extra spaces.
if (opts.trim && isFieldValueEditable(element)) {
value = trim(value);
}
// Replaces empty string by null.
if (opts.nullify) {
value = nullify(value);
}
return value;

@@ -453,0 +451,0 @@ }

{
"name": "@jalik/form-parser",
"version": "3.1.0",
"version": "3.1.1",
"description": "A utility to parse complex forms with minimum effort.",

@@ -49,18 +49,18 @@ "license": "MIT",

"devDependencies": {
"@babel/cli": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@jest/globals": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"concurrently": "^8.2.0",
"eslint": "^8.43.0",
"@babel/cli": "^7.24.1",
"@babel/preset-env": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@jest/globals": "^29.7.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.2.1",
"rimraf": "^5.0.1",
"typescript": "^5.1.3"
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"rimraf": "^5.0.5",
"typescript": "^5.4.2"
}
}

@@ -19,2 +19,3 @@ # @jalik/form-parser

- Clean values using a custom function
* TypeScript declarations ♥

@@ -25,2 +26,11 @@ ## Sandbox

## Installing
```shell
npm i -P @jalik/form-parser
```
```shell
yarn add @jalik/form-parser
```
## Getting started

@@ -27,0 +37,0 @@

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