Comparing version 8.1.1 to 8.1.2
@@ -391,3 +391,3 @@ /** | ||
isExemplar: function (eg){ | ||
return eg === '===' || eg === undefined; | ||
return (eg === '===') || _.isUndefined(eg); | ||
}, | ||
@@ -394,0 +394,0 @@ getExemplarDescription: function () { |
@@ -10,2 +10,3 @@ /** | ||
var infer = require('./infer'); | ||
var getDefaultExemplar = require('./get-default-exemplar'); | ||
@@ -151,7 +152,7 @@ | ||
// exemplar-vs-type-schema-agnostic helper for building return values | ||
function normalizeResult(eg){ | ||
function normalizeResult(type){ | ||
if (!isExemplar) { | ||
return infer(eg); | ||
return type; | ||
} | ||
return eg; | ||
return getDefaultExemplar(type); | ||
} | ||
@@ -171,3 +172,3 @@ | ||
if ( thisSchema(schema1).is('ref', 'lamda') ) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -179,5 +180,5 @@ if (_.isArray(schema1) || !_.isObject(schema1)) { | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
} | ||
@@ -192,3 +193,3 @@ | ||
if (thisSchema(schema1).containsType('ref', 'lamda') || thisSchema(schema0).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -204,3 +205,3 @@ return {}; | ||
if ( thisSchema(schema1).is('ref', 'lamda') ) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -212,5 +213,5 @@ if (!_.isArray(schema1)) { | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
} | ||
@@ -224,3 +225,3 @@ if (_.isEqual(schema1, [])) { | ||
if ( thisSchema(schema1).is('ref', 'lamda') ) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -231,3 +232,3 @@ // If `schema1` is a faceted dictionary or patterned array which contains | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -237,7 +238,7 @@ if (!_.isArray(schema1) && _.isObject(schema1)) { | ||
} | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
}, | ||
function onGenericArray(schema0, schema1, parentKeyOrIndex){ | ||
if ( thisSchema(schema1).is('ref', 'lamda') ) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -248,3 +249,3 @@ // If `schema1` is a faceted dictionary or patterned array which contains | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -254,7 +255,7 @@ if (_.isArray(schema1)) { | ||
} | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
}, | ||
function onJson(schema0, schema1, parentKeyOrIndex) { | ||
if ( thisSchema(schema1).is('ref', 'lamda') ) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -265,14 +266,14 @@ // If `schema1` is a faceted dictionary or patterned array which contains | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
}, | ||
function onRef(schema0, schema1, parentKeyOrIndex) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
}, | ||
function onLamda(schema0, schema1, parentKeyOrIndex) { | ||
if ( thisSchema(schema1).is('lamda') ) { | ||
return normalizeResult('->'); | ||
return normalizeResult('lamda'); | ||
} | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
}, | ||
@@ -287,3 +288,3 @@ function onString(schema0, schema1, parentKeyOrIndex) { | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -300,6 +301,6 @@ if (!isStrict){ | ||
) { | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
} | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
}, | ||
@@ -314,3 +315,3 @@ function onNumber(schema0, schema1, parentKeyOrIndex) { | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -330,5 +331,5 @@ if (!isStrict){ | ||
) { | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
} | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
}, | ||
@@ -343,3 +344,3 @@ function onBoolean(schema0, schema1, parentKeyOrIndex) { | ||
if (thisSchema(schema1).containsType('ref', 'lamda')) { | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -358,5 +359,5 @@ | ||
) { | ||
return normalizeResult('*'); | ||
return normalizeResult('json'); | ||
} | ||
return normalizeResult('==='); | ||
return normalizeResult('ref'); | ||
} | ||
@@ -363,0 +364,0 @@ ); |
{ | ||
"name": "rttc", | ||
"version": "8.1.1", | ||
"version": "8.1.2", | ||
"description": "Runtime type-checking for JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212901
4544