Socket
Socket
Sign inDemoInstall

felixriddle.checkpoint

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    felixriddle.checkpoint

A data validation package


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
189 kB
Created
Weekly downloads
 

Readme

Source

Checkpoint

Data validation package and other miscellaneous things.

Introduction

Last update: 2.0.0 This is an introduction to checkpoint

Create a validator

import Validator from "validator";

// Create a validator and multiple scopes
let val = new Validator()
    .createScope("email", "email", "felix@email.com")
    .isNotFalsy()
    .isEmail()
    .lengthRange(5, 64)
    .isStr()
    // Use scope
    .useScope("email", "friend_email", "joe@email.com")
    // Create new scope
    // These ones pass
    .createScope("username", "username", "my_cool_username_65")
    .isNotFalsy()
    .lengthRange(5, 64)
    .isStr()
    // Phone scope
    .createScope("phone", "phone_number", 6756829123)
    .isNotFalsy()
    .isNum()
    // Use phone scope again
    // And fail both tests
    .useScope("phone", "alt_phone", "");

Perform validation and check if passed

// Perform validations
let result = val.validate();

// The result should have an array of 'ValidationResult' objects
if(result.length > 0) {
    console.log(`Not all validations passed`);
}

Print every result message

// Perform validations
let result = val.validate();

// Print result messages
for(let res in result) {
    console.log(`Field: ${}`, res.field);
    console.log(`Message: ${}\n`, res.message);
}

Todo

  • Form fetch all parses what is clearly a number or float
  • Data validation
  • Object validation
  • Scopes

Keywords

FAQs

Last updated on 21 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc