Socket
Book a DemoInstallSign in
Socket

cheek

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheek

Yet another value-validator in JavaScript ... Or is it?

3.1.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

cheek

cheek (formerly check) is a library of various validation methods.

cheek.isArray(["Hello", "world"]); // true
cheek.is(MyObject, new MyObject()); // true

cheek.bundle(["isDefined", "isPositive", "isEmptyString"], [null, 15, ""]);
/*  [
 *     [ false, false, false ],
 *     [ true, true, false ],
 *     [ true, false, true ]
 *  ]
 */

It allows you to keep your code clean and vastly increases its readability.

let every = cheek.every([8, 11, -5, 32]);

if (every.isInRange([-20, 20], "exclusively")) // false
  // you shall not pass!

// ***

for (var i = 0; i = inputs.length; i++)
	if (inputs[i] instanceof InvalidObject)
		throw new Error("The input is invalid");

for (let input of inputs)
	if (input instanceof InvalidObject)
		throw new Error("The input is invalid");

if (cheek.any(inputs).is(InvalidObject))
	throw new Error("The input is invalid");

// ***

if (this.profile.person.age < 5 || this.profile.person.age > 42)
	throw new RangeError("The age is not in range");

if (cheek.isNotInRange(this.profile.person.age, [5, 42]))
	throw new RangeError("The age is not in range");

Chapters:

  • General
  • Existance
  • Types
  • Array
  • String
  • Number
  • Bundle
  • Proxy

TODO:

See issues.

Keywords

check

FAQs

Package last updated on 15 Mar 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.