refactor: expectTypes to access ssfi flag

The `ssfi` flag doesn't need to be passed to the `expectTypes`
util function because it can access it directly from the assertion
object.
This commit is contained in:
Grant Snodgrass 2017-06-11 08:33:48 -04:00
parent 616cf8bf88
commit e7b23846b4
2 changed files with 3 additions and 4 deletions

View file

@ -462,7 +462,7 @@ module.exports = function (chai, _) {
function include (val, msg) {
if (msg) flag(this, 'message', msg);
_.expectTypes(this, ['array', 'object', 'string'], flag(this, 'ssfi'));
_.expectTypes(this, ['array', 'object', 'string']);
var obj = flag(this, 'object')
, objType = _.type(obj).toLowerCase()

View file

@ -13,8 +13,6 @@
*
* @param {Mixed} obj constructed Assertion
* @param {Array} type A list of allowed types for this assertion
* @param {Function} ssfi starting point for removing implementation frames from
* stack trace of AssertionError
* @namespace Utils
* @name expectTypes
* @api public
@ -24,8 +22,9 @@ var AssertionError = require('assertion-error');
var flag = require('./flag');
var type = require('type-detect');
module.exports = function expectTypes(obj, types, ssfi) {
module.exports = function expectTypes(obj, types) {
var flagMsg = flag(obj, 'message');
var ssfi = flag(obj, 'ssfi');
flagMsg = flagMsg ? flagMsg + ': ' : '';