'use strict';
var $ = require('../internals/export');
var global = require('../internals/global');
+var uncurryThis = require('../internals/function-uncurry-this');
var isForced = require('../internals/is-forced');
var redefine = require('../internals/redefine');
var InternalMetadataModule = require('../internals/internal-metadata');
var iterate = require('../internals/iterate');
var anInstance = require('../internals/an-instance');
+var isCallable = require('../internals/is-callable');
var isObject = require('../internals/is-object');
var fails = require('../internals/fails');
var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
var exported = {};
var fixMethod = function (KEY) {
- var nativeMethod = NativePrototype[KEY];
+ var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
redefine(NativePrototype, KEY,
KEY == 'add' ? function add(value) {
- nativeMethod.call(this, value === 0 ? 0 : value);
+ uncurriedNativeMethod(this, value === 0 ? 0 : value);
return this;
} : KEY == 'delete' ? function (key) {
- return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
} : KEY == 'get' ? function get(key) {
- return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
+ return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
} : KEY == 'has' ? function has(key) {
- return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
+ return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
} : function set(key, value) {
- nativeMethod.call(this, key === 0 ? 0 : key, value);
+ uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
return this;
}
);
var REPLACE = isForced(
CONSTRUCTOR_NAME,
- typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
+ !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
new NativeConstructor().entries().next();
}))
);
if (REPLACE) {
// create collection constructor
Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
- InternalMetadataModule.REQUIRED = true;
+ InternalMetadataModule.enable();
} else if (isForced(CONSTRUCTOR_NAME, true)) {
var instance = new Constructor();
// early implementations not supports chaining
if (!ACCEPT_ITERABLES) {
Constructor = wrapper(function (dummy, iterable) {
- anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
+ anInstance(dummy, NativePrototype);
var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
return that;