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

@darkwolf/validator

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@darkwolf/validator

Validator Utility

  • 2.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Validator Utility

Install

npm i --save @darkwolf/validator

Usage

const validator = require('@darkwolf/validator')

validator.isNumber(13) // true
validator.isString(21) // false

// Using constructor
const { Validator } = validator

new Validator(69).isString().isValid // false
new Validator(69).isNumber().isRange(0, 100).isValid // true
new Validator('69')
  .isNumber()
  .call(validator => validator)
  .throw(() => new TypeError('Value must be a number')) // throw error

Init

new Validator(value?)

Methods

setValue(value)

call(validator => validator)

throw(() => e)

isType(value?, type)

isObject(value?)

isUndefined(value?)

isBoolean(value?)

isNumber(value?)

isString(value?)

isFunction(value?)

isSymbol(value?)

isNull(value?)

isInstance(value?, instance)

isArray(value?)

isBuffer(value?)

isArrayBuffer(value?)

isRegExp(value?)

isSet(value?)

isObjectExact(value?)

isTrue(value?)

isFalse(value?)

isExists(value?)

isNaN(value?)

isFinite(value?)

isInteger(value?)

isSafeInteger(value?)

isFloat(value?)

isInfinity(value?)

isMore(value?, number)

isLess(value?, number)

isEqual(value?, number)

isMoreEqual(value?, number)

isLessEqual(value?, number)

isRange(value?, min, max)

isRegex(value?, regex)

isRequired(value?)

isOptional(value?)

isLength(value?, length? || ...[min, max])

Keywords

FAQs

Package last updated on 31 Oct 2019

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