Debian Codegraph @

js/src/tests/test262/intl402/PluralRules/supportedLocalesOf/shell.js

raw
1 // GENERATED, DO NOT EDIT
2 // file: isConstructor.js
3 // Copyright (C) 2017 André Bargull. All rights reserved.
4 // This code is governed by the BSD license found in the LICENSE file.
5
6 /*---
7 description: |
8 Test if a given function is a constructor function.
9 defines: [isConstructor]
10 features: [Reflect.construct]
11 ---*/
12
13 function isConstructor(f) {
14 if (typeof f !== "function") {
15 throw new Test262Error("isConstructor invoked with a non-function value");
16 }
17
18 try {
19 Reflect.construct(function(){}, [], f);
20 } catch (e) {
21 return false;
22 }
23 return true;
24 }