Skip to content

Commit

Permalink
fix: Call itemMediator in Array constructor
Browse files Browse the repository at this point in the history
finom committed Sep 20, 2016

Verified

This commit was signed with the committer’s verified signature.
renovate-bot Mend Renovate
1 parent 53b3806 commit dcce619
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/array/index.js
Original file line number Diff line number Diff line change
@@ -12,14 +12,15 @@ instanceMembers.constructor = function MatreshkaArray(length) {
throw matreshkaError('common:call_class');
}

initMK(this);
const def = initMK(this);
const { itemMediator } = def;

// repeat the same logic as for native Array
if (arguments.length === 1 && typeof length === 'number') {
this.length = length;
} else {
nofn.forEach(arguments, (arg, index) => {
this[index] = arg;
this[index] = itemMediator ? itemMediator(arg, index) : arg;
});

this.length = arguments.length;

0 comments on commit dcce619

Please sign in to comment.