Comparing version 4.4.2 to 4.4.3
@@ -9,2 +9,3 @@ /** | ||
var dehydrate = require('./dehydrate'); | ||
var isEqual = require('./is-equal'); | ||
@@ -59,11 +60,14 @@ | ||
// Generate some sample values | ||
var samples = _.reduce(_.range(n), function (memo, i) { | ||
memo.push(generateSampleVal(dehydratedTypeSchema)); | ||
return memo; | ||
// Generate some (unique) sample values | ||
var samples = _.reduce(_.range(n), function (samplesSoFar, i) { | ||
var newSample = generateSampleVal(dehydratedTypeSchema); | ||
var isUnique = _.reduce(samplesSoFar, function checkUniqueness(isUnique, existingSample){ | ||
return isUnique && !isEqual(existingSample, newSample, typeSchema); | ||
}, true); | ||
if (isUnique) { | ||
samplesSoFar.push(newSample); | ||
} | ||
return samplesSoFar; | ||
}, []); | ||
// Remove any duplicates | ||
samples = _.uniq(samples); | ||
// Scramble them and return. | ||
@@ -70,0 +74,0 @@ return _.shuffle(samples); |
{ | ||
"name": "rttc", | ||
"version": "4.4.2", | ||
"version": "4.4.3", | ||
"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
159097
3176