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

rttc

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rttc - npm Package Compare versions

Comparing version 9.0.0 to 9.1.0

lib/is-specific.js

3

index.js

@@ -17,3 +17,3 @@ module.exports = {

getDisplayType: require('./lib/get-display-type'),
isStrictType: require('./lib/is-strict-type'),
isSpecific: require('./lib/is-specific'),
isInvalidExample: require('./lib/is-invalid-example'),

@@ -35,1 +35,2 @@ reify: require('./lib/reify'),

module.exports.exemplar = module.exports.getDefaultExemplar;
module.exports.isStrictType = module.exports.isSpecific;

@@ -12,2 +12,4 @@ /**

*
* Note that this works for either type schemas OR exemplars!
*
* @param {Function} onFacetDict

@@ -14,0 +16,0 @@ * -> @param {Object} facetDictionary

{
"name": "rttc",
"version": "9.0.0",
"version": "9.1.0",
"description": "Runtime type-checking for JavaScript.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -88,3 +88,3 @@ # rttc

## Types
## Types & terminology

@@ -252,3 +252,3 @@ > Each type can be validated or coerced against. If coercion fails, the "base value" for the type will be used.

## Edge-cases
## Conventions and edge-cases

@@ -385,7 +385,13 @@ The following is a high-level overview of important conventions used by the `rttc` module. For detailed coverage of every permutation of validation and coercion, check out the declarative tests in the `spec/` folder of this repository.

##### .isStrictType(typeSchema, [recursive=false])
##### .isSpecific(typeSchemaOrExemplar, [recursive=false], [isExemplar=false])
Determine whether the given type schema is "strict" (note that this is NOT the same as `validateStrict()`!!! It's confusing and we should change the terminology. In this sense, "strict" means that it is a string, number, boolean, lamda, faceted dictionary, or patterned array). If second argument (`recursive`) is set to `true`, then also recursively check the subkeys of faceted dictionaries and patterns of arrays in the type schema.
Determine whether the given type schema is "specific". String, number, boolean, lamda, faceted dictionary, or patterned array types are "specific". Everything else is "generic".
| type | is strict? |
If the second argument (`recursive`) is set to `true`, then also recursively check the subkeys of faceted dictionaries and patterns of arrays in the type schema.
If the third argument (`isExemplar`) is set to `true`, then treat the provided schema as an rttc example rather than a type schema.
For reference
| type | is specific? |
|-------------------------|---------------------|

@@ -553,3 +559,3 @@ | string | yes _(always)_ |

Given a type schema, strip out generics ("ref", "json", {}, and []) to convert it into a "strict" type (note that this is NOT the same as `validateStrict()`!!! It's confusing and we should change the terminology.) In other words, this makes a type schema "strict" (again, bad terminology choice, sorry!), and the result of this function always passes `rttc.isStrictType()`.
Given a type schema, strip out generics ("ref", "json", {}, and []) to convert it into a "specific" type. In other words, the result of this function always passes `rttc.isSpecific()`.

@@ -556,0 +562,0 @@

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