Sha256: 2557585f89a2543993060a9c998190e0751793450f09aa3d43531d21f1a46c3d

Contents?: true

Size: 953 Bytes

Versions: 16

Compression:

Stored size: 953 Bytes

Contents

/*!
 * Should
 * Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
 * MIT Licensed
 */

var util = require('../util'),
  eql = require('../eql');

module.exports = function(should, Assertion) {
  var i = should.format;

  Assertion.add('include', function(obj, description) {
    if(!Array.isArray(this.obj) && !util.isString(this.obj)) {
      this.params = { operator: 'to include an object equal to ' + i(obj), message: description };
      var cmp = {};
      for(var key in obj) cmp[key] = this.obj[key];
      this.assert(eql(cmp, obj));
    } else {
      this.params = { operator: 'to include ' + i(obj), message: description };

      this.assert(~this.obj.indexOf(obj));
    }
  });

  Assertion.add('includeEql', function(obj, description) {
    this.params = { operator: 'to include an object equal to ' + i(obj), message: description };

    this.assert(this.obj.some(function(item) {
      return eql(obj, item);
    }));
  });
};

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
stylus-source-0.42.2 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.42.1 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.42.0 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.41.3 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.41.2 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.41.1 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.41.0 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.40.3 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.40.2 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.40.1 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.40.0 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.39.4 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.39.3 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.39.2 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.39.1 vendor/node_modules/should/lib/ext/deprecated.js
stylus-source-0.39.0 vendor/node_modules/should/lib/ext/deprecated.js