core-js
Version:
Standard library
22 lines (19 loc) • 713 B
JavaScript
var DESCRIPTORS = require('../internals/descriptors');
var uncurryThis = require('../internals/function-uncurry-this');
var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
var URLSearchParamsPrototype = URLSearchParams.prototype;
var forEach = uncurryThis(URLSearchParamsPrototype.forEach);
// `URLSearchParams.prototype.size` getter
// https://github.com/whatwg/url/pull/734
if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
defineBuiltInAccessor(URLSearchParamsPrototype, 'size', {
get: function size() {
var count = 0;
forEach(this, function () { count++; });
return count;
},
configurable: true,
enumerable: true
});
}
;