<commit_before>'use strict';

(function (context, factory) {
  if (typeof require === 'function' &&
      typeof exports === 'object' &&
      typeof module === 'object') {
    // Node.js
    module.exports = factory(require('immutable'));
  }
  else if (typeof define === 'function' && define.amd) {
    // AMD
    throw new Error('chai-immutable is not compatible with an AMD loader yet.');
  }
  else {
    // Other environments (usually <script> tag)
    context.chai.use(factory(context.Immutable));
  }
}(this, function (Immutable) {
  return function (chai, utils) {
    var Assertion = chai.Assertion;

    function assertIsIterable(obj) {
      new Assertion(obj).assert(
        Immutable.Iterable.isIterable(obj),
        'expected #{this} to be an Iterable'
      );
    }

    /**
     * ## BDD API Reference
     */

    /**
     * ### .empty
     *
     * Asserts that the immutable collection is empty.
     *
     * ```js
     * expect(List()).to.be.empty;
     * expect(List.of(1, 2, 3)).to.not.be.empty;
     * ```
     *
     * @name empty
     * @namespace BDD
     * @api public
     */

    Assertion.overwriteProperty('empty', function (_super) {
      return function () {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          var size = obj.size;
          new Assertion(size).a('number');

          this.assert(
            size === 0,
            'expected #{this} to be empty but got size #{act}',
            'expected #{this} to not be empty'
          );
        }
        else _super.apply(this, arguments);
      };
    });

    /**
     * ### .equal(collection)
     *
     * Asserts that the values of the target are equivalent to the values of
     * `collection`. Aliases of Chai's original `equal` method are also supported.
     *
     * ```js
     * var a = List.of(1, 2, 3);
     * var b = List.of(1, 2, 3);
     * expect(a).to.equal(b);
     * ```
     *
     * Immutable data structures should only contain other immutable data
     * structures (unlike `Array`s and `Object`s) to be considered immutable and
     * properly work against `.equal()`. See
     * [this issue](https://github.com/astorije/chai-immutable/issues/24) for
     * more information.
     *
     * Also, note that `deep.equal` and `eql` are synonyms of `equal` when
     * tested against immutable data structures, therefore they are aliases to
     * `equal`.
     *
     * @name equal
     * @alias equals
     * @alias eq
     * @alias eql
     * @alias eqls
     * @alias deep.equal
     * @param {Collection} value
     * @namespace BDD
     * @api public
     */

    function assertCollectionEqual(_super) {
      return function (collection) {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          this.assert(
            Immutable.is(obj, collection),
            'expected #{act} to equal #{exp}',
            'expected #{act} to not equal #{exp}',
            collection.toString(),
            obj.toString(),
            true
          );
        }
        else _super.apply(this, arguments);
      };
    }

    Assertion.overwriteMethod('equal', assertCollectionEqual);
    Assertion.overwriteMethod('equals', assertCollectionEqual);
    Assertion.overwriteMethod('eq', assertCollectionEqual);
    Assertion.overwriteMethod('eql', assertCollectionEqual);
    Assertion.overwriteMethod('eqls', assertCollectionEqual);

    /**
     * ### .include(value)
     *
     * The `include` and `contain` assertions can be used as either property
     * based language chains or as methods to assert the inclusion of a value
     * in an immutable collection. When used as language chains, they toggle the
     * `contains` flag for the `keys` assertion.
     *
     * ```js
     * expect(new List([1, 2, 3])).to.include(2);
     * expect(new Map({ foo: 'bar', hello: 'universe' })).to.include.keys('foo');
     * ```
     *
     * @name include
     * @alias contain
     * @alias includes
     * @alias contains
     * @param {Mixed} val
     * @namespace BDD
     * @api public
     */

    function assertCollectionInclude(_super) {
      return function (val) {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          this.assert(
            obj.includes(val),
            'expected #{act} to include #{exp}',
            'expected #{act} to not include #{exp}',
            val,
            obj.toString()
          );
        }
        else _super.apply(this, arguments);
      };
    }

    function chainCollectionInclude(_super) {
      return function () {
        _super.apply(this, arguments);
      };
    };

    ['include', 'contain', 'contains', 'includes'].forEach(function (keyword) {
      Assertion.overwriteChainableMethod(
        keyword,
        assertCollectionInclude,
        chainCollectionInclude<commit_msg>Remove unnecessary semicolon<commit_after>'use strict';

(function (context, factory) {
  if (typeof require === 'function' &&
      typeof exports === 'object' &&
      typeof module === 'object') {
    // Node.js
    module.exports = factory(require('immutable'));
  }
  else if (typeof define === 'function' && define.amd) {
    // AMD
    throw new Error('chai-immutable is not compatible with an AMD loader yet.');
  }
  else {
    // Other environments (usually <script> tag)
    context.chai.use(factory(context.Immutable));
  }
}(this, function (Immutable) {
  return function (chai, utils) {
    var Assertion = chai.Assertion;

    function assertIsIterable(obj) {
      new Assertion(obj).assert(
        Immutable.Iterable.isIterable(obj),
        'expected #{this} to be an Iterable'
      );
    }

    /**
     * ## BDD API Reference
     */

    /**
     * ### .empty
     *
     * Asserts that the immutable collection is empty.
     *
     * ```js
     * expect(List()).to.be.empty;
     * expect(List.of(1, 2, 3)).to.not.be.empty;
     * ```
     *
     * @name empty
     * @namespace BDD
     * @api public
     */

    Assertion.overwriteProperty('empty', function (_super) {
      return function () {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          var size = obj.size;
          new Assertion(size).a('number');

          this.assert(
            size === 0,
            'expected #{this} to be empty but got size #{act}',
            'expected #{this} to not be empty'
          );
        }
        else _super.apply(this, arguments);
      };
    });

    /**
     * ### .equal(collection)
     *
     * Asserts that the values of the target are equivalent to the values of
     * `collection`. Aliases of Chai's original `equal` method are also supported.
     *
     * ```js
     * var a = List.of(1, 2, 3);
     * var b = List.of(1, 2, 3);
     * expect(a).to.equal(b);
     * ```
     *
     * Immutable data structures should only contain other immutable data
     * structures (unlike `Array`s and `Object`s) to be considered immutable and
     * properly work against `.equal()`. See
     * [this issue](https://github.com/astorije/chai-immutable/issues/24) for
     * more information.
     *
     * Also, note that `deep.equal` and `eql` are synonyms of `equal` when
     * tested against immutable data structures, therefore they are aliases to
     * `equal`.
     *
     * @name equal
     * @alias equals
     * @alias eq
     * @alias eql
     * @alias eqls
     * @alias deep.equal
     * @param {Collection} value
     * @namespace BDD
     * @api public
     */

    function assertCollectionEqual(_super) {
      return function (collection) {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          this.assert(
            Immutable.is(obj, collection),
            'expected #{act} to equal #{exp}',
            'expected #{act} to not equal #{exp}',
            collection.toString(),
            obj.toString(),
            true
          );
        }
        else _super.apply(this, arguments);
      };
    }

    Assertion.overwriteMethod('equal', assertCollectionEqual);
    Assertion.overwriteMethod('equals', assertCollectionEqual);
    Assertion.overwriteMethod('eq', assertCollectionEqual);
    Assertion.overwriteMethod('eql', assertCollectionEqual);
    Assertion.overwriteMethod('eqls', assertCollectionEqual);

    /**
     * ### .include(value)
     *
     * The `include` and `contain` assertions can be used as either property
     * based language chains or as methods to assert the inclusion of a value
     * in an immutable collection. When used as language chains, they toggle the
     * `contains` flag for the `keys` assertion.
     *
     * ```js
     * expect(new List([1, 2, 3])).to.include(2);
     * expect(new Map({ foo: 'bar', hello: 'universe' })).to.include.keys('foo');
     * ```
     *
     * @name include
     * @alias contain
     * @alias includes
     * @alias contains
     * @param {Mixed} val
     * @namespace BDD
     * @api public
     */

    function assertCollectionInclude(_super) {
      return function (val) {
        var obj = this._obj;

        if (Immutable.Iterable.isIterable(obj)) {
          this.assert(
            obj.includes(val),
            'expected #{act} to include #{exp}',
            'expected #{act} to not include #{exp}',
            val,
            obj.toString()
          );
        }
        else _super.apply(this, arguments);
      };
    }

    function chainCollectionInclude(_super) {
      return function () {
        _super.apply(this, arguments);
      };
    }

    ['include', 'contain', 'contains', 'includes'].forEach(function (keyword) {
      Assertion.overwriteChainableMethod(
        keyword,
        assertCollectionInclude,
        chainCollectionInclude
{'fraction_non_alphanumeric': 0.13156275635767023, 'fraction_numerical': 0.003281378178835111, 'mean_word_length': 2.1430873348372543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '608560', 'n_tokens_mistral': 2857, 'n_tokens_neox': 2832, 'n_words': 763}