You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

rttc

Package Overview
Dependencies
1
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.1.0 to 9.2.0

lib/cast.js

1

index.js

@@ -25,2 +25,3 @@ module.exports = {

coerceExemplar: require('./lib/coerce-exemplar'),
cast: require('./lib/cast'),
};

@@ -27,0 +28,0 @@

5

lib/coerce-exemplar.js

@@ -15,3 +15,3 @@ /**

* If `allowSpecialSyntax` is set, '->', '*', and '===' take on their traditional special meaning.
* Otherwise, they will be replaced with strings ('an arrow symbol', 'a star symbol', '3 equal signs')
* Otherwise, they will be "exemplified"-- that is, replaced with strings ('an arrow symbol', 'a star symbol', '3 equal signs')
*

@@ -87,4 +87,5 @@ * @param {*} value

}
// dictionaries need a recursive step
// dictionaries need a recursive step too
else if (_.isObject(valuePart)) {
// Note that empty dictionaries just become generic dictionaries.
return _.reduce(valuePart, function (dictSoFar, subValue, key) {

@@ -91,0 +92,0 @@ dictSoFar[key] = _recursivelyCoerceExemplar(subValue); // <= recursive step

@@ -10,9 +10,9 @@ /**

/**
* A convenience method to return the base val for the given value.
* A convenience method to return the base value for the given exemplar.
*
* @param {===} val
* @param {===} exemplar
* @return {*?}
*/
module.exports = function getBaseVal(val){
return coerce(infer(val));
module.exports = function getBaseVal(exemplar){
return coerce(infer(exemplar));
};

@@ -94,3 +94,2 @@ /**

* @param {*} thingToTraverse1
* @param {boolean} _isExemplar
* @return {*}

@@ -97,0 +96,0 @@ */

@@ -15,3 +15,3 @@ /**

* In other words, this makes a type schema "strict", and the result of
* this function always passes `rttc.isStrictType()`.
* this function always passes `rttc.isSpecific()`.
*

@@ -18,0 +18,0 @@ * @param {*} typeSchema

@@ -182,2 +182,6 @@ /**

var sharedKeys = _.intersection(_.keys(schema0), _.keys(schema1));
// If there are any keys that don't exist in BOTH schemas, we'll just return
// a generic type (ref or {}) as the union. This way coercing a value to the
// unioned schema will never result in data loss (i.e. stripped keys).
var xorKeys = _.difference(_.union(_.keys(schema0), _.keys(schema1)), sharedKeys);

@@ -184,0 +188,0 @@ if (xorKeys.length > 0) {

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

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

@@ -102,3 +102,3 @@ # rttc

| boolean | `false` _(or `true`)_ | `false`
| lamda | `function anyFunction(){ /* any function */ }` | `function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); };`
| lamda | `'->'` | `function () { throw new Error('Not implemented! (this function was automatically created by `rttc`'); };`
| generic dictionary | `{}` | `{}` _(empty dictionary)_

@@ -560,5 +560,8 @@ | generic array | `[]` | `[]` _(empty array)_

##### .getBaseVal(sampleValue)
A convenience method to return the base value for the given exemplar.
## License

@@ -565,0 +568,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc