(value, opts)
| 601 | }; |
| 602 | |
| 603 | function validate(value, opts) { |
| 604 | var valObjectDef = exports.valObjectMeta[opts.valType]; |
| 605 | |
| 606 | if(opts.arrayOk && isArrayOrTypedArray(value)) return true; |
| 607 | |
| 608 | if(valObjectDef.validateFunction) { |
| 609 | return valObjectDef.validateFunction(value, opts); |
| 610 | } |
| 611 | |
| 612 | var failed = {}; |
| 613 | var out = failed; |
| 614 | var propMock = { set: function(v) { out = v; } }; |
| 615 | |
| 616 | // 'failed' just something mutable that won't be === anything else |
| 617 | |
| 618 | valObjectDef.coerceFunction(value, propMock, failed, opts); |
| 619 | return out !== failed; |
| 620 | } |
| 621 | exports.validate = validate; |
no test coverage detected
searching dependent graphs…