deno.land / std@0.166.0 / encoding / testdata / jsonc / test262 / isConstructor.js

isConstructor.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.// Ported from test262// https://github.com/tc39/test262/blob/488eb365db7c613d52e72a9f5b8726684906e540/harness/isConstructor.js// Copyright (C) 2017 André Bargull. All rights reserved.// This code is governed by the BSD license found in the LICENSE file.
/*---description: | Test if a given function is a constructor function.defines: [isConstructor]---*/
function isConstructor(f) { try { Reflect.construct(function(){}, [], f); } catch (e) { return false; } return true;}
std

Version Info

Tagged at
a year ago