source: imaps-frontend/node_modules/es-abstract/2017/GetMethod.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: 684 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var GetV = require('./GetV');
6var IsCallable = require('./IsCallable');
7var isPropertyKey = require('../helpers/isPropertyKey');
8
9var inspect = require('object-inspect');
10
11// https://262.ecma-international.org/6.0/#sec-getmethod
12
13module.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.