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

lambda_validators

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda_validators

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

lambda_validators

Simple all-purpose data validation (lambda-based)

Until complete documentation is done, here are some examples, taken from the unit tests:

(1) Adding validations one-by-one in block syntax:

validator = DataValidator.new
validator.add("data must be != 3") {|data| data != 3}
validator.add("data must be != 4") {|data| data != 4}

validator.validate(2) # => true
validator.last_error # => nil

validator.validate(3) # => false
validator.last_error # => "data must be != 3"

(2) Adding multiple validations as lambdas via constructor as Array:

validator = DataValidator.new([
  ["data must be != 2", ->(data) { data != 2 }],
  ["data must be != 3", ->(data) { data != 3 }]
])

(3) You can of course mix both versions.

FAQs

Package last updated on 05 Nov 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc