🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

checko

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checko

Simple modular predicates and assertions.

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
2
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source
Checko the gecko

There is a new sherrif in town to check your values for type and range errors! :police_car:

Motivation

I needed predicates and assertions for type and range checking that:

  • have a fast and simple implementation,
  • only check for what their name implies,
  • yield standard errors,
  • yield readable stack traces,
  • can be included when needed,
  • can be used to create custom predicates and assertions and
  • do.not.use.this.style()

Installation

npm install checko

Example

Import any of the exported predicates and assertions and simply use them.

const expectArray = require('checko/exports/expectArray')
// or
const expectArray = require('checko').expectArray
// or
import expectArray from 'checko/exports/expectArray'
// or
import { expectArray } from 'checko'

expectArray('this is not an array')

Tip: This package publishes source maps. Use source-map-support to utilize them during development to get clearer stack traces.

Documentation

For some 'expect' variants there is no 'is' variant because the language itself provides an operator.

PredicateAssertion
value === expectedexpectEqual(expected, value)
isArray(value)expectArray(value)

All files in exports/ can be directly included. Implementations for each predicate and assertion can be found there. Examples are shown in the accompanying .test.js.

Due to the simple nature of this package (except for the isDeepEqual(expected, value) implementation) there is no further documentation. If this is a problem, please let me know.

FAQs

Package last updated on 15 Jun 2016

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