|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
684 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var $TypeError = require('es-errors/type');
|
|---|
| 4 |
|
|---|
| 5 | var GetV = require('./GetV');
|
|---|
| 6 | var IsCallable = require('./IsCallable');
|
|---|
| 7 | var isPropertyKey = require('../helpers/isPropertyKey');
|
|---|
| 8 |
|
|---|
| 9 | var inspect = require('object-inspect');
|
|---|
| 10 |
|
|---|
| 11 | // https://262.ecma-international.org/6.0/#sec-getmethod
|
|---|
| 12 |
|
|---|
| 13 | module.exports = function GetMethod(O, P) {
|
|---|
| 14 | // 7.3.9.1
|
|---|
| 15 | if (!isPropertyKey(P)) {
|
|---|
| 16 | throw new $TypeError('Assertion failed: P is not a Property Key');
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | // 7.3.9.2
|
|---|
| 20 | var func = GetV(O, P);
|
|---|
| 21 |
|
|---|
| 22 | // 7.3.9.4
|
|---|
| 23 | if (func == null) {
|
|---|
| 24 | return void 0;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | // 7.3.9.5
|
|---|
| 28 | if (!IsCallable(func)) {
|
|---|
| 29 | throw new $TypeError(inspect(P) + ' is not a function: ' + inspect(func));
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | // 7.3.9.6
|
|---|
| 33 | return func;
|
|---|
| 34 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.