Skip to content

Inconsistent behaviour in empty method. #59

@xgbuils

Description

@xgbuils

I read about this test and don't understand why exist.

it('should ignore invalid arguments safely', function(){
    var obj = {};
    // 1
    expect(objectPath.empty()).to.equal(void 0);
    // 2
    expect(objectPath.empty(obj, 'path')).to.equal(void 0);
    // 3
    expect(objectPath.empty(obj, '')).to.equal(obj);

    obj.path = true;
    // 4
    expect(objectPath.empty(obj, 'inexistant')).to.equal(obj);
});

2nd an 4th assertions are essentialy the same thing. 
In second assertion `obj` is an object and `path` property does not exist in `obj`.
In fourth assertion `obj` is an object and `existant` property does not exist in `obj`

I think that it should return the same value `undefined` or the same `object` passed.

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