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

@bayou/typecheck

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bayou/typecheck

Subcomponent of the Bayou project.

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@bayou/typecheck

This module consists mostly of utility classes (just static methods), each of which is dedicated to doing type and content checking for values of a particular type. In order to disambiguate between these classes and the built-in classes for the same types, this module prefixes its classes with the capital letter T.

The main method of each type checker class is called check(), which always takes as its first argument the value to check and in some cases accepts additional options (as documented). These methods always either return a value of the class's type-in-question or throw an error, as follows:

  • If the input value is already of the type in question, that value is returned.

  • If the input value isn't of the type in question but the options allow for conversion or defaulting, then the return value is the converted / defaulted value.

  • Otherwise, an error is thrown with a message typically of the form "Expected value of type type."

In some cases, type checker classes have additional methods which perform variations of the type check. These are defined in cases where it would be confusing to overload the semantics of the main check() method.


Copyright 2016-2018 the Bayou Authors (Dan Bornstein et alia).
Licensed AS IS and WITHOUT WARRANTY under the Apache License,
Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0>

FAQs

Package last updated on 23 Jul 2018

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