New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tjek

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tjek

Validate inputs

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

TJEK

Validate inputs.

It's late and I'm too tired to write any docs. Have a look at the (too few) tests. It's very simple really.

Some examples

import tjek from 'tjek')

// some event listener
function onInputHandler (e) {
    var {error, message} = tjek.minLength(3)(e.target.value)
    if (error) throw new Error(message)
    // ...
}
// Composing checks
import tjek from 'tjek')

const myCheck = tjek.compose([
    tjek.present(),
    tjek.not('fluppe de houp!')
])

myCheck('')
/*
{ error: true,
  message: 'Should not be empty',
  results: 
   [ { error: true, message: 'Should not be empty' },
     { valid: true } ],
  count: 1 }
*/

myCheck('fluppe de houp!')
/*
{ error: true,
  message: 'Should not be fluppe de houp!',
  results:
   [ { valid: true },
     { error: true, message: 'Should not be fluppe de houp!' } ],
  count: 1 }
*/

myCheck('hello')
/*
{ valid: true }
*/

FAQs

Package last updated on 11 Oct 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