LogoPear Docs

bare-type

Cross-realm type predicates for Bare

stable

bare-type — Cross-realm type predicates for Bare. It is a native addon and requires Bare >=1.2.0.

npm i bare-type

Usage

const type = require('bare-type')

if (type(123).isNumber()) {
  console.log(123, 'is a number')
}

API

Functions

type(value: unknown): Type

Source

Return a Type wrapping value, exposing is*() predicates to test its runtime type across realms.

Parameters

ParameterTypeDefaultDescription
valueunknownThe value to wrap and test.

See also

On this page