source: imaps-frontend/node_modules/core-js/modules/web.url-search-params.has.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2var defineBuiltIn = require('../internals/define-built-in');
3var uncurryThis = require('../internals/function-uncurry-this');
4var toString = require('../internals/to-string');
5var validateArgumentsLength = require('../internals/validate-arguments-length');
6
7var $URLSearchParams = URLSearchParams;
8var URLSearchParamsPrototype = $URLSearchParams.prototype;
9var getAll = uncurryThis(URLSearchParamsPrototype.getAll);
10var $has = uncurryThis(URLSearchParamsPrototype.has);
11var params = new $URLSearchParams('a=1');
12
13// `undefined` case is a Chromium 117 bug
14// https://bugs.chromium.org/p/v8/issues/detail?id=14222
15if (params.has('a', 2) || !params.has('a', undefined)) {
16 defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) {
17 var length = arguments.length;
18 var $value = length < 2 ? undefined : arguments[1];
19 if (length && $value === undefined) return $has(this, name);
20 var values = getAll(this, name); // also validates `this`
21 validateArgumentsLength(length, 1);
22 var value = toString($value);
23 var index = 0;
24 while (index < values.length) {
25 if (values[index++] === value) return true;
26 } return false;
27 }, { enumerable: true, unsafe: true });
28}
Note: See TracBrowser for help on using the repository browser.