FieldVal - multipurpose validation library. Supports both sync and async validation.

Overview

FieldVal-JS

The FieldVal-JS library allows you to easily validate data and provide readable and structured error reports.

MinoHubs

Gitter

Documentation and Examples

Documentation and examples can be found at http://fieldval.com

Development

This project uses gulp.js to build and mocha to test.

npm install
gulp js
mocha test/test
Comments
  • Throw an error for invalid date format

    Throw an error for invalid date format

    When an invalid date format is passed to the validator, calling get returns undefined and if it is further passed to the function date_with_format_array the following error occurs.

    TypeError: Cannot read property 'length' of undefined
        at Object.date_with_format_array (file:///path/fieldval.js:902:44)
    

    I check if format_array is an array in the function date_with_format_array first to prevent such problem.

    opened by waitingcheung 2
  • Ignore unrecognized fields

    Ignore unrecognized fields

    I forked you to add the option to ignore unrecognized fields because my UI framework adds some but my Node.js API doesn't need to care. But, while reading through your code I noticed that I can get effectively the same results by instantiating my validator with a null second parameter (existing_error) : new FieldVal(input, null);

    But, I think that's just a coincidence since it still does unrecognized logic checking in generate_response().

    I took a quick stab at accepting options without breaking backwards compatibility over here : https://github.com/darcling/fieldval-js/commit/76cfc059a8297baa78dc460210fe981b41ff7fb0 But I only added the 'ignore unrecognized fields' option because that's what I needed : )

    You may have a better way.

    Thanks for the library by the way, I'm just getting rolling with it.

    opened by darcling 2
  • Added date_format_array and added validation to date_with_format_array

    Added date_format_array and added validation to date_with_format_array

    This solves the same issue as #26 (credit to @waitingcheung for his implementation that inspired this one).

    The issue being that date_with_format_array does not throw any exception if an invalid date format array is provided, leading to a rather vague exception.

    I've implemented a date_format_array check, which is then used in the date_with_format_array check to ensure that the provided date format is indeed a valid format array.

    opened by MarcusLongmuir 0
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    FieldVal/fieldval-js now has a Chat Room on Gitter

    @bestan has just created a chat room. You can visit it here: https://gitter.im/FieldVal/fieldval-js.

    This pull-request adds this badge to your README.md:

    Gitter

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Fix missing value for BasicVal

    Fix missing value for BasicVal

    The following error occurs when the value is missing for min_length and max_length. I have added a test case to reproduce the problem and the corresponding fix.

                    if (value.length > max_len) {
                             ^
    
    TypeError: Cannot read property 'length' of undefined
        at Object.check (/path/fieldval.js:1460:26)
        at Function.FieldVal.use_check (/path/fieldval.js:649:50)
        at Function.FieldVal.use_checks (/path/fieldval.js:703:38)
        at Object.check (/path/fieldval.js:1802:49)
        at Function.FieldVal.use_check (/path/fieldval.js:649:50)
        at check_done (/path/fieldval.js:578:46)
        at Function.FieldVal.use_check (/path/fieldval.js:589:17)
        at Function.FieldVal.use_checks (/path/fieldval.js:703:38)
        at FieldVal.get_async (/path/fieldval.js:274:39)
        at FieldVal.get (/path/fieldval.js:244:31)
    
    opened by waitingcheung 3
The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

Ajv JSON schema validator The fastest JSON validator for Node.js and browser. Supports JSON Schema draft-06/07/2019-09/2020-12 (draft-04 is supported

Ajv JSON schema validator 12k Jan 4, 2023
Convert JSON examples into JSON schema (supports Swagger 2, OpenAPI 3 and 3.1)

json-to-json-schema Convert JSON examples into JSON schema. Supports JSON Schema draft-05 used in Swagger 2.0 and OpenAPI 3.0 and new draft draft-2020

Redocly 9 Sep 15, 2022
Lightweight and powerfull library for declarative form validation

Formurai is a lightweight and powerfull library for declarative form validation Features Setup Usage Options Methods Rules Examples Roadmap Features ?

Illia 49 May 13, 2022
Themis is a validation and processing library that helps you always make sure your data is correct.

Dataffy Themis - The advanced validation library Themis is a validation and processing library that helps you always make sure your data is correct. ·

Dataffy 14 Oct 27, 2022
jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

null 10.3k Jan 3, 2023
Lightweight JavaScript form validation library inspired by CodeIgniter.

validate.js validate.js is a lightweight JavaScript form validation library inspired by CodeIgniter. Features Validate form fields from over a dozen r

Rick Harrison 2.6k Dec 15, 2022
jQuery Validation Plugin library sources

jQuery Validation Plugin - Form validation made easy The jQuery Validation Plugin provides drop-in validation for your existing forms, while making al

null 10.3k Jan 3, 2023
The most powerful data validation library for JS

joi The most powerful schema description language and data validator for JavaScript. Installation npm install joi Visit the joi.dev Developer Portal f

Sideway Inc. 19.6k Jan 4, 2023
A simple credit cards validation library in JavaScript

creditcard.js A simple credit cards validation library in JavaScript. Project website: https://contaazul.github.io/creditcard.js Install creditcard.js

ContaAzul 323 Jan 7, 2023
v8n ☑️ ultimate JavaScript validation library

The ultimate JavaScript validation library you've ever needed. Dead simple fluent API. Customizable. Reusable. Installation - Documentation - API Intr

Bruno C. Couto 4.1k Dec 30, 2022
A lightweight NodeJS library for strict mime-type validation on streams

A lightweight NodeJS library for strict mime-type validation on streams. It gets a ReadableStream and decets the mime-type using its Magic number and validates it using the provided allowed and forbidden lists; If it's allowed it will pass it to the created WritableStreams and if it's not it will throw an error.

CEO of Death Star 9 Apr 3, 2022
Schema-Inspector is an JSON API sanitisation and validation module.

Schema-Inspector is a powerful tool to sanitize and validate JS objects. It's designed to work both client-side and server-side and to be scalable wit

null 494 Oct 3, 2022
:white_check_mark: Easy property validation for JavaScript, Node and Express.

property-validator ✅ Easy property validation for JavaScript, Node and Express Built on top of validator.js, property-validator makes validating reque

Netto Farah 160 Dec 14, 2022
Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

upjs 314 Dec 26, 2022
TypeScript-first schema validation for h3 and Nuxt applications

h3-zod Validate h3 and Nuxt 3 requests using zod schema's. Install npm install h3-zod Usage import { createServer } from 'http' import { createApp } f

Robert Soriano 48 Dec 28, 2022
Simple, smart and pleasant validation solution.

nice-validator Simple, smart and pleasant validation solution. Download the latest release or install package via npm or bower $ npm install nice-vali

Jony 608 Nov 18, 2022
String validation

validator.js A library of string validators and sanitizers. Strings only This library validates and sanitizes strings only. If you're not sure if your

null 20.7k Jan 5, 2023
Cross Browser HTML5 Form Validation.

Validatr Cross Browser HTML5 Form Validation. Getting Started View the documentation to learn how to use Validatr. Changelog Version 0.5.1 - 2013-03-1

Jay Morrow 279 Nov 1, 2022