Skip to content

Union array of strings made unpredictable results #7

@KainHaart

Description

@KainHaart

While lodash union works perfectly fine
Extendify with union strategy makes array of strings a complete mess

describe('extendify', function() {
    var chai = require('chai');
    var expect = chai.expect;

    describe('lodash', function() {
        var _ = require('lodash');
        it('lodash union', function() {
            expect(_.union(['mocha', 'chai', 'closure'], ['closure']))
                .deep.equal(['mocha', 'chai', 'closure']); // OK
        });
    });

    describe('extendify', function() {
        it('union array of strings', function() {
            var extend = require('extendify')({
                arrays: 'union',
                inPlace: false
            });

            expect(extend(['mocha', 'chai', 'closure'], ['closure']))
                .deep.equal(['mocha', 'chai', 'closure'] // WTF ['closure', 'chai', 'closure']
            );
        });
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions