Skip to content

shift may need to unset shifted item in data array #25

Description

@patternleaf
var b = new CBuffer(10);
b.push(1, 2, 3, 4, 5);
b.rotateLeft();
b.sort();
b.toArray();

=> [1, 1, 2, 3, 4]

Seems the culprit is the use of shift in rotateLeft, which moves the start index but leaves the shifted item in the underlying array. Explicitly setting that array index to undefined seems to fix the above. Not sure if it would have other consequences.

Thanks for the implementation!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions